Skip to content

Commit

Permalink
fix: fix empty tensor functionality in mean for paddle backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksondm33 committed Feb 23, 2024
1 parent c0ae5f7 commit c5f18a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ivy/functional/backends/paddle/statistical.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def max(
def _calculate_reduced_shape(x, axis, keepdims):
if axis is None:
axis = tuple(range(len(x.shape)))
elif type(axis) not in (tuple, list):
elif isinstance(axis, int):
axis = (axis,)
if keepdims:
return [1 if i in axis else x.shape[i] for i in range(len(x.shape))]
Expand All @@ -128,7 +128,7 @@ def mean(
ret_dtype = x.dtype
if 0 in x.shape:
shape = _calculate_reduced_shape(x, axis, keepdims)
ret = paddle.empty(shape)
ret = paddle.full(shape, float("nan"))
elif paddle.is_complex(x):
ret = paddle.complex(
paddle.mean(x.real(), axis=axis, keepdim=keepdims),
Expand Down

0 comments on commit c5f18a9

Please sign in to comment.