forked from mindspore-Ecosystem/mindspore
commit
67f7d1b460
|
@ -27,7 +27,7 @@ mindspore.nn.AvgPool2d
|
|||
- **data_format** (str) - 输入数据格式可为'NHWC'或'NCHW'。默认值:'NCHW'。
|
||||
|
||||
输入:
|
||||
- **x** (Tensor) - 输入数据的shape为 :math:`(N,C_{in},H_{in},W_{in})` 或 :math:`C_{in},H_{in},W_{in})` 的Tensor。
|
||||
- **x** (Tensor) - 输入数据的shape为 :math:`(N,C_{in},H_{in},W_{in})` 或 :math:`(C_{in},H_{in},W_{in})` 的Tensor。
|
||||
|
||||
输出:
|
||||
输出数据的shape为 :math:`(N,C_{out},H_{out},W_{out})` 或 :math:`(C_{out},H_{out},W_{out})` 的Tensor。
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
- **valid** - 在不填充的前提下返回有效计算所得的输出。不满足计算的多余像素会被丢弃。
|
||||
- **pad** - 对输入进行填充。在输入的深度、高度和宽度方向上填充 `pad` 大小的0。如果设置此模式, `pad` 必须大于或等于0。
|
||||
|
||||
- **pad** (Union(int, tuple[int])) - 池化填充方式。默认值:0。如果 `pad` 是一个整数,则头部、尾部、顶部、底部、左边和右边的填充都是相同的,等于 `pad` 。如果 `pad` 是六个integer的tuple,则头部、尾部、顶部、底部、左边和右边的填充分别等于填充pad[0]、pad[1]、pad[2]、pad[3]、pad[4]和pad[5]。
|
||||
- **pad** (Union(int, tuple[int], list[int])) - 池化填充方式。默认值:0。如果 `pad` 是一个整数,则头部、尾部、顶部、底部、左边和右边的填充都是相同的,等于 `pad` 。如果 `pad` 是六个integer的tuple,则头部、尾部、顶部、底部、左边和右边的填充分别等于填充pad[0]、pad[1]、pad[2]、pad[3]、pad[4]和pad[5]。
|
||||
- **ceil_mode** (bool) - 是否使用ceil函数计算输出高度和宽度。默认值:False。
|
||||
- **count_include_pad** (bool) - 如果为True,平均计算将包括零填充。默认值:True。
|
||||
- **divisor_override** (int) - 如果指定了该值,它将在平均计算中用作除数,否则将使用kernel_size作为除数。默认值:0。
|
||||
|
|
|
@ -10,8 +10,8 @@ mindspore.ops.ctc_loss
|
|||
参数:
|
||||
- **log_probs** (Tensor) - 输入Tensor,shape :math:`(T, N, C)` 。其中T表示输入长度,N表示批次大小,C是分类数,包含空白。
|
||||
- **targets** (Tensor) - 目标Tensor,shape :math:`(N, S)` 。其中S表示最大目标长度。
|
||||
- **input_lengths** (Union[tuple, Tensor]) - shape为N的Tensor或tuple。表示输入长度。
|
||||
- **target_lengths** (Union[tuple, Tensor]) - shape为N的Tensor或tuple。表示目标长度。
|
||||
- **input_lengths** (Union(tuple, Tensor)) - shape为N的Tensor或tuple。表示输入长度。
|
||||
- **target_lengths** (Union(tuple, Tensor)) - shape为N的Tensor或tuple。表示目标长度。
|
||||
- **blank** (int) - 空白标签。默认值:0。
|
||||
- **reduction** (str) - 对输出应用归约方法。可选值为"none"、"mean"或"sum"。默认值:"mean"。
|
||||
- **zero_infinity** (bool) - 是否设置无限损失和相关梯度为零。默认值:False。
|
||||
|
|
|
@ -5,14 +5,14 @@ mindspore.ops.lstsq
|
|||
|
||||
计算满秩矩阵 `x` :math:`(m \times n)` 与满秩矩阵 `a` :math:`(m \times k)` 的最小二乘问题或最小范数问题的解。
|
||||
|
||||
若 :math:`m \geq n` , `Lstsq` 解决最小二乘问题:
|
||||
若 :math:`m \geq n` , `lstsq` 解决最小二乘问题:
|
||||
|
||||
.. math::
|
||||
\begin{array}{ll}
|
||||
\min_y & \|xy-a\|_2.
|
||||
\end{array}
|
||||
|
||||
若 :math:`m < n` , `Lstsq` 解决最小范数问题:
|
||||
若 :math:`m < n` , `lstsq` 解决最小范数问题:
|
||||
|
||||
.. math::
|
||||
\begin{array}{llll}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mindspore_lite.Converter
|
||||
========================
|
||||
|
||||
.. py:class:: mindspore_lite.Converter(fmk_type, model_file, output_file, weight_file="", config_file="", weight_fp16=False, input_shape=None, input_format=Format.NHWC, input_data_type=DataType.FLOAT32, output_data_type=DataType.FLOAT32, save_type=ModelType.MINDIR_LITE, decrypt_key="", decrypt_mode="AES-GCM", enable_encryption=False, encrypt_key="", infer=False, train_model=False, optimize="general", device="")
|
||||
.. py:class:: mindspore_lite.Converter(fmk_type, model_file, output_file, weight_file="", config_file="", weight_fp16=False, input_shape=None, input_format=Format.NHWC, input_data_type=DataType.FLOAT32, output_data_type=DataType.FLOAT32, save_type=None, decrypt_key="", decrypt_mode="AES-GCM", enable_encryption=False, encrypt_key="", infer=False, train_model=False, optimize="general", device="")
|
||||
|
||||
构造 `Converter` 的类。使用场景是:1. 将第三方模型转换生成MindSpore模型或MindSpore Lite模型;2. 将MindSpore模型转换生成MindSpore Lite模型。
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ mindspore_lite.ModelType
|
|||
|
||||
适用于以下场景:
|
||||
|
||||
1. 调用 `mindspore_lite.Converter`时,设置 `save_type` 参数, `ModelType` 用于定义转换生成的模型类型。
|
||||
1. 调用 `mindspore_lite.Converter` 时,设置 `save_type` 参数, `ModelType` 用于定义转换生成的模型类型。
|
||||
|
||||
2. 调用 `mindspore_lite.Converter`之后,当从文件加载或构建模型以进行推理时, `ModelType` 用于定义输入模型框架类型。
|
||||
2. 调用 `mindspore_lite.Converter` 之后,当从文件加载或构建模型以进行推理时, `ModelType` 用于定义输入模型框架类型。
|
||||
|
||||
目前,支持以下 `ModelType` :
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ class ModelType(Enum):
|
|||
|
||||
Used in the following scenarios:
|
||||
|
||||
1. When using 'mindspore_lite.Converter', set `save_type` parameter, `ModelType` used to define the model type
|
||||
1. When using `mindspore_lite.Converter`, set `save_type` parameter, `ModelType` used to define the model type
|
||||
generated by Converter.
|
||||
|
||||
2. After using 'mindspore_lite.Converter', when loading or building a model from file for predicting, the
|
||||
2. After using `mindspore_lite.Converter`, when loading or building a model from file for predicting, the
|
||||
`ModelType` is used to define Input model framework type.
|
||||
|
||||
Currently, the following `ModelType` are supported:
|
||||
|
|
|
@ -1100,10 +1100,10 @@ class Multi30kDataset(SourceDataset, TextBaseDataset):
|
|||
A source dataset that reads and parses Multi30k dataset.
|
||||
|
||||
The generated dataset has two columns :py:obj:`[text, translation]` .
|
||||
The tensor of column :py:obj:'text' is of the string type.
|
||||
The tensor of column :py:obj:'translation' is of the string type.
|
||||
The tensor of column :py:obj:`text` is of the string type.
|
||||
The tensor of column :py:obj:`translation` is of the string type.
|
||||
|
||||
Args:
|
||||
Args:
|
||||
dataset_dir (str): Path to the root directory that contains the dataset.
|
||||
usage (str, optional): Acceptable usages include 'train', 'test, 'valid' or 'all'. Default: 'all'.
|
||||
language_pair (str, optional): Acceptable language_pair include ['en', 'de'], ['de', 'en'].
|
||||
|
@ -1384,12 +1384,12 @@ class SQuADDataset(SourceDataset, TextBaseDataset):
|
|||
A source dataset that reads and parses SQuAD 1.1 and SQuAD 2.0 datasets.
|
||||
|
||||
The generated dataset with different versions and usages has the same output columns:
|
||||
:py:obj:`[context, question, text, answer_start]` .
|
||||
:py:obj:`[context, question, text, answer_start]` .
|
||||
The tensor of column :py:obj:`context` is of the string type.
|
||||
The tensor of column :py:obj:`question` is of the string type.
|
||||
The tensor of column :py:obj:`text` is the answer in the context of the string type.
|
||||
The tensor of column :py:obj:`answer_start` is the start index of answer in context,
|
||||
which is of the uint32 type.
|
||||
which is of the uint32 type.
|
||||
|
||||
Args:
|
||||
dataset_dir (str): Path to the root directory that contains the dataset.
|
||||
|
|
|
@ -653,7 +653,7 @@ class AvgPool2d(_PoolNd):
|
|||
- pad: pads the input. Pads the top, bottom, left, and right sides of the input with `padding` number of
|
||||
zeros. If this mode is set, `padding` must be greater than or equal to 0.
|
||||
|
||||
padding (Union[int, tuple[int], list[int]]): Specifies the padding value of the pooling operation. Default: 0.
|
||||
padding (Union(int, tuple[int], list[int])): Specifies the padding value of the pooling operation. Default: 0.
|
||||
`padding` can only be an integer or a tuple/list containing one or two integers. If `padding` is an integer
|
||||
or a tuple/list containing one integer, it will be padded `padding` times in the four directions of the
|
||||
input. If `padding` is a tuple/list containing two integers, it will be padded `padding[0]` times in the
|
||||
|
@ -666,7 +666,7 @@ class AvgPool2d(_PoolNd):
|
|||
Default: 'NCHW'.
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})` or :math:`C_{in},H_{in},W_{in})`.
|
||||
- **x** (Tensor) - Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})` or :math:`(C_{in},H_{in},W_{in})`.
|
||||
|
||||
Outputs:
|
||||
Tensor of shape :math:`(N, C_{out}, H_{out}, W_{out})` or :math:`(C_{out},H_{out},W_{out})`.
|
||||
|
@ -771,9 +771,6 @@ class AvgPool1d(_PoolNd):
|
|||
\text{output}(N_i, C_j, l) = \frac{1}{l_{ker}} \sum_{n=0}^{l_{ker}-1}
|
||||
\text{input}(N_i, C_j, s_0 \times l + n)
|
||||
|
||||
Note:
|
||||
pad_mode for training only supports "same" and "valid".
|
||||
|
||||
Args:
|
||||
kernel_size (int): The size of kernel window used to take the average value, Default: 1.
|
||||
stride (int): The distance of kernel moving, an int number that represents
|
||||
|
|
|
@ -3964,10 +3964,10 @@ def ctc_loss(log_probs, targets, input_lengths, target_lengths, blank=0, reducti
|
|||
log_probs (Tensor): A tensor of shape (T, N, C), where T is input length, N is batch size and C is
|
||||
number of classes (including blank).
|
||||
targets (Tensor): A tensor of shape (N, S), where S is max target length, means the target sequences.
|
||||
input_lengths (Union(Tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the input.
|
||||
target_lengths (Union(Tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the target.
|
||||
input_lengths (Union(tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the input.
|
||||
target_lengths (Union(tuple, Tensor)): A tuple or Tensor of shape(N). It means the lengths of the target.
|
||||
blank (int): The blank label. Default: 0.
|
||||
reduction (string): Implements the reduction method to the output with 'none', 'mean', or 'sum'.
|
||||
reduction (str): Implements the reduction method to the output with 'none', 'mean', or 'sum'.
|
||||
Default: 'mean'.
|
||||
zero_infinity (bool): Whether to set infinite loss and correlation gradient to 0. Default: False.
|
||||
|
||||
|
|
Loading…
Reference in New Issue