square_error_cost

paddle.nn.functional. 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

Tensor, The tensor storing the element-wise squared error difference between input and label.

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)
Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.01000000, 0.01000000])