delay#

class diffsptk.Delay(start, keeplen=False)[source]#

See this page for details.

Parameters:
startint [scalar]

Start point, \(S\). If negative, advance signal.

keeplenbool [scalar]

If True, output has the same length of input.

forward(x, dim=-1)[source]#

Delay signal.

Parameters:
xTensor [shape=(…, T, …)]

Signal.

dimint [scalar]

Dimension along which to shift the tensors.

Returns:
yTensor [shape=(…, T-S, …)] or [shape=(…, T, …)]

Delayed signal.

Examples

>>> x = torch.arange(1, 4)
>>> delay = diffsptk.Delay(2)
>>> y = delay(x)
>>> y
tensor([0., 0., 1., 2., 3.])
>>> delay = diffsptk.Delay(2, keeplen=True)
>>> y = delay(x)
>>> y
tensor([0., 0., 1.])