检查一个pytorch的张量是不是空张量,很简单:
if torch_tensor == torch.Size([]):
print("this tensor is empty")
else:
print("this tensor is not empty")
检查一个pytorch的张量是不是空张量,很简单:
if torch_tensor == torch.Size([]):
print("this tensor is empty")
else:
print("this tensor is not empty")