| @@ -293,11 +293,11 @@ class Tensor(Tensor_): | |||||
| def view(self, *shape): | def view(self, *shape): | ||||
| """ | |||||
| r""" | |||||
| Reshape the tensor according to the input shape. | Reshape the tensor according to the input shape. | ||||
| Args: | Args: | ||||
| shape (Union(list(int), *int)): Dimension of the output tensor. | |||||
| shape (Union(list[int], \*int)): Dimension of the output tensor. | |||||
| Returns: | Returns: | ||||
| Tensor, has the same dimension as the input shape. | Tensor, has the same dimension as the input shape. | ||||
| @@ -539,11 +539,10 @@ def set_context(**kwargs): | |||||
| - training_trace: collect iterative trajectory data, that is, the training task and software information of | - training_trace: collect iterative trajectory data, that is, the training task and software information of | ||||
| the AI software stack, to achieve performance analysis of the training task, focusing on data | the AI software stack, to achieve performance analysis of the training task, focusing on data | ||||
| enhancement, forward and backward calculation, gradient aggregation update and other related data. | enhancement, forward and backward calculation, gradient aggregation update and other related data. | ||||
| - task_trace: collect task trajectory data, that is, the hardware information of the HWTS/AICore of | - task_trace: collect task trajectory data, that is, the hardware information of the HWTS/AICore of | ||||
| the Ascend 910 processor, and analyze the information of beginning and ending of the task. | the Ascend 910 processor, and analyze the information of beginning and ending of the task. | ||||
| - op_trace: collect single operator performance data. | - op_trace: collect single operator performance data. | ||||
| The profiling can choose the combination of `training_trace`, `task_trace`, | The profiling can choose the combination of `training_trace`, `task_trace`, | ||||
| `training_trace` and `task_trace` combination, and eparated by colons; | `training_trace` and `task_trace` combination, and eparated by colons; | ||||
| a single operator can choose `op_trace`, `op_trace` cannot be combined with | a single operator can choose `op_trace`, `op_trace` cannot be combined with | ||||
| @@ -151,8 +151,9 @@ class Dataset: | |||||
| def parse_tree(self): | def parse_tree(self): | ||||
| """ | """ | ||||
| Internal method to parse the API tree into an IR tree. | Internal method to parse the API tree into an IR tree. | ||||
| Returns: | Returns: | ||||
| DatasetNode. The root of the IR tree. | |||||
| DatasetNode, The root of the IR tree. | |||||
| """ | """ | ||||
| if len(self.parent) > 1: | if len(self.parent) > 1: | ||||
| raise ValueError("The data pipeline is not a tree (i.e., one node has 2 consumers)") | raise ValueError("The data pipeline is not a tree (i.e., one node has 2 consumers)") | ||||
| @@ -823,7 +824,7 @@ class Dataset: | |||||
| ValueError: If sizes is list of float and not all floats are between 0 and 1, or if the | ValueError: If sizes is list of float and not all floats are between 0 and 1, or if the | ||||
| floats don’t sum to 1. | floats don’t sum to 1. | ||||
| Returns | |||||
| Returns: | |||||
| tuple(Dataset), a tuple of datasets that have been split. | tuple(Dataset), a tuple of datasets that have been split. | ||||
| Examples: | Examples: | ||||
| @@ -1516,10 +1517,10 @@ class Dataset: | |||||
| """ | """ | ||||
| Get the class index. | Get the class index. | ||||
| Return: | |||||
| Returns: | |||||
| Dict, A str-to-int mapping from label name to index. | Dict, A str-to-int mapping from label name to index. | ||||
| Dict, A str-to-list<int> mapping from label name to index for Coco ONLY. The second number | Dict, A str-to-list<int> mapping from label name to index for Coco ONLY. The second number | ||||
| in the list is used to indicate the super category | |||||
| in the list is used to indicate the super category | |||||
| """ | """ | ||||
| if self.children: | if self.children: | ||||
| return self.children[0].get_class_indexing() | return self.children[0].get_class_indexing() | ||||
| @@ -1710,7 +1711,7 @@ class MappableDataset(SourceDataset): | |||||
| ValueError: If sizes is list of float and not all floats are between 0 and 1, or if the | ValueError: If sizes is list of float and not all floats are between 0 and 1, or if the | ||||
| floats don’t sum to 1. | floats don’t sum to 1. | ||||
| Returns | |||||
| Returns: | |||||
| tuple(Dataset), a tuple of datasets that have been split. | tuple(Dataset), a tuple of datasets that have been split. | ||||
| Examples: | Examples: | ||||
| @@ -4064,7 +4065,7 @@ class ManifestDataset(MappableDataset): | |||||
| """ | """ | ||||
| Get the class index. | Get the class index. | ||||
| Return: | |||||
| Returns: | |||||
| Dict, A str-to-int mapping from label name to index. | Dict, A str-to-int mapping from label name to index. | ||||
| """ | """ | ||||
| if self.class_indexing is None: | if self.class_indexing is None: | ||||
| @@ -4720,7 +4721,7 @@ class VOCDataset(MappableDataset): | |||||
| """ | """ | ||||
| Get the class index. | Get the class index. | ||||
| Return: | |||||
| Returns: | |||||
| Dict, A str-to-int mapping from label name to index. | Dict, A str-to-int mapping from label name to index. | ||||
| """ | """ | ||||
| if self.task != "Detection": | if self.task != "Detection": | ||||
| @@ -4911,7 +4912,7 @@ class CocoDataset(MappableDataset): | |||||
| """ | """ | ||||
| Get the class index. | Get the class index. | ||||
| Return: | |||||
| Returns: | |||||
| Dict, A str-to-list<int> mapping from label name to index | Dict, A str-to-list<int> mapping from label name to index | ||||
| """ | """ | ||||
| if self.task not in {"Detection", "Panoptic"}: | if self.task not in {"Detection", "Panoptic"}: | ||||
| @@ -61,7 +61,7 @@ class Occlusion(PerturbationAttribution): | |||||
| Inputs: | Inputs: | ||||
| - **inputs** (Tensor) - The input data to be explained, a 4D tensor of shape :math:`(N, C, H, W)`. | - **inputs** (Tensor) - The input data to be explained, a 4D tensor of shape :math:`(N, C, H, W)`. | ||||
| - **targets** (Tensor, int) - The label of interest. It should be a 1D or 0D tensor, or an integer. | - **targets** (Tensor, int) - The label of interest. It should be a 1D or 0D tensor, or an integer. | ||||
| If it is a 1D tensor, its length should be the same as `inputs`. | |||||
| If it is a 1D tensor, its length should be the same as `inputs`. | |||||
| Outputs: | Outputs: | ||||
| Tensor, a 4D tensor of shape :math:`(N, 1, H, W)`. | Tensor, a 4D tensor of shape :math:`(N, 1, H, W)`. | ||||
| @@ -365,8 +365,12 @@ class FastGelu(Cell): | |||||
| Applies FastGelu function to each element of the input. The input is a Tensor with any valid shape. | Applies FastGelu function to each element of the input. The input is a Tensor with any valid shape. | ||||
| FastGelu is defined as: | FastGelu is defined as: | ||||
| :math:`FastGelu(x_i) = \frac {x_i} {1 + \exp(-1.702 * \left| x_i \right|)} * | |||||
| \exp(0.851 * (x_i - \left| x_i \right|))`, where :math:`x_i` is the element of the input. | |||||
| .. math:: | |||||
| FastGelu(x_i) = \frac {x_i} {1 + \exp(-1.702 * \left| x_i \right|)} * | |||||
| \exp(0.851 * (x_i - \left| x_i \right|)) | |||||
| where :math:`x_i` is the element of the input. | |||||
| Inputs: | Inputs: | ||||
| - **input_data** (Tensor) - The input of FastGelu with data type of float16 or float32. | - **input_data** (Tensor) - The input of FastGelu with data type of float16 or float32. | ||||
| @@ -221,7 +221,8 @@ class SoftmaxCrossEntropyWithLogits(_Loss): | |||||
| .. math:: | .. math:: | ||||
| \ell(x_i, t_i) = - \log\left(\frac{\exp(x_{t_i})}{\sum_j \exp(x_j)}\right) | \ell(x_i, t_i) = - \log\left(\frac{\exp(x_{t_i})}{\sum_j \exp(x_j)}\right) | ||||
| = -x_{t_i} + \log\left(\sum_j \exp(x_j)\right), | |||||
| = -x_{t_i} + \log\left(\sum_j \exp(x_j)\right) | |||||
| where :math:`x_i` is a 1D score Tensor, :math:`t_i` is a scalar. | where :math:`x_i` is a 1D score Tensor, :math:`t_i` is a scalar. | ||||
| Note: | Note: | ||||
| @@ -91,7 +91,8 @@ class MSE(Metric): | |||||
| norm) between each element in the input: :math:`x` and the target: :math:`y`. | norm) between each element in the input: :math:`x` and the target: :math:`y`. | ||||
| .. math:: | .. math:: | ||||
| \text{MSE}(x,\ y) = \frac{\sum_{i=1}^n(y_i - x_i)^2}{n}, | |||||
| \text{MSE}(x,\ y) = \frac{\sum_{i=1}^n(y_i - x_i)^2}{n} | |||||
| where :math:`n` is batch size. | where :math:`n` is batch size. | ||||
| Examples: | Examples: | ||||
| @@ -26,6 +26,7 @@ class PowerTransform(Bijector): | |||||
| .. math:: | .. math:: | ||||
| Y = g(X) = (1 + X * c)^{1 / c}, X >= -1 / c | Y = g(X) = (1 + X * c)^{1 / c}, X >= -1 / c | ||||
| where c >= 0 is the power. | where c >= 0 is the power. | ||||
| The power transform maps inputs from `[-1/c, inf]` to `[0, inf]`. | The power transform maps inputs from `[-1/c, inf]` to `[0, inf]`. | ||||
| @@ -25,6 +25,7 @@ class ScalarAffine(Bijector): | |||||
| .. math:: | .. math:: | ||||
| Y = a * X + b | Y = a * X + b | ||||
| where a is the scale factor and b is the shift factor. | where a is the scale factor and b is the shift factor. | ||||
| Args: | Args: | ||||
| @@ -2610,6 +2610,7 @@ class StridedSlice(PrimitiveWithInfer): | |||||
| Outputs: | Outputs: | ||||
| Tensor. | Tensor. | ||||
| The output is explained by following example. | The output is explained by following example. | ||||
| - In the 0th dimension, begin is 1, end is 2, and strides is 1, | - In the 0th dimension, begin is 1, end is 2, and strides is 1, | ||||
| because :math:`1+1=2\geq2`, the interval is :math:`[1,2)`. | because :math:`1+1=2\geq2`, the interval is :math:`[1,2)`. | ||||
| Thus, return the element with :math:`index = 1` in 0th dimension, i.e., [[3, 3, 3], [4, 4, 4]]. | Thus, return the element with :math:`index = 1` in 0th dimension, i.e., [[3, 3, 3], [4, 4, 4]]. | ||||
| @@ -2624,7 +2625,7 @@ class StridedSlice(PrimitiveWithInfer): | |||||
| Supported Platforms: | Supported Platforms: | ||||
| ``Ascend`` ``GPU`` ``CPU`` | ``Ascend`` ``GPU`` ``CPU`` | ||||
| Examples | |||||
| Examples: | |||||
| >>> input_x = Tensor([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]], | >>> input_x = Tensor([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]], | ||||
| ... [[5, 5, 5], [6, 6, 6]]], mindspore.float32) | ... [[5, 5, 5], [6, 6, 6]]], mindspore.float32) | ||||
| >>> slice = ops.StridedSlice() | >>> slice = ops.StridedSlice() | ||||