A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.jax.dev/en/latest/_autosummary/jax.numpy.trim_zeros.html below:

jax.numpy.trim_zeros — JAX documentation

jax.numpy.trim_zeros#
jax.numpy.trim_zeros(filt, trim='fb')[source]#

Trim leading and/or trailing zeros of the input array.

JAX implementation of numpy.trim_zeros().

Parameters:
  • filt (ArrayLike) – input array. Must have filt.ndim == 1.

  • trim (str) –

    string, optional, default = fb. Specifies from which end the input is trimmed.

    • f - trims only the leading zeros.

    • b - trims only the trailing zeros.

    • fb - trims both leading and trailing zeros.

Returns:

An array containing the trimmed input with same dtype as filt.

Return type:

Array

Examples

>>> x = jnp.array([0, 0, 2, 0, 1, 4, 3, 0, 0, 0])
>>> jnp.trim_zeros(x)
Array([2, 0, 1, 4, 3], dtype=int32)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4