You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pytorch shows the following inconsistent behaviour.
importnumpyasnpimporttorchfromtorch.autogradimportVariable1.0+Variable(torch.ones(1))
# returns as expected# Variable containing:# 2# [torch.FloatTensor of size 1]np.sum(1.0) +Variable(torch.ones(1))
# returns an unexpected (depth of array is 32)# array([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[Variable containing:# 2# [torch.FloatTensor of size 1]# ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], dtype=object)# Switching their order Variable(torch.ones(1)) +np.sum(1.0)
# returns the expected# Variable containing:# 2# [torch.FloatTensor of size 1]