Search code examples
pythonnumpyneural-networkmatrix-multiplication

Calculating matrix product with numpy


Is this code segment:

layer_1 = self.layer_0.dot(self.weights_0_1)

The same as this one?

layer_1 = np.dot(self.layer_0, self.weights_0_1)

Solution

  • Yes: dot is available both as a function in the numpy module and as an instance method of an array object.