Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.all

Contents

jax.numpy.all#

jax.numpy.all(a,axis=None,out=None,keepdims=False,*,where=None)[source]#

Test whether all array elements along a given axis evaluate to True.

JAX implementation ofnumpy.all().

Parameters:
  • a (ArrayLike) – Input array.

  • axis (Axis) – int or array, default=None. Axis along which to be tested. If None,tests along all the axes.

  • keepdims (bool) – bool, default=False. If true, reduced axes are left in the resultwith size 1.

  • where (ArrayLike |None) – int or array of boolean dtype, default=None. The elements to be usedin the test. Array should be broadcast compatible to the input.

  • out (None) – Unused by JAX.

Returns:

An array of boolean values.

Return type:

Array

Examples

By default,jnp.all tests for True values along all the axes.

>>>x=jnp.array([[True,True,True,False],...[True,False,True,False],...[True,True,False,False]])>>>jnp.all(x)Array(False, dtype=bool)

Ifaxis=0, tests for True values along axis 0.

>>>jnp.all(x,axis=0)Array([ True, False, False, False], dtype=bool)

Ifkeepdims=True,ndim of the output will be same of that of the input.

>>>jnp.all(x,axis=0,keepdims=True)Array([[ True, False, False, False]], dtype=bool)

To include specific elements in testing for True values, you can use a``where``.

>>>where=jnp.array([[1,0,1,0],...[0,0,1,1],...[1,1,1,0]],dtype=bool)>>>jnp.all(x,axis=0,keepdims=True,where=where)Array([[ True,  True, False, False]], dtype=bool)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp