... d1 = p.sum() #将所有的值相加,得到的仍是tensor类别的int值print d1 print type(d1) d2 = d1.item() #转成python数字print d2 print type(d2).
確定! 回上一頁