Hi,
I have a tensor like this:
tensor([[[[0., 0., 0.],
[0., 0., 0.]]],
[[[0., 0., 0.],
[0., 0., 0.]]]])
I want to concatenate a column of 1 to tensor without any loop like this:
tensor([[[[1., 0., 0., 0.],
[1., 0., 0., 0.]]],
[[[1., 0., 0., 0.],
[1., 0., 0., 0.]]]])
I try this code but I receive an error:
import torch
temp = torch.ones((2, 1, 2, 1))
input = torch.zeros((2, 1, 2, 3))
print(torch.cat((temp, input), 0))
Do you have any idea?
Many thanks