forked from mindspore-Ecosystem/mindspore
!33539 Update check tensor logic
Merge pull request !33539 from zichun_ye/graph_mode_check_tensor
This commit is contained in:
commit
851a1fc9e5
|
@ -329,7 +329,9 @@ class CheckTensor(PrimitiveWithInfer):
|
|||
return out
|
||||
|
||||
def __call__(self, x, name):
|
||||
if isinstance(x, Tensor) or x is None:
|
||||
# we skip this check in graph mode as it is checked in the infer stage
|
||||
# and in the graph mode x is None if x is not const in the graph
|
||||
if context.get_context("mode") == 0 or isinstance(x, Tensor):
|
||||
return x
|
||||
raise TypeError(
|
||||
f"For {name}, input type should be a Tensor or Parameter.")
|
||||
|
|
Loading…
Reference in New Issue