Question: 2.2 [2 pt] Write a function called flatten_slice_and_multiply that has two inputs called Matrix1 and Matrix2 where each is represented as a numpy array.
2.2 [2 pt] Write a function called flatten_slice_and_multiply that has two inputs called Matrix1 and Matrix2 where each is represented as a numpy array. The function should reshape Matrix2 so that it is a vector (i.e. its shape is in the form (x,)), then it should slice Matrix1 (by removing the last z columns) so that the product of the sliced Matrix1 and the reshaped Matrix2 is possible, and finally return the product. For this question, the number of elements in the reshaped Matrix2 will always be less than or equal to the number of columns in initial Matrix1. For example, if the shape of Matrix1 were (10,8) and the shape of Matrix2 were (2,3), then the shape of the reshaped Matrix2 would be (6,) and the shape of the sliced Matrix1 would be (10,6). : def flatten_slice_and_multiply (Matrix1, Matrix2): # YOUR CODE HERE raise NotImplementedError() : #hidden tests for problem 2.2 are within this cell A Go
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
