Use 'as_scalar' when checking the 'cond' value of 'If' (#7063)

#6884
This commit is contained in:
Scott McKay 2021-03-22 18:04:38 +10:00 committed by GitHub
parent cec919bae9
commit b2c6617b0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -746,7 +746,7 @@ class SymbolicShapeInference:
subgraphs = [get_attribute(node, 'then_branch'), get_attribute(node, 'else_branch')]
cond = self._try_get_value(node, 0)
if cond is not None:
if cond > 0:
if as_scalar(cond) > 0:
subgraphs[1].CopyFrom(subgraphs[0])
else:
subgraphs[0].CopyFrom(subgraphs[1])