Skip to content

Commit

Permalink
change name to clipmul
Browse files Browse the repository at this point in the history
  • Loading branch information
a162837 committed Nov 18, 2024
1 parent ce86278 commit 2de3599
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -3798,13 +3798,7 @@ def clip(
max_ = float(np.finfo(np.float32).max)
tensor_dtype = 'float32'

if (
isinstance(min, Variable)
and (len(min.shape) > 1 or (len(min.shape == 1) and min.shape[-1] != 1))
) or (
isinstance(max, Variable)
and (len(max.shape) > 1 or (len(max.shape == 1) and max.shape[-1] != 1))
):
if (paddle.is_tensor(min) and min.numel() > 1) or (paddle.is_tensor(max) and max.numel() > 1):
min = paddle.full_like(x, min_, tensor_dtype) if min is None else min
max = paddle.full_like(x, max_, tensor_dtype) if max is None else max
min = (
Expand Down Expand Up @@ -3949,13 +3943,7 @@ def clip_(
fmax = float(np.finfo(np.float32).max)
tensor_dtype = 'float32'

if (
isinstance(min, Variable)
and (len(min.shape) > 1 or (len(min.shape == 1) and min.shape[-1] != 1))
) or (
isinstance(max, Variable)
and (len(max.shape) > 1 or (len(max.shape == 1) and max.shape[-1] != 1))
):
if (paddle.is_tensor(min) and min.numel() > 1) or (paddle.is_tensor(max) and max.numel() > 1):
min = paddle.full_like(x, fmin, tensor_dtype) if min is None else min
max = paddle.full_like(x, fmax, tensor_dtype) if max is None else max
min = (
Expand Down

0 comments on commit 2de3599

Please sign in to comment.