Skip to content

Commit

Permalink
fix the problem of slice infer shape (#42568) (#43246)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyfncg committed Jun 7, 2022
1 parent e09803c commit f1b4e4d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/paddle/fluid/variable_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ def idx_empty(var):
return paddle.empty(var_shape, dtype=var.dtype)

from .layers.control_flow import cond
return cond(item.any(), lambda: idx_not_empty(var, item),
lambda: idx_empty(var))
return cond(
paddle.logical_not(item.any()), lambda: idx_empty(var),
lambda: idx_not_empty(var, item))


def _getitem_impl_(var, item):
Expand Down

0 comments on commit f1b4e4d

Please sign in to comment.