Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
longranger2 committed Nov 14, 2023
1 parent 773d8c2 commit ba8dc2b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/paddle/tensor/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,9 @@ def eye(num_rows, num_columns=None, dtype=None, name=None):
"""

def _check_attr(attr, message):
if isinstance(attr, ((Variable, core.eager.Tensor))):
if isinstance(
attr, ((Variable, core.eager.Tensor, paddle.pir.OpResult))
):
assert len(attr.shape) == 1 and attr.shape[0] in [1, -1]
elif not isinstance(attr, int) or attr < 0:
raise TypeError(f"{message} should be a non-negative int.")
Expand Down

0 comments on commit ba8dc2b

Please sign in to comment.