1

I need to multiply all rows of a matrix by column, i think with an example it will be clearer:

matrix is:

1,2,3 4,5,6 7,8,9 

An i need an operation that returns:

28,80,162 

But i can't find anything in the documentation and blogs and other SO question only are related to matrix multiplication and dot product, which is not what i need in this case,how can it be achieved in a vectorized fashion(instead of for loop based) ?

For example this is easy to achieve for the case of sum like:

the_matrix.sum(dim=0) 

But there's not something like:

the_matrix.mul(dim=0) 

1 Answer 1

2

I found the solution, there's no :

the_matrix.mul(dim=0) 

But there's:

he_matrix.prod(dim=0) 

Which does exactly what is needed.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.