Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minimun minimum #60920

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/paddle/sparse/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def sparse_coo_tensor(
shape = list(shape)
if shape < min_shape:
raise ValueError(
f"the minimun shape required is {min_shape}, but get {shape}"
f"the minimum shape required is {min_shape}, but get {shape}"
)
if len(shape) != sparse_dim + dense_dim:
raise ValueError(
Expand Down Expand Up @@ -188,7 +188,7 @@ def sparse_csr_tensor(
r"""
Constructs a sparse ``paddle.Tensor`` in CSR(Compressed Sparse Row) format according to the
``crows``, ``cols`` and ``values``.
Currently, the crows and cols of each batch must be incrementd.
Currently, the crows and cols of each batch must be incremented.

Args:
crows(list|tuple|ndarray|Tensor): 1-D array, each element in the rows represents the
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/sparse/nn/layer/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Softmax(Layer):
Only support axis=-1 for SparseCsrTensor, which is faster when read data
by row (axis=-1).

Transform x to dense matix, and :math:`i` is row index, :math:`j` is column index.
Transform x to dense matrix, and :math:`i` is row index, :math:`j` is column index.
If axis=-1, We have:

.. math::
Expand Down
40 changes: 20 additions & 20 deletions python/paddle/sparse/nn/layer/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def extra_repr(self):

class Conv3D(_Conv3D):
r"""
**Sparse Convlution3d Layer**
**Sparse Convolution3d Layer**
The Sparse convolution3d layer calculates the output based on the input, filter
and strides, paddings, dilations, groups parameters. Input(Input) and
Output(Output) are multidimensional SparseCooTensors with a shape of
Expand Down Expand Up @@ -267,11 +267,11 @@ class Conv3D(_Conv3D):
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
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 couple be in one of the following forms.
1. a string in ['valid', 'same'].
2. an int, which means each spartial dimension(depth, height, width) is zero paded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spartial dimensions, which contains the amount of padding on each side for each spartial dimension. It has the form [pad_d1, pad_d2, ...].
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.
2. an int, which means each spatial dimension(depth, height, width) is zero padded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spatial dimensions, which contains the amount of padding on each side for each spatial dimension. It has the form [pad_d1, pad_d2, ...].
4. a list[int] or tuple[int] whose length is 2 * number of spatial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spatial 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).
The default value is 0.
dilation(int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
Expand Down Expand Up @@ -373,7 +373,7 @@ def __init__(

class Conv2D(_Conv2D):
r"""
**Sparse Convlution2d Layer**
**Sparse Convolution2d Layer**

The Sparse convolution2d layer calculates the output based on the input, filter
and strides, paddings, dilations, groups parameters. Input(Input) and
Expand Down Expand Up @@ -403,12 +403,12 @@ class Conv2D(_Conv2D):
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
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 couple be in one of the following forms.

1. a string in ['valid', 'same'].
2. an int, which means each spartial dimension(height, width) is zero paded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spartial dimensions, which contains the amount of padding on each side for each spartial dimension. It has the form [pad_d1, pad_d2, ...].
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.
2. an int, which means each spatial dimension(height, width) is zero padded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spatial dimensions, which contains the amount of padding on each side for each spatial dimension. It has the form [pad_d1, pad_d2, ...].
4. a list[int] or tuple[int] whose length is 2 * number of spatial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spatial 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).
Expand Down Expand Up @@ -508,7 +508,7 @@ def __init__(

class SubmConv3D(_Conv3D):
r"""
**Submanifold Sparse Convlution3d Layer**
**Submanifold Sparse Convolution3d Layer**
The submanifold sparse convolution3d layer calculates the output based on the input, filter
and strides, paddings, dilations, groups parameters. Input(Input) and
Output(Output) are multidimensional SparseCooTensors with a shape of
Expand Down Expand Up @@ -537,11 +537,11 @@ class SubmConv3D(_Conv3D):
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
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 couple be in one of the following forms.
1. a string in ['valid', 'same'].
2. an int, which means each spartial dimension(depth, height, width) is zero paded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spartial dimensions, which contains the amount of padding on each side for each spartial dimension. It has the form [pad_d1, pad_d2, ...].
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.
2. an int, which means each spatial dimension(depth, height, width) is zero padded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spatial dimensions, which contains the amount of padding on each side for each spatial dimension. It has the form [pad_d1, pad_d2, ...].
4. a list[int] or tuple[int] whose length is 2 * number of spatial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spatial 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).
The default value is 0.
dilation(int|list|tuple, optional): The dilation size. If dilation is a list/tuple, it must
Expand Down Expand Up @@ -648,7 +648,7 @@ def __init__(

class SubmConv2D(_Conv2D):
r"""
**Submanifold Sparse Convlution2d Layer**
**Submanifold Sparse Convolution2d Layer**

The submanifold sparse convolution2d layer calculates the output based on the input, filter
and strides, paddings, dilations, groups parameters. Input(Input) and
Expand Down Expand Up @@ -678,12 +678,12 @@ class SubmConv2D(_Conv2D):
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
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 couple be in one of the following forms.

1. a string in ['valid', 'same'].
2. an int, which means each spartial dimension(depth, height, width) is zero paded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spartial dimensions, which contains the amount of padding on each side for each spartial dimension. It has the form [pad_d1, pad_d2, ...].
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.
2. an int, which means each spatial dimension(depth, height, width) is zero padded by size of `padding`
3. a list[int] or tuple[int] whose length is the number of spatial dimensions, which contains the amount of padding on each side for each spatial dimension. It has the form [pad_d1, pad_d2, ...].
4. a list[int] or tuple[int] whose length is 2 * number of spatial dimensions. It has the form [pad_before, pad_after, pad_before, pad_after, ...] for all spatial 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).
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/sparse/nn/layer/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class SyncBatchNorm(paddle.nn.SyncBatchNorm):
epsilon(float, optional): The small value added to the variance to prevent division by zero. Default: 1e-5.
momentum(float, optional): The value used for the moving_mean and moving_var computation. Default: 0.9.
weight_attr(ParamAttr|bool, optional): The parameter attribute for Parameter `scale`
of this layer. If it is set to None or one attribute of ParamAttr, this layerr
of this layer. If it is set to None or one attribute of ParamAttr, this layer
will create ParamAttr as param_attr. If the Initializer of the param_attr
is not set, the parameter is initialized with Xavier. If it is set to False,
this layer will not have trainable scale parameter. Default: None.
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/sparse/unary.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ def slice(x, axes, starts, ends, name=None):
``starts`` or ``ends`` such as :math:`-i`, it represents the reverse position of
the axis :math:`i-1` (here 0 is the initial position).
If the value passed to ``starts`` or ``ends`` is greater than the number of elements
in the dimenstion (n), it represents n.
in the dimension (n), it represents n.
For slicing to the end of a dimension with unknown size, it is recommended to pass
in INT_MAX. The size of ``axes`` must be equal to ``starts`` and ``ends``.

Expand Down Expand Up @@ -1039,7 +1039,7 @@ def pca_lowrank(x, q=None, center=True, niter=2, name=None):

Args:
x (Tensor): The input tensor. Its shape should be `[N, M]`,
N and M can be arbitraty positive number.
N and M can be arbitrary positive number.
The data type of x should be float32 or float64.
q (int, optional): a slightly overestimated rank of :math:`X`.
Default value is :math:`q=min(6,N,M)`.
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/static/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class InputSpec:
def __init__(self, shape, dtype='float32', name=None, stop_gradient=False):
# replace `None` in shape with -1
self.shape = self._verify(shape)
# convert dtype into united represention
# convert dtype into united representation
if dtype is not None:
if isinstance(dtype, (np.dtype, str)):
dtype = convert_np_dtype_to_dtype_(dtype)
Expand Down
26 changes: 13 additions & 13 deletions python/paddle/static/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def normalize_program(program, feed_vars, fetch_vars, **kwargs):
feed_vars(Tensor | list[Tensor]): Variables needed by inference.
fetch_vars(Tensor | list[Tensor]): Variables returned by inference.
kwargs: Supported keys including ``skip_prune_program``.
- skip_prune_program(bool): whether to skip prunning program. Defaults to False.
- skip_prune_program(bool): whether to skip pruning program. Defaults to False.

Returns:
Program: Normalized/Optimized program.
Expand All @@ -211,7 +211,7 @@ def normalize_program(program, feed_vars, fetch_vars, **kwargs):

>>> path_prefix = "./infer_model"

# User defined network, here a softmax regession example
# User defined network, here a softmax regression example
>>> image = paddle.static.data(name='img', shape=[None, 28, 28], dtype='float32')
>>> label = paddle.static.data(name='label', shape=[None, 1], dtype='int64')
>>> predict = paddle.static.nn.fc(image, 10, activation='softmax')
Expand Down Expand Up @@ -283,10 +283,10 @@ def normalize_program(program, feed_vars, fetch_vars, **kwargs):
# remove backward block
copy_program.blocks.pop(backward_block_id)
# update attrs ``blocks``
reserverd_blocks = []
reserved_blocks = []
for block_id in sub_blocks_ids[:-1]:
reserverd_blocks.append(copy_program.block(block_id))
op._update_desc_attr("blocks", reserverd_blocks)
reserved_blocks.append(copy_program.block(block_id))
op._update_desc_attr("blocks", reserved_blocks)

for idx in remove_op_idx[::-1]:
global_block._remove_op(idx)
Expand Down Expand Up @@ -332,7 +332,7 @@ def serialize_program(feed_vars, fetch_vars, **kwargs):

>>> path_prefix = "./infer_model"

# User defined network, here a softmax regession example
# User defined network, here a softmax regression example
>>> image = paddle.static.data(name='img', shape=[None, 28, 28], dtype='float32')
>>> label = paddle.static.data(name='label', shape=[None, 1], dtype='int64')
>>> predict = paddle.static.nn.fc(image, 10, activation='softmax')
Expand Down Expand Up @@ -391,7 +391,7 @@ def serialize_persistables(feed_vars, fetch_vars, executor, **kwargs):

>>> path_prefix = "./infer_model"

# User defined network, here a softmax regession example
# User defined network, here a softmax regression example
>>> image = paddle.static.data(name='img', shape=[None, 28, 28], dtype='float32')
>>> label = paddle.static.data(name='label', shape=[None, 1], dtype='int64')
>>> predict = paddle.static.nn.fc(image, 10, activation='softmax')
Expand Down Expand Up @@ -431,7 +431,7 @@ def _serialize_persistables(program, executor):
"variables in your model to save"
)
return None
# create a new program and clone persitable vars to it
# create a new program and clone persistable vars to it
save_program = Program()
save_block = save_program.global_block()
save_var_map = {}
Expand Down Expand Up @@ -543,7 +543,7 @@ def save_inference_model(

>>> path_prefix = "./infer_model"

# User defined network, here a softmax regession example
# User defined network, here a softmax regression example
>>> image = paddle.static.data(name='img', shape=[None, 28, 28], dtype='float32')
>>> label = paddle.static.data(name='label', shape=[None, 1], dtype='int64')
>>> predict = paddle.static.nn.fc(image, 10, activation='softmax')
Expand Down Expand Up @@ -644,7 +644,7 @@ def deserialize_program(data):

>>> path_prefix = "./infer_model"

# User defined network, here a softmax regession example
# User defined network, here a softmax regression example
>>> image = paddle.static.data(name='img', shape=[None, 28, 28], dtype='float32')
>>> label = paddle.static.data(name='label', shape=[None, 1], dtype='int64')
>>> predict = paddle.static.nn.fc(image, 10, activation='softmax')
Expand Down Expand Up @@ -693,7 +693,7 @@ def deserialize_persistables(program, data, executor):

>>> path_prefix = "./infer_model"

# User defined network, here a softmax regession example
# User defined network, here a softmax regression example
>>> image = paddle.static.data(name='img', shape=[None, 28, 28], dtype='float32')
>>> label = paddle.static.data(name='label', shape=[None, 1], dtype='int64')
>>> predict = paddle.static.nn.fc(image, 10, activation='softmax')
Expand Down Expand Up @@ -1620,7 +1620,7 @@ def load(program, model_path, executor=None, var_list=None):
program_var_list = program.list_vars()
program_var_name_set = {var.name for var in program_var_list}

# check all the variable inlcuded in program
# check all the variable included in program
for var in var_list:
if var.name not in program_var_name_set:
raise LookupError(
Expand Down Expand Up @@ -1804,7 +1804,7 @@ def set_program_state(program, state_dict):
unused_para_list.append(k)
if len(unused_para_list) > 0:
warnings.warn(
"This list is not set, Because of Paramerter not found in program. There are: {}".format(
"This list is not set, Because of Parameter not found in program. There are: {}".format(
" ".join(unused_para_list)
)
)
Expand Down
Loading