cupy.trim_zeros#

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

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

Returns the trimmed array

Parameters:
  • filt (cupy.ndarray) – Input array

  • trim (str, optional) – ‘fb’ default option trims the array from both sides. ‘f’ option trim zeros from front. ‘b’ option trim zeros from back.

Returns:

trimmed input

Return type:

cupy.ndarray