Remove asarray() calls from the array API statistical functions
asarray() is already called in Array._new.
@@ -10,21 +10,21 @@ def max(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keep
return Array._new(np.max(x._array, axis=axis, keepdims=keepdims))
def mean(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
- return Array._new(np.asarray(np.mean(x._array, axis=axis, keepdims=keepdims)))
+ return Array._new(np.mean(x._array, axis=axis, keepdims=keepdims))
def min(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
return Array._new(np.min(x._array, axis=axis, keepdims=keepdims))
def prod(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
- return Array._new(np.asarray(np.prod(x._array, axis=axis, keepdims=keepdims)))
+ return Array._new(np.prod(x._array, axis=axis, keepdims=keepdims))
def std(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, correction: Union[int, float] = 0.0, keepdims: bool = False) -> Array:
# Note: the keyword argument correction is different here
- return Array._new(np.asarray(np.std(x._array, axis=axis, ddof=correction, keepdims=keepdims)))
+ return Array._new(np.std(x._array, axis=axis, ddof=correction, keepdims=keepdims))
def sum(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
- return Array._new(np.asarray(np.sum(x._array, axis=axis, keepdims=keepdims)))
+ return Array._new(np.sum(x._array, axis=axis, keepdims=keepdims))
def var(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, correction: Union[int, float] = 0.0, keepdims: bool = False) -> Array:
# Note: the keyword argument correction is different here
- return Array._new(np.asarray(np.var(x._array, axis=axis, ddof=correction, keepdims=keepdims)))
+ return Array._new(np.var(x._array, axis=axis, ddof=correction, keepdims=keepdims))
