Browse Source

fix error in len of tensor in pynative mode

tags/v1.2.0-rc1
buxue 5 years ago
parent
commit
3973f1424e
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      mindspore/common/tensor.py

+ 4
- 3
mindspore/common/tensor.py View File

@@ -197,9 +197,10 @@ class Tensor(Tensor_):

def __len__(self):
out = tensor_operator_registry.get('shape')(self)
if not out:
return 1
return out[0]
if out:
return out[0]
raise TypeError("Not support len of a 0-D tensor")


def __mod__(self, other):
return tensor_operator_registry.get('__mod__')(self, other)


Loading…
Cancel
Save