提交 8e87a685 编写于 作者: A acosta123 提交者: Cheerego

Update metrics_en.rst (#822)

上级 731be846
...@@ -21,15 +21,15 @@ Fluid contains common classification metrics, such as Precision, Recall, Accurac ...@@ -21,15 +21,15 @@ Fluid contains common classification metrics, such as Precision, Recall, Accurac
.. code-block:: python .. code-block:: python
>>> import paddle.fluid as fluid >>> 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") >>> data = fluid.layers.data(name="data", shape=[32, 32], dtype="int32")
>>> pred = fluid.layers.fc(input=data, size=1000, act="tanh") >>> pred = fluid.layers.fc(input=data, size=1000, act="tanh")
>>> acc = fluid.metrics.Precision() >>> acc = fluid.metrics.Precision()
>>> for pass in range(PASSES): >>> for pass_iter in range(PASSES):
>>> acc.reset() >>> acc.reset()
>>> for data in train_reader(): >>> for data in train_reader():
>>> loss, preds, labels = exe.run(fetch_list=[cost, preds, labels]) >>> loss, preds, labels = exe.run(fetch_list=[cost, preds, labels])
>>> acc.update(preds=preds, labels=labels) >>> acc.update(preds=preds, labels=labels)
>>> numpy_acc = acc.eval() >>> numpy_acc = acc.eval()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册