modify format

This commit is contained in:
huodagu 2022-10-28 11:47:04 +08:00
parent a772fcf78f
commit a89a94de20
12 changed files with 52 additions and 80 deletions

View File

@ -286,7 +286,6 @@ Tensor创建
mindspore.ops.one_hot
mindspore.ops.ones
mindspore.ops.ones_like
mindspore.ops.zeros_like
随机生成函数
^^^^^^^^^^^^^^^^

View File

@ -1,20 +1,19 @@
mindspore.Tensor.multinomial
=============================
.. py:method:: mindspore.Tensor.multinomial(self, num_samples, seed=0, seed2=0):
.. py:method:: mindspore.Tensor.multinomial(num_samples, seed=0, seed2=0)
返回从相应的张量输入行。输入行不需要求和为1(在这种情况下,我们使用这些值作为权重)但必须是非负的、有限的并且具有非零和。self必须是输入张量包含概率总和的必须是1或2维。
参数:
- **num_samples** (int32)—要绘制的样本数
- **seed** (int)随机种子必须为非负数。默认值0
- **seed2** (int)随机seed2必须为非负数。默认值0
- **num_samples** (int32) - 要绘制的样本数。
- **seed** (int) - 随机种子必须为非负数。默认值0。
- **seed2** (int) - 随机seed2必须为非负数。默认值0。
返回:
与self具有相同行的张量每行具有num_samples采样索引。
输出:
与self具有相同行的张量每行具有num_samples采样索引
异常:
TypeError:如果`seed``seed2`都不是int
TypeError:如果`self`不是数据类型为float32的Tensor
TypeError:如果`num_samples`的数据类型不是int32
支持的平台:
``GPU``
- **TypeError** - 如果 `seed``seed2` 都不是int。
- **TypeError** - 如果 `self` 不是数据类型为float32的Tensor。
- **TypeError** - 如果 `num_samples` 的数据类型不是int32。

View File

@ -13,7 +13,7 @@ mindspore.nn.LPPool1d
f(X) = \sqrt[p]{\sum_{x \in X} x^{p}}
参数:
- **norm_type** (float) - 标准化类型代表公式里的p
- **norm_type** (Union[int, float]) - 标准化类型代表公式里的p
- 如果 p = 1得到的结果为池化核内元素之和与平均池化成比例
- 如果 p = :math:`\infty`,得到的结果为最大池化的结果。

View File

@ -1,15 +0,0 @@
mindspore.ops.zeros_like
=========================
.. py:function:: mindspore.ops.zeros_like(input_x)
返回填充值为0的Tensor其shape和数据类型与 `input_x` 相同。
参数:
- **input_x** (Tensor) - 任何维度的输入Tensor。数据类型为int32、int64、float16或float32。
返回:
Tensor具有与 `input_x` 相同的shape和数据类型但填充了零。
异常:
- **TypeError** - 如果 `input_x` 不是Tensor。

View File

@ -312,6 +312,13 @@ Other Methods
mindspore.Tensor.flush_from_cache
mindspore.Tensor.set_const_arg
{% elif fullname=="mindspore.nn.Cell" %}
{{ fullname | underline }}
.. autoclass:: {{ name }}
:exclude-members: infer_value, infer_shape, infer_dtype, auto_parallel_compile_and_run, load_parameter_slice, set_auto_parallel, set_parallel_input_with_inputs
:members:
{% elif objname[0].istitle() %}
{{ fullname | underline }}

View File

@ -286,7 +286,6 @@ Tensor Building
mindspore.ops.one_hot
mindspore.ops.ones
mindspore.ops.ones_like
mindspore.ops.zeros_like
Randomly Generating Functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -223,15 +223,6 @@ class Dropout1d(Cell):
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> input_x = Tensor(np.random.randn(4, 3), mindspore.float32)
>>> output = dropout1d(input_x, 0.5)
>>> print(output.shape)
(4, 3)
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> dropout = nn.Dropout1d(p=0.5)
>>> x = Tensor(np.ones([4, 3]), mindspore.float32)

View File

@ -2436,21 +2436,21 @@ class HingeEmbeddingLoss(LossBase):
The loss function for :math:`n`-th sample in the mini-batch is
.. math::
l_n = \begin{cases}
x_n, & \text{if}\; y_n = 1,\\
\max \{0, \Delta - x_n\}, & \text{if}\; y_n = -1,
\end{cases}
.. math::
l_n = \begin{cases}
x_n, & \text{if}\; y_n = 1,\\
\max \{0, \Delta - x_n\}, & \text{if}\; y_n = -1,
\end{cases}
and the total loss functions is
and the total loss functions is
.. math::
\ell(x, y) = \begin{cases}
\operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\
\operatorname{sum}(L), & \text{if reduction} = \text{'sum'.}
\end{cases}
.. math::
\ell(x, y) = \begin{cases}
\operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\
\operatorname{sum}(L), & \text{if reduction} = \text{'sum'.}
\end{cases}
where :math:`L = \{l_1,\dots,l_N\}^\top`.
where :math:`L = \{l_1,\dots,l_N\}^\top`.
Args:
margin (float): Threshold defined by Hinge Embedding Loss :math:`margin`.

