Hi!
I have a tensor of shape torch.Size([2, 3])
with this content
tensor([[ 1.0000, 0.5000, 0.0000],
[ 0.5000, 1.0000, 0.0000]])
I want to repeat the values 32 times and get a tensor with a shape torch.Size([32, 2, 3])
like that
tensor([[[ 1.0000, 0.5000, 0.0000],
[ 0.5000, 1.0000, 0.0000]],
[[ 1.0000, 0.5000, 0.0000],
[ 0.5000, 1.0000, 0.0000]],
..........
[[ 1.0000, 0.5000, 0.0000],
[ 0.5000, 1.0000, 0.0000]]]
)
I tried
identity = [[1, 0.5, 0], [0.5, 1, 0]]
theta = torch.ones((32,), dtype=torch.float32)
theta = theta.new_tensor(identity)
theta = theta.view(32, theta.size(0), theta.size(1))
But it’s not working.
Please kindly help!!!