rmse#

diffsptk.RMSE#

alias of RootMeanSquareError

class diffsptk.RootMeanSquareError(reduction: str = 'mean')[source]#

See this page for details.

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

The reduction type.

forward(x: Tensor, y: Tensor) Tensor[source]#

Calculate RMSE.

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

The input.

yTensor [shape=(…, D)]

The target.

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

The RMSE.

Examples

>>> import diffsptk
>>> import torch
>>> rmse = diffsptk.RootMeanSquareError()
>>> x = torch.tensor([0.1, -0.2, 0.3, -0.4, 0.5])
>>> y = torch.tensor([-0.4, 0.9, 1.1, 3.2, -0.3])
>>> e = rmse(x, y)
>>> e
tensor(1.7720)
diffsptk.functional.rmse(x: Tensor, y: Tensor, reduction: str = 'mean') Tensor[source]#

Calculate RMSE.

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

The input.

yTensor [shape=(…, D)]

The target.

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

The reduction type.

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

The RMSE.

See also

snr f0eval