Is it possible to create a higher-order tensor with no elements, e.g., torch.LongTensor(1, 0) ? This would be convenient, but the current behavior seems to be returning a tensor with dimensions equal to the prefix until the first zero, e.g., torch.LongTensor(1, 0, 3, 4) yields a tensor of size 1.

Are you considering changing this behavior? Is there any good reason for it? Thanks.

there is no way of constructing tensors with placeholder dimensions. What is the use-case exactly? (I cant think of one).
We will not be changing this behavior.

In the use-case that I came across, I would start with a Tensor of size (1, 0) and increment the second dimension by one at each step of the algorithm. The first dimension also increase, but it isnâ€™t as periodic. This use-case came up in beam search.

It is not a big deal. I just added a test based on the number of elements, which can
be obtained through numel.