Skip to content

Commit

Permalink
fix numpy array type check
Browse files Browse the repository at this point in the history
  • Loading branch information
inisis committed Nov 10, 2024
1 parent c5fb05a commit 97bacb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions onnxslim/core/pattern/elimination/reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def check_constant_mergeable(reshape_node):
"""
if isinstance(reshape_node.inputs[1], gs.Constant):
input_shape = reshape_node.inputs[0].shape
reshape_shape = reshape_node.inputs[1].values
reshape_shape = reshape_node.inputs[1].values.tolist()
if input_shape is not None and np.any(reshape_shape == 0):
shape = [
input_shape[i] if dim_size == 0 else dim_size for i, dim_size in enumerate(reshape_shape)
input_shape[i] if dim_size == 0 else reshape_shape[i] for i, dim_size in enumerate(reshape_shape)
]
if not all(isinstance(item, int) for item in shape):
return False
Expand Down

0 comments on commit 97bacb7

Please sign in to comment.