diff --git a/doc/fluid/user_guides/howto/evaluation_and_debugging/evaluation/metrics.rst b/doc/fluid/user_guides/howto/evaluation_and_debugging/evaluation/metrics.rst index acc03596b2463c377940787c7ee9b6809d168808..a6080bf270988a8905b0886bd19bf9644e502a7c 100644 --- a/doc/fluid/user_guides/howto/evaluation_and_debugging/evaluation/metrics.rst +++ b/doc/fluid/user_guides/howto/evaluation_and_debugging/evaluation/metrics.rst @@ -22,15 +22,15 @@ Fluid中包含了常用分类指标,例如Precision, Recall, Accuracy等,更 .. code-block:: python >>> import paddle.fluid as fluid - >>> labels = fluid.layers.data(name="data", shape=[1], dtype="int32") + >>> label = fluid.layers.data(name="label", shape=[1], dtype="int32") >>> data = fluid.layers.data(name="data", shape=[32, 32], dtype="int32") >>> pred = fluid.layers.fc(input=data, size=1000, act="tanh") >>> acc = fluid.metrics.Precision() - >>> for pass in range(PASSES): + >>> for pass_iter in range(PASSES): >>> acc.reset() >>> for data in train_reader(): - >>> loss, preds, labels = exe.run(fetch_list=[cost, preds, labels]) - >>> acc.update(preds=preds, labels=labels) + >>> loss, preds, labels = exe.run(fetch_list=[cost, pred, label]) + >>> acc.update(preds=preds, labels=labels) >>> numpy_acc = acc.eval()