torch.all() 其中的所有项都为True,返回True,反之,返回False
>>> import torch >>> a = torch.tensor([[1, 2], [3, 4]]) >>> b = torch.tensor([[1, 2], [3, 4]]) >>> a OUT: tensor([[1, 2], [3, 4]]) >>> torch.eq(a, b) OUT:tensor([[True, True], [True, True]]) >>> torch.all(torch.eq(a, b)) OUT: tensor(True) >>> torch.all(torch.tensor([True, False])) OUT: tensor(False)
标签:False,tensor,True,torch,eq,OUT From: https://www.cnblogs.com/chentiao/p/17589285.html