In Numpy I can do:
np.hstack((np.zeros((3, 0)), np.zeros((3, 3)))

and it would give me a 3x3 zero matrix.
But in pytorch,
torch.cat((torch.zeros(3, 0), torch.zeros(3, 3)), dim=1)

gives me a run time error RuntimeError: dim out of range - got 1 but the tensor is only 1D. Because torch.zeros(3, 0) is actually a 3-element Tensor (as opposed to Numpy, where it is empty).
Now, @smth has said before that there are no 0 dimensional Tensors in pytorch (For-loop with a 2D matrix of size 0) but does anyone know of a solution to this problem, where for example the 0 size of the dim is being calculated in a loop?
For example if I have
for i in xrange(5):
  print torch.cat((torch.zeros(3, i), torch.zeros(3, 3)), dim=1)

the first iteration would give an error…