Change 1x1x33 tensor to 1x1x34

So let’s say for a smaller example I have the tensor that’s 1x2

I want to change it to
So append an extra column but leave everything else to same. Now I want to do this to a 3D tensor that is 1x1x33 to 1x1x34 should do exactly this:, 1, 33), torch.randn(1, 1, 1)), dim=2)
import torch
import torch.nn.functional as F

x = torch.rand(1, 1, 33)
y = F.pad(x, (0, 1, 0, 0), mode='constant', value=0)

also works but is not recommended.