From 9e1afc560295097619c9bc499a1df213fa43c102 Mon Sep 17 00:00:00 2001 From: baiyfbupt Date: Mon, 28 Sep 2020 11:17:48 +0800 Subject: [PATCH] migrate code example and doc --- python/paddle/fluid/layers/loss.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/python/paddle/fluid/layers/loss.py b/python/paddle/fluid/layers/loss.py index f88e4f6536f..9cecbd97595 100644 --- a/python/paddle/fluid/layers/loss.py +++ b/python/paddle/fluid/layers/loss.py @@ -329,12 +329,12 @@ def square_error_cost(input, label): .. code-block:: python - import paddle - input = paddle.to_tensor([1.1, 1.9]) - label = paddle.to_tensor([1.0, 2.0]) - output = paddle.fluid.layers.square_error_cost(input, label) - print(output.numpy()) - # [0.01, 0.01] + import paddle + input = paddle.to_tensor([1.1, 1.9]) + label = paddle.to_tensor([1.0, 2.0]) + output = paddle.fluid.layers.square_error_cost(input, label) + print(output.numpy()) + # [0.01, 0.01] """ check_variable_and_dtype(input, "input", ['float32', 'float64'], @@ -1775,12 +1775,12 @@ def mse_loss(input, label): Examples: .. code-block:: python - import paddle - input = paddle.to_tensor([1.1, 1.9]) - label = paddle.to_tensor([1.0, 2.0]) - output = paddle.fluid.layers.mse_loss(input, label) - print(output.numpy()) - # [0.01] + import paddle + input = paddle.to_tensor([1.1, 1.9]) + label = paddle.to_tensor([1.0, 2.0]) + output = paddle.fluid.layers.mse_loss(input, label) + print(output.numpy()) + # [0.01] """ check_variable_and_dtype(input, "input", ['float32', 'float64'], 'mse_loss') check_variable_and_dtype(label, "label", ['float32', 'float64'], 'mse_loss') -- GitLab