A = torch.ones(0, 3)
print('tensor-A', A)
if min(A.shape) == 0 :
print('此处张量为空')
输出:
tensor-A tensor([], size=(0, 3))
此处张量为空
A = torch.ones(0, 3)
print('tensor-A', A)
if min(A.shape) == 0 :
print('此处张量为空')
输出:
tensor-A tensor([], size=(0, 3))
此处张量为空