Trim leading and/or trailing zeros of the input array.
JAX implementation of numpy.trim_zeros()
.
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.
An array containing the trimmed input with same dtype as filt
.
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