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?

No comments yet!

Learn Machine Learning

!learnmachinelearning@sh.itjust.works

Create post

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

Example questions:

  • “Should I use a deep neural network for my audio classification task?”
  • “I’m working with a small dataset, what can I do to make my model generalize well?”
  • “Is there a library available that implements function X in language Y?”
  • “I want to learn more about the math behind machine learning technique A, where should I start?”

Please do:

  • Be kind to new people
  • Post guides and tutorials that you find helpful
  • Link to open/free sources instead of paywalled when possible

Please don’t:

  • Post news articles / memes (there are other machine learning/AI communities for this)

Other communities in this area:

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

Community stats

  • 2

    Monthly active users

  • 38

    Posts

  • 0

    Comments