!12338 [Docs] update formulas for math and array operators

From: @david-he91
Reviewed-by: @ljl0711,@liangchenghui
Signed-off-by: @liangchenghui
This commit is contained in:
mindspore-ci-bot 2021-02-10 14:29:01 +08:00 committed by Gitee
commit 6b7766b530
2 changed files with 19 additions and 30 deletions

View File

@ -3275,11 +3275,9 @@ class ScatterUpdate(_ScatterOp_Dynamic):
Using given values to update tensor value, along with the input indices.
for each `i, ..., j` in `indices.shape`:
.. math::
\begin{array}{l}
\text {for each i, ..., j in indices.shape:} \\
input\_x[indices[i, ..., j], :] = updates[i, ..., j, :]
\end{array}
\text{input_x}[\text{indices}[i, ..., j], :] = \text{updates}[i, ..., j, :]
Inputs of `input_x` and `updates` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to
@ -3393,11 +3391,10 @@ class ScatterMax(_ScatterOp):
Using given values to update tensor value through the max operation, along with the input indices.
This operation outputs the `input_x` after the update is done, which makes it convenient to use the updated value.
for each `i, ..., j` in `indices.shape`:
.. math::
\begin{array}{l}
\text {for each i, ..., j in indices.shape:} \\
input\_x[indices[i, ..., j], :] = max(input\_x[indices[i, ..., j], :], updates[i, ..., j, :])
\end{array}
\text{input_x}[\text{indices}[i, ..., j], :]
= max(\text{input_x}[\text{indices}[i, ..., j], :], \text{updates}[i, ..., j, :])
Inputs of `input_x` and `updates` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to
@ -3438,11 +3435,10 @@ class ScatterMin(_ScatterOp):
Using given values to update tensor value through the min operation, along with the input indices.
This operation outputs the `input_x` after the update is done, which makes it convenient to use the updated value.
for each `i, ..., j` in `indices.shape`:
.. math::
\begin{array}{l}
\text {for each i, ..., j in indices.shape:} \\
input\_x[indices[i, ..., j], :] = min(input\_x[indices[i, ..., j], :], updates[i, ..., j, :])
\end{array}
\text{input_x}[\text{indices}[i, ..., j], :]
= min(\text{input_x}[\text{indices}[i, ..., j], :], \text{updates}[i, ..., j, :])
Inputs of `input_x` and `updates` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to
@ -3483,11 +3479,9 @@ class ScatterAdd(_ScatterOp_Dynamic):
Using given values to update tensor value through the add operation, along with the input indices.
This operation outputs the `input_x` after the update is done, which makes it convenient to use the updated value.
for each `i, ..., j` in `indices.shape`:
.. math::
\begin{array}{l}
\text {for each i, ..., j in indices.shape:} \\
input\_x[indices[i, ..., j], :] \mathrel{+}= updates[i, ..., j, :]
\end{array}
\text{input_x}[\text{indices}[i, ..., j], :] \mathrel{+}= \text{updates}[i, ..., j, :]
Inputs of `input_x` and `updates` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to
@ -3535,11 +3529,9 @@ class ScatterSub(_ScatterOp):
Using given values to update tensor value through the subtraction operation, along with the input indices.
This operation outputs the `input_x` after the update is done, which makes it convenient to use the updated value.
for each `i, ..., j` in `indices.shape`:
.. math::
\begin{array}{l}
\text {for each i, ..., j in indices.shape:} \\
input\_x[indices[i, ..., j], :] \mathrel{-}= updates[i, ..., j, :]
\end{array}
\text{input_x}[\text{indices}[i, ..., j], :] \mathrel{-}= \text{updates}[i, ..., j, :]
Inputs of `input_x` and `updates` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to
@ -3581,11 +3573,9 @@ class ScatterMul(_ScatterOp):
Using given values to update tensor value through the mul operation, along with the input indices.
This operation outputs the `input_x` after the update is done, which makes it convenient to use the updated value.
for each `i, ..., j` in `indices.shape`:
.. math::
\begin{array}{l}
\text {for each i, ..., j in indices.shape:} \\
input\_x[indices[i, ..., j], :] \mathrel{*}= updates[i, ..., j, :]
\end{array}
\text{input_x}[\text{indices}[i, ..., j], :] \mathrel{*}= \text{updates}[i, ..., j, :]
Inputs of `input_x` and `updates` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to
@ -3626,11 +3616,9 @@ class ScatterDiv(_ScatterOp):
Using given values to update tensor value through the div operation, along with the input indices.
This operation outputs the `input_x` after the update is done, which makes it convenient to use the updated value.
for each `i, ..., j` in `indices.shape`:
.. math::
\begin{array}{l}
\text {for each i, ..., j in indices.shape:} \\
input\_x[indices[i, ..., j], :] \mathrel{/}= updates[i, ..., j, :]
\end{array}
\text{input_x}[\text{indices}[i, ..., j], :] \mathrel{/}= \text{updates}[i, ..., j, :]
Inputs of `input_x` and `updates` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to

View File

@ -791,9 +791,10 @@ class MatMul(PrimitiveWithCheck):
class BatchMatMul(MatMul):
"""
Computes matrix multiplication between two tensors by batch
Computes matrix multiplication between two tensors by batch.
`result[..., :, :] = tensor(a[..., :, :]) * tensor(b[..., :, :])`.
.. math::
\text{output}[..., :, :] = \text{matrix}(a[..., :, :]) * \text{matrix}(b[..., :, :])
The two input tensors must have the same rank and the rank must be not less than `3`.