jax.numpy.iterable
Contents
jax.numpy.iterable#
- jax.numpy.iterable(y)#
Check whether or not an object can be iterated over.
- Parameters:
y (object) – Input object.
- Returns:
b – Return
Trueif the object has an iterator method or is asequence andFalseotherwise.- Return type:
Examples
>>>importnumpyasnp>>>np.iterable([1,2,3])True>>>np.iterable(2)False
Notes
In most cases, the results of
np.iterable(obj)are consistent withisinstance(obj,collections.abc.Iterable). One notable exception isthe treatment of 0-dimensional arrays:>>>fromcollections.abcimportIterable>>>a=np.array(1.0)# 0-dimensional numpy array>>>isinstance(a,Iterable)True>>>np.iterable(a)False
Contents
