Hey,

I have a 4D Tensor (say A) and an integer b which will change with respect to each model. and I want to initialize a 5D tensor of size (b,A). for example if A.size() is [32,1,3,3] and b is 5, I want to initialize a tensor of size [5,32,1,3,3]. I do torch.zeros(b, A.size()) but it doesn’t do the job!

I would appreciate if someone helps out.

You can use asterisks in Python to unpack.

`torch.zeros((b, *A.size()))`

That should do the trick^