Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

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 – ReturnTrue if the object has an iterator method or is asequence andFalse otherwise.

Return type:

bool

Examples

>>>importnumpyasnp>>>np.iterable([1,2,3])True>>>np.iterable(2)False

Notes

In most cases, the results ofnp.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

[8]ページ先頭

©2009-2025 Movatter.jp