modify format1116
This commit is contained in:
parent
7190fff7cb
commit
8035203d14
|
@ -14,4 +14,5 @@ mindspore.dataset.audio.BorderType
|
|||
- **BorderType.SYMMETRIC** - 以各边的边界为轴进行对称填充,包括边界像素值。
|
||||
例如,向 [1, 2, 3, 4] 的两边分别填充2个元素,结果为 [2, 1, 1, 2, 3, 4, 4, 3]。
|
||||
|
||||
.. note:: 该类派生自 :class:`str` 以支持 JSON 可序列化。
|
||||
.. note::
|
||||
该类派生自 `str` 以支持 JSON 可序列化。
|
||||
|
|
|
@ -8,9 +8,9 @@ mindspore.dataset.transforms.Mask
|
|||
参数:
|
||||
- **operator** (:class:`mindspore.dataset.transforms.Relational`) - 关系操作符,可以取值为Relational.EQ、Relational.NE、Relational.LT、Relational.GT、Relational.LE、Relational.GE。以Relational.EQ为例,将找出Tensor中与 `constant` 相等的元素。
|
||||
- **constant** (Union[str, int, float, bool]) - 与输入Tensor进行比较的基准值。
|
||||
- **dtype** (:class:`mindspore.dtype`, 可选) - 生成的掩码Tensor的数据类型。默认值::class:`mindspore.dtype.bool_` 。
|
||||
- **dtype** (:class:`mindspore.dtype`, 可选) - 生成的掩码Tensor的数据类型。默认值:mstype.bool\_ 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - 参数 `operator` 类型不为 :class:`mindspore.dataset.transforms.Relational` 。
|
||||
- **TypeError** - 参数 `constant` 类型不为str、int、float或bool。
|
||||
- **TypeError** - 参数 `dtype` 类型不为 :class:`mindspore.dtype` 。
|
||||
- **TypeError** - 参数 `dtype` 类型不为 :class:`mindspore.dtype` 。
|
||||
|
|
|
@ -30,6 +30,6 @@ mindspore.dataset.vision.AutoAugment
|
|||
|
||||
异常:
|
||||
- **TypeError** - 如果 `policy` 不是 :class:`mindspore.dataset.vision.AutoAugmentPolicy` 类型。
|
||||
- **TypeError** - 如果 `interpolation` 不是 :class:`mindsore.dataset.vision.Inter` 类型。
|
||||
- **TypeError** - 如果 `interpolation` 不是 :class:`mindspore.dataset.vision.Inter` 类型。
|
||||
- **TypeError** - 如果 `fill_value` 不是整数或长度为3的元组。
|
||||
- **RuntimeError** - 如果给定的张量形状不是<H, W, C>。
|
||||
- **RuntimeError** - 如果给定的张量shape不是<H, W, C>。
|
||||
|
|
|
@ -14,4 +14,5 @@ mindspore.dataset.vision.Border
|
|||
- **Border.SYMMETRIC** - 以各边的边界为轴进行对称填充,包括边界像素值。
|
||||
例如,对 [1,2,3,4] 的两侧分别填充2个元素,结果为 [2,1,1,2,3,4,4,3]。
|
||||
|
||||
.. note:: 该类派生自 :class:`str` 以支持 JSON 可序列化。
|
||||
.. note::
|
||||
该类派生自 `str` 以支持 JSON 可序列化。
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
mindspore.Tensor.index_add
|
||||
==========================
|
||||
|
||||
.. py:method:: mindspore.Tensor.index_addindex_add(dim, index, source, *, alpha=1)
|
||||
.. py:method:: mindspore.Tensor.index_add(dim, index, source, *, alpha=1)
|
||||
|
||||
详情请参考 :func:`mindspore.ops.index_add`。
|
||||
|
|
|
@ -11,7 +11,7 @@ mindspore.DatasetHelper
|
|||
DatasetHelper的迭代将提供一个epoch的数据。
|
||||
|
||||
参数:
|
||||
- **dataset** (Dataset) - 训练数据集迭代器。数据集可以由数据集生成器API在 :class:`mindspore.dataset` 中生成,例如 :class:`mindspore.dataset.ImageFolderDataset` 。
|
||||
- **dataset** (Dataset) - 训练数据集迭代器。数据集可以由数据集生成器API在 `mindspore.dataset` 中生成,例如 :class:`mindspore.dataset.ImageFolderDataset` 。
|
||||
- **dataset_sink_mode** (bool) - 如果值为True,使用 :class:`mindspore.ops.GetNext` 在设备(Device)上通过数据通道中获取数据,否则在主机(Host)直接遍历数据集获取数据。默认值:True。
|
||||
- **sink_size** (int) - 控制每个下沉中的数据量。如果 `sink_size` 为-1,则下沉每个epoch的完整数据集。如果 `sink_size` 大于0,则下沉每个epoch的 `sink_size` 数据。默认值:-1。
|
||||
- **epoch_num** (int) - 控制待发送的epoch数据量。默认值:1。
|
||||
|
|
|
@ -7,7 +7,7 @@ mindspore.data_sink
|
|||
|
||||
参数:
|
||||
- **fn** (Function) - 将与数据集一起运行的函数。
|
||||
- **dataset** (Dataset) - 训练数据集迭代器。数据集可以由数据集生成器API在 :class:`mindspore.dataset` 中生成,例如 :class:`mindspore.dataset.ImageFolderDataset` 。
|
||||
- **dataset** (Dataset) - 训练数据集迭代器。数据集可以由数据集生成器API在 `mindspore.dataset` 中生成,例如 :class:`mindspore.dataset.ImageFolderDataset` 。
|
||||
- **sink_size** (int) - 控制每次下沉的数据执行次数。 `sink_size` 必须为正整数。默认值:1。
|
||||
- **jit_config** (JitConfig) - 编译时所使用的JitConfig配置项,详细可参考 :class:`mindspore.JitConfig` 。默认值:None,表示以PyNative模式运行。
|
||||
- **input_signature** (Union[Tensor, List or Tuple of Tensors]) - 用于表示输入参数的Tensor。Tensor的shape和dtype将作为函数的输入shape和dtype。默认值:None。
|
||||
|
|
|
@ -19,7 +19,7 @@ mindspore.load_checkpoint
|
|||
- **specify_prefix** (Union[str, list[str], tuple[str]]) - 以 `specify_prefix` 开头的参数将会被加载。默认值:None。
|
||||
|
||||
返回:
|
||||
字典,key是参数名称,value是Parameter类型。当使用 :func:`mindspore.save_checkpoint` 的 `append_dict` 参数和 :class:`CheckpointConfig` 的 `append_info` 参数保存
|
||||
字典,key是参数名称,value是Parameter类型。当使用 :func:`mindspore.save_checkpoint` 的 `append_dict` 参数和 :class:`mindspore.train.CheckpointConfig` 的 `append_info` 参数保存
|
||||
checkpoint, `append_dict` 和 `append_info` 是dict类型,且它们的值value是string时,加载checkpoint得到的返回值是string类型,其它情况返回值均是Parameter类型。
|
||||
|
||||
异常:
|
||||
|
|
|
@ -8,7 +8,7 @@ mindspore.ops.Conv2DTranspose
|
|||
参数:
|
||||
- **out_channel** (int) - 输出的通道数。
|
||||
- **kernel_size** (Union[int, tuple[int]]) - 卷积核的大小。
|
||||
- **pad_mode** (str) - 填充的模式。它可以是"valid"、"same"或"pad"。默认值:"valid"。请参考 :class:`mindspore.nn.Conv2DTranspose` 了解更多 `pad_mode` 的使用规则。
|
||||
- **pad_mode** (str) - 填充的模式。它可以是"valid"、"same"或"pad"。默认值:"valid"。请参考 :class:`mindspore.nn.Conv2dTranspose` 了解更多 `pad_mode` 的使用规则。
|
||||
- **pad** (Union[int, tuple[int]]) - 指定要填充的填充值。默认值:0。如果 `pad` 是整数,则顶部、底部、左侧和右侧的填充都等于 `pad` 。如果 `pad` 是四个整数的tuple,则顶部、底部、左侧和右侧的填充分别等于pad[0]、pad[1]、pad[2]和pad[3]。
|
||||
- **pad_list** (Union[str, None]) - 卷积填充方式,如(顶部、底部、左、右)。默认值:None,表示不使用此参数。
|
||||
- **mode** (int) - 指定不同的卷积模式。当前未使用该值。默认值:1。
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mindspore.ops.addr
|
||||
==================
|
||||
|
||||
.. py:function:: mindspore.ops.addr(x, vec1, vec2, beta=1, alpha=1)
|
||||
.. py:function:: mindspore.ops.addr(vec1, vec2, beta=1, alpha=1)
|
||||
|
||||
计算 `vec1` 和 `vec2` 的外积,并将其添加到 `x` 中。
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ mindspore.ops.multi_label_margin_loss
|
|||
|
||||
.. py:function:: mindspore.ops.multi_label_margin_loss(inputs, target, reduction='mean')
|
||||
|
||||
用于优化多标签分类问题的铰链损失。
|
||||
|
||||
创建一个标准,用于优化输入 :math:`x` (一个2D小批量Tensor)
|
||||
和输出 :math:`y` (一个目标类别索引的2DTensor)之间的多类分类铰链损失(基于边距的损失):
|
||||
和输出 :math:`y` (一个目标类别索引的2DTensor)之间的多标签分类铰链损失(基于边距的损失):
|
||||
对于每个小批量样本:
|
||||
|
||||
.. math::
|
||||
|
|
|
@ -3,6 +3,8 @@ mindspore.ops.multi_margin_loss
|
|||
|
||||
.. py:function:: mindspore.ops.multi_margin_loss(inputs, target, p=1, margin=1, weight=None, reduction='mean')
|
||||
|
||||
用于优化多类分类问题的铰链损失。
|
||||
|
||||
创建一个标准,用于优化输入 :math:`x` (一个2D小批量Tensor)
|
||||
和输出 :math:`y` (一个目标类索引的1DTensor :math:`0 \leq y \leq \text{x.size}(1)-1`)
|
||||
之间的多类分类铰链损失(基于边距的损失):
|
||||
|
|
|
@ -2750,7 +2750,7 @@ class Tensor(Tensor_):
|
|||
|
||||
Args:
|
||||
v (Union[int, float, bool, list, tuple, Tensor]): Values to insert into the tensor.
|
||||
side ('left', 'right', optional): If 'left', the index of the first suitable
|
||||
side (str, optional): If 'left', the index of the first suitable
|
||||
location found is given. If 'right', return the last such index. If there is
|
||||
no suitable index, return either 0 or N (where N is the length of the tensor).
|
||||
Default: 'left'.
|
||||
|
|
|
@ -286,7 +286,7 @@ class Mask(TensorOperation):
|
|||
operator (Relational): relational operators, it can be any of [Relational.EQ, Relational.NE, Relational.LT,
|
||||
Relational.GT, Relational.LE, Relational.GE], take Relational.EQ as example, EQ refers to equal.
|
||||
constant (Union[str, int, float, bool]): Constant to be compared to.
|
||||
dtype (mindspore.dtype, optional): Type of the generated mask. Default: mindspore.dtype.bool\_.
|
||||
dtype (mindspore.dtype, optional): Type of the generated mask. Default: mstype.bool_.
|
||||
|
||||
Raises:
|
||||
TypeError: `operator` is not of type Relational.
|
||||
|
|
|
@ -701,7 +701,7 @@ class ConvertColor(ImageTensorOperation):
|
|||
- ConvertMode.COLOR_RGBA2GRAY, Convert RGBA image to GRAY image.
|
||||
|
||||
Raises:
|
||||
TypeError: If `convert_mode` is not of type :class:`mindspore.dataset.vision.transforms.ConvertMode` .
|
||||
TypeError: If `convert_mode` is not of type :class:`mindspore.dataset.vision.ConvertMode` .
|
||||
RuntimeError: If given tensor shape is not <H, W> or <H, W, C>.
|
||||
|
||||
Supported Platforms:
|
||||
|
|
|
@ -180,7 +180,7 @@ class EmbeddingLookup(Cell):
|
|||
target (str): Specifies the target where the op is executed. The value must in
|
||||
['DEVICE', 'CPU']. Default: 'CPU'.
|
||||
slice_mode (str): The slicing way in semi_auto_parallel/auto_parallel. The value must get through
|
||||
:class:`mindspore.nn.EmbeddingLookup`. Default: :class:`mindspore.nn.EmbeddingLookup.BATCH_SLICE`.
|
||||
:class:`mindspore.nn.EmbeddingLookup`. Default: 'nn.EmbeddingLookup.BATCH_SLICE'.
|
||||
manual_shapes (tuple): The accompaniment array in field slice mode. Default: None.
|
||||
max_norm (Union[float, None]): A maximum clipping value. The data type must be float16, float32
|
||||
or None. Default: None
|
||||
|
@ -496,7 +496,7 @@ class MultiFieldEmbeddingLookup(EmbeddingLookup):
|
|||
target (str): Specifies the target where the op is executed. The value must in
|
||||
['DEVICE', 'CPU']. Default: 'CPU'.
|
||||
slice_mode (str): The slicing way in semi_auto_parallel/auto_parallel. The value must get through
|
||||
:class:`mindspore.nn.EmbeddingLookup`. Default: :class:`mindspore.nn.EmbeddingLookup.BATCH_SLICE`.
|
||||
:class:`mindspore.nn.EmbeddingLookup`. Default: 'nn.EmbeddingLookup.BATCH_SLICE'.
|
||||
feature_num_list (tuple): The accompaniment array in field slice mode. This is unused currently. Default: None.
|
||||
max_norm (Union[float, None]): A maximum clipping value. The data type must be float16, float32
|
||||
or None. Default: None
|
||||
|
|
|
@ -3988,7 +3988,7 @@ def addr(x, vec1, vec2, beta=1, alpha=1):
|
|||
alpha (scalar[int, float, bool], optional): Multiplier for `vec1` ⊗ `vec2` (α). The `alpha` must
|
||||
be int or float or bool, Default: 1.
|
||||
|
||||
Outputs:
|
||||
Returns:
|
||||
Tensor, the shape of the output tensor is :vec1:`(N, M)`, has the same dtype as `x`.
|
||||
|
||||
Raises:
|
||||
|
@ -5925,7 +5925,7 @@ def log2(x):
|
|||
Raises:
|
||||
TypeError: If `x` is not a Tensor.
|
||||
TypeError: If dtype of `x` is not float16 or float32 or float64 on CPU and GPU, if dtype of `x` is not float16
|
||||
or float32 on Ascend.
|
||||
or float32 on Ascend.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
@ -6137,7 +6137,7 @@ def log10(x):
|
|||
Raises:
|
||||
TypeError: If `x` is not a Tensor.
|
||||
TypeError: If dtype of `x` is not float16 or float32 or float64 on CPU and GPU, if dtype of `x` is not float16
|
||||
or float32 on Ascend.
|
||||
or float32 on Ascend.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
|
|
@ -4501,6 +4501,8 @@ def glu(x, axis=-1):
|
|||
|
||||
def multi_margin_loss(inputs, target, p=1, margin=1, weight=None, reduction='mean'):
|
||||
r"""
|
||||
Hinge loss for optimizing a multi-class classification.
|
||||
|
||||
Creates a criterion that optimizes a multi-class classification hinge
|
||||
loss (margin-based loss) between input :math:`x` (a 2D mini-batch `Tensor`) and
|
||||
output :math:`y` (which is a 1D tensor of target class indices,
|
||||
|
@ -4569,7 +4571,9 @@ def multi_margin_loss(inputs, target, p=1, margin=1, weight=None, reduction='mea
|
|||
|
||||
def multi_label_margin_loss(inputs, target, reduction='mean'):
|
||||
r"""
|
||||
Creates a criterion that optimizes a multi-class multi-classification
|
||||
Hinge loss for optimizing a multi-label classification.
|
||||
|
||||
Creates a criterion that optimizes a multi-label multi-classification
|
||||
hinge loss (margin-based loss) between input :math:`x` (a 2D mini-batch `Tensor`)
|
||||
and output :math:`y` (which is a 2D `Tensor` of target class indices).
|
||||
For each sample in the mini-batch:
|
||||
|
|
|
@ -32,12 +32,12 @@ class AdjustSaturation(Primitive):
|
|||
adds an offset to the saturation channel, converts back to RGB and then back to the original data type.
|
||||
If several adjustments are chained it is advisable to minimize the number of redundant conversions.
|
||||
|
||||
inputs:
|
||||
Inputs:
|
||||
- **image** (Tensor): Images to adjust. Must be one of the following types: float16, float32.
|
||||
At least 3-D.The last dimension is interpreted as channels, and must be three.
|
||||
- **scale** (Tensor): A float scale to add to the saturation. A Tensor of type float32. Must be 0-D.
|
||||
|
||||
Output:
|
||||
Outputs:
|
||||
Adjusted image(s), same shape and dtype as `image`.
|
||||
|
||||
Raises:
|
||||
|
@ -81,12 +81,12 @@ class AdjustContrastv2(Primitive):
|
|||
The other dimensions only represent a collection of images, such as [batch, height, width, channels].
|
||||
Contrast is adjusted independently for each channel of each image.
|
||||
|
||||
inputs:
|
||||
Inputs:
|
||||
-**images**(tensor): Images to adjust. Must be one of the following types: float16, float32.
|
||||
At least 3-D.The last dimension is interpreted as channels, and must be three.
|
||||
-**contrast_factor**(tensor): A float multiplier for adjusting contrast. A Tensor of type float32. Must be 0-D.
|
||||
|
||||
Output:
|
||||
Outputs:
|
||||
Adjusted image(s), same shape and dtype as `images`.
|
||||
|
||||
Raises:
|
||||
|
@ -135,7 +135,7 @@ class AdjustHue(Primitive):
|
|||
the dtype is float16 or float32. At least 3-D.
|
||||
- **delta** (Tensor): How much to add to the hue channel, the dtype is float32. Must be 0-D.
|
||||
|
||||
Output:
|
||||
Outputs:
|
||||
Adjusted image(s), same shape and dtype as `image`.
|
||||
|
||||
Raises:
|
||||
|
|
|
@ -7530,7 +7530,7 @@ class Qr(Primitive):
|
|||
|
||||
class Cauchy(Primitive):
|
||||
r"""
|
||||
Create a tensor of shape `size` with random numbers drawn from Cauchy distribution
|
||||
Create a tensor of shape `size` with random numbers drawn from Cauchy distribution.
|
||||
|
||||
.. math::
|
||||
\f(x)= \frac{1}{\pi} \frac{\sigma}{(x-median)^2 +\sigma^2}
|
||||
|
|
|
@ -7985,19 +7985,19 @@ class CTCLossV2(Primitive):
|
|||
|
||||
Args:
|
||||
blank (int, optional): The blank label. Default: 0.
|
||||
reduction (string, optional): Apply specific reduction method to the output. Currently only support 'none',
|
||||
reduction (str, optional): Apply specific reduction method to the output. Currently only support 'none',
|
||||
not case sensitive. Default: "none".
|
||||
zero_infinity (bool, optional): Whether to set infinite loss and correlation gradient to zero. Default: False.
|
||||
|
||||
Inputs:
|
||||
- **log_probs** (Tensor) - A tensor of shape :math:`(T, C, N)`, where :math:`T` is input length, :math:`N` is
|
||||
batch size and :math:`C` is number of classes (including blank).
|
||||
batch size and :math:`C` is number of classes (including blank).
|
||||
- **targets** (Tensor) - A tensor of shape :math:`(N, S)`, where :math:`S` is max target length,
|
||||
means the target sequences.
|
||||
means the target sequences.
|
||||
- **input_lengths** (Union(Tuple, Tensor)) - A tuple or Tensor of shape :math:`(N)`.
|
||||
It means the lengths of the input.
|
||||
It means the lengths of the input.
|
||||
- **target_lengths** (Union(Tuple, Tensor)) - A tuple or Tensor of shape :math:`(N)`.
|
||||
It means the lengths of the target.
|
||||
It means the lengths of the target.
|
||||
|
||||
Outputs:
|
||||
- **neg_log_likelihood** (Tensor) - A loss value which is differentiable with respect to each input node.
|
||||
|
|
|
@ -816,15 +816,16 @@ class BlackmanWindow(Primitive):
|
|||
Args:
|
||||
periodic (bool): If True, returns a window to be used as periodic function.
|
||||
If False, return a symmetric window. Default: True.
|
||||
dtype (mindspore.dtype): the desired data type of returned tensor. Only float16, float32 and float64 is allowed.
|
||||
Default: mindspore.float32.
|
||||
dtype (mindspore.dtype): the desired data type of returned tensor.
|
||||
Only float16, float32 and float64 is allowed. Default: mindspore.float32.
|
||||
|
||||
Inputs:
|
||||
- **window_length** (Tensor) - the size of returned window, with data type int32, int64.
|
||||
The input data should be an integer with a value of [0, 1000000].
|
||||
|
||||
Outputs:
|
||||
A 1-D tensor of size "window_length" containing the window. Its datatype is set by the attr 'dtype'
|
||||
A 1-D tensor of size "window_length" containing the window. Its datatype is set by the attr 'dtype'.
|
||||
|
||||
Raises:
|
||||
TypeError: If "window_length" is not a Tensor.
|
||||
TypeError: If "periodic" is not a bool.
|
||||
|
|
Loading…
Reference in New Issue