From d9b152f2ef1851e3537cc5bae8794c3947fc419f Mon Sep 17 00:00:00 2001 From: zhangyi Date: Thu, 18 Mar 2021 12:40:33 +0800 Subject: [PATCH] fix error format of api comments. --- mindspore/dataset/engine/datasets.py | 30 +++++++++++++--------------- mindspore/nn/metrics/roc.py | 4 ++-- mindspore/nn/optim/sgd.py | 8 ++++---- mindspore/ops/operations/comm_ops.py | 10 +++++----- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/mindspore/dataset/engine/datasets.py b/mindspore/dataset/engine/datasets.py index 162a4e29cc1..659eac23c3a 100644 --- a/mindspore/dataset/engine/datasets.py +++ b/mindspore/dataset/engine/datasets.py @@ -857,12 +857,10 @@ class Dataset: original dataset. If after rounding: - - Any size equals 0, an error will occur. - - - The sum of split sizes < K, the difference will be added to the first split. - - - The sum of split sizes > K, the difference will be removed from the first large - enough split such that it will have at least 1 row after removing the difference. + - Any size equals 0, an error will occur. + - The sum of split sizes < K, the difference will be added to the first split. + - The sum of split sizes > K, the difference will be removed from the first large + enough split such that it will have at least 1 row after removing the difference. randomize (bool, optional): Determines whether or not to split the data randomly (default=True). If True, the data will be randomly split. Otherwise, each split will be created with @@ -4120,9 +4118,9 @@ class VOCDataset(MappableDataset): The generated dataset has multiple columns : - - task='Detection', column: [['image', dtype=uint8], ['bbox', dtype=float32], ['label', dtype=uint32], - ['difficult', dtype=uint32], ['truncate', dtype=uint32]]. - - task='Segmentation', column: [['image', dtype=uint8], ['target',dtype=uint8]]. + - task='Detection', column: [['image', dtype=uint8], ['bbox', dtype=float32], ['label', dtype=uint32], + ['difficult', dtype=uint32], ['truncate', dtype=uint32]]. + - task='Segmentation', column: [['image', dtype=uint8], ['target',dtype=uint8]]. 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. @@ -4276,13 +4274,13 @@ class CocoDataset(MappableDataset): The generated dataset has multi-columns : - - task='Detection', column: [['image', dtype=uint8], ['bbox', dtype=float32], ['category_id', dtype=uint32], - ['iscrowd', dtype=uint32]]. - - task='Stuff', column: [['image', dtype=uint8], ['segmentation',dtype=float32], ['iscrowd',dtype=uint32]]. - - task='Keypoint', column: [['image', dtype=uint8], ['keypoints', dtype=float32], - ['num_keypoints', dtype=uint32]]. - - task='Panoptic', column: [['image', dtype=uint8], ['bbox', dtype=float32], ['category_id', dtype=uint32], - ['iscrowd', dtype=uint32], ['area', dtype=uint32]]. + - task='Detection', column: [['image', dtype=uint8], ['bbox', dtype=float32], ['category_id', dtype=uint32], + ['iscrowd', dtype=uint32]]. + - task='Stuff', column: [['image', dtype=uint8], ['segmentation',dtype=float32], ['iscrowd',dtype=uint32]]. + - task='Keypoint', column: [['image', dtype=uint8], ['keypoints', dtype=float32], + ['num_keypoints', dtype=uint32]]. + - task='Panoptic', column: [['image', dtype=uint8], ['bbox', dtype=float32], ['category_id', dtype=uint32], + ['iscrowd', dtype=uint32], ['area', dtype=uint32]]. This dataset can take in a sampler. 'sampler' and 'shuffle' are mutually exclusive. CocoDataset doesn't support PKSampler. The table below shows what input arguments are allowed and their expected behavior. diff --git a/mindspore/nn/metrics/roc.py b/mindspore/nn/metrics/roc.py index 5efba740972..d10159561d5 100644 --- a/mindspore/nn/metrics/roc.py +++ b/mindspore/nn/metrics/roc.py @@ -163,9 +163,9 @@ class ROC(Metric): A tuple, composed of `fpr`, `tpr`, and `thresholds`. - **fpr** (np.array) - np.array with false positive rates. If multiclass, this is a list of such np.array, - one for each class. + one for each class. - **tps** (np.array) - np.array with true positive rates. If multiclass, this is a list of such np.array, - one for each class. + one for each class. - **thresholds** (np.array) - thresholds used for computing false- and true positive rates. """ if self._is_update is False: diff --git a/mindspore/nn/optim/sgd.py b/mindspore/nn/optim/sgd.py index c4a17cc3894..877156204a5 100755 --- a/mindspore/nn/optim/sgd.py +++ b/mindspore/nn/optim/sgd.py @@ -44,13 +44,13 @@ class SGD(Optimizer): If nesterov is True: - .. math:: - p_{t+1} = p_{t} - lr \ast (gradient + u \ast v_{t+1}) + .. math:: + p_{t+1} = p_{t} - lr \ast (gradient + u \ast v_{t+1}) If nesterov is Flase: - .. math:: - p_{t+1} = p_{t} - lr \ast v_{t+1} + .. math:: + p_{t+1} = p_{t} - lr \ast v_{t+1} To be noticed, for the first step, v_{t+1} = gradient diff --git a/mindspore/ops/operations/comm_ops.py b/mindspore/ops/operations/comm_ops.py index b2b66676fa6..e19cab37fb9 100644 --- a/mindspore/ops/operations/comm_ops.py +++ b/mindspore/ops/operations/comm_ops.py @@ -29,10 +29,10 @@ class ReduceOp: There are four kinds of operation options, "SUM", "MAX", "MIN", and "PROD". - - SUM: Take the sum. - - MAX: Take the maximum. - - MIN: Take the minimum. - - PROD: Take the product. + - SUM: Take the sum. + - MAX: Take the maximum. + - MIN: Take the minimum. + - PROD: Take the product. Supported Platforms: ``Ascend`` ``GPU`` @@ -285,7 +285,7 @@ class _HostAllGather(PrimitiveWithInfer): class ReduceScatter(PrimitiveWithInfer): """ - Reduces and scatters tensors from the specified communication group. + Reduces and scatters tensors from the specified communication group. Note: The back propagation of the op is not supported yet. Stay tuned for more.