update docs for Problems in TensorFlow and Mindspore of API mapping

This commit is contained in:
dinglinhe 2021-09-24 12:01:53 +08:00
parent 75a7ca6923
commit d95f0bc0b1
10 changed files with 31 additions and 27 deletions

View File

@ -44,7 +44,7 @@ class Tensor(Tensor_):
output tensor will be the same as the `input_data`. Default: None.
shape (Union[tuple, list, int]): A list of integers, a tuple of integers or an integer as the shape of
output. If `input_data` is available, `shape` doesn't need to be set. Default: None.
init (Initializer): the information of init data.
init (Initializer): The information of init data.
'init' is used for delayed initialization in parallel mode. Usually, it is not recommended to use
'init' interface to initialize parameters in other conditions. If 'init' interface is used to initialize
parameters, the `Tensor.init_data` API needs to be called to convert `Tensor` to the actual data.

View File

@ -38,7 +38,7 @@ class BaseReplacement:
'EMPTY' to mark the required args. Initializing an object will
check the given kwargs w.r.t '_necessary_args'.
Raise:
Raises:
ValueError: Raise when provided kwargs not contain necessary arg names with 'EMPTY' mark.
"""
_necessary_args = {}

View File

@ -501,7 +501,7 @@ class Searcher:
tuple[EditStep, list[float]], the root edit step and network output of each layer after applied the
layer steps.
Raise:
Raises:
TypeError: Be raised for any argument or data type problem.
ValueError: Be raised for any argument or data value problem.
NoValidResultError: Be raised if no valid result was found.
@ -566,7 +566,7 @@ class Searcher:
tuple[EditStep, list[float]], the root edit step and network output of each layer after applied the
layer steps.
Raise:
Raises:
NoValidResultError: Be raised if no valid result was found.
"""
# the leaf layer's network output may not meet the threshold,
@ -634,7 +634,7 @@ class Searcher:
Returns:
numpy.ndarray, the image tensor workpiece.
Raise:
Raises:
OriginalOutputError: Be raised if network output of the original image is not strictly larger than the
threshold.
"""
@ -674,7 +674,7 @@ class Searcher:
Returns:
tuple[list[EditStep], _StopReason], result edit stop and the stop reason.
Raise:
Raises:
OriginalOutputError: Be raised if network output of the original image is not strictly larger than the
threshold.
"""

View File

@ -475,7 +475,7 @@ class Norm(Cell):
otherwise a Tensor with dimensions in 'axis' removed is returned. The data type is the same with `x`
Raises:
TypeError: If `axis` is neither an int nor tuple.
TypeError: If `axis` is neither an int nor a tuple.
TypeError: If `keep_dims` is not a bool.
Supported Platforms:
@ -669,17 +669,18 @@ class Pad(Cell):
paddings are int type. For `D` th dimension of the `x`, paddings[D, 0] indicates how many sizes to be
extended ahead of the `D` th dimension of the input tensor, and paddings[D, 1] indicates how many sizes to
be extended behind of the `D` th dimension of the input tensor. The padded size of each dimension D of the
output is: :math:`paddings[D, 0] + input\_x.dim\_size(D) + paddings[D, 1]`
eg:
output is: :math:`paddings[D, 0] + input\_x.dim\_size(D) + paddings[D, 1]`,
e.g.:
- mode = "CONSTANT".
- paddings = [[1,1], [2,2]].
- x = [[1,2,3], [4,5,6], [7,8,9]].
- The above can be seen: 1st dimension of `x` is 3, 2nd dimension of `x` is 3.
- Substitute into the formula to get:
- 1st dimension of output is paddings[0][0] + 3 + paddings[0][1] = 1 + 3 + 1 = 4.
- 2nd dimension of output is paddings[1][0] + 3 + paddings[1][1] = 2 + 3 + 2 = 7.
- so output.shape is (4, 7)
.. code-block::
mode = "CONSTANT".
paddings = [[1,1], [2,2]].
x = [[1,2,3], [4,5,6], [7,8,9]].
# The above can be seen: 1st dimension of `x` is 3, 2nd dimension of `x` is 3.
# Substitute into the formula to get:
# 1st dimension of output is paddings[0][0] + 3 + paddings[0][1] = 1 + 3 + 1 = 4.
# 2nd dimension of output is paddings[1][0] + 3 + paddings[1][1] = 2 + 3 + 2 = 7.
# So the shape of output is (4, 7).
mode (str): Specifies padding mode. The optional values are "CONSTANT", "REFLECT", "SYMMETRIC".
Default: "CONSTANT".

