Skip to content

Commit c5f18a9

Browse files
committed
fix: fix empty tensor functionality in mean for paddle backend
1 parent c0ae5f7 commit c5f18a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ivy/functional/backends/paddle/statistical.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def max(
107107
def _calculate_reduced_shape(x, axis, keepdims):
108108
if axis is None:
109109
axis = tuple(range(len(x.shape)))
110-
elif type(axis) not in (tuple, list):
110+
elif isinstance(axis, int):
111111
axis = (axis,)
112112
if keepdims:
113113
return [1 if i in axis else x.shape[i] for i in range(len(x.shape))]
@@ -128,7 +128,7 @@ def mean(
128128
ret_dtype = x.dtype
129129
if 0 in x.shape:
130130
shape = _calculate_reduced_shape(x, axis, keepdims)
131-
ret = paddle.empty(shape)
131+
ret = paddle.full(shape, float("nan"))
132132
elif paddle.is_complex(x):
133133
ret = paddle.complex(
134134
paddle.mean(x.real(), axis=axis, keepdim=keepdims),

0 commit comments

Comments
 (0)