Skip to content

Commit

Permalink
【prim】test composite rules with -1 shape (#51435)
Browse files Browse the repository at this point in the history
* init

* modify
  • Loading branch information
xiaoguoguo626807 authored Mar 14, 2023
1 parent c3f8ba9 commit 82a7c33
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/paddle/incubate/autograd/primx.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ def expand_nested_list(xs):
f'but orig_out.dtype={orig_out.dtype} and new_out.dtype={new_out.dtype}'
)
if orig_out.shape and new_out.shape:
assert (
-1 not in new_out.shape
), f'when replace origin op {op_name} with composite rule, composite out shape has -1.'
assert orig_out.shape == new_out.shape, (
f'when replace origin op {op_name} with composite rule, origin out shape should be equal to new out shape, '
f'but orig_out.shape={orig_out.shape} and new_out.shape={new_out.shape}'
Expand Down

0 comments on commit 82a7c33

Please sign in to comment.