Solved by ptrblck in post #2 
              
              
                You could use tensor.expand, if you want to increase a singleton dimension with a view, tensor.repeat to repeat the values in this dimension, or torch.cat to concatenate different tensors and thus increasing the size in this dimension.