Do not use isinstance()
@@ -25,15 +25,11 @@ def average(a, axis=None, weights=None, returned=False):
.. seealso:: :func:`numpy.average`
"""
- if not isinstance(a, cupy.ndarray):
a = cupy.asarray(a)
if weights is None:
avg = a.mean(axis)
scl = avg.dtype.type(a.size / avg.size)
- else:
- if isinstance(weights, cupy.ndarray):
- wgt = weights
else:
wgt = cupy.asarray(weights)
