linear_intpl#

class diffsptk.LinearInterpolation(upsampling_factor)[source]#

Perform linear interpolation.

Note that this is not for linear_intpl in C/C++ version of SPTK, but for filter coefficients interpolation in digital filtering.

Parameters:
upsampling_factorint >= 1

Upsampling factor, \(P\).

forward(x)[source]#

Interpolate filter coefficients.

Parameters:
xTensor [shape=(B, N, D) or (N, D) or (N,)]

Filter coefficients.

Returns:
outTensor [shape=(B, NxP, D) or (NxP, D) or (NxP,)]

Upsampled filter coefficients.

Examples

>>> x = diffsptk.ramp(2)
>>> x
tensor([0., 1., 2.])
>>> linear_intpl = diffsptk.LinearInterpolation(2)
>>> y = linear_intpl(x)
>>> y
tensor([0.0000, 0.5000, 1.0000, 1.5000, 2.0000, 2.0000])
diffsptk.functional.linear_intpl(x, upsampling_factor=80)[source]#

Interpolate filter coefficients.

Parameters:
xTensor [shape=(B, N, D) or (N, D) or (N,)]

Filter coefficients.

upsampling_factorint >= 1

Upsampling factor, \(P\).

Returns:
yTensor [shape=(B, NxP, D) or (NxP, D) or (NxP,)]

Upsampled filter coefficients.

See also

poledf zerodf