View File

@ -919,6 +919,9 @@ class Moments(Cell):
"""
Calculates the mean and variance of `x`.
The mean and variance are calculated by aggregating the contents of `input_x` across axes.
If `input_x` is 1-D and axes = [0] this is just the mean and variance of a vector.
Args:
axis (Union[int, tuple(int)]): Calculates the mean and variance along the specified axis. Default: None.
keep_dims (bool): If true, The dimension of mean and variance are identical with input's.

View File

@ -112,7 +112,7 @@ class Momentum(Optimizer):
- **gradients** (tuple[Tensor]) - The gradients of `params`, the shape is the same as `params`.
Outputs:
tuple[bool], all elements are True.
tuple[bool]. All elements are True.
Raises:
TypeError: If `learning_rate` is not one of int, float, Tensor, Iterable, LearningRateSchedule.

View File

@ -149,7 +149,7 @@ def uniform(shape, minval, maxval, seed=None, dtype=mstype.float32):
If dtype is int32, only one number is allowed.
seed (int): Seed is used as entropy source for the random number engines to generate pseudo-random numbers,
must be non-negative. Default: None, which will be treated as 0.
dtype (mindspore.dtype): type of the Uniform distribution. If it is int32, it generates numbers from discrete
dtype (mindspore.dtype): Type of the Uniform distribution. If it is int32, it generates numbers from discrete
uniform distribution; if it is float32, it generates numbers from continuous uniform distribution. It only
supports these two data types. Default: mindspore.float32.
@ -161,7 +161,7 @@ def uniform(shape, minval, maxval, seed=None, dtype=mstype.float32):
Raises:
TypeError: If `shape` is not tuple.
TypeError: If 'minval' or 'maxval' is neither int32 nor float32
and dtype of 'minval' is not the same as 'maxval'
and dtype of 'minval' is not the same as 'maxval'.
TypeError: If `seed` is not an int.
TypeError: If 'dtype' is neither int32 nor float32.

View File

@ -1178,7 +1178,7 @@ class Size(PrimitiveWithInfer):
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`. The data type is Number.
Outputs:
int, a scalar representing the elements size of `input_x`, tensor is the number of elements
int. A scalar representing the elements size of `input_x`, tensor is the number of elements
in a tensor, :math:`size=x_1*x_2*...x_R`. The data type is an int.
Raises:
@ -2665,14 +2665,14 @@ class Slice(PrimitiveWithInfer):
"""
Slices a tensor in the specified shape.
Slice the tensor 'input_x` in shape of `size` and starting at the location specified by `begin`,
Slice the tensor `input_x` in shape of `size` and starting at the location specified by `begin`,
The slice `begin` represents the offset in each dimension of `input_x`,
The slice `size` represents the size of the output tensor.
Note that `begin` is zero-based and `size` is one-based.
If `size[i]` is -1, all remaining elements in dimension i are included in the slice.
This is equivalent to setting :math:`size[i] = input_x.shape(i) - begin[i]`
This is equivalent to setting :math:`size[i] = input_x.shape(i) - begin[i]`.
Inputs:
- **input_x** (Tensor): The target tensor.

View File

@ -479,7 +479,7 @@ class Mish(PrimitiveWithInfer):
Supported Platforms:
``Ascend``
Raise:
Raises:
TypeError: If dtype of `x` is neither float16 nor float32.
Examples:
@ -533,7 +533,7 @@ class SeLU(PrimitiveWithInfer):
Supported Platforms:
``Ascend``
Raise:
Raises:
TypeError: If dtype of `input_x` is neither float16 nor float32.
Examples:
@ -948,7 +948,7 @@ class InstanceNorm(PrimitiveWithInfer):
Supported Platforms:
``GPU``
Raise:
Raises:
TypeError: If `epsilon` or `momentum` is not a float.
TypeError: If dtype of `input_x` is neither float16 nor float32.
TypeError: If dtype of `gamma`, `beta` or `mean` is not float32.

View File

@ -143,7 +143,7 @@ class Gamma(PrimitiveWithInfer):
Produces random positive floating-point values x, distributed according to probability density function:
.. math::
\text{P}(x|α,β) = \frac{\exp(-x/β)}{{β^α}\cdot{\Gamma(α)}}\cdot{x^{α-1}},
\text{P}(x|α,β) = \frac{\exp(-x/β)}{{β^α}\cdot{\Gamma(α)}}\cdot{x^{α-1}}
Args:
seed (int): Random seed, must be non-negative. Default: 0.