ddbourgin / numpy-ml

Machine learning, in numpy
https://numpy-ml.readthedocs.io/
GNU General Public License v3.0
15.26k stars 3.7k forks source link

Using numpy.tensordot for Conv2D #57

Open tetrahydra opened 4 years ago

tetrahydra commented 4 years ago

From this link: https://stackoverflow.com/questions/56085669/convolutional-layer-in-python-using-numpy

and

https://numpy.org/doc/stable/reference/generated/numpy.tensordot.html

Z = np.tensordot(X_pad, weights, axes=3) + self.bias

Does this function is more relevant that using im2col?

ddbourgin commented 4 years ago

Oh, interesting! Thanks for the tip - I'll need to look into this, but it looks like it could be much cleaner :) I'm pretty busy these days, so if you're impatient and would like to submit a PR, I'd be happy to consider it!