Browse Source

fix IsInstance op bug when input is tensor

tags/v1.1.0
liangzelang 5 years ago
parent
commit
ca84130080
2 changed files with 5 additions and 2 deletions
  1. +3
    -1
      mindspore/core/ir/dtype/tensor_type.cc
  2. +2
    -1
      mindspore/ops/operations/array_ops.py

+ 3
- 1
mindspore/core/ir/dtype/tensor_type.cc View File

@@ -64,7 +64,9 @@ bool UndeterminedType::operator==(const Type &other) const {
}

TypePtr TensorType::DeepCopy() const {
MS_EXCEPTION_IF_NULL(element_type_);
if (element_type_ == nullptr) {
return std::make_shared<TensorType>();
}
if (IsGeneric()) {
return std::make_shared<TensorType>();
}


+ 2
- 1
mindspore/ops/operations/array_ops.py View File

@@ -347,7 +347,8 @@ class IsInstance(PrimitiveWithInfer):
sub_type_t = inst['dtype']
type_v = type_['value']

validator.check_const_input("inst", inst['value'], self.name)
if not isinstance(inst, type(mstype.tensor)):
validator.check_const_input("inst", inst['value'], self.name)
validator.check_value_type("type_", type_v, [mstype.Type], self.name)

if type_v == mstype.list_:


Loading…
Cancel
Save