How can I use this kind of shape of Tensor

Hi, I am using PyTorch with custom loss function. But when I checked the loss function’s output, the shape of it was torch.Size([]). To make the same shape of tensor, how can I do it?

It’s a scalar value, which can be created via:

x = torch.tensor(1.)
print(x.size())
> torch.Size([])