nnmnkwii.util.trim_zeros_frames

nnmnkwii.util.trim_zeros_frames(x, eps=1e-07)[source]

Remove trailling zeros frames.

Similar to numpy.trim_zeros(), trimming trailing zeros features.

Parameters:
  • x (numpy.ndarray) – Feature matrix, shape (T x D)
  • eps (float) – Values smaller than eps considered as zeros.
Returns:

Trimmed 2d feature matrix, shape (T' x D)

Return type:

numpy.ndarray

Examples

>>> import numpy as np
>>> from nnmnkwii.util import trim_zeros_frames
>>> x = np.random.rand(100,10)
>>> y = trim_zeros_frames(x)