this post was submitted on 22 Jun 2023
5 points (100.0% liked)

Learn Machine Learning

524 readers
1 users here now

Welcome! This is a place for people to learn more about machine learning techniques, discuss applications and ask questions.

Example questions:

Please do:

Please don't:

Other communities in this area:

Similar subreddits: r/MLquestions, r/askmachinelearning, r/learnmachinelearning

founded 1 year ago
MODERATORS
 

Not OP. This question is being reposted to preserve technical content removed from elsewhere. Feel free to add your own answers/discussion.

I have two 2-D arrays with the same first axis dimensions. In python, I would like to convolve the two matrices along the second axis only. I would like to get C below without computing the convolution along the first axis as well.

import numpy as np
import scipy.signal as sg

M, N, P = 4, 10, 20
A = np.random.randn(M, N)
B = np.random.randn(M, P)

C = sg.convolve(A, B, 'full')[(2*M-1)/2]

Is there a fast way?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 year ago

NN libraries like Pytorch and Tensorflow can repurposed to be used for GPU-accelerated operations like convolution by setting up specific networks with preset weights. Another option can be to use FFT or wavelet libraries but for applications with many samples, this can be a good option.