Solved by albanD in post #4 
              
              
                This should do it then to create a tensor of same type and on the same device as A. 
You can change the dtype and device arguments if you need a different type and/or device. 
size = list(A.size())
size.insert(1, 3)
B = torch.zeros(size, dtype=A.dtype, device=A.device)