Skip to content

Commit

Permalink
limit chunk.axis
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhen38 authored and root committed Aug 6, 2021
1 parent 4cc3d9a commit 977aa74
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/paddle/fluid/layers/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4890,6 +4890,7 @@ def split(input, num_or_sections, dim=-1, name=None):
if isinstance(dim, Variable):
dim = dim.numpy()
dim = dim.item(0)
assert len(input.shape) + dim >= 0, "(rank(x) + axis) must >= 0"
dim = (len(input.shape) + dim) if dim < 0 else dim
attrs += ('axis', dim)

Expand Down Expand Up @@ -4951,6 +4952,7 @@ def _get_SectionsTensorList(one_list):
dim.stop_gradient = True
inputs['AxisTensor'] = dim
else:
assert len(input.shape) + dim >= 0, "(rank(x) + axis) must >= 0"
dim = (len(input_shape) + dim) if dim < 0 else dim
attrs['axis'] = dim

Expand Down

1 comment on commit 977aa74

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.