From 273ff6549d97c6b98de3fca0a363b62a52a0afcf Mon Sep 17 00:00:00 2001 From: Jackson McClintock Date: Thu, 22 Feb 2024 21:49:53 -0500 Subject: [PATCH] fix: fix empty tensor functionality in `mean` for paddle backend --- ivy/functional/backends/paddle/statistical.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ivy/functional/backends/paddle/statistical.py b/ivy/functional/backends/paddle/statistical.py index fc036b4465474..468c178ec460a 100644 --- a/ivy/functional/backends/paddle/statistical.py +++ b/ivy/functional/backends/paddle/statistical.py @@ -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))] @@ -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),