mindspore.nn.RMSELoss
- class mindspore.nn.RMSELoss[source]
RMSELoss creates a standard to measure the root mean square error between
and element-wise, where is the input and is the target.For simplicity, let
and be 1-dimensional Tensor with length and , the unreduced loss (i.e. with argument reduction set to ‘none’) of and is given as:- Inputs:
logits (Tensor) - Tensor of shape
.labels (Tensor) - Tensor of shape
.
- Outputs:
Tensor, weighted loss float tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> loss = nn.RMSELoss() >>> logits = Tensor(np.array([1, 2, 3]), mindspore.float32) >>> labels = Tensor(np.array([1, 2, 2]), mindspore.float32) >>> output = loss(logits, labels) >>> print(output) 0.57735026