| @@ -293,7 +293,7 @@ class Tensor(Tensor_): | |||
| @property | |||
| def dtype(self): | |||
| """Returns the dtype of the tensor (:class:`mindspore.dtype`).""" | |||
| """Return the dtype of the tensor (:class:`mindspore.dtype`).""" | |||
| return self._dtype | |||
| @property | |||
| @@ -303,7 +303,7 @@ class Tensor(Tensor_): | |||
| @property | |||
| def ndim(self): | |||
| """Returns the number of tensor dimensions.""" | |||
| """Return the number of tensor dimensions.""" | |||
| return len(self._shape) | |||
| @property | |||
| @@ -313,22 +313,22 @@ class Tensor(Tensor_): | |||
| @property | |||
| def itemsize(self): | |||
| """Returns the length of one tensor element in bytes.""" | |||
| """Return the length of one tensor element in bytes.""" | |||
| return self._itemsize | |||
| @property | |||
| def strides(self): | |||
| """Returns the tuple of bytes to step in each dimension when traversing a tensor.""" | |||
| """Return the tuple of bytes to step in each dimension when traversing a tensor.""" | |||
| return self._strides | |||
| @property | |||
| def nbytes(self): | |||
| """Returns the total number of bytes taken by the tensor.""" | |||
| """Return the total number of bytes taken by the tensor.""" | |||
| return self._nbytes | |||
| @property | |||
| def T(self): | |||
| """Returns the transposed tensor.""" | |||
| """Return the transposed tensor.""" | |||
| return self.transpose() | |||
| @property | |||
| @@ -439,7 +439,7 @@ class Tensor(Tensor_): | |||
| def mean(self, axis=(), keep_dims=False): | |||
| """ | |||
| Reduces a dimension of a tensor by averaging all elements in the dimension. | |||
| Reduce a dimension of a tensor by averaging all elements in the dimension. | |||
| Args: | |||
| axis (Union[None, int, tuple(int), list(int)]): Dimensions of reduction, | |||
| @@ -456,7 +456,7 @@ class Tensor(Tensor_): | |||
| def transpose(self, *axes): | |||
| r""" | |||
| Returns a view of the tensor with axes transposed. | |||
| Return a view of the tensor with axes transposed. | |||
| For a 1-D tensor this has no effect, as a transposed vector is simply the | |||
| same vector. For a 2-D tensor, this is a standard matrix transpose. For a | |||
| @@ -480,7 +480,7 @@ class Tensor(Tensor_): | |||
| def reshape(self, *shape): | |||
| """ | |||
| Gives a new shape to a tensor without changing its data. | |||
| Give a new shape to a tensor without changing its data. | |||
| Args: | |||
| shape(Union[int, tuple(int), list(int)]): The new shape should be compatible | |||
| @@ -497,7 +497,7 @@ class Tensor(Tensor_): | |||
| def ravel(self): | |||
| """ | |||
| Returns a contiguous flattened tensor. | |||
| Return a contiguous flattened tensor. | |||
| Returns: | |||
| Tensor, a 1-D tensor, containing the same elements of the input. | |||
| @@ -508,7 +508,7 @@ class Tensor(Tensor_): | |||
| def flatten(self, order='C'): | |||
| r""" | |||
| Returns a copy of the tensor collapsed into one dimension. | |||
| Return a copy of the tensor collapsed into one dimension. | |||
| Args: | |||
| order (str, optional): Can choose between 'C' and 'F'. 'C' means to | |||
| @@ -531,7 +531,7 @@ class Tensor(Tensor_): | |||
| def swapaxes(self, axis1, axis2): | |||
| """ | |||
| Interchanges two axes of a tensor. | |||
| Interchange two axes of a tensor. | |||
| Args: | |||
| axis1 (int): First axis. | |||
| @@ -561,7 +561,7 @@ class Tensor(Tensor_): | |||
| def squeeze(self, axis=None): | |||
| """ | |||
| Removes single-dimensional entries from the shape of a tensor. | |||
| Remove single-dimensional entries from the shape of a tensor. | |||
| Args: | |||
| axis (Union[None, int, list(int), tuple(int)], optional): Default is None. | |||
| @@ -577,7 +577,7 @@ class Tensor(Tensor_): | |||
| def astype(self, dtype, copy=True): | |||
| """ | |||
| Returns a copy of the tensor, casted to a specified type. | |||
| Return a copy of the tensor, casted to a specified type. | |||
| Args: | |||
| dtype (Union[:class:`mindspore.dtype`, str]): Designated tensor dtype, can be in format | |||
| @@ -175,7 +175,7 @@ def get_local_rank_size(group=GlobalComm.WORLD_COMM_GROUP): | |||
| def get_world_rank_from_group_rank(group, group_rank_id): | |||
| """ | |||
| Gets the rank ID in the world communication group corresponding to | |||
| Get the rank ID in the world communication group corresponding to | |||
| the rank ID in the specified user communication group. | |||
| Note: | |||
| @@ -43,7 +43,7 @@ def create_quant_config(quant_observer=(nn.FakeQuantWithMinMaxObserver, nn.FakeQ | |||
| symmetric=(False, False), | |||
| narrow_range=(False, False)): | |||
| r""" | |||
| Configs the observer type of weights and data flow with quant params. | |||
| Config the observer type of weights and data flow with quant params. | |||
| Args: | |||
| quant_observer (Union[Observer, list, tuple]): The observer type to do quantization. The first element represent | |||
| @@ -86,12 +86,12 @@ class _ThreadLocalInfo(threading.local): | |||
| @property | |||
| def reserve_class_name_in_scope(self): | |||
| """Gets whether to save the network class name in the scope.""" | |||
| """Get whether to save the network class name in the scope.""" | |||
| return self._reserve_class_name_in_scope | |||
| @reserve_class_name_in_scope.setter | |||
| def reserve_class_name_in_scope(self, reserve_class_name_in_scope): | |||
| """Sets whether to save the network class name in the scope.""" | |||
| """Set whether to save the network class name in the scope.""" | |||
| if not isinstance(reserve_class_name_in_scope, bool): | |||
| raise ValueError( | |||
| "Set reserve_class_name_in_scope value must be bool!") | |||
| @@ -295,12 +295,12 @@ class _Context: | |||
| @property | |||
| def reserve_class_name_in_scope(self): | |||
| """Gets whether to save the network class name in the scope.""" | |||
| """Get whether to save the network class name in the scope.""" | |||
| return self._thread_local_info.reserve_class_name_in_scope | |||
| @reserve_class_name_in_scope.setter | |||
| def reserve_class_name_in_scope(self, reserve_class_name_in_scope): | |||
| """Sets whether to save the network class name in the scope.""" | |||
| """Set whether to save the network class name in the scope.""" | |||
| self._thread_local_info.reserve_class_name_in_scope = reserve_class_name_in_scope | |||
| @property | |||
| @@ -444,7 +444,7 @@ def set_auto_parallel_context(**kwargs): | |||
| def get_auto_parallel_context(attr_key): | |||
| """ | |||
| Gets auto parallel context attribute value according to the key. | |||
| Get auto parallel context attribute value according to the key. | |||
| Args: | |||
| attr_key (str): The key of the attribute. | |||
| @@ -512,7 +512,7 @@ def _check_target_specific_cfgs(device, arg_key): | |||
| enable_sparse=bool, max_call_depth=int, env_config_path=str) | |||
| def set_context(**kwargs): | |||
| """ | |||
| Sets context for running environment. | |||
| Set context for running environment. | |||
| Context should be configured before running your program. If there is no configuration, | |||
| the "Ascend" device target will be used by default. GRAPH_MODE or | |||
| @@ -679,7 +679,7 @@ def set_context(**kwargs): | |||
| def get_context(attr_key): | |||
| """ | |||
| Gets context attribute value according to the input key. | |||
| Get context attribute value according to the input key. | |||
| Args: | |||
| attr_key (str): The key of the attribute. | |||
| @@ -4812,7 +4812,7 @@ class _NumpySlicesDataset: | |||
| class NumpySlicesDataset(GeneratorDataset): | |||
| """ | |||
| Create a dataset with given data slices, mainly for loading Python data into dataset. | |||
| Creates a dataset with given data slices, mainly for loading Python data into dataset. | |||
| This dataset can take in a sampler. 'sampler' and 'shuffle' are mutually exclusive. The table | |||
| below shows what input arguments are allowed and their expected behavior. | |||
| @@ -4911,7 +4911,7 @@ class _PaddedDataset: | |||
| class PaddedDataset(GeneratorDataset): | |||
| """ | |||
| Create a dataset with filler data provided by user. Mainly used to add to the original data set | |||
| Creates a dataset with filler data provided by user. Mainly used to add to the original data set | |||
| and assign it to the corresponding shard. | |||
| Args: | |||
| @@ -162,7 +162,7 @@ class BoundingBoxAugment(ImageTensorOperation): | |||
| class CenterCrop(ImageTensorOperation): | |||
| """ | |||
| Crops the input image at the center to the given size. | |||
| Crop the input image at the center to the given size. | |||
| Args: | |||
| size (Union[int, sequence]): The output size of the cropped image. | |||
| @@ -417,7 +417,7 @@ class NormalizePad(ImageTensorOperation): | |||
| class Pad(ImageTensorOperation): | |||
| """ | |||
| Pads the image according to padding parameters. | |||
| Pad the image according to padding parameters. | |||
| Args: | |||
| padding (Union[int, sequence]): The number of pixels to pad the image. | |||
| @@ -827,7 +827,7 @@ def grayscale(img, num_output_channels): | |||
| def pad(img, padding, fill_value, padding_mode): | |||
| """ | |||
| Pads the image according to padding parameters. | |||
| Pad the image according to padding parameters. | |||
| Args: | |||
| img (PIL image): Image to be padded. | |||
| @@ -70,7 +70,7 @@ class Cifar100ToMR: | |||
| def run(self, fields=None): | |||
| """ | |||
| Executes transformation from cifar100 to MindRecord. | |||
| Execute transformation from cifar100 to MindRecord. | |||
| Args: | |||
| fields (list[str]): A list of index field, e.g.["fine_label", "coarse_label"]. | |||
| @@ -70,7 +70,7 @@ class Cifar10ToMR: | |||
| def run(self, fields=None): | |||
| """ | |||
| Executes transformation from cifar10 to MindRecord. | |||
| Execute transformation from cifar10 to MindRecord. | |||
| Args: | |||
| fields (list[str], optional): A list of index fields, e.g.["label"] (default=None). | |||
| @@ -119,7 +119,7 @@ class CsvToMR: | |||
| def run(self): | |||
| """ | |||
| Executes transformation from csv to MindRecord. | |||
| Execute transformation from csv to MindRecord. | |||
| Returns: | |||
| MSRStatus, whether csv is successfully transformed to MindRecord. | |||
| @@ -120,7 +120,7 @@ class ImageNetToMR: | |||
| def run(self): | |||
| """ | |||
| Executes transformation from imagenet to MindRecord. | |||
| Execute transformation from imagenet to MindRecord. | |||
| Returns: | |||
| MSRStatus, whether imagenet is successfully transformed to MindRecord. | |||
| @@ -123,7 +123,7 @@ class MnistToMR: | |||
| def _transform_train(self): | |||
| """ | |||
| Executes transformation from Mnist train part to MindRecord. | |||
| Execute transformation from Mnist train part to MindRecord. | |||
| Returns: | |||
| MSRStatus, whether successfully written into MindRecord. | |||
| @@ -171,7 +171,7 @@ class MnistToMR: | |||
| def _transform_test(self): | |||
| """ | |||
| Executes transformation from Mnist test part to MindRecord. | |||
| Execute transformation from Mnist test part to MindRecord. | |||
| Returns: | |||
| MSRStatus, whether Mnist is successfully transformed to MindRecord. | |||
| @@ -220,7 +220,7 @@ class MnistToMR: | |||
| def run(self): | |||
| """ | |||
| Executes transformation from Mnist to MindRecord. | |||
| Execute transformation from Mnist to MindRecord. | |||
| Returns: | |||
| MSRStatus, whether successfully written into MindRecord. | |||
| @@ -75,7 +75,7 @@ def _check_inputs(learning_rate, decay_rate, total_step, step_per_epoch, decay_e | |||
| def exponential_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, decay_epoch, is_stair=False): | |||
| r""" | |||
| Calculate learning rate base on exponential decay function. | |||
| Calculates learning rate base on exponential decay function. | |||
| For the i-th step, the formula of computing decayed_learning_rate[i] is: | |||
| @@ -118,7 +118,7 @@ def exponential_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, | |||
| def natural_exp_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, decay_epoch, is_stair=False): | |||
| r""" | |||
| Calculate learning rate base on natural exponential decay function. | |||
| Calculates learning rate base on natural exponential decay function. | |||
| For the i-th step, the formula of computing decayed_learning_rate[i] is: | |||
| @@ -162,7 +162,7 @@ def natural_exp_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, | |||
| def inverse_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, decay_epoch, is_stair=False): | |||
| r""" | |||
| Calculate learning rate base on inverse-time decay function. | |||
| Calculates learning rate base on inverse-time decay function. | |||
| For the i-th step, the formula of computing decayed_learning_rate[i] is: | |||
| @@ -205,7 +205,7 @@ def inverse_decay_lr(learning_rate, decay_rate, total_step, step_per_epoch, deca | |||
| def cosine_decay_lr(min_lr, max_lr, total_step, step_per_epoch, decay_epoch): | |||
| r""" | |||
| Calculate learning rate base on cosine decay function. | |||
| Calculates learning rate base on cosine decay function. | |||
| For the i-th step, the formula of computing decayed_learning_rate[i] is: | |||
| @@ -257,7 +257,7 @@ def cosine_decay_lr(min_lr, max_lr, total_step, step_per_epoch, decay_epoch): | |||
| def polynomial_decay_lr(learning_rate, end_learning_rate, total_step, step_per_epoch, decay_epoch, power, | |||
| update_decay_epoch=False): | |||
| r""" | |||
| Calculate learning rate base on polynomial decay function. | |||
| Calculates learning rate base on polynomial decay function. | |||
| For the i-th step, the formula of computing decayed_learning_rate[i] is: | |||
| @@ -332,7 +332,7 @@ def polynomial_decay_lr(learning_rate, end_learning_rate, total_step, step_per_e | |||
| def warmup_lr(learning_rate, total_step, step_per_epoch, warmup_epoch): | |||
| r""" | |||
| Get learning rate warming up. | |||
| Gets learning rate warming up. | |||
| For the i-th step, the formula of computing warmup_learning_rate[i] is: | |||
| @@ -38,7 +38,7 @@ __all__ = ['Dropout', 'Flatten', 'Dense', 'ClipByNorm', 'Norm', 'OneHot', 'Pad', | |||
| class L1Regularizer(Cell): | |||
| r""" | |||
| Apply l1 regularization to weights | |||
| Applies l1 regularization to weights. | |||
| l1 regularization makes weights sparsity | |||
| @@ -730,7 +730,7 @@ class ResizeBilinear(Cell): | |||
| class Unfold(Cell): | |||
| r""" | |||
| Extract patches from images. | |||
| Extracts patches from images. | |||
| The input tensor must be a 4-D tensor and the data format is NCHW. | |||
| Args: | |||
| @@ -479,7 +479,7 @@ def _get_bbox(rank, shape, central_fraction): | |||
| class CentralCrop(Cell): | |||
| """ | |||
| Crop the centeral region of the images with the central_fraction. | |||
| Crops the centeral region of the images with the central_fraction. | |||
| Args: | |||
| central_fraction (float): Fraction of size to crop. It must be float and in range (0.0, 1.0]. | |||
| @@ -1148,7 +1148,7 @@ class DenseQuant(Cell): | |||
| class _QuantActivation(Cell): | |||
| r""" | |||
| Base class for quantization aware training activation function. Add fake quantized operation | |||
| Base class for quantization aware training activation function. Adds fake quantized operation | |||
| after activation operation. | |||
| """ | |||
| @@ -1232,7 +1232,7 @@ class ActQuant(_QuantActivation): | |||
| class TensorAddQuant(Cell): | |||
| r""" | |||
| Add fake quantized operation after TensorAdd operation. | |||
| Adds fake quantized operation after TensorAdd operation. | |||
| This part is a more detailed overview of TensorAdd operation. For more detials about Quantilization, | |||
| please refer to :class:`mindspore.nn.FakeQuantWithMinMaxObserver`. | |||
| @@ -1288,7 +1288,7 @@ class TensorAddQuant(Cell): | |||
| class MulQuant(Cell): | |||
| r""" | |||
| Add fake quantized operation after `Mul` operation. | |||
| Adds fake quantized operation after `Mul` operation. | |||
| This part is a more detailed overview of `Mul` operation. For more detials about Quantilization, | |||
| please refer to :class:`mindspore.nn.FakeQuantWithMinMaxObserver`. | |||
| @@ -18,7 +18,7 @@ import numpy as np | |||
| def auc(x, y, reorder=False): | |||
| """ | |||
| Compute the Area Under the Curve (AUC) using the trapezoidal rule. This is a general function, given points on a | |||
| Computes the Area Under the Curve (AUC) using the trapezoidal rule. This is a general function, given points on a | |||
| curve. For computing the area under the ROC-curve. | |||
| Args: | |||
| @@ -21,7 +21,7 @@ from .metric import Metric | |||
| class BleuScore(Metric): | |||
| """ | |||
| Calculate BLEU score of machine translated text with one or more references. | |||
| Calculates BLEU score of machine translated text with one or more references. | |||
| Args: | |||
| n_gram (int): The n_gram value ranged from 1 to 4. Default: 4 | |||
| @@ -66,7 +66,7 @@ class _ROISpatialData(metaclass=ABCMeta): | |||
| class HausdorffDistance(Metric): | |||
| r""" | |||
| Calculate the Hausdorff distance. Hausdorff distance is the maximum and minimum distance between two point sets. | |||
| Calculates the Hausdorff distance. Hausdorff distance is the maximum and minimum distance between two point sets. | |||
| Given two feature sets A and B, the Hausdorff distance between two point sets A and B is defined as follows: | |||
| .. math:: | |||
| @@ -20,7 +20,7 @@ from .metric import Metric | |||
| class ROC(Metric): | |||
| """ | |||
| Calculate the ROC curve. It is suitable for solving binary classification and multi classification problems. | |||
| Calculates the ROC curve. It is suitable for solving binary classification and multi classification problems. | |||
| In the case of multiclass, the values will be calculated based on a one-vs-the-rest approach. | |||
| Args: | |||
| @@ -1671,7 +1671,7 @@ def flipud(m): | |||
| def fliplr(m): | |||
| """ | |||
| Flip the entries in each row in the left/right direction. | |||
| Flips the entries in each row in the left/right direction. | |||
| Columns are preserved, but appear in a different order than before. | |||
| Note: | |||
| @@ -126,7 +126,7 @@ class Randperm(PrimitiveWithInfer): | |||
| class NoRepeatNGram(PrimitiveWithInfer): | |||
| """ | |||
| Update log_probs with repeat n-grams. | |||
| Updates log_probs with repeat n-grams. | |||
| During beam search, if consecutive `ngram_size` words exist in the generated word sequence, | |||
| the consecutive `ngram_size` words will be avoided during subsequent prediction. | |||
| @@ -227,9 +227,9 @@ class InternalCallbackParam(dict): | |||
| class RunContext: | |||
| """ | |||
| Provides information about the model. | |||
| Provide information about the model. | |||
| Provides information about original request to model function. | |||
| Provide information about original request to model function. | |||
| Callback objects can stop the loop by calling request_stop() of run_context. | |||
| Args: | |||
| @@ -252,7 +252,7 @@ class RunContext: | |||
| def request_stop(self): | |||
| """ | |||
| Sets stop requirement during training. | |||
| Set stop requirement during training. | |||
| Callbacks can use this function to request stop of iterations. | |||
| model.train() checks whether this is called or not. | |||
| @@ -261,7 +261,7 @@ class RunContext: | |||
| def get_stop_requested(self): | |||
| """ | |||
| Returns whether a stop is requested or not. | |||
| Return whether a stop is requested or not. | |||
| Returns: | |||
| bool, if true, model.train() stops iterations. | |||
| @@ -202,7 +202,7 @@ class SummaryRecord: | |||
| def set_mode(self, mode): | |||
| """ | |||
| Sets the training phase. Different training phases affect data recording. | |||
| Set the training phase. Different training phases affect data recording. | |||
| Args: | |||
| mode (str): The mode to be set, which should be 'train' or 'eval'. When the mode is 'eval', | |||