未验证 提交 15158927 编写于 作者: X xiemoyuan 提交者: GitHub

[Docs] Modified the docs of some api for supporting list/tuple args. (#32360)

* fixed docs.

* Fixed docs. test=document_fix

code bak.

fixed docs. test=document_fix

* Revert to previous version of python/paddle/fluid/backward.py

* fixed bugs.

* test=document_fix. Fixed examples.
上级 23d3e36a
...@@ -28,10 +28,10 @@ def auto_cast(enable=True, custom_white_list=None, custom_black_list=None): ...@@ -28,10 +28,10 @@ def auto_cast(enable=True, custom_white_list=None, custom_black_list=None):
Args: Args:
enable(bool, optional): Enable auto-mixed-precision or not. Default is True. enable(bool, optional): Enable auto-mixed-precision or not. Default is True.
custom_white_list(set|list, optional): The custom white_list. It's the set of ops that support custom_white_list(set|list|tuple, optional): The custom white_list. It's the set of ops that support
fp16 calculation and are considered numerically-safe and performance-critical. These ops fp16 calculation and are considered numerically-safe and performance-critical. These ops
will be converted to fp16. will be converted to fp16.
custom_black_list(set|list, optional): The custom black_list. The set of ops that support fp16 custom_black_list(set|list|tuple, optional): The custom black_list. The set of ops that support fp16
calculation and are considered numerically-dangerous and whose effects may also be calculation and are considered numerically-dangerous and whose effects may also be
observed in downstream ops. These ops will not be converted to fp16. observed in downstream ops. These ops will not be converted to fp16.
......
...@@ -662,7 +662,7 @@ def scatter(tensor, tensor_list=None, src=0, group=None, use_calc_stream=True): ...@@ -662,7 +662,7 @@ def scatter(tensor, tensor_list=None, src=0, group=None, use_calc_stream=True):
Args: Args:
tensor (Tensor): The output Tensor. Its data type tensor (Tensor): The output Tensor. Its data type
should be float16, float32, float64, int32 or int64. should be float16, float32, float64, int32 or int64.
tensor_list (list): A list of Tensors to scatter. Every element in the list must be a Tensor whose data type tensor_list (list|tuple): A list/tuple of Tensors to scatter. Every element in the list must be a Tensor whose data type
should be float16, float32, float64, int32 or int64. Default value is None. should be float16, float32, float64, int32 or int64. Default value is None.
src (int): The source rank id. Default value is 0. src (int): The source rank id. Default value is 0.
group (Group): The group instance return by new_group or None for global default group. group (Group): The group instance return by new_group or None for global default group.
...@@ -679,6 +679,8 @@ def scatter(tensor, tensor_list=None, src=0, group=None, use_calc_stream=True): ...@@ -679,6 +679,8 @@ def scatter(tensor, tensor_list=None, src=0, group=None, use_calc_stream=True):
import paddle import paddle
from paddle.distributed import init_parallel_env from paddle.distributed import init_parallel_env
# required: gpu
paddle.set_device('gpu:%d'%paddle.distributed.ParallelEnv().dev_id) paddle.set_device('gpu:%d'%paddle.distributed.ParallelEnv().dev_id)
init_parallel_env() init_parallel_env()
if paddle.distributed.ParallelEnv().local_rank == 0: if paddle.distributed.ParallelEnv().local_rank == 0:
......
...@@ -24,7 +24,7 @@ def wait_server_ready(endpoints): ...@@ -24,7 +24,7 @@ def wait_server_ready(endpoints):
port readiness. port readiness.
Args: Args:
endpoints (list): endpoints string list, like: endpoints (list|tuple): endpoints string list, like:
["127.0.0.1:8080", "127.0.0.1:8081"] ["127.0.0.1:8080", "127.0.0.1:8081"]
Examples: Examples:
......
...@@ -325,7 +325,7 @@ def spawn(func, args=(), nprocs=-1, join=True, daemon=False, **options): ...@@ -325,7 +325,7 @@ def spawn(func, args=(), nprocs=-1, join=True, daemon=False, **options):
func (function): The target function is called by spawned process. func (function): The target function is called by spawned process.
This function need to be able to pickled, so it must be defined This function need to be able to pickled, so it must be defined
at the top level of a module. at the top level of a module.
args (tuple, optional): Arguments passed to ``func``. args (list|tuple, optional): Arguments passed to ``func``.
nprocs (int, optional): Number of processed to start. Default: -1. nprocs (int, optional): Number of processed to start. Default: -1.
when nprocs is -1, the available device will be obtained from when nprocs is -1, the available device will be obtained from
the environment variable when the model is executed: If use GPU, the environment variable when the model is executed: If use GPU,
......
...@@ -233,7 +233,7 @@ class TensorDataset(Dataset): ...@@ -233,7 +233,7 @@ class TensorDataset(Dataset):
each sample by indexing tensors in the 1st dimension. each sample by indexing tensors in the 1st dimension.
Args: Args:
tensors(list of Tensor): tensors with same shape in the 1st dimension. tensors(list|tuple): A list/tuple of tensors with same shape in the 1st dimension.
Returns: Returns:
Dataset: a Dataset instance wrapping tensors. Dataset: a Dataset instance wrapping tensors.
......
...@@ -418,7 +418,7 @@ def cuda_places(device_ids=None): ...@@ -418,7 +418,7 @@ def cuda_places(device_ids=None):
[paddle.CUDAPlace(0), paddle.CUDAPlace(1), paddle.CUDAPlace(2)]. [paddle.CUDAPlace(0), paddle.CUDAPlace(1), paddle.CUDAPlace(2)].
Parameters: Parameters:
device_ids (list or tuple of int, optional): list of GPU device ids. device_ids (list|tuple, optional): A list/tuple of int of GPU device ids.
Returns: Returns:
list of paddle.CUDAPlace: Created GPU place list. list of paddle.CUDAPlace: Created GPU place list.
...@@ -429,6 +429,8 @@ def cuda_places(device_ids=None): ...@@ -429,6 +429,8 @@ def cuda_places(device_ids=None):
import paddle import paddle
import paddle.static as static import paddle.static as static
# required: gpu
paddle.enable_static() paddle.enable_static()
cuda_places = static.cuda_places() cuda_places = static.cuda_places()
......
...@@ -1913,7 +1913,7 @@ def load(program, model_path, executor=None, var_list=None): ...@@ -1913,7 +1913,7 @@ def load(program, model_path, executor=None, var_list=None):
model_path(str): The file prefix store the program model_path(str): The file prefix store the program
executor(Executor, optional): The executor used for initialize the parameter executor(Executor, optional): The executor used for initialize the parameter
When startup program is not run. When startup program is not run.
var_list(list, optional): The Tensor list to load single model file saved with var_list(list|tuple, optional): The Tensor list/tuple to load single model file saved with
[ save_params, save_persistables, save_vars ]. [ save_params, save_persistables, save_vars ].
Default: None Default: None
...@@ -2103,7 +2103,7 @@ def load_program_state(model_path, var_list=None): ...@@ -2103,7 +2103,7 @@ def load_program_state(model_path, var_list=None):
Args: Args:
model_path(str): The file prefix store the program model_path(str): The file prefix store the program
var_list(list, optional): The Tensor list to load saved with var_list(list|tuple, optional): The Tensor list/tuple to load saved with
[ save_params, save_persistables, save_vars ]. [ save_params, save_persistables, save_vars ].
Default: None. Default: None.
The var_list is only used to get name, The var_list is only used to get name,
......
...@@ -148,7 +148,7 @@ def create_global_var(shape, ...@@ -148,7 +148,7 @@ def create_global_var(shape,
This function creates a new tensor variable with value in the global block(block 0). This function creates a new tensor variable with value in the global block(block 0).
Parameters: Parameters:
shape (list of int): Shape of the variable shape (list[int]|tuple[int]): Shape of the variable
value (float): The value of the variable. The new created value (float): The value of the variable. The new created
variable will be filled with it. variable will be filled with it.
dtype (str): Data type of the variable dtype (str): Data type of the variable
......
...@@ -81,7 +81,7 @@ def set_cuda_rng_state(state_list): ...@@ -81,7 +81,7 @@ def set_cuda_rng_state(state_list):
Sets generator state for all cuda generators Sets generator state for all cuda generators
Args: Args:
state_list(list): The cuda states to set back to cuda generators. state_list is obtained from get_cuda_rng_state(). state_list(list|tuple): The cuda states to set back to cuda generators. state_list is obtained from get_cuda_rng_state().
Returns: Returns:
None None
......
...@@ -182,7 +182,7 @@ class Accuracy(Metric): ...@@ -182,7 +182,7 @@ class Accuracy(Metric):
Encapsulates accuracy metric logic. Encapsulates accuracy metric logic.
Args: Args:
topk (int|tuple(int)): Number of top elements to look at topk (int|list[int]|tuple[int]): Number of top elements to look at
for computing accuracy. Default is (1,). for computing accuracy. Default is (1,).
name (str, optional): String name of the metric instance. Default name (str, optional): String name of the metric instance. Default
is `acc`. is `acc`.
......
...@@ -207,7 +207,7 @@ def interpolate(x, ...@@ -207,7 +207,7 @@ def interpolate(x,
size (list|tuple|Tensor|None): Output shape of image resize size (list|tuple|Tensor|None): Output shape of image resize
layer, the shape is (out_w, ) when input is a 3-D Tensor, the shape is (out_h, out_w) layer, the shape is (out_w, ) when input is a 3-D Tensor, the shape is (out_h, out_w)
when input is a 4-D Tensor and is (out_d, out_h, out_w) when input is a 5-D Tensor. when input is a 4-D Tensor and is (out_d, out_h, out_w) when input is a 5-D Tensor.
Default: None. If a list, each element can be an integer or a Tensor of shape: [1]. Default: None. If a list/tuple, each element can be an integer or a Tensor of shape: [1].
If a Tensor, its dimensions size should be a 1. If a Tensor, its dimensions size should be a 1.
scale_factor (float|Tensor|list|tuple|None): The multiplier for the input height or width. At scale_factor (float|Tensor|list|tuple|None): The multiplier for the input height or width. At
least one of :attr:`size` or :attr:`scale_factor` must be set. least one of :attr:`size` or :attr:`scale_factor` must be set.
...@@ -638,7 +638,7 @@ def upsample(x, ...@@ -638,7 +638,7 @@ def upsample(x,
size (list|tuple|Tensor|None): Output shape of image resize size (list|tuple|Tensor|None): Output shape of image resize
layer, the shape is (out_w, ) when input is a 3-D Tensor, the shape is (out_h, out_w) layer, the shape is (out_w, ) when input is a 3-D Tensor, the shape is (out_h, out_w)
when input is a 4-D Tensor and is (out_d, out_h, out_w) when input is a 5-D Tensor. when input is a 4-D Tensor and is (out_d, out_h, out_w) when input is a 5-D Tensor.
Default: None. If a list, each element can be an integer or a Tensor of shape: [1]. Default: None. If a list/tuple, each element can be an integer or a Tensor of shape: [1].
If a Tensor , its dimensions size should be a 1. If a Tensor , its dimensions size should be a 1.
scale_factor (float|Tensor|list|tuple|None): The multiplier for the input height or width. At scale_factor (float|Tensor|list|tuple|None): The multiplier for the input height or width. At
least one of :attr:`size` or :attr:`scale_factor` must be set. least one of :attr:`size` or :attr:`scale_factor` must be set.
......
...@@ -218,7 +218,7 @@ def conv1d(x, ...@@ -218,7 +218,7 @@ def conv1d(x,
weight (Tensor): The convolution kernel with shape [M, C/g, K], where M is weight (Tensor): The convolution kernel with shape [M, C/g, K], where M is
the number of output channels, g is the number of groups, K is the kernel's size. the number of output channels, g is the number of groups, K is the kernel's size.
bias (Tensor, optional): The bias with shape [M,]. Default: None. bias (Tensor, optional): The bias with shape [M,]. Default: None.
stride (int or tuple, optional): The stride size. If stride is a tuple, it must stride (int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain one integers, (stride_size). Default: 1. contain one integers, (stride_size). Default: 1.
padding(int|str|tuple|list, optional): The padding size. Padding could be in one of the following forms. padding(int|str|tuple|list, optional): The padding size. Padding could be in one of the following forms.
1. a string in ['valid', 'same']. 1. a string in ['valid', 'same'].
...@@ -227,7 +227,7 @@ def conv1d(x, ...@@ -227,7 +227,7 @@ def conv1d(x,
4. a list[int] or tuple[int] whose length is 2. It has the form [pad_before, pad_after]. 4. a list[int] or tuple[int] whose length is 2. It has the form [pad_before, pad_after].
5. a list or tuple of pairs of ints. It has the form [[pad_before, pad_after], [pad_before, pad_after], ...]. Note that, the batch dimension and channel dimension are also included. Each pair of integers correspond to the amount of padding for a dimension of the input. Padding in batch dimension and channel dimension should be [0, 0] or (0, 0). 5. a list or tuple of pairs of ints. It has the form [[pad_before, pad_after], [pad_before, pad_after], ...]. Note that, the batch dimension and channel dimension are also included. Each pair of integers correspond to the amount of padding for a dimension of the input. Padding in batch dimension and channel dimension should be [0, 0] or (0, 0).
The default value is 0. The default value is 0.
dilation (int or tuple, optional): The dilation size. If dilation is a tuple, it must dilation (int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
contain one integer, (dilation_size). Default: 1. contain one integer, (dilation_size). Default: 1.
groups (int, optional): The groups number of the conv1d function. According to grouped groups (int, optional): The groups number of the conv1d function. According to grouped
convolution in Alex Krizhevsky's Deep CNN paper: when group=2, convolution in Alex Krizhevsky's Deep CNN paper: when group=2,
...@@ -250,7 +250,7 @@ def conv1d(x, ...@@ -250,7 +250,7 @@ def conv1d(x,
ValueError: If the channel dimension of the input is less than or equal to zero. ValueError: If the channel dimension of the input is less than or equal to zero.
ValueError: If `data_format` is not "NCL" or "NLC". ValueError: If `data_format` is not "NCL" or "NLC".
ValueError: If `padding` is a string, but not "SAME" or "VALID". ValueError: If `padding` is a string, but not "SAME" or "VALID".
ValueError: If `padding` is a tuple, but the element corresponding to the input's batch size is not 0 ValueError: If `padding` is a list/tuple, but the element corresponding to the input's batch size is not 0
or the element corresponding to the input's channel is not 0. or the element corresponding to the input's channel is not 0.
ShapeError: If the input is not 3-D Tensor. ShapeError: If the input is not 3-D Tensor.
ShapeError: If the input's dimension size and filter's dimension size not equal. ShapeError: If the input's dimension size and filter's dimension size not equal.
...@@ -451,8 +451,8 @@ def conv2d(x, ...@@ -451,8 +451,8 @@ def conv2d(x,
the number of output channels, g is the number of groups, kH is the filter's the number of output channels, g is the number of groups, kH is the filter's
height, kW is the filter's width. height, kW is the filter's width.
bias (Tensor, optional): The bias with shape [M,]. bias (Tensor, optional): The bias with shape [M,].
stride (int|tuple): The stride size. It means the stride in convolution. stride (int|list|tuple): The stride size. It means the stride in convolution.
If stride is a tuple, it must contain two integers, (stride_height, stride_width). If stride is a list/tuple, it must contain two integers, (stride_height, stride_width).
Otherwise, stride_height = stride_width = stride. Default: stride = 1. Otherwise, stride_height = stride_width = stride. Default: stride = 1.
padding (string|int|list|tuple): The padding size. It means the number of zero-paddings padding (string|int|list|tuple): The padding size. It means the number of zero-paddings
on both sides for each dimension.If `padding` is a string, either 'VALID' or on both sides for each dimension.If `padding` is a string, either 'VALID' or
...@@ -464,8 +464,8 @@ def conv2d(x, ...@@ -464,8 +464,8 @@ def conv2d(x,
when `data_format` is `"NHWC"`, `padding` can be in the form when `data_format` is `"NHWC"`, `padding` can be in the form
`[[0,0], [pad_height_top, pad_height_bottom], [pad_width_left, pad_width_right], [0,0]]`. `[[0,0], [pad_height_top, pad_height_bottom], [pad_width_left, pad_width_right], [0,0]]`.
Default: padding = 0. Default: padding = 0.
dilation (int|tuple): The dilation size. It means the spacing between the kernel dilation (int|list|tuple): The dilation size. It means the spacing between the kernel
points. If dilation is a tuple, it must contain two integers, (dilation_height, points. If dilation is a list/tuple, it must contain two integers, (dilation_height,
dilation_width). Otherwise, dilation_height = dilation_width = dilation. dilation_width). Otherwise, dilation_height = dilation_width = dilation.
Default: dilation = 1. Default: dilation = 1.
groups (int): The groups number of the Conv2D Layer. According to grouped groups (int): The groups number of the Conv2D Layer. According to grouped
...@@ -488,7 +488,7 @@ def conv2d(x, ...@@ -488,7 +488,7 @@ def conv2d(x,
ValueError: If `data_format` is not "NCHW" or "NHWC". ValueError: If `data_format` is not "NCHW" or "NHWC".
ValueError: If the channel dimension of the input is less than or equal to zero. ValueError: If the channel dimension of the input is less than or equal to zero.
ValueError: If `padding` is a string, but not "SAME" or "VALID". ValueError: If `padding` is a string, but not "SAME" or "VALID".
ValueError: If `padding` is a tuple, but the element corresponding to the input's batch size is not 0 ValueError: If `padding` is a list/tuple, but the element corresponding to the input's batch size is not 0
or the element corresponding to the input's channel is not 0. or the element corresponding to the input's channel is not 0.
ShapeError: If the input is not 4-D Tensor. ShapeError: If the input is not 4-D Tensor.
ShapeError: If the input's dimension size and filter's dimension size not equal. ShapeError: If the input's dimension size and filter's dimension size not equal.
...@@ -637,7 +637,7 @@ def conv1d_transpose(x, ...@@ -637,7 +637,7 @@ def conv1d_transpose(x,
K is the size of the kernel. K is the size of the kernel.
bias(Tensor, optional): The bias, a Tensor with shape [M, ]. bias(Tensor, optional): The bias, a Tensor with shape [M, ].
stride(int|tuple|list, optional): The stride size. It means the stride in transposed convolution. stride(int|tuple|list, optional): The stride size. It means the stride in transposed convolution.
If stride is a tuple, it must contain one integer, `(stride_size)`. If stride is a list/tuple, it must contain one integer, `(stride_size)`.
Default: stride = 1. Default: stride = 1.
padding(int|list|str|tuple, optional): The padding size. The padding argument effectively adds padding(int|list|str|tuple, optional): The padding size. The padding argument effectively adds
`dilation * (kernel - 1)` amount of zero-padding on both sides of input. If `padding` is a `dilation * (kernel - 1)` amount of zero-padding on both sides of input. If `padding` is a
...@@ -645,7 +645,7 @@ def conv1d_transpose(x, ...@@ -645,7 +645,7 @@ def conv1d_transpose(x,
If `padding` is a tuple or list, it could be in two forms: If `padding` is a tuple or list, it could be in two forms:
`[pad]` or `[pad_left, pad_right]`. Default: padding = 0. `[pad]` or `[pad_left, pad_right]`. Default: padding = 0.
output_padding(int|list|tuple, optional): The count of zeros to be added to tail of each dimension. output_padding(int|list|tuple, optional): The count of zeros to be added to tail of each dimension.
If it is a tuple, it must contain one integer. Default: 0. If it is a list/tuple, it must contain one integer. Default: 0.
groups(int, optional): The groups number of the conv1d transpose function. Inspired by groups(int, optional): The groups number of the conv1d transpose function. Inspired by
grouped convolution in Alex Krizhevsky's Deep CNN paper, in which grouped convolution in Alex Krizhevsky's Deep CNN paper, in which
when group=2, the first half of the filters is only connected to the when group=2, the first half of the filters is only connected to the
...@@ -653,10 +653,10 @@ def conv1d_transpose(x, ...@@ -653,10 +653,10 @@ def conv1d_transpose(x,
filters is only connected to the second half of the input channels. filters is only connected to the second half of the input channels.
Default: groups = 1. Default: groups = 1.
dilation(int|tuple|list, optional): The dilation size. It means the spacing between the kernel points. dilation(int|tuple|list, optional): The dilation size. It means the spacing between the kernel points.
If dilation is a tuple, it must contain one integer, `(dilation_size)`. If dilation is a list/tuple, it must contain one integer, `(dilation_size)`.
Default: dilation = 1. Default: dilation = 1.
output_size(int|tuple|list, optional): The output image size. If output size is a output_size(int|tuple|list, optional): The output image size. If output size is a
tuple, it must contain one integer, `(feature_length)`. None if use tuple/list, it must contain one integer, `(feature_length)`. None if use
filter_size(shape of weight), padding, and stride to calculate output_size. filter_size(shape of weight), padding, and stride to calculate output_size.
data_format (str, optional): Specify the data format of the input, and the data format of the output data_format (str, optional): Specify the data format of the input, and the data format of the output
will be consistent with that of the input. An optional string from: `"NCL"`, `"NLC"`. will be consistent with that of the input. An optional string from: `"NCL"`, `"NLC"`.
...@@ -675,7 +675,7 @@ def conv1d_transpose(x, ...@@ -675,7 +675,7 @@ def conv1d_transpose(x,
Raises: Raises:
ValueError: If `data_format` is a string, but not "NCL" or "NLC". ValueError: If `data_format` is a string, but not "NCL" or "NLC".
ValueError: If `padding` is a string, but not "SAME" or "VALID". ValueError: If `padding` is a string, but not "SAME" or "VALID".
ValueError: If `padding` is a tuple, but the element corresponding to the input's batch size is not 0 ValueError: If `padding` is a list/tuple, but the element corresponding to the input's batch size is not 0
or the element corresponding to the input's channel is not 0. or the element corresponding to the input's channel is not 0.
ValueError: If `output_size` and filter_size are None at the same time. ValueError: If `output_size` and filter_size are None at the same time.
ValueError: If `output_padding` is greater than `stride`. ValueError: If `output_padding` is greater than `stride`.
...@@ -900,7 +900,7 @@ def conv2d_transpose(x, ...@@ -900,7 +900,7 @@ def conv2d_transpose(x,
kH is the height of the kernel, and kW is the width of the kernel. kH is the height of the kernel, and kW is the width of the kernel.
bias(Tensor, optional): The bias, a Tensor with shape [M, ]. bias(Tensor, optional): The bias, a Tensor with shape [M, ].
stride(int|list|tuple, optional): The stride size. It means the stride in transposed convolution. stride(int|list|tuple, optional): The stride size. It means the stride in transposed convolution.
If stride is a tuple, it must contain two integers, (stride_height, stride_width). If stride is a list/tuple, it must contain two integers, (stride_height, stride_width).
Otherwise, stride_height = stride_width = stride. Default: stride = 1. Otherwise, stride_height = stride_width = stride. Default: stride = 1.
padding(str|int|list|tuple, optional): The padding size. It means the number of zero-paddings padding(str|int|list|tuple, optional): The padding size. It means the number of zero-paddings
on both sides for each dimension. If `padding` is a string, either 'VALID' or on both sides for each dimension. If `padding` is a string, either 'VALID' or
...@@ -921,10 +921,10 @@ def conv2d_transpose(x, ...@@ -921,10 +921,10 @@ def conv2d_transpose(x,
filters is only connected to the second half of the input channels. filters is only connected to the second half of the input channels.
Default: groups = 1. Default: groups = 1.
dilation(int|list|tuple, optional): The dilation size. It means the spacing between the kernel points. dilation(int|list|tuple, optional): The dilation size. It means the spacing between the kernel points.
If dilation is a tuple, it must contain two integers, (dilation_height, dilation_width). If dilation is a list/tuple, it must contain two integers, (dilation_height, dilation_width).
Otherwise, dilation_height = dilation_width = dilation. Default: dilation = 1. Otherwise, dilation_height = dilation_width = dilation. Default: dilation = 1.
output_size(int|tuple|list, optional): The output image size. If output size is a output_size(int|tuple|list, optional): The output image size. If output size is a
tuple, it must contain two integers, (image_height, image_width). None if use tuple/list, it must contain two integers, (image_height, image_width). None if use
filter_size(shape of weight), padding, and stride to calculate output_size. filter_size(shape of weight), padding, and stride to calculate output_size.
data_format (str, optional): Specify the data format of the input, and the data format of the output data_format (str, optional): Specify the data format of the input, and the data format of the output
will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`. will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`.
...@@ -943,7 +943,7 @@ def conv2d_transpose(x, ...@@ -943,7 +943,7 @@ def conv2d_transpose(x,
Raises: Raises:
ValueError: If `data_format` is not "NCHW" or "NHWC". ValueError: If `data_format` is not "NCHW" or "NHWC".
ValueError: If `padding` is a string, but not "SAME" or "VALID". ValueError: If `padding` is a string, but not "SAME" or "VALID".
ValueError: If `padding` is a tuple, but the element corresponding to the input's batch size is not 0 ValueError: If `padding` is a list/tuple, but the element corresponding to the input's batch size is not 0
or the element corresponding to the input's channel is not 0. or the element corresponding to the input's channel is not 0.
ValueError: If `output_size` and kernel_size are None at the same time. ValueError: If `output_size` and kernel_size are None at the same time.
ShapeError: If the input is not 4-D Tensor. ShapeError: If the input is not 4-D Tensor.
...@@ -1120,8 +1120,8 @@ def conv3d(x, ...@@ -1120,8 +1120,8 @@ def conv3d(x,
where M is the number of filters(output channels), g is the number of groups, where M is the number of filters(output channels), g is the number of groups,
kD, kH, kW are the filter's depth, height and width respectively. kD, kH, kW are the filter's depth, height and width respectively.
bias (Tensor, optional): The bias, a Tensor of shape [M, ]. bias (Tensor, optional): The bias, a Tensor of shape [M, ].
stride (int|tuple): The stride size. It means the stride in convolution. If stride is a stride (int|list|tuple): The stride size. It means the stride in convolution. If stride is a
tuple, it must contain three integers, (stride_depth, stride_height, stride_width). list/tuple, it must contain three integers, (stride_depth, stride_height, stride_width).
Otherwise, stride_depth = stride_height = stride_width = stride. Default: stride = 1. Otherwise, stride_depth = stride_height = stride_width = stride. Default: stride = 1.
padding (string|int|list|tuple): The padding size. It means the number of zero-paddings padding (string|int|list|tuple): The padding size. It means the number of zero-paddings
on both sides for each dimension. If `padding` is a string, either 'VALID' or on both sides for each dimension. If `padding` is a string, either 'VALID' or
...@@ -1133,8 +1133,8 @@ def conv3d(x, ...@@ -1133,8 +1133,8 @@ def conv3d(x,
when `data_format` is `"NDHWC"`, `padding` can be in the form when `data_format` is `"NDHWC"`, `padding` can be in the form
`[[0,0], [pad_depth_front, pad_depth_back], [pad_height_top, pad_height_bottom], [pad_width_left, pad_width_right], [0,0]]`. `[[0,0], [pad_depth_front, pad_depth_back], [pad_height_top, pad_height_bottom], [pad_width_left, pad_width_right], [0,0]]`.
Default: padding = 0. Default: padding = 0.
dilation (int|tuple): The dilation size. It means the spacing between the kernel points. dilation (int|list|tuple): The dilation size. It means the spacing between the kernel points.
If dilation is a tuple, it must contain three integers, (dilation_depth, dilation_height, If dilation is a list/tuple, it must contain three integers, (dilation_depth, dilation_height,
dilation_width). Otherwise, dilation_depth = dilation_height = dilation_width = dilation. dilation_width). Otherwise, dilation_depth = dilation_height = dilation_width = dilation.
Default: dilation = 1. Default: dilation = 1.
groups (int): The groups number of the Conv3D Layer. According to grouped groups (int): The groups number of the Conv3D Layer. According to grouped
...@@ -1292,7 +1292,7 @@ def conv3d_transpose(x, ...@@ -1292,7 +1292,7 @@ def conv3d_transpose(x,
kD, kH, kW are the filter's depth, height and width respectively. kD, kH, kW are the filter's depth, height and width respectively.
bias (Tensor, optional): The bias, a Tensor of shape [M, ]. bias (Tensor, optional): The bias, a Tensor of shape [M, ].
stride(int|list|tuple, optional): The stride size. It means the stride in transposed convolution. stride(int|list|tuple, optional): The stride size. It means the stride in transposed convolution.
If stride is a tuple, it must contain three integers, (stride_depth, stride_height, If stride is a list/tuple, it must contain three integers, (stride_depth, stride_height,
stride_width). Otherwise, stride_depth = stride_height = stride_width = stride. stride_width). Otherwise, stride_depth = stride_height = stride_width = stride.
Default: stride = 1. Default: stride = 1.
padding (string|int|list|tuple, optional): The padding size. It means the number of zero-paddings padding (string|int|list|tuple, optional): The padding size. It means the number of zero-paddings
...@@ -1314,11 +1314,11 @@ def conv3d_transpose(x, ...@@ -1314,11 +1314,11 @@ def conv3d_transpose(x,
filters is only connected to the second half of the input channels. filters is only connected to the second half of the input channels.
Default: groups=1 Default: groups=1
dilation(int|list|tuple, optional): The dilation size. It means the spacing between the kernel points. dilation(int|list|tuple, optional): The dilation size. It means the spacing between the kernel points.
If dilation is a tuple, it must contain three integers, (dilation_depth, dilation_height, If dilation is a list/tuple, it must contain three integers, (dilation_depth, dilation_height,
dilation_width). Otherwise, dilation_depth = dilation_height = dilation_width = dilation. dilation_width). Otherwise, dilation_depth = dilation_height = dilation_width = dilation.
Default: dilation = 1. Default: dilation = 1.
output_size(int|list|tuple, optional): The output image size. If output size is a output_size(int|list|tuple, optional): The output image size. If output size is a
tuple, it must contain three integers, (image_depth, image_height, image_width). list/tuple, it must contain three integers, (image_depth, image_height, image_width).
None if use filter_size(shape of weight), padding, and stride to calculate output_size. None if use filter_size(shape of weight), padding, and stride to calculate output_size.
data_format (str, optional): Specify the data format of the input, and the data format of the output data_format (str, optional): Specify the data format of the input, and the data format of the output
will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`. will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`.
...@@ -1338,7 +1338,7 @@ def conv3d_transpose(x, ...@@ -1338,7 +1338,7 @@ def conv3d_transpose(x,
Raises: Raises:
ValueError: If `data_format` is not "NCDHW" or "NDHWC". ValueError: If `data_format` is not "NCDHW" or "NDHWC".
ValueError: If `padding` is a string, but not "SAME" or "VALID". ValueError: If `padding` is a string, but not "SAME" or "VALID".
ValueError: If `padding` is a tuple, but the element corresponding to the input's batch size is not 0 ValueError: If `padding` is a list/tuple, but the element corresponding to the input's batch size is not 0
or the element corresponding to the input's channel is not 0. or the element corresponding to the input's channel is not 0.
ValueError: If `output_size` and kernel_size are None at the same time. ValueError: If `output_size` and kernel_size are None at the same time.
ShapeError: If the input is not 5-D Tensor. ShapeError: If the input is not 5-D Tensor.
......
...@@ -300,7 +300,7 @@ class Upsample(layers.Layer): ...@@ -300,7 +300,7 @@ class Upsample(layers.Layer):
size (list|tuple|Tensor|None): Output shape of image resize size (list|tuple|Tensor|None): Output shape of image resize
layer, the shape is (out_w, ) when input is a 3-D Tensor, the shape is (out_h, out_w) layer, the shape is (out_w, ) when input is a 3-D Tensor, the shape is (out_h, out_w)
when input is a 4-D Tensor and is (out_d, out_h, out_w) when input is a 5-D Tensor. when input is a 4-D Tensor and is (out_d, out_h, out_w) when input is a 5-D Tensor.
Default: None. If a list, each element can be an integer or a Tensor of shape: [1]. Default: None. If a list/tuple, each element can be an integer or a Tensor of shape: [1].
If a Tensor , its dimensions size should be a 1. If a Tensor , its dimensions size should be a 1.
scale_factor (float|Tensor|list|tuple|None): The multiplier for the input height or width. At scale_factor (float|Tensor|list|tuple|None): The multiplier for the input height or width. At
least one of :attr:`size` or :attr:`scale_factor` must be set. least one of :attr:`size` or :attr:`scale_factor` must be set.
...@@ -419,7 +419,7 @@ class UpsamplingNearest2D(layers.Layer): ...@@ -419,7 +419,7 @@ class UpsamplingNearest2D(layers.Layer):
its data format is specified by :attr:`data_format`. its data format is specified by :attr:`data_format`.
size (list|tuple|Tensor|None): Output shape of image resize size (list|tuple|Tensor|None): Output shape of image resize
layer, the shape is (out_h, out_w) when input is a 4-D Tensor. layer, the shape is (out_h, out_w) when input is a 4-D Tensor.
Default: None. If a list, each element can be an integer or a Tensor of shape: [1]. Default: None. If a list/tuple, each element can be an integer or a Tensor of shape: [1].
If a Tensor , its dimensions size should be a 1. If a Tensor , its dimensions size should be a 1.
scale_factor (float|int|list|tuple|Tensor|None): The multiplier for the input height or width. At scale_factor (float|int|list|tuple|Tensor|None): The multiplier for the input height or width. At
least one of :attr:`size` or :attr:`scale_factor` must be set. least one of :attr:`size` or :attr:`scale_factor` must be set.
...@@ -506,7 +506,7 @@ class UpsamplingBilinear2D(layers.Layer): ...@@ -506,7 +506,7 @@ class UpsamplingBilinear2D(layers.Layer):
its data format is specified by :attr:`data_format`. its data format is specified by :attr:`data_format`.
size (list|tuple|Tensor|None): Output shape of image resize size (list|tuple|Tensor|None): Output shape of image resize
layer, the shape is (out_h, out_w) when input is a 4-D Tensor. layer, the shape is (out_h, out_w) when input is a 4-D Tensor.
Default: None. If a list, each element can be an integer or a Tensor of shape: [1]. Default: None. If a list/tuple, each element can be an integer or a Tensor of shape: [1].
If a Tensor , its dimensions size should be a 1. If a Tensor , its dimensions size should be a 1.
scale_factor (float|int|list|tuple|Tensor|None): The multiplier for the input height or width. At scale_factor (float|int|list|tuple|Tensor|None): The multiplier for the input height or width. At
least one of :attr:`size` or :attr:`scale_factor` must be set. least one of :attr:`size` or :attr:`scale_factor` must be set.
......
...@@ -232,16 +232,16 @@ class Conv1D(_ConvNd): ...@@ -232,16 +232,16 @@ class Conv1D(_ConvNd):
in_channels(int): The number of channels in the input image. in_channels(int): The number of channels in the input image.
out_channels(int): The number of filter. It is as same as the output out_channels(int): The number of filter. It is as same as the output
feature map. feature map.
kernel_size (int|tuple|list): The filter size. If kernel_size is a tuple, kernel_size (int|tuple|list): The filter size. If kernel_size is a tuple/list,
it must contain one integer, (kernel_size). it must contain one integer, (kernel_size).
stride (int|tuple|list, optional): The stride size. If stride is a tuple, it must stride (int|tuple|list, optional): The stride size. If stride is a tuple/list, it must
contain one integer, (stride_size). Default: 1. contain one integer, (stride_size). Default: 1.
padding(int|str|tuple|list, optional): The size of zeros to be padded. It must be in one of the following forms. padding(int|str|tuple|list, optional): The size of zeros to be padded. It must be in one of the following forms.
1. a string in ['valid', 'same']. 1. a string in ['valid', 'same'].
2. an int, which means the feature map is zero paded by size of `padding` on both sides. 2. an int, which means the feature map is zero paded by size of `padding` on both sides.
3. a list[int] or tuple[int] whose length is 1, which means the feature map is zero paded by size of `padding[0]` on both sides. 3. a list[int] or tuple[int] whose length is 1, which means the feature map is zero paded by size of `padding[0]` on both sides.
The default value is 0. The default value is 0.
dilation (int|tuple|list, optional): The dilation size. If dilation is a tuple, it must dilation (int|tuple|list, optional): The dilation size. If dilation is a tuple/list, it must
contain one integer, (dilation_size). Default: 1. contain one integer, (dilation_size). Default: 1.
groups (int, optional): The groups number of the conv2d Layer. According to grouped groups (int, optional): The groups number of the conv2d Layer. According to grouped
convolution in Alex Krizhevsky's Deep CNN paper: when group=2, convolution in Alex Krizhevsky's Deep CNN paper: when group=2,
...@@ -410,12 +410,12 @@ class Conv1DTranspose(_ConvNd): ...@@ -410,12 +410,12 @@ class Conv1DTranspose(_ConvNd):
in_channels(int): The number of channels in the input image. in_channels(int): The number of channels in the input image.
out_channels(int): The number of the filter. It is as same as the output out_channels(int): The number of the filter. It is as same as the output
feature map. feature map.
kernel_size(int|tuple|list, optional): The filter size. If kernel_size is a tuple, kernel_size(int|tuple|list, optional): The filter size. If kernel_size is a tuple/list,
it must contain one integers, (kernel_size). None if it must contain one integers, (kernel_size). None if
use output size to calculate kernel_size. Default: None. kernel_size and use output size to calculate kernel_size. Default: None. kernel_size and
output_size should not be None at the same time. output_size should not be None at the same time.
stride(int|tuple|list, optional): The stride size. It means the stride in transposed convolution. stride(int|tuple|list, optional): The stride size. It means the stride in transposed convolution.
If stride is a tuple, it must contain one integer, (stride_size). If stride is a tuple/list, it must contain one integer, (stride_size).
Default: stride = 1. Default: stride = 1.
padding(int|list|str|tuple, optional): The padding size. The padding argument effectively adds padding(int|list|str|tuple, optional): The padding size. The padding argument effectively adds
`dilation * (kernel - 1)` amount of zero-padding on both sides of input. If `padding` is a `dilation * (kernel - 1)` amount of zero-padding on both sides of input. If `padding` is a
...@@ -423,7 +423,7 @@ class Conv1DTranspose(_ConvNd): ...@@ -423,7 +423,7 @@ class Conv1DTranspose(_ConvNd):
If `padding` is a tuple or list, it could be in two forms: If `padding` is a tuple or list, it could be in two forms:
`[pad]` or `[pad_left, pad_right]`. Default: padding = 0. `[pad]` or `[pad_left, pad_right]`. Default: padding = 0.
output_padding(int|list|tuple, optional): The count of zeros to be added to tail of each dimension. output_padding(int|list|tuple, optional): The count of zeros to be added to tail of each dimension.
If it is a tuple, it must contain one integer. Default: 0. If it is a tuple/list, it must contain one integer. Default: 0.
groups(int, optional): The groups number of the Conv2D transpose layer. Inspired by groups(int, optional): The groups number of the Conv2D transpose layer. Inspired by
grouped convolution in Alex Krizhevsky's Deep CNN paper, in which grouped convolution in Alex Krizhevsky's Deep CNN paper, in which
when group=2, the first half of the filters is only connected to the when group=2, the first half of the filters is only connected to the
...@@ -432,7 +432,7 @@ class Conv1DTranspose(_ConvNd): ...@@ -432,7 +432,7 @@ class Conv1DTranspose(_ConvNd):
Default: groups = 1. Default: groups = 1.
bias(bool, optional): Whether to use bias. Default: True. bias(bool, optional): Whether to use bias. Default: True.
dilation(int|tuple|list, optional): The dilation size. It means the spacing between the kernel points. dilation(int|tuple|list, optional): The dilation size. It means the spacing between the kernel points.
If dilation is a tuple, it must contain one integer, (dilation_size). If dilation is a tuple/list, it must contain one integer, (dilation_size).
Default: dilation = 1. Default: dilation = 1.
weight_attr (ParamAttr, optional): The parameter attribute for learnable parameters/weights weight_attr (ParamAttr, optional): The parameter attribute for learnable parameters/weights
of conv1d_transpose. If it is set to None or one attribute of ParamAttr, conv1d_transpose of conv1d_transpose. If it is set to None or one attribute of ParamAttr, conv1d_transpose
...@@ -451,7 +451,7 @@ class Conv1DTranspose(_ConvNd): ...@@ -451,7 +451,7 @@ class Conv1DTranspose(_ConvNd):
Shape: Shape:
- x(Tensor): 3-D tensor with shape (batch, in_channels, length) when data_format is "NCL" or shape (batch, length, in_channels) when data_format is "NLC". - x(Tensor): 3-D tensor with shape (batch, in_channels, length) when data_format is "NCL" or shape (batch, length, in_channels) when data_format is "NLC".
- output_size(int|tuple|list, optional): The output image size. If output size is a tuple, it must contain one integer, (feature_length). None if use kernel_size, padding, output_padding and stride to calculate output_size. If output_size and kernel_size are specified at the same time, They should follow the formula above. Default: None. output_size and kernel_size should not be None at the same time. - output_size(int|tuple|list, optional): The output image size. If output size is a tuple/list, it must contain one integer, (feature_length). None if use kernel_size, padding, output_padding and stride to calculate output_size. If output_size and kernel_size are specified at the same time, They should follow the formula above. Default: None. output_size and kernel_size should not be None at the same time.
- output(Tensor): 3-D tensor with same shape as input x. - output(Tensor): 3-D tensor with same shape as input x.
Examples: Examples:
...@@ -555,7 +555,7 @@ class Conv2D(_ConvNd): ...@@ -555,7 +555,7 @@ class Conv2D(_ConvNd):
in_channels(int): The number of input channels in the input image. in_channels(int): The number of input channels in the input image.
out_channels(int): The number of output channels produced by the convolution. out_channels(int): The number of output channels produced by the convolution.
kernel_size(int|list|tuple, optional): The size of the convolving kernel. kernel_size(int|list|tuple, optional): The size of the convolving kernel.
stride(int|list|tuple, optional): The stride size. If stride is a tuple, it must stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain three integers, (stride_H, stride_W). Otherwise, the contain three integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride. The default value is 1. stride_H = stride_W = stride. The default value is 1.
padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms. padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms.
...@@ -565,7 +565,7 @@ class Conv2D(_ConvNd): ...@@ -565,7 +565,7 @@ class Conv2D(_ConvNd):
4. a list[int] or tuple[int] whose length is 2 * number of spartial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spartial dimensions. 4. a list[int] or tuple[int] whose length is 2 * number of spartial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spartial dimensions.
5. a list or tuple of pairs of ints. It has the form [[pad_before, pad_after], [pad_before, pad_after], ...]. Note that, the batch dimension and channel dimension are also included. Each pair of integers correspond to the amount of padding for a dimension of the input. Padding in batch dimension and channel dimension should be [0, 0] or (0, 0). 5. a list or tuple of pairs of ints. It has the form [[pad_before, pad_after], [pad_before, pad_after], ...]. Note that, the batch dimension and channel dimension are also included. Each pair of integers correspond to the amount of padding for a dimension of the input. Padding in batch dimension and channel dimension should be [0, 0] or (0, 0).
The default value is 0. The default value is 0.
dilation(int|list|tuple, optional): The dilation size. If dilation is a tuple, it must dilation(int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the
dilation_D = dilation_H = dilation_W = dilation. The default value is 1. dilation_D = dilation_H = dilation_W = dilation. The default value is 1.
groups(int, optional): The groups number of the Conv3D Layer. According to grouped groups(int, optional): The groups number of the Conv3D Layer. According to grouped
...@@ -710,10 +710,10 @@ class Conv2DTranspose(_ConvNd): ...@@ -710,10 +710,10 @@ class Conv2DTranspose(_ConvNd):
Parameters: Parameters:
in_channels(int): The number of channels in the input image. in_channels(int): The number of channels in the input image.
out_channels(int): The number of channels produced by the convolution. out_channels(int): The number of channels produced by the convolution.
kernel_size(int|list|tuple): The kernel size. If kernel_size is a tuple, kernel_size(int|list|tuple): The kernel size. If kernel_size is a list/tuple,
it must contain two integers, (kernel_size_H, kernel_size_W). it must contain two integers, (kernel_size_H, kernel_size_W).
Otherwise, the kernel will be a square. Otherwise, the kernel will be a square.
stride(int|list|tuple, optional): The stride size. If stride is a tuple, it must stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain two integers, (stride_H, stride_W). Otherwise, the contain two integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride. Default: 1. stride_H = stride_W = stride. Default: 1.
padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms. padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms.
...@@ -725,7 +725,7 @@ class Conv2DTranspose(_ConvNd): ...@@ -725,7 +725,7 @@ class Conv2DTranspose(_ConvNd):
The default value is 0. The default value is 0.
output_padding(int|list|tuple, optional): Additional size added to one side output_padding(int|list|tuple, optional): Additional size added to one side
of each dimension in the output shape. Default: 0. of each dimension in the output shape. Default: 0.
dilation(int|list|tuple, optional): The dilation size. If dilation is a tuple, it must dilation(int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
contain two integers, (dilation_H, dilation_W). Otherwise, the contain two integers, (dilation_H, dilation_W). Otherwise, the
dilation_H = dilation_W = dilation. Default: 1. dilation_H = dilation_W = dilation. Default: 1.
groups(int, optional): The groups number of the Conv2D transpose layer. Inspired by groups(int, optional): The groups number of the Conv2D transpose layer. Inspired by
...@@ -866,7 +866,7 @@ class Conv3D(_ConvNd): ...@@ -866,7 +866,7 @@ class Conv3D(_ConvNd):
in_channels(int): The number of input channels in the input image. in_channels(int): The number of input channels in the input image.
out_channels(int): The number of output channels produced by the convolution. out_channels(int): The number of output channels produced by the convolution.
kernel_size(int|list|tuple, optional): The size of the convolving kernel. kernel_size(int|list|tuple, optional): The size of the convolving kernel.
stride(int|list|tuple, optional): The stride size. If stride is a tuple, it must stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
stride_D = stride_H = stride_W = stride. The default value is 1. stride_D = stride_H = stride_W = stride. The default value is 1.
padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms. padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms.
...@@ -876,7 +876,7 @@ class Conv3D(_ConvNd): ...@@ -876,7 +876,7 @@ class Conv3D(_ConvNd):
4. a list[int] or tuple[int] whose length is 2 * number of spartial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spartial dimensions. 4. a list[int] or tuple[int] whose length is 2 * number of spartial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spartial dimensions.
5. a list or tuple of pairs of ints. It has the form [[pad_before, pad_after], [pad_before, pad_after], ...]. Note that, the batch dimension and channel dimension are also included. Each pair of integers correspond to the amount of padding for a dimension of the input. Padding in batch dimension and channel dimension should be [0, 0] or (0, 0). 5. a list or tuple of pairs of ints. It has the form [[pad_before, pad_after], [pad_before, pad_after], ...]. Note that, the batch dimension and channel dimension are also included. Each pair of integers correspond to the amount of padding for a dimension of the input. Padding in batch dimension and channel dimension should be [0, 0] or (0, 0).
The default value is 0. The default value is 0.
dilation(int|list|tuple, optional): The dilation size. If dilation is a tuple, it must dilation(int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the
dilation_D = dilation_H = dilation_W = dilation. The default value is 1. dilation_D = dilation_H = dilation_W = dilation. The default value is 1.
groups(int, optional): The groups number of the Conv3D Layer. According to grouped groups(int, optional): The groups number of the Conv3D Layer. According to grouped
...@@ -1037,11 +1037,11 @@ class Conv3DTranspose(_ConvNd): ...@@ -1037,11 +1037,11 @@ class Conv3DTranspose(_ConvNd):
Parameters: Parameters:
in_channels(int): The number of channels in the input image. in_channels(int): The number of channels in the input image.
out_channels(int): The number of channels produced by the convolution. out_channels(int): The number of channels produced by the convolution.
kernel_size(int|list|tuple): The kernel size. If kernel_size is a tuple, kernel_size(int|list|tuple): The kernel size. If kernel_size is a list/tuple,
it must contain three integers, (kernel_size_D, kernel_size_H, kernel_size_W). it must contain three integers, (kernel_size_D, kernel_size_H, kernel_size_W).
Otherwise, the kernel will be a square. Otherwise, the kernel will be a square.
stride(int|list|tuple, optional): The stride size. It means the stride in transposed convolution. stride(int|list|tuple, optional): The stride size. It means the stride in transposed convolution.
If stride is a tuple, it must contain three integers, (stride_depth, stride_height, If stride is a list/tuple, it must contain three integers, (stride_depth, stride_height,
stride_width). Otherwise, stride_depth = stride_height = stride_width = stride. stride_width). Otherwise, stride_depth = stride_height = stride_width = stride.
The default value is 1. The default value is 1.
padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms. padding(int|str|tuple|list, optional): The padding size. Padding coule be in one of the following forms.
...@@ -1053,7 +1053,7 @@ class Conv3DTranspose(_ConvNd): ...@@ -1053,7 +1053,7 @@ class Conv3DTranspose(_ConvNd):
The default value is 0. The default value is 0.
output_padding(int|list|tuple, optional): Additional size added to one side output_padding(int|list|tuple, optional): Additional size added to one side
of each dimension in the output shape. Default: 0. of each dimension in the output shape. Default: 0.
dilation(int|list|tuple, optional): The dilation size. If dilation is a tuple, it must dilation(int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the
dilation_D = dilation_H = dilation_W = dilation. The default value is 1. dilation_D = dilation_H = dilation_W = dilation. The default value is 1.
groups(int, optional): The groups number of the Conv3D transpose layer. Inspired by groups(int, optional): The groups number of the Conv3D transpose layer. Inspired by
...@@ -1071,11 +1071,6 @@ class Conv3DTranspose(_ConvNd): ...@@ -1071,11 +1071,6 @@ class Conv3DTranspose(_ConvNd):
If it is set to None or one attribute of ParamAttr, conv3d_transpose If it is set to None or one attribute of ParamAttr, conv3d_transpose
will create ParamAttr as bias_attr. If the Initializer of the bias_attr will create ParamAttr as bias_attr. If the Initializer of the bias_attr
is not set, the bias is initialized zero. The default value is None. is not set, the bias is initialized zero. The default value is None.
output_size(int|list|tuple, optional): The output image size. If output size is a
tuple, it must contain two integers, (image_H, image_W). None if use
filter_size, padding, and stride to calculate output_size.
if output_size and filter_size are specified at the same time, They
should follow the formula above. Default: None.
data_format(str, optional): Data format that specifies the layout of input. data_format(str, optional): Data format that specifies the layout of input.
It can be "NCDHW" or "NDHWC". Default: "NCDHW". It can be "NCDHW" or "NDHWC". Default: "NCDHW".
......
...@@ -447,7 +447,7 @@ class LSTMCell(RNNCellBase): ...@@ -447,7 +447,7 @@ class LSTMCell(RNNCellBase):
Inputs: Inputs:
- **inputs** (Tensor): shape `[batch_size, input_size]`, the input, corresponding to :math:`x_t` in the formula. - **inputs** (Tensor): shape `[batch_size, input_size]`, the input, corresponding to :math:`x_t` in the formula.
- **states** (tuple, optional): a tuple of two tensors, each of shape `[batch_size, hidden_size]`, the previous hidden state, corresponding to :math:`h_{t-1}, c_{t-1}` in the formula. When states is None, zero state is used. Defaults to None. - **states** (list|tuple, optional): a list/tuple of two tensors, each of shape `[batch_size, hidden_size]`, the previous hidden state, corresponding to :math:`h_{t-1}, c_{t-1}` in the formula. When states is None, zero state is used. Defaults to None.
Returns: Returns:
- **outputs** (Tensor): shape `[batch_size, hidden_size]`, the output, corresponding to :math:`h_{t}` in the formula. - **outputs** (Tensor): shape `[batch_size, hidden_size]`, the output, corresponding to :math:`h_{t}` in the formula.
...@@ -1251,7 +1251,7 @@ class LSTM(RNNBase): ...@@ -1251,7 +1251,7 @@ class LSTM(RNNBase):
Inputs: Inputs:
- **inputs** (Tensor): the input sequence. If `time_major` is True, the shape is `[time_steps, batch_size, input_size]`, else, the shape is `[batch_size, time_steps, hidden_size]`. - **inputs** (Tensor): the input sequence. If `time_major` is True, the shape is `[time_steps, batch_size, input_size]`, else, the shape is `[batch_size, time_steps, hidden_size]`.
- **initial_states** (tuple, optional): the initial state, a tuple of (h, c), the shape of each is `[num_layers * num_directions, batch_size, hidden_size]`. If initial_state is not given, zero initial states are used. - **initial_states** (list|tuple, optional): the initial state, a list/tuple of (h, c), the shape of each is `[num_layers * num_directions, batch_size, hidden_size]`. If initial_state is not given, zero initial states are used.
- **sequence_length** (Tensor, optional): shape `[batch_size]`, dtype: int64 or int32. The valid lengths of input sequences. Defaults to None. If `sequence_length` is not None, the inputs are treated as padded sequences. In each input sequence, elements whos time step index are not less than the valid length are treated as paddings. - **sequence_length** (Tensor, optional): shape `[batch_size]`, dtype: int64 or int32. The valid lengths of input sequences. Defaults to None. If `sequence_length` is not None, the inputs are treated as padded sequences. In each input sequence, elements whos time step index are not less than the valid length are treated as paddings.
Returns: Returns:
......
...@@ -461,14 +461,14 @@ class TransformerEncoderLayer(Layer): ...@@ -461,14 +461,14 @@ class TransformerEncoderLayer(Layer):
normalization and post-precess includes dropout, residual connection. normalization and post-precess includes dropout, residual connection.
Otherwise, no pre-process and post-precess includes dropout, residual Otherwise, no pre-process and post-precess includes dropout, residual
connection, layer normalization. Default False connection, layer normalization. Default False
weight_attr(ParamAttr|tuple, optional): To specify the weight parameter property. weight_attr(ParamAttr|list|tuple, optional): To specify the weight parameter property.
If it is a tuple, `weight_attr[0]` would be used as `weight_attr` for If it is a list/tuple, `weight_attr[0]` would be used as `weight_attr` for
MHA, and `weight_attr[1]` would be used as `weight_attr` for linear in FFN. MHA, and `weight_attr[1]` would be used as `weight_attr` for linear in FFN.
Otherwise, MHA and FFN both use it as `weight_attr` to create parameters. Otherwise, MHA and FFN both use it as `weight_attr` to create parameters.
Default: None, which means the default weight parameter property is used. Default: None, which means the default weight parameter property is used.
See usage for details in :code:`ParamAttr` . See usage for details in :code:`ParamAttr` .
bias_attr (ParamAttr|tuple|bool, optional): To specify the bias parameter property. bias_attr (ParamAttr|list|tuple|bool, optional): To specify the bias parameter property.
If it is a tuple, `bias_attr[0]` would be used as `bias_attr` for If it is a list/tuple, `bias_attr[0]` would be used as `bias_attr` for
MHA, and `bias_attr[1]` would be used as `bias_attr` for linear in FFN. MHA, and `bias_attr[1]` would be used as `bias_attr` for linear in FFN.
Otherwise, MHA and FFN both use it as `bias_attr` to create parameters. Otherwise, MHA and FFN both use it as `bias_attr` to create parameters.
The `False` value means the corresponding layer would not have trainable The `False` value means the corresponding layer would not have trainable
...@@ -747,16 +747,16 @@ class TransformerDecoderLayer(Layer): ...@@ -747,16 +747,16 @@ class TransformerDecoderLayer(Layer):
normalization and post-precess includes dropout, residual connection. normalization and post-precess includes dropout, residual connection.
Otherwise, no pre-process and post-precess includes dropout, residual Otherwise, no pre-process and post-precess includes dropout, residual
connection, layer normalization. Default False connection, layer normalization. Default False
weight_attr(ParamAttr|tuple, optional): To specify the weight parameter property. weight_attr(ParamAttr|list|tuple, optional): To specify the weight parameter property.
If it is a tuple, `weight_attr[0]` would be used as `weight_attr` for If it is a list/tuple, `weight_attr[0]` would be used as `weight_attr` for
self attention, `weight_attr[1]` would be used as `weight_attr` for self attention, `weight_attr[1]` would be used as `weight_attr` for
cross attention, and `weight_attr[2]` would be used as `weight_attr` cross attention, and `weight_attr[2]` would be used as `weight_attr`
for linear in FFN. Otherwise, the three sub-layers all uses it as for linear in FFN. Otherwise, the three sub-layers all uses it as
`weight_attr` to create parameters. Default: None, which means the `weight_attr` to create parameters. Default: None, which means the
default weight parameter property is used. See usage for details default weight parameter property is used. See usage for details
in :ref:`api_paddle_fluid_param_attr_ParamAttr` . in :ref:`api_paddle_fluid_param_attr_ParamAttr` .
bias_attr (ParamAttr|tuple|bool, optional): To specify the bias parameter property. bias_attr (ParamAttr|list|tuple|bool, optional): To specify the bias parameter property.
If it is a tuple, `bias_attr[0]` would be used as `bias_attr` for If it is a list/tuple, `bias_attr[0]` would be used as `bias_attr` for
self attention, `bias_attr[1]` would be used as `bias_attr` for self attention, `bias_attr[1]` would be used as `bias_attr` for
cross attention, and `bias_attr[2]` would be used as `bias_attr` cross attention, and `bias_attr[2]` would be used as `bias_attr`
for linear in FFN. Otherwise, the three sub-layers all uses it as for linear in FFN. Otherwise, the three sub-layers all uses it as
...@@ -1129,8 +1129,8 @@ class Transformer(Layer): ...@@ -1129,8 +1129,8 @@ class Transformer(Layer):
normalization and post-precess includes dropout, residual connection. normalization and post-precess includes dropout, residual connection.
Otherwise, no pre-process and post-precess includes dropout, residual Otherwise, no pre-process and post-precess includes dropout, residual
connection, layer normalization. Default False connection, layer normalization. Default False
weight_attr(ParamAttr|tuple, optional): To specify the weight parameter property. weight_attr(ParamAttr|list|tuple, optional): To specify the weight parameter property.
If it is a tuple, the length of `weight_attr` could be 1, 2 or 3. If it is 3, If it is a list/tuple, the length of `weight_attr` could be 1, 2 or 3. If it is 3,
`weight_attr[0]` would be used as `weight_attr` for self attention, `weight_attr[1]` `weight_attr[0]` would be used as `weight_attr` for self attention, `weight_attr[1]`
would be used as `weight_attr` for cross attention of `TransformerDecoder`, would be used as `weight_attr` for cross attention of `TransformerDecoder`,
and `weight_attr[2]` would be used as `weight_attr` for linear in FFN. and `weight_attr[2]` would be used as `weight_attr` for linear in FFN.
...@@ -1142,8 +1142,8 @@ class Transformer(Layer): ...@@ -1142,8 +1142,8 @@ class Transformer(Layer):
Default: None, which means the default weight parameter property is used. Default: None, which means the default weight parameter property is used.
See usage for details See usage for details
in :code:`ParamAttr` . in :code:`ParamAttr` .
bias_attr (ParamAttr|tuple|bool, optional): To specify the bias parameter property. bias_attr (ParamAttr|list|tuple|bool, optional): To specify the bias parameter property.
If it is a tuple, the length of `bias_attr` could be 1, 2 or 3. If it is 3, If it is a list/tuple, the length of `bias_attr` could be 1, 2 or 3. If it is 3,
`bias_attr[0]` would be used as `bias_attr` for self attention, `bias_attr[1]` `bias_attr[0]` would be used as `bias_attr` for self attention, `bias_attr[1]`
would be used as `bias_attr` for cross attention of `TransformerDecoder`, would be used as `bias_attr` for cross attention of `TransformerDecoder`,
and `bias_attr[2]` would be used as `bias_attr` for linear in FFN. and `bias_attr[2]` would be used as `bias_attr` for linear in FFN.
......
...@@ -36,20 +36,20 @@ class Adadelta(Optimizer): ...@@ -36,20 +36,20 @@ class Adadelta(Optimizer):
E(dx_t^2) &= \\rho * E(dx_{t-1}^2) + (1-\\rho) * (-g*learning\_rate)^2 E(dx_t^2) &= \\rho * E(dx_{t-1}^2) + (1-\\rho) * (-g*learning\_rate)^2
Args: Args:
learning_rate (float|Tensor|LearningRateDecay, optional): The learning rate used to update ``Parameter``. learning_rate (float|Tensor|LearningRateDecay, optional): The learning rate used to update ``Parameter``.
It can be a float value, a ``Tensor`` with a float type or a LearningRateDecay. The default value is 0.001. It can be a float value, a ``Tensor`` with a float type or a LearningRateDecay. The default value is 0.001.
epsilon (float): a small float number for numeric stability. Default 1.0e-6. epsilon (float): a small float number for numeric stability. Default 1.0e-6.
rho (float): a floating point value indicating the decay rate. Default 0.95. rho (float): a floating point value indicating the decay rate. Default 0.95.
parameters (list, optional): List of ``Tensor`` to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
It canbe a float value as coeff of L2 regularization or \ It canbe a float value as coeff of L2 regularization or \
:ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`. :ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`.
If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \ If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \
the regularization setting here in optimizer will be ignored for this parameter. \ the regularization setting here in optimizer will be ignored for this parameter. \
Otherwise, the regularization setting here in optimizer will take effect. \ Otherwise, the regularization setting here in optimizer will take effect. \
Default None, meaning there is no regularization. Default None, meaning there is no regularization.
grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of
some derived class of ``GradientClipBase`` . There are three cliping strategies some derived class of ``GradientClipBase`` . There are three cliping strategies
( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` , ( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` ,
......
...@@ -43,16 +43,16 @@ class Adagrad(Optimizer): ...@@ -43,16 +43,16 @@ class Adagrad(Optimizer):
It can be a float value or a ``Variable`` with a float type. It can be a float value or a ``Variable`` with a float type.
epsilon (float, optional): A small float value for numerical stability. epsilon (float, optional): A small float value for numerical stability.
The default value is 1e-06. The default value is 1e-06.
parameters (list, optional): List of ``Tensor`` to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
It canbe a float value as coeff of L2 regularization or \ It canbe a float value as coeff of L2 regularization or \
:ref:`api_paddle_regularizer_L1Decay`, :ref:`api_paddle_regularizer_L2Decay`. :ref:`api_paddle_regularizer_L1Decay`, :ref:`api_paddle_regularizer_L2Decay`.
If a parameter has set regularizer using :ref:`api_paddle_fluid_param_attr_aramAttr` already, \ If a parameter has set regularizer using :ref:`api_paddle_fluid_param_attr_aramAttr` already, \
the regularization setting here in optimizer will be ignored for this parameter. \ the regularization setting here in optimizer will be ignored for this parameter. \
Otherwise, the regularization setting here in optimizer will take effect. \ Otherwise, the regularization setting here in optimizer will take effect. \
Default None, meaning there is no regularization. Default None, meaning there is no regularization.
grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of
some derived class of ``GradientClipBase`` . There are three cliping strategies, some derived class of ``GradientClipBase`` . There are three cliping strategies,
ClipGradByGlobalNorm, ClipGradByNorm and ClipGradByValue. Default None, ClipGradByGlobalNorm, ClipGradByNorm and ClipGradByValue. Default None,
......
...@@ -60,16 +60,16 @@ class Adam(Optimizer): ...@@ -60,16 +60,16 @@ class Adam(Optimizer):
The default value is 0.999. The default value is 0.999.
epsilon (float, optional): A small float value for numerical stability. epsilon (float, optional): A small float value for numerical stability.
The default value is 1e-08. The default value is 1e-08.
parameters (list, optional): List of ``Tensor`` to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
It canbe a float value as coeff of L2 regularization or \ It canbe a float value as coeff of L2 regularization or \
:ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`. :ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`.
If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \ If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \
the regularization setting here in optimizer will be ignored for this parameter. \ the regularization setting here in optimizer will be ignored for this parameter. \
Otherwise, the regularization setting here in optimizer will take effect. \ Otherwise, the regularization setting here in optimizer will take effect. \
Default None, meaning there is no regularization. Default None, meaning there is no regularization.
grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of
some derived class of ``GradientClipBase`` . There are three cliping strategies some derived class of ``GradientClipBase`` . There are three cliping strategies
( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` , ( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` ,
......
...@@ -53,16 +53,16 @@ class Adamax(Optimizer): ...@@ -53,16 +53,16 @@ class Adamax(Optimizer):
The default value is 0.999. The default value is 0.999.
epsilon (float, optional): A small float value for numerical stability. epsilon (float, optional): A small float value for numerical stability.
The default value is 1e-08. The default value is 1e-08.
parameters (list, optional): List of ``Tensor`` to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
It canbe a float value as coeff of L2 regularization or \ It canbe a float value as coeff of L2 regularization or \
:ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`. :ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`.
If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \ If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \
the regularization setting here in optimizer will be ignored for this parameter. \ the regularization setting here in optimizer will be ignored for this parameter. \
Otherwise, the regularization setting here in optimizer will take effect. \ Otherwise, the regularization setting here in optimizer will take effect. \
Default None, meaning there is no regularization. Default None, meaning there is no regularization.
grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of
some derived class of ``GradientClipBase`` . There are three cliping strategies some derived class of ``GradientClipBase`` . There are three cliping strategies
( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` , ( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` ,
......
...@@ -43,9 +43,9 @@ class AdamW(Adam): ...@@ -43,9 +43,9 @@ class AdamW(Adam):
Args: Args:
learning_rate (float|LRScheduler, optional): The learning rate used to update ``Parameter``. learning_rate (float|LRScheduler, optional): The learning rate used to update ``Parameter``.
It can be a float value or a LRScheduler. The default value is 0.001. It can be a float value or a LRScheduler. The default value is 0.001.
parameters (list, optional): List of ``Tensor`` names to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` names to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
beta1 (float|Tensor, optional): The exponential decay rate for the 1st moment estimates. beta1 (float|Tensor, optional): The exponential decay rate for the 1st moment estimates.
It should be a float number or a Tensor with shape [1] and data type as float32. It should be a float number or a Tensor with shape [1] and data type as float32.
The default value is 0.9. The default value is 0.9.
......
...@@ -312,8 +312,8 @@ class PiecewiseDecay(LRScheduler): ...@@ -312,8 +312,8 @@ class PiecewiseDecay(LRScheduler):
learning_rate = 0.1 learning_rate = 0.1
Args: Args:
boundaries(list): A list of steps numbers. The type of element in the list is python int. boundaries(list|tuple): A list/tuple of steps numbers. The type of element in the list is python int.
values(list): A list of learning rate values that will be picked during different epoch boundaries. values(list|tuple): A list/tuple of learning rate values that will be picked during different epoch boundaries.
The type of element in the list is python float. The type of element in the list is python float.
last_epoch (int, optional): The index of last epoch. Can be set to restart training. Default: -1, means initial learning rate. last_epoch (int, optional): The index of last epoch. Can be set to restart training. Default: -1, means initial learning rate.
verbose (bool, optional): If ``True``, prints a message to stdout for each update. Default: ``False`` . verbose (bool, optional): If ``True``, prints a message to stdout for each update. Default: ``False`` .
......
...@@ -49,16 +49,16 @@ class Momentum(Optimizer): ...@@ -49,16 +49,16 @@ class Momentum(Optimizer):
learning_rate (float|Tensor|LearningRateDecay, optional): The learning rate used to update ``Parameter``. learning_rate (float|Tensor|LearningRateDecay, optional): The learning rate used to update ``Parameter``.
It can be a float value, a ``Tensor`` with a float type or a LearningRateDecay. The default value is 0.001. It can be a float value, a ``Tensor`` with a float type or a LearningRateDecay. The default value is 0.001.
momentum (float): Momentum factor. The default value is 0.9. momentum (float): Momentum factor. The default value is 0.9.
parameters (list, optional): List of ``Tensor`` to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
It canbe a float value as coeff of L2 regularization or \ It canbe a float value as coeff of L2 regularization or \
:ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`. :ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`.
If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \ If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \
the regularization setting here in optimizer will be ignored for this parameter. \ the regularization setting here in optimizer will be ignored for this parameter. \
Otherwise, the regularization setting here in optimizer will take effect. \ Otherwise, the regularization setting here in optimizer will take effect. \
Default None, meaning there is no regularization. Default None, meaning there is no regularization.
grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of
some derived class of ``GradientClipBase`` . There are three cliping strategies some derived class of ``GradientClipBase`` . There are three cliping strategies
( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` , ( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` ,
......
...@@ -53,7 +53,7 @@ class Optimizer(object): ...@@ -53,7 +53,7 @@ class Optimizer(object):
Args: Args:
learning_rate (float|LRScheduler): The learning rate used to update ``Parameter``. learning_rate (float|LRScheduler): The learning rate used to update ``Parameter``.
It can be a float value or any subclass of ``LRScheduler`` . It can be a float value or any subclass of ``LRScheduler`` .
parameters (list, optional): List of ``Tensor`` names to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` names to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
......
...@@ -78,16 +78,16 @@ class RMSProp(Optimizer): ...@@ -78,16 +78,16 @@ class RMSProp(Optimizer):
the gradient; if False, by the uncentered second moment. Setting this to the gradient; if False, by the uncentered second moment. Setting this to
True may help with training, but is slightly more expensive in terms of True may help with training, but is slightly more expensive in terms of
computation and memory. Defaults to False. computation and memory. Defaults to False.
parameters (list, optional): List of ``Tensor`` to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
It canbe a float value as coeff of L2 regularization or \ It canbe a float value as coeff of L2 regularization or \
:ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`. :ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`.
If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \ If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \
the regularization setting here in optimizer will be ignored for this parameter. \ the regularization setting here in optimizer will be ignored for this parameter. \
Otherwise, the regularization setting here in optimizer will take effect. \ Otherwise, the regularization setting here in optimizer will take effect. \
Default None, meaning there is no regularization. Default None, meaning there is no regularization.
grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of
some derived class of ``GradientClipBase`` . There are three cliping strategies some derived class of ``GradientClipBase`` . There are three cliping strategies
( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` , ( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` ,
......
...@@ -30,16 +30,16 @@ class SGD(Optimizer): ...@@ -30,16 +30,16 @@ class SGD(Optimizer):
Parameters: Parameters:
learning_rate (float|Tensor|LearningRateDecay, optional): The learning rate used to update ``Parameter``. learning_rate (float|Tensor|LearningRateDecay, optional): The learning rate used to update ``Parameter``.
It can be a float value, a ``Tensor`` with a float type or a LearningRateDecay. The default value is 0.001. It can be a float value, a ``Tensor`` with a float type or a LearningRateDecay. The default value is 0.001.
parameters (list, optional): List of ``Tensor`` to update to minimize ``loss``. \ parameters (list|tuple, optional): List/Tuple of ``Tensor`` to update to minimize ``loss``. \
This parameter is required in dygraph mode. \ This parameter is required in dygraph mode. \
The default value is None in static mode, at this time all parameters will be updated. The default value is None in static mode, at this time all parameters will be updated.
weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \ weight_decay (float|WeightDecayRegularizer, optional): The strategy of regularization. \
It canbe a float value as coeff of L2 regularization or \ It canbe a float value as coeff of L2 regularization or \
:ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`. :ref:`api_fluid_regularizer_L1Decay`, :ref:`api_fluid_regularizer_L2Decay`.
If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \ If a parameter has set regularizer using :ref:`api_fluid_ParamAttr` already, \
the regularization setting here in optimizer will be ignored for this parameter. \ the regularization setting here in optimizer will be ignored for this parameter. \
Otherwise, the regularization setting here in optimizer will take effect. \ Otherwise, the regularization setting here in optimizer will take effect. \
Default None, meaning there is no regularization. Default None, meaning there is no regularization.
grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of grad_clip (GradientClipBase, optional): Gradient cliping strategy, it's an instance of
some derived class of ``GradientClipBase`` . There are three cliping strategies some derived class of ``GradientClipBase`` . There are three cliping strategies
( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` , ( :ref:`api_fluid_clip_GradientClipByGlobalNorm` , :ref:`api_fluid_clip_GradientClipByNorm` ,
......
...@@ -86,7 +86,7 @@ def fc(x, ...@@ -86,7 +86,7 @@ def fc(x,
out.shape = (1, 2) out.shape = (1, 2)
Args: Args:
x (Tensor|list of Tensor): A tensor or a list of tensor. The number of dimensions x (Tensor|list[Tensor]|tuple[Tensor]): A tensor or a list/tuple of tensors. The number of dimensions
of each tensor is at least 2. The data type should be float16, float32 or float64. of each tensor is at least 2. The data type should be float16, float32 or float64.
size (int): The number of output units in this layer, which also means the feature size (int): The number of output units in this layer, which also means the feature
size of output tensor. size of output tensor.
...@@ -233,16 +233,16 @@ def deform_conv2d(x, ...@@ -233,16 +233,16 @@ def deform_conv2d(x,
deformable convolution v1. deformable convolution v1.
num_filters(int): The number of filter. It is as same as the output num_filters(int): The number of filter. It is as same as the output
image channel. image channel.
filter_size (int|tuple): The filter size. If filter_size is a tuple, filter_size (int|list|tuple): The filter size. If filter_size is a list/tuple,
it must contain two integers, (filter_size_H, filter_size_W). it must contain two integers, (filter_size_H, filter_size_W).
Otherwise, the filter will be a square. Otherwise, the filter will be a square.
stride (int|tuple, Optional): The stride size. If stride is a tuple, it must stride (int|list|tuple, Optional): The stride size. If stride is a list/tuple, it must
contain two integers, (stride_H, stride_W). Otherwise, the contain two integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride. Default: stride = 1. stride_H = stride_W = stride. Default: stride = 1.
padding (int|tuple, Optional): The padding size. If padding is a tuple, it must padding (int|list|tuple, Optional): The padding size. If padding is a list/tuple, it must
contain two integers, (padding_H, padding_W). Otherwise, the contain two integers, (padding_H, padding_W). Otherwise, the
padding_H = padding_W = padding. Default: padding = 0. padding_H = padding_W = padding. Default: padding = 0.
dilation (int|tuple, Optional): The dilation size. If dilation is a tuple, it must dilation (int|list|tuple, Optional): The dilation size. If dilation is a list/tuple, it must
contain two integers, (dilation_H, dilation_W). Otherwise, the contain two integers, (dilation_H, dilation_W). Otherwise, the
dilation_H = dilation_W = dilation. Default: dilation = 1. dilation_H = dilation_W = dilation. Default: dilation = 1.
groups (int, Optional): The groups number of the deformable conv layer. According to groups (int, Optional): The groups number of the deformable conv layer. According to
......
...@@ -132,7 +132,7 @@ def flip(x, axis, name=None): ...@@ -132,7 +132,7 @@ def flip(x, axis, name=None):
Args: Args:
x (Tensor): A Tensor(or LoDTensor) with shape :math:`[N_1, N_2,..., N_k]` . The data type of the input Tensor x x (Tensor): A Tensor(or LoDTensor) with shape :math:`[N_1, N_2,..., N_k]` . The data type of the input Tensor x
should be float32, float64, int32, int64, bool. should be float32, float64, int32, int64, bool.
axis (list): The axis(axes) to flip on. Negative indices for indexing from the end are accepted. axis (list|tuple): The axis(axes) to flip on. Negative indices for indexing from the end are accepted.
name (str, optional): The default value is None. Normally there is no need for user to set this property. name (str, optional): The default value is None. Normally there is no need for user to set this property.
For more information, please refer to :ref:`api_guide_Name` . For more information, please refer to :ref:`api_guide_Name` .
...@@ -545,7 +545,7 @@ def squeeze(x, axis=None, name=None): ...@@ -545,7 +545,7 @@ def squeeze(x, axis=None, name=None):
Args: Args:
x (Tensor): The input Tensor. Supported data type: float32, float64, bool, int8, int32, int64. x (Tensor): The input Tensor. Supported data type: float32, float64, bool, int8, int32, int64.
axis (int|list|tuple, optional): An integer or list of integers, indicating the dimensions to be squeezed. Default is None. axis (int|list|tuple, optional): An integer or list/tuple of integers, indicating the dimensions to be squeezed. Default is None.
The range of axis is :math:`[-ndim(x), ndim(x))`. The range of axis is :math:`[-ndim(x), ndim(x))`.
If axis is negative, :math:`axis = axis + ndim(x)`. If axis is negative, :math:`axis = axis + ndim(x)`.
If axis is None, all the dimensions of x of size 1 will be removed. If axis is None, all the dimensions of x of size 1 will be removed.
......
...@@ -752,7 +752,7 @@ def add_n(inputs, name=None): ...@@ -752,7 +752,7 @@ def add_n(inputs, name=None):
[14, 16, 18]] [14, 16, 18]]
Args: Args:
inputs (Tensor|list(Tensor)): A Tensor list. The shape and data type of the list elements should be consistent. inputs (Tensor|list[Tensor]|tuple[Tensor]): A Tensor or a list/tuple of Tensors. The shape and data type of the list/tuple elements should be consistent.
Input can be multi-dimensional Tensor, and data types can be: float32, float64, int32, int64. Input can be multi-dimensional Tensor, and data types can be: float32, float64, int32, int64.
name(str, optional): The default value is None. Normally there is no need for name(str, optional): The default value is None. Normally there is no need for
user to set this property. For more information, please refer to :ref:`api_guide_Name` user to set this property. For more information, please refer to :ref:`api_guide_Name`
...@@ -1082,7 +1082,7 @@ def max(x, axis=None, keepdim=False, name=None): ...@@ -1082,7 +1082,7 @@ def max(x, axis=None, keepdim=False, name=None):
Args: Args:
x(Tensor): A tensor, the data type is float32, x(Tensor): A tensor, the data type is float32,
float64, int32, int64. float64, int32, int64.
axis(list|int, optional): The axis along which the maximum is computed. axis(int|list|tuple, optional): The axis along which the maximum is computed.
If :attr:`None`, compute the maximum over all elements of If :attr:`None`, compute the maximum over all elements of
`x` and return a Tensor with a single element, `x` and return a Tensor with a single element,
otherwise must be in the range :math:`[-x.ndim(x), x.ndim(x))`. otherwise must be in the range :math:`[-x.ndim(x), x.ndim(x))`.
...@@ -1174,7 +1174,7 @@ def min(x, axis=None, keepdim=False, name=None): ...@@ -1174,7 +1174,7 @@ def min(x, axis=None, keepdim=False, name=None):
Args: Args:
x(Tensor): A tensor, the data type is float32, float64, int32, int64. x(Tensor): A tensor, the data type is float32, float64, int32, int64.
axis(list|int, optional): The axis along which the minimum is computed. axis(int|list|tuple, optional): The axis along which the minimum is computed.
If :attr:`None`, compute the minimum over all elements of If :attr:`None`, compute the minimum over all elements of
`x` and return a Tensor with a single element, `x` and return a Tensor with a single element,
otherwise must be in the range :math:`[-x.ndim, x.ndim)`. otherwise must be in the range :math:`[-x.ndim, x.ndim)`.
......
...@@ -454,13 +454,13 @@ def deform_conv2d(x, ...@@ -454,13 +454,13 @@ def deform_conv2d(x,
the number of output channels, g is the number of groups, kH is the filter's the number of output channels, g is the number of groups, kH is the filter's
height, kW is the filter's width. height, kW is the filter's width.
bias (Tensor, optional): The bias with shape [M,]. bias (Tensor, optional): The bias with shape [M,].
stride (int|list|tuple, optional): The stride size. If stride is a tuple, it must stride (int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain two integers, (stride_H, stride_W). Otherwise, the contain two integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride. Default: stride = 1. stride_H = stride_W = stride. Default: stride = 1.
padding (int|list|tuple, optional): The padding size. If padding is a tuple, it must padding (int|list|tuple, optional): The padding size. If padding is a list/tuple, it must
contain two integers, (padding_H, padding_W). Otherwise, the contain two integers, (padding_H, padding_W). Otherwise, the
padding_H = padding_W = padding. Default: padding = 0. padding_H = padding_W = padding. Default: padding = 0.
dilation (int|list|tuple, optional): The dilation size. If dilation is a tuple, it must dilation (int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
contain two integers, (dilation_H, dilation_W). Otherwise, the contain two integers, (dilation_H, dilation_W). Otherwise, the
dilation_H = dilation_W = dilation. Default: dilation = 1. dilation_H = dilation_W = dilation. Default: dilation = 1.
deformable_groups (int): The number of deformable group partitions. deformable_groups (int): The number of deformable group partitions.
...@@ -644,13 +644,13 @@ class DeformConv2D(Layer): ...@@ -644,13 +644,13 @@ class DeformConv2D(Layer):
in_channels(int): The number of input channels in the input image. in_channels(int): The number of input channels in the input image.
out_channels(int): The number of output channels produced by the convolution. out_channels(int): The number of output channels produced by the convolution.
kernel_size(int|list|tuple): The size of the convolving kernel. kernel_size(int|list|tuple): The size of the convolving kernel.
stride(int|list|tuple, optional): The stride size. If stride is a tuple, it must stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain three integers, (stride_H, stride_W). Otherwise, the contain three integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride. The default value is 1. stride_H = stride_W = stride. The default value is 1.
padding (int|list|tuple, optional): The padding size. If padding is a tuple, it must padding (int|list|tuple, optional): The padding size. If padding is a list/tuple, it must
contain two integers, (padding_H, padding_W). Otherwise, the contain two integers, (padding_H, padding_W). Otherwise, the
padding_H = padding_W = padding. Default: padding = 0. padding_H = padding_W = padding. Default: padding = 0.
dilation(int|list|tuple, optional): The dilation size. If dilation is a tuple, it must dilation(int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the contain three integers, (dilation_D, dilation_H, dilation_W). Otherwise, the
dilation_D = dilation_H = dilation_W = dilation. The default value is 1. dilation_D = dilation_H = dilation_W = dilation. The default value is 1.
deformable_groups (int): The number of deformable group partitions. deformable_groups (int): The number of deformable group partitions.
......
...@@ -153,8 +153,8 @@ def pad(img, padding, fill=0, padding_mode='constant'): ...@@ -153,8 +153,8 @@ def pad(img, padding, fill=0, padding_mode='constant'):
Args: Args:
img (PIL.Image|np.array): Image to be padded. img (PIL.Image|np.array): Image to be padded.
padding (int|list|tuple): Padding on each border. If a single int is provided this padding (int|list|tuple): Padding on each border. If a single int is provided this
is used to pad all borders. If tuple of length 2 is provided this is the padding is used to pad all borders. If list/tuple of length 2 is provided this is the padding
on left/right and top/bottom respectively. If a tuple of length 4 is provided on left/right and top/bottom respectively. If a list/tuple of length 4 is provided
this is the padding for the left, top, right and bottom borders this is the padding for the left, top, right and bottom borders
respectively. respectively.
fill (float, optional): Pixel fill value for constant fill. If a tuple of fill (float, optional): Pixel fill value for constant fill. If a tuple of
......
...@@ -136,8 +136,8 @@ def pad(img, padding, fill=0, padding_mode='constant'): ...@@ -136,8 +136,8 @@ def pad(img, padding, fill=0, padding_mode='constant'):
Args: Args:
img (np.array): Image to be padded. img (np.array): Image to be padded.
padding (int|list|tuple): Padding on each border. If a single int is provided this padding (int|list|tuple): Padding on each border. If a single int is provided this
is used to pad all borders. If tuple of length 2 is provided this is the padding is used to pad all borders. If list/tuple of length 2 is provided this is the padding
on left/right and top/bottom respectively. If a tuple of length 4 is provided on left/right and top/bottom respectively. If a list/tuple of length 4 is provided
this is the padding for the left, top, right and bottom borders this is the padding for the left, top, right and bottom borders
respectively. respectively.
fill (float, optional): Pixel fill value for constant fill. If a tuple of fill (float, optional): Pixel fill value for constant fill. If a tuple of
......
...@@ -141,8 +141,8 @@ def pad(img, padding, fill=0, padding_mode='constant'): ...@@ -141,8 +141,8 @@ def pad(img, padding, fill=0, padding_mode='constant'):
Args: Args:
img (PIL.Image): Image to be padded. img (PIL.Image): Image to be padded.
padding (int|list|tuple): Padding on each border. If a single int is provided this padding (int|list|tuple): Padding on each border. If a single int is provided this
is used to pad all borders. If tuple of length 2 is provided this is the padding is used to pad all borders. If list/tuple of length 2 is provided this is the padding
on left/right and top/bottom respectively. If a tuple of length 4 is provided on left/right and top/bottom respectively. If a list/tuple of length 4 is provided
this is the padding for the left, top, right and bottom borders this is the padding for the left, top, right and bottom borders
respectively. respectively.
fill (float, optional): Pixel fill value for constant fill. If a tuple of fill (float, optional): Pixel fill value for constant fill. If a tuple of
......
...@@ -86,7 +86,7 @@ class Compose(object): ...@@ -86,7 +86,7 @@ class Compose(object):
together for a dataset transform. together for a dataset transform.
Args: Args:
transforms (list): List of transforms to compose. transforms (list|tuple): List/Tuple of transforms to compose.
Returns: Returns:
A compose object which is callable, __call__ for this Compose A compose object which is callable, __call__ for this Compose
...@@ -608,8 +608,8 @@ class Normalize(BaseTransform): ...@@ -608,8 +608,8 @@ class Normalize(BaseTransform):
``output[channel] = (input[channel] - mean[channel]) / std[channel]`` ``output[channel] = (input[channel] - mean[channel]) / std[channel]``
Args: Args:
mean (int|float|list): Sequence of means for each channel. mean (int|float|list|tuple): Sequence of means for each channel.
std (int|float|list): Sequence of standard deviations for each channel. std (int|float|list|tuple): Sequence of standard deviations for each channel.
data_format (str, optional): Data format of img, should be 'HWC' or data_format (str, optional): Data format of img, should be 'HWC' or
'CHW'. Default: 'CHW'. 'CHW'. Default: 'CHW'.
to_rgb (bool, optional): Whether to convert to rgb. Default: False. to_rgb (bool, optional): Whether to convert to rgb. Default: False.
...@@ -1022,11 +1022,11 @@ class Pad(BaseTransform): ...@@ -1022,11 +1022,11 @@ class Pad(BaseTransform):
Args: Args:
padding (int|list|tuple): Padding on each border. If a single int is provided this padding (int|list|tuple): Padding on each border. If a single int is provided this
is used to pad all borders. If tuple of length 2 is provided this is the padding is used to pad all borders. If list/tuple of length 2 is provided this is the padding
on left/right and top/bottom respectively. If a tuple of length 4 is provided on left/right and top/bottom respectively. If a list/tuple of length 4 is provided
this is the padding for the left, top, right and bottom borders this is the padding for the left, top, right and bottom borders
respectively. respectively.
fill (int|list|tuple): Pixel fill value for constant fill. Default is 0. If a tuple of fill (int|list|tuple): Pixel fill value for constant fill. Default is 0. If a list/tuple of
length 3, it is used to fill R, G, B channels respectively. length 3, it is used to fill R, G, B channels respectively.
This value is only used when the padding_mode is constant This value is only used when the padding_mode is constant
padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric. Default is constant. padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric. Default is constant.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册