Element-wise multiplication

Hello all,

I want to multiply a matrix of 200*300 vector by each element of a 200 sized vector. Each element of the rows of the matrix will be multiplied by the corresponding element of the vector. Is it possible?

For example : [2, 3] is my vector and [[1, 2], [4,5]] is my matrix. So the output should be, [[2,4], [12,14]]

matrix = torch.rand(2, 3)
vector = torch.rand(2)
result = (matrix.T * vector).T

or

matrix = torch.rand(2, 3)
vector = torch.rand(2)
result = matrix * vector[:, None]