未验证 提交 0def5938 编写于 作者: Q qingqing01 提交者: GitHub

Update doc for 2.0 API and some callback (#31180) (#31189)

test=document_fix
上级 5bd7c82b
...@@ -2214,17 +2214,18 @@ def multi_box_head(inputs, ...@@ -2214,17 +2214,18 @@ def multi_box_head(inputs,
Examples 1: set min_ratio and max_ratio: Examples 1: set min_ratio and max_ratio:
.. code-block:: python .. code-block:: python
import paddle.fluid as fluid import paddle
paddle.enable_static()
images = fluid.data(name='data', shape=[None, 3, 300, 300], dtype='float32') images = paddle.static.data(name='data', shape=[None, 3, 300, 300], dtype='float32')
conv1 = fluid.data(name='conv1', shape=[None, 512, 19, 19], dtype='float32') conv1 = paddle.static.data(name='conv1', shape=[None, 512, 19, 19], dtype='float32')
conv2 = fluid.data(name='conv2', shape=[None, 1024, 10, 10], dtype='float32') conv2 = paddle.static.data(name='conv2', shape=[None, 1024, 10, 10], dtype='float32')
conv3 = fluid.data(name='conv3', shape=[None, 512, 5, 5], dtype='float32') conv3 = paddle.static.data(name='conv3', shape=[None, 512, 5, 5], dtype='float32')
conv4 = fluid.data(name='conv4', shape=[None, 256, 3, 3], dtype='float32') conv4 = paddle.static.data(name='conv4', shape=[None, 256, 3, 3], dtype='float32')
conv5 = fluid.data(name='conv5', shape=[None, 256, 2, 2], dtype='float32') conv5 = paddle.static.data(name='conv5', shape=[None, 256, 2, 2], dtype='float32')
conv6 = fluid.data(name='conv6', shape=[None, 128, 1, 1], dtype='float32') conv6 = paddle.static.data(name='conv6', shape=[None, 128, 1, 1], dtype='float32')
mbox_locs, mbox_confs, box, var = fluid.layers.multi_box_head( mbox_locs, mbox_confs, box, var = paddle.static.nn.multi_box_head(
inputs=[conv1, conv2, conv3, conv4, conv5, conv6], inputs=[conv1, conv2, conv3, conv4, conv5, conv6],
image=images, image=images,
num_classes=21, num_classes=21,
...@@ -2239,17 +2240,18 @@ def multi_box_head(inputs, ...@@ -2239,17 +2240,18 @@ def multi_box_head(inputs,
Examples 2: set min_sizes and max_sizes: Examples 2: set min_sizes and max_sizes:
.. code-block:: python .. code-block:: python
import paddle.fluid as fluid import paddle
paddle.enable_static()
images = fluid.data(name='data', shape=[None, 3, 300, 300], dtype='float32') images = paddle.static.data(name='data', shape=[None, 3, 300, 300], dtype='float32')
conv1 = fluid.data(name='conv1', shape=[None, 512, 19, 19], dtype='float32') conv1 = paddle.static.data(name='conv1', shape=[None, 512, 19, 19], dtype='float32')
conv2 = fluid.data(name='conv2', shape=[None, 1024, 10, 10], dtype='float32') conv2 = paddle.static.data(name='conv2', shape=[None, 1024, 10, 10], dtype='float32')
conv3 = fluid.data(name='conv3', shape=[None, 512, 5, 5], dtype='float32') conv3 = paddle.static.data(name='conv3', shape=[None, 512, 5, 5], dtype='float32')
conv4 = fluid.data(name='conv4', shape=[None, 256, 3, 3], dtype='float32') conv4 = paddle.static.data(name='conv4', shape=[None, 256, 3, 3], dtype='float32')
conv5 = fluid.data(name='conv5', shape=[None, 256, 2, 2], dtype='float32') conv5 = paddle.static.data(name='conv5', shape=[None, 256, 2, 2], dtype='float32')
conv6 = fluid.data(name='conv6', shape=[None, 128, 1, 1], dtype='float32') conv6 = paddle.static.data(name='conv6', shape=[None, 128, 1, 1], dtype='float32')
mbox_locs, mbox_confs, box, var = fluid.layers.multi_box_head( mbox_locs, mbox_confs, box, var = paddle.static.nn.multi_box_head(
inputs=[conv1, conv2, conv3, conv4, conv5, conv6], inputs=[conv1, conv2, conv3, conv4, conv5, conv6],
image=images, image=images,
num_classes=21, num_classes=21,
......
...@@ -298,13 +298,15 @@ class Callback(object): ...@@ -298,13 +298,15 @@ class Callback(object):
class ProgBarLogger(Callback): class ProgBarLogger(Callback):
""" """
Logger callback function. Logger callback function to print loss and metrics to stdout. It supports
silent mode (not print), progress bar or one line per each printing,
see arguments for more detailed.
Args: Args:
log_freq (int): The frequency, in number of steps, log_freq (int): The frequency, in number of steps,
the logs such as loss, metrics are printed. Default: 1. the logs such as loss, metrics are printed. Default: 1.
verbose (int): The verbosity mode, should be 0, 1, or 2. verbose (int): The verbosity mode, should be 0, 1, or 2.
0 = silent, 1 = progress bar, 2 = one line per epoch, 3 = 2 + 0 = silent, 1 = progress bar, 2 = one line each printing, 3 = 2 +
time counter, such as average reader cost, samples per second. time counter, such as average reader cost, samples per second.
Default: 2. Default: 2.
...@@ -531,7 +533,9 @@ class ProgBarLogger(Callback): ...@@ -531,7 +533,9 @@ class ProgBarLogger(Callback):
class ModelCheckpoint(Callback): class ModelCheckpoint(Callback):
""" """
Model checkpoint callback function. Model checkpoint callback function to save model weights and optimizer
state during training in conjunction with model.fit(). Currently,
ModelCheckpoint only supports saving after a fixed number of epochs.
Args: Args:
save_freq(int): The frequency, in number of epochs, the model checkpoint save_freq(int): The frequency, in number of epochs, the model checkpoint
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册