Question: Task 4: Full Inference (2 marks) Finally, we can put everything together to compute the output of the whole ANN (e.g., scores) given some input

Task 4: Full Inference (2 marks) Finally, we can put everything together to compute the output of the whole ANN (e.g., scores) given some input vector (e.g., pixels). Specifically, the output of the ANN is computed layer-by-layer starting from the input layer, continuing with the inner layer(s) and ending with the output layer. It is worth noting that the outputs of one layer is acting as inputs for the next layer. Think about a way to ensure the correct transfer of data from one layer to the next. Write function inference(x, w, b) that can be used to compute the output of an ANN by adhering to the following specification Input: An inputs list (x), a list of tables of weights (w) and a table of biases (b). Output: A list of numbers corresponding to output of the ANN. The function inference behaves as follows for the example ANN (i.e., visualized in Figure 4), with the weight matrices, and biases table b, (2.1, -3.1 3.8, 1.5 W = (-0.7,4.1) . (-1.2, 1.1) . = (_1.7,2.5) and input vector x = (1,0) -1.1, 4.2) > > > x = [1, 0] > > > w = [[[2.1, -3.1], [-0.7, 4.1]], [[3.8, 1.5], [-1.2, 1.1]]] > > > b = [[-1.1, 4.2], [-1.7, 2.5]] > > > inference(x,w,b) [7.35, 5.15] Next, we will focus on implementing functions that read in and store data from text files
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
