square_error_cost

paddle.fluid.layers.loss. square_error_cost ( input, label ) [source]

This op accepts input predictions and target label and returns the squared error cost.

For predictions label, and target label, the equation is:

\[Out = (input - label)^2\]
Parameters
  • input (Tensor) – Input tensor, the data type should be float32.

  • label (Tensor) – Label tensor, the data type should be float32.

Returns

The tensor storing the element-wise squared error

difference between input and label.

Return type: Tensor.

Examples

import paddle
input = paddle.to_tensor([1.1, 1.9])
label = paddle.to_tensor([1.0, 2.0])
output = paddle.nn.functional.square_error_cost(input, label)
print(output)
# [0.01, 0.01]