Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.clip

Contents

jax.numpy.clip#

jax.numpy.clip(arr=None,/,min=None,max=None,*,a=Deprecated,a_min=Deprecated,a_max=Deprecated)[source]#

Clip array values to a specified range.

JAX implementation ofnumpy.clip().

Parameters:
  • arr (ArrayLike |None) – N-dimensional array to be clipped.

  • min (ArrayLike |None) – optional minimum value of the clipped range; ifNone (default) thenresult will not be clipped to any minimum value. If specified, it should bebroadcast-compatible witharr andmax.

  • max (ArrayLike |None) – optional maximum value of the clipped range; ifNone (default) thenresult will not be clipped to any maximum value. If specified, it should bebroadcast-compatible witharr andmin.

  • a (ArrayLike |DeprecatedArg) – deprecated alias of thearr argument. Will result in aDeprecationWarning if used.

  • a_min (ArrayLike |None |DeprecatedArg) – deprecated alias of themin argument. Will result in aDeprecationWarning if used.

  • a_max (ArrayLike |None |DeprecatedArg) – deprecated alias of themax argument. Will result in aDeprecationWarning if used.

Returns:

An array containing values fromarr, with values smaller thanmin settomin, and values larger thanmax set tomax.Wherevermin is larger thanmax, the value ofmax is returned.

Return type:

Array

See also

Examples

>>>arr=jnp.array([0,1,2,3,4,5,6,7])>>>jnp.clip(arr,2,5)Array([2, 2, 2, 3, 4, 5, 5, 5], dtype=int32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp