1. Add # pylint: disable=missing-docstring label beside the function;

2. Revise the name of TF NumPy and vanilla NumPy according to the
   imports.
This commit is contained in:
DarrenZhang01 2020-08-29 22:59:42 -04:00
parent 706552aa1c
commit 9a9bec8fc7

View File

@ -562,16 +562,16 @@ def _reduce(tf_fn,
# TODO (DarrenZhang01): Add `axis` support to the `size` API.
@utils.np_doc('size')
def size(x, axis=None):
def size(x, axis=None): # pylint: disable=missing-docstring
if axis is not None:
raise NotImplementedError("axis argument is not supported in the current `np.size` "
"implementation")
raise NotImplementedError("axis argument is not supported in the current "
"`np.size` implementation")
x = asarray(x).data
if isinstance(x, (int, float, onp.int32, onp.int64,
onp.float32, onp.float64)):
if isinstance(x, (int, float, np.int32, np.int64,
np.float32, np.float64)):
return 1
elif isinstance(x, (np.ndarray, onp.ndarray)):
return np.prod(x.shape)
elif isinstance(x, (np_arrays.ndarray, np.ndarray)):
return prod(x.shape)
else:
raise TypeError("The inputs must be one of types {int, float, numpy array"
", TensorFlow Tensor, TensorFlow ndarray} object.")