View File

@ -3097,11 +3097,11 @@ def nonzero(x):
Tensor, a 2-D Tensor whose data type is int64, containing the positions of all non-zero values of the input.
Raises:
TypeError: If `x` is not Tensor.
ValueError: If 'x' dim equal to 0.
TypeError: If `x` is not Tensor.
ValueError: If 'x' dim equal to 0.
Supported Platforms:
``GPU``
``GPU``
Examples:
>>> import mindspore

View File

@ -992,14 +992,10 @@ def jacfwd(fn, grad_position=0, has_aux=False):
>>> print(jac)
[[[[ 2., 0.]
[ 0., 0.]]
[[ 0., 4.]
[ 0., 0.]]]
[[[ 0., 0.]
[ 6., 0.]]
[[ 0., 0.]
[ 0., 8.]]]]
>>> print(aux)
@ -1187,14 +1183,10 @@ def jacrev(fn, grad_position=0, has_aux=False):
>>> print(jac)
[[[[ 2., 0.]
[ 0., 0.]]
[[ 0., 4.]
[ 0., 0.]]]
[[[ 0., 0.]
[ 6., 0.]]
[[ 0., 0.]
[ 0., 8.]]]]
>>> print(aux)

View File

@ -6703,10 +6703,10 @@ def igammac(input, other):
.. warning::
This is an experimental prototype that is subject to change and/or deletion.
Inputs:
Args:
input (Tensor): The first input tensor. With type of float32 or float64.
other (Tensor): The second input tensor. With float32 or float64 type. `other` should have
the same dtype with `input`.
the same dtype with `input`.
Outputs:
Tensor, has the same dtype as `input` and `other`.

View File

@ -2573,28 +2573,28 @@ def hinge_embedding_loss(inputs, targets, margin=1.0, reduction='mean'):
The loss function for :math:`n`-th sample in the mini-batch is
.. math::
l_n = \begin{cases}
x_n, & \text{if}\; y_n = 1,\\
\max \{0, \Delta - x_n\}, & \text{if}\; y_n = -1,
\end{cases}
.. math::
l_n = \begin{cases}
x_n, & \text{if}\; y_n = 1,\\
\max \{0, \Delta - x_n\}, & \text{if}\; y_n = -1,
\end{cases}
and the total loss functions is
and the total loss functions is
.. math::
\ell(x, y) = \begin{cases}
\operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\
\operatorname{sum}(L), & \text{if reduction} = \text{'sum'.}
\end{cases}
.. math::
\ell(x, y) = \begin{cases}
\operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\
\operatorname{sum}(L), & \text{if reduction} = \text{'sum'.}
\end{cases}
where :math:`L = \{l_1,\dots,l_N\}^\top`.
where :math:`L = \{l_1,\dots,l_N\}^\top`.
Args:
inputs (Tensor): Tensor of shape :math:`(*)` where :math:`*` means any number of dimensions.
targets (Tensor): Same shape as the logits, contains -1 or 1.
margin (float): Threshold defined by Hinge Embedding Loss :math:`margin`.
Represented as :math:`\Delta` in the formula. Default: 1.0.
reduction (string): Specify the computing method to be applied to the outputs: 'none', 'mean', or 'sum'.
reduction (str): Specify the computing method to be applied to the outputs: 'none', 'mean', or 'sum'.
Default: 'mean'.
Returns:
@ -3617,8 +3617,8 @@ def lp_pool1d(x, norm_type, kernel_size, stride=None, ceil_mode=False):
f(X) = \sqrt[p]{\sum_{x \in X} x^{p}}
Args:
x (Tensor) - Tensor of shape :math:`(N, C, L_{in})` or :math:`(C, L_{in})`.
norm_type (Union[int, float]) - Type of normalization, represents p in the formula,
x (Tensor): Tensor of shape :math:`(N, C, L_{in})` or :math:`(C, L_{in})`.
norm_type (Union[int, float]): Type of normalization, represents p in the formula,
- if p = 1, one gets Sum Pooling (which is proportional to Average Pooling),
- if p = :math:`\infty`, one gets Max Pooling.
@ -3688,8 +3688,8 @@ def lp_pool2d(x, norm_type, kernel_size, stride=None, ceil_mode=False):
f(X) = \sqrt[p]{\sum_{x \in X} x^{p}}
Args:
x (Tensor) - Tensor of shape :math:`(N, C, H_{in}, W_{in})`.
norm_type (Union[int, float]) - Type of normalization, represents p in the formula,
x (Tensor): Tensor of shape :math:`(N, C, H_{in}, W_{in})`.
norm_type (Union[int, float]): Type of normalization, represents p in the formula,
- if p = 1, one gets Sum Pooling (which is proportional to Average Pooling),
- if p = :math:`\infty`, one gets Max Pooling.