jax.numpy.trim_zeros#

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

Trim the leading and/or trailing zeros from a 1-D array or sequence.

LAX-backend implementation of numpy.trim_zeros().

Original docstring below.

Parameters
  • filt (1-D array or sequence) – Input array.

  • trim (str, optional) – A string with ‘f’ representing trim from front and ‘b’ to trim from back. Default is ‘fb’, trim zeros from both front and back of the array.

Returns

trimmed – The result of trimming the input. The input data type is preserved.

Return type

1-D array or sequence