Solved by richard in post #3 
              
              
                tensor = torch.Tensor() gives you an empty tensor. You can resize this with tensor.resize_as_(output) when you have another tensor.