检查一个pytorch的张量是不是空张量,很简单:

if torch_tensor == torch.Size([]):
	print("this tensor is empty")
else:
	print("this tensor is not empty")
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