PyTorch number of dimensions

tensor.ndim. Can basically think of this as number of square brackets

PyTorch tensor data

tensor.item()

Change tensor type
tensor_float16 = tensor.type(torch.float16)