Pytorch框架之tensor.equal和tensor.eq--判断相等torch的equal|eq⽅法
QQ:3020889729 ⼩蔡
cctv9英语
equal – 张量⽐较
原型:equal(other)
⽐较两个张量是否相等–相等返回:True; 否则返回:Fal
'''
tensor调⽤equal⽅法与torch.equal是⼀致的
都是⽐较两个张量是否相等
'''
x = sor([1,2,3])银行竞聘演讲稿
y = sor([1,1,3])
niina
print(x.equal(y))
print(x.equal(y)== torch.equal(x, y))快速识字
eq – 逐元素判断
原型:eq(other)
⽐较两个张量tensor中,每⼀个对应位置上元素是否相等–对应位置相等,就返回⼀个True;否则返回⼀个Fal. '''
objectionable
逐元素进⾏判断是否相等
'''
x = sor([1,2,3])
y = sor([1,1,3])
print(x.eq(y))
pocketchipeq_ – 将判断结果返回并替换原tensor
原型:eq_(other)
等价于tensor = tensor.eq(other);
即:将⽐较后的结果替换原张量的值
money中文意思the power of love歌词x = sor([1,2,3])
y = sor([1,1,3])
downloadingprint(x.eq_(y))polyethylene
print(x)