How to transform a vector to a matrix with each line equal to the vector in pytorch?
for exemple I have the vector [1, 2, 3]

I want to get a matrix like

[[1, 2, 3],
[1, 2, 3],
[1, 2, 3],
[1, 2, 3]]


How to do that efficiently?

You should look at .repeat():

In [1]: torch.Tensor([1, 2, 3]).repeat(4, 1)
Out[1]: 
tensor([[1., 2., 3.],
        [1., 2., 3.],
        [1., 2., 3.],
        [1., 2., 3.]])

