rmse#

diffsptk.RMSE#

alias of RootMeanSquaredError

class diffsptk.RootMeanSquaredError(reduction='mean', eps=1e-08)[source]#

See this page for details.

Parameters:
reduction[‘none’, ‘mean’, ‘sum’]

Reduction type.

epsfloat >= 0 [scalar]

A small value to prevent NaN.

forward(x, y)[source]#

Calculate RMSE.

Parameters:
xTensor [shape=(…,)]

Input.

yTensor [shape=(…,)]

Target.

Returns:
eTensor [shape=(…,) or scalar]

RMSE.

Examples

>>> x = diffsptk.nrand(4)
>>> x
tensor([-0.5945, -0.2401,  0.8633, -0.6464,  0.4515])
>>> y = diffsptk.nrand(4)
>>> y
tensor([-0.4025,  0.9367,  1.1299,  3.1986, -0.2832])
>>> rmse = diffsptk.RootMeanSquaredError()
>>> e = rmse(x, y)
>>> e
tensor(1.8340)

See also

snr