From 35a4ca54e9ca33ae34336ef2a451e88534758229 Mon Sep 17 00:00:00 2001 From: xingzhongfan Date: Wed, 26 Mar 2025 15:44:08 +0800 Subject: [PATCH] fix typo --- MindFlow/mindflow/core/losses.py | 12 +++---- .../mindflow.core.MTLWeightedLoss.rst} | 4 +-- .../mindflow.core.RelativeRMSELoss.rst} | 4 +-- .../mindflow.core.WaveletTransformLoss.rst} | 36 +++++++++---------- .../mindflow.core.batched_hessian.rst} | 6 ++-- .../mindflow.core.batched_jacobian.rst} | 6 ++-- .../mindflow.core.get_loss_metric.rst} | 4 +-- .../mindflow.core.get_multi_step_lr.rst} | 4 +-- .../mindflow.core.get_poly_lr.rst} | 4 +-- ...w.core.get_warmup_cosine_annealing_lr.rst} | 6 ++-- docs/api_python/mindflow/mindflow.common.rst | 11 ------ docs/api_python/mindflow/mindflow.core.rst | 17 +++++++++ docs/api_python/mindflow/mindflow.loss.rst | 12 ------- .../mindflow/mindflow.operators.rst | 10 ------ .../mindflow/mindflow.common.rst | 11 ------ docs/api_python_en/mindflow/mindflow.core.rst | 17 +++++++++ docs/api_python_en/mindflow/mindflow.loss.rst | 12 ------- .../mindflow/mindflow.operators.rst | 10 ------ 18 files changed, 73 insertions(+), 113 deletions(-) rename docs/api_python/mindflow/{loss/mindflow.loss.MTLWeightedLoss.rst => core/mindflow.core.MTLWeightedLoss.rst} (85%) rename docs/api_python/mindflow/{loss/mindflow.loss.RelativeRMSELoss.rst => core/mindflow.core.RelativeRMSELoss.rst} (92%) rename docs/api_python/mindflow/{loss/mindflow.loss.WaveletTransformLoss.rst => core/mindflow.core.WaveletTransformLoss.rst} (64%) rename docs/api_python/mindflow/{operators/mindflow.operators.batched_hessian.rst => core/mindflow.core.batched_hessian.rst} (53%) rename docs/api_python/mindflow/{operators/mindflow.operators.batched_jacobian.rst => core/mindflow.core.batched_jacobian.rst} (54%) rename docs/api_python/mindflow/{loss/mindflow.loss.get_loss_metric.rst => core/mindflow.core.get_loss_metric.rst} (67%) rename docs/api_python/mindflow/{common/mindflow.common.get_multi_step_lr.rst => core/mindflow.core.get_multi_step_lr.rst} (89%) rename docs/api_python/mindflow/{common/mindflow.common.get_poly_lr.rst => core/mindflow.core.get_poly_lr.rst} (85%) rename docs/api_python/mindflow/{common/mindflow.common.get_warmup_cosine_annealing_lr.rst => core/mindflow.core.get_warmup_cosine_annealing_lr.rst} (87%) delete mode 100644 docs/api_python/mindflow/mindflow.common.rst create mode 100644 docs/api_python/mindflow/mindflow.core.rst delete mode 100644 docs/api_python/mindflow/mindflow.loss.rst delete mode 100644 docs/api_python/mindflow/mindflow.operators.rst delete mode 100644 docs/api_python_en/mindflow/mindflow.common.rst create mode 100644 docs/api_python_en/mindflow/mindflow.core.rst delete mode 100644 docs/api_python_en/mindflow/mindflow.loss.rst delete mode 100644 docs/api_python_en/mindflow/mindflow.operators.rst diff --git a/MindFlow/mindflow/core/losses.py b/MindFlow/mindflow/core/losses.py index 404d0ed5a..d4e2bb705 100644 --- a/MindFlow/mindflow/core/losses.py +++ b/MindFlow/mindflow/core/losses.py @@ -164,10 +164,10 @@ class MTLWeightedLoss(WeightedLossCell): is higher than certain constant given. Inputs: - - **input** - tuple of Tensors. + - **input** (tuple[Tensor]) - The input data. Outputs: - Tensor. losses for MTL weighted strategy. + Tensor. Losses for MTL weighted strategy. Supported Platforms: ``Ascend`` ``GPU`` @@ -220,7 +220,7 @@ class WaveletTransformLoss(nn.LossBase): The multi-level wavelet transformation losses. Args: - wave_level (int): The number of the wavelet transformation levels, should be positive integer. + wave_level (int): The number of the wavelet transformation levels, should be positive integer. Default: ``2``. regroup (bool): The regroup error combination form of the wavelet transformation losses. Default: ``"False"``. Inputs: @@ -229,11 +229,7 @@ class WaveletTransformLoss(nn.LossBase): P denotes the patch size. C denots the feature channels. Outputs: - Tensor. - - Raises: - TypeError: if `wave_level` is not an int. - TypeError: if `regroup` is not a bool. + Tensor. Losses for multi-level wavelet transformation. Supported Platforms: ``Ascend`` ``GPU`` diff --git a/docs/api_python/mindflow/loss/mindflow.loss.MTLWeightedLoss.rst b/docs/api_python/mindflow/core/mindflow.core.MTLWeightedLoss.rst similarity index 85% rename from docs/api_python/mindflow/loss/mindflow.loss.MTLWeightedLoss.rst rename to docs/api_python/mindflow/core/mindflow.core.MTLWeightedLoss.rst index 776ef481f..30171e7be 100644 --- a/docs/api_python/mindflow/loss/mindflow.loss.MTLWeightedLoss.rst +++ b/docs/api_python/mindflow/core/mindflow.core.MTLWeightedLoss.rst @@ -1,7 +1,7 @@ -mindflow.loss.MTLWeightedLoss +mindflow.core.MTLWeightedLoss ================================= -.. py:class:: mindflow.loss.MTLWeightedLoss(num_losses, bound_param=0.0) +.. py:class:: mindflow.core.MTLWeightedLoss(num_losses, bound_param=0.0) 计算MTL策略自动加权多任务损失。请参考 `自动加权进行多任务学习 `_ 。 diff --git a/docs/api_python/mindflow/loss/mindflow.loss.RelativeRMSELoss.rst b/docs/api_python/mindflow/core/mindflow.core.RelativeRMSELoss.rst similarity index 92% rename from docs/api_python/mindflow/loss/mindflow.loss.RelativeRMSELoss.rst rename to docs/api_python/mindflow/core/mindflow.core.RelativeRMSELoss.rst index e0f05a4f4..d680698e9 100644 --- a/docs/api_python/mindflow/loss/mindflow.loss.RelativeRMSELoss.rst +++ b/docs/api_python/mindflow/core/mindflow.core.RelativeRMSELoss.rst @@ -1,7 +1,7 @@ -mindflow.loss.RelativeRMSELoss +mindflow.core.RelativeRMSELoss ============================== -.. py:class:: mindflow.loss.RelativeRMSELoss(reduction="sum") +.. py:class:: mindflow.core.RelativeRMSELoss(reduction="sum") 相对均方根误差(RRMSE)是由均方根值归一化的均方根误差,其中每个残差都是根据实际值缩放的。 Relative RMSELoss用来测量 :math:`x` 和 :math:`y` 之间的相对均方根误差,其中 :math:`x` 是预测值, :math:`y` 是目标值。 diff --git a/docs/api_python/mindflow/loss/mindflow.loss.WaveletTransformLoss.rst b/docs/api_python/mindflow/core/mindflow.core.WaveletTransformLoss.rst similarity index 64% rename from docs/api_python/mindflow/loss/mindflow.loss.WaveletTransformLoss.rst rename to docs/api_python/mindflow/core/mindflow.core.WaveletTransformLoss.rst index d29751757..bf3bc6af1 100644 --- a/docs/api_python/mindflow/loss/mindflow.loss.WaveletTransformLoss.rst +++ b/docs/api_python/mindflow/core/mindflow.core.WaveletTransformLoss.rst @@ -1,20 +1,16 @@ -mindflow.loss.WaveletTransformLoss -================================== - -.. py:class:: mindflow.loss.WaveletTransformLoss(wave_level=2, regroup=False) - - 多级小波变换损失。 - - 参数: - - **wave_level** (int) - 小波变换级数,应为正整数。默认值: ``2``。 - - **regroup** (bool) - 小波变换损失的regroup误差组合形式。默认值: ``False``。 - - 输入: - - **input** - 张量构成的tuple。Tensor的shape为 :math:`(B*H*W/(P*P), P*P*C)` ,其中B表示批次大小。H、W分别表示图像的高度和宽度。P表示补丁大小。C表示特征通道。 - - 输出: - Tensor。小波变换损失函数输出。 - - 异常: - - **TypeError** - 如果 `wave_level` 不是int。 - - **TypeError** - 如果 `regroup` bool。 \ No newline at end of file +mindflow.core.WaveletTransformLoss +================================== + +.. py:class:: mindflow.core.WaveletTransformLoss(wave_level=2, regroup=False) + + 多级小波变换损失。 + + 参数: + - **wave_level** (int) - 小波变换级数,应为正整数。默认值: ``2``。 + - **regroup** (bool) - 小波变换损失的regroup误差组合形式。默认值: ``False``。 + + 输入: + - **input** - 张量构成的tuple。Tensor的shape为 :math:`(B*H*W/(P*P), P*P*C)` ,其中B表示批次大小。H、W分别表示图像的高度和宽度。P表示补丁大小。C表示特征通道。 + + 输出: + Tensor。小波变换损失函数输出。 \ No newline at end of file diff --git a/docs/api_python/mindflow/operators/mindflow.operators.batched_hessian.rst b/docs/api_python/mindflow/core/mindflow.core.batched_hessian.rst similarity index 53% rename from docs/api_python/mindflow/operators/mindflow.operators.batched_hessian.rst rename to docs/api_python/mindflow/core/mindflow.core.batched_hessian.rst index 72ccfdfd2..c310bfed9 100644 --- a/docs/api_python/mindflow/operators/mindflow.operators.batched_hessian.rst +++ b/docs/api_python/mindflow/core/mindflow.core.batched_hessian.rst @@ -1,7 +1,7 @@ -mindflow.operators.batched_hessian +mindflow.core.batched_hessian ================================== -.. py:function:: mindflow.operators.batched_hessian(model) +.. py:function:: mindflow.core.batched_hessian(model) 计算网络模型的海森矩阵。 @@ -9,7 +9,7 @@ mindflow.operators.batched_hessian - **model** (mindspore.nn.Cell) - 输入维度为in_channels输出维度为out_channels的网络模型。 返回: - Function,用于计算海森矩阵的Hessian实例。输入维度为:[batch_size,in_channels],输出维度为:[out_channels,in_channels,batch_size,in_channels]。 + Jacobian(Tensor),用于计算海森矩阵的Hessian实例。输入维度为:[batch_size,in_channels],输出维度为:[out_channels,in_channels,batch_size,in_channels]。 .. note:: 要求MindSpore版本 >= 2.0.0调用如下接口: `mindspore.jacrev` 。 \ No newline at end of file diff --git a/docs/api_python/mindflow/operators/mindflow.operators.batched_jacobian.rst b/docs/api_python/mindflow/core/mindflow.core.batched_jacobian.rst similarity index 54% rename from docs/api_python/mindflow/operators/mindflow.operators.batched_jacobian.rst rename to docs/api_python/mindflow/core/mindflow.core.batched_jacobian.rst index 27f29b298..581127b16 100644 --- a/docs/api_python/mindflow/operators/mindflow.operators.batched_jacobian.rst +++ b/docs/api_python/mindflow/core/mindflow.core.batched_jacobian.rst @@ -1,7 +1,7 @@ -mindflow.operators.batched_jacobian +mindflow.core.batched_jacobian =================================== -.. py:function:: mindflow.operators.batched_jacobian(model) +.. py:function:: mindflow.core.batched_jacobian(model) 计算网络模型的雅可比矩阵。 @@ -9,7 +9,7 @@ mindflow.operators.batched_jacobian - **model** (mindspore.nn.Cell) - 输入维度为in_channels输出维度为out_channels的网络模型。 返回: - Function,用于计算雅可比矩阵的Jacobian实例。输入维度为:[batch_size,in_channels],输出维度为:[out_channels,batch_size,in_channels]。 + Hessian(Tensor),用于计算雅可比矩阵的Jacobian实例。输入维度为:[batch_size,in_channels],输出维度为:[out_channels,batch_size,in_channels]。 .. note:: 要求MindSpore版本 >= 2.0.0调用如下接口: `mindspore.jacrev` 。 \ No newline at end of file diff --git a/docs/api_python/mindflow/loss/mindflow.loss.get_loss_metric.rst b/docs/api_python/mindflow/core/mindflow.core.get_loss_metric.rst similarity index 67% rename from docs/api_python/mindflow/loss/mindflow.loss.get_loss_metric.rst rename to docs/api_python/mindflow/core/mindflow.core.get_loss_metric.rst index d2f583eef..75b56a7d6 100644 --- a/docs/api_python/mindflow/loss/mindflow.loss.get_loss_metric.rst +++ b/docs/api_python/mindflow/core/mindflow.core.get_loss_metric.rst @@ -1,7 +1,7 @@ -mindflow.loss.get_loss_metric +mindflow.core.get_loss_metric ============================= -.. py:function:: mindflow.loss.get_loss_metric(name) +.. py:function:: mindflow.core.get_loss_metric(name) 获取损失函数。 diff --git a/docs/api_python/mindflow/common/mindflow.common.get_multi_step_lr.rst b/docs/api_python/mindflow/core/mindflow.core.get_multi_step_lr.rst similarity index 89% rename from docs/api_python/mindflow/common/mindflow.common.get_multi_step_lr.rst rename to docs/api_python/mindflow/core/mindflow.core.get_multi_step_lr.rst index c3fe69ae5..adcf05de6 100644 --- a/docs/api_python/mindflow/common/mindflow.common.get_multi_step_lr.rst +++ b/docs/api_python/mindflow/core/mindflow.core.get_multi_step_lr.rst @@ -1,7 +1,7 @@ -mindflow.common.get_multi_step_lr +mindflow.core.get_multi_step_lr ================================= -.. py:function:: mindflow.common.get_multi_step_lr(lr_init, milestones, gamma, steps_per_epoch, last_epoch) +.. py:function:: mindflow.core.get_multi_step_lr(lr_init, milestones, gamma, steps_per_epoch, last_epoch) epoch的数量到达其中一个milestone时,学习率按 `gamma` 进行衰减,生成学习率数组。 diff --git a/docs/api_python/mindflow/common/mindflow.common.get_poly_lr.rst b/docs/api_python/mindflow/core/mindflow.core.get_poly_lr.rst similarity index 85% rename from docs/api_python/mindflow/common/mindflow.common.get_poly_lr.rst rename to docs/api_python/mindflow/core/mindflow.core.get_poly_lr.rst index bdb5ab47f..708bc3e7c 100644 --- a/docs/api_python/mindflow/common/mindflow.common.get_poly_lr.rst +++ b/docs/api_python/mindflow/core/mindflow.core.get_poly_lr.rst @@ -1,7 +1,7 @@ -mindflow.common.get_poly_lr +mindflow.core.get_poly_lr =========================== -.. py:function:: mindflow.common.get_poly_lr(global_step, lr_init, lr_end, lr_max, warmup_steps, total_steps, poly_power) +.. py:function:: mindflow.core.get_poly_lr(global_step, lr_init, lr_end, lr_max, warmup_steps, total_steps, poly_power) 生成指数衰减的学习率。学习率随着训练步数进行指数衰减。当step小于warmup_steps时,:math:`lr = step * (lr\_max - lr\_init)/warmup\_steps` ,之后 :math:`lr = lr\_end + (lr\_max - lr\_end) * [(1 - i + step)/(total\_steps - warmup\_steps)]**poly\_power`。 diff --git a/docs/api_python/mindflow/common/mindflow.common.get_warmup_cosine_annealing_lr.rst b/docs/api_python/mindflow/core/mindflow.core.get_warmup_cosine_annealing_lr.rst similarity index 87% rename from docs/api_python/mindflow/common/mindflow.common.get_warmup_cosine_annealing_lr.rst rename to docs/api_python/mindflow/core/mindflow.core.get_warmup_cosine_annealing_lr.rst index f54dda046..b0f8cba14 100644 --- a/docs/api_python/mindflow/common/mindflow.common.get_warmup_cosine_annealing_lr.rst +++ b/docs/api_python/mindflow/core/mindflow.core.get_warmup_cosine_annealing_lr.rst @@ -1,7 +1,7 @@ -mindflow.common.get_warmup_cosine_annealing_lr +mindflow.core.get_warmup_cosine_annealing_lr ============================================== -.. py:function:: mindflow.common.get_warmup_cosine_annealing_lr(lr_init, steps_per_epoch, last_epoch, warmup_epochs=0, warmup_lr_init=0.0, eta_min=1e-6) +.. py:function:: mindflow.core.get_warmup_cosine_annealing_lr(lr_init, steps_per_epoch, last_epoch, warmup_epochs=0, warmup_lr_init=0.0, eta_min=1e-6) 基于余弦函数生成衰减学习率数组。如果指定了预热epoch,将通过线性方法对预热epoch进行预热。 对于第 `i` 步,计算余弦衰减的学习速率decayed_learning_rate[i]的表达式为: @@ -10,7 +10,7 @@ mindflow.common.get_warmup_cosine_annealing_lr decayed\_learning\_rate[i] = eta\_min + 0.5 * (lr\_init - eta\_min) * (1 + cos(\frac{current\_epoch}{last\_epoch}\pi)) - 其中 :math:`current\_epoch = floor(\frac{i}{steps\_per\_epoch})` . + 其中 :math:`current\_epoch = floor(\frac{i}{steps\_per\_epoch})` 。 如果指定了预热epoch,对于预热epoch的第 `i` 步,预热学习速率的计算表达式warmup_learning_rate[i]为: diff --git a/docs/api_python/mindflow/mindflow.common.rst b/docs/api_python/mindflow/mindflow.common.rst deleted file mode 100644 index ba981062c..000000000 --- a/docs/api_python/mindflow/mindflow.common.rst +++ /dev/null @@ -1,11 +0,0 @@ -mindflow.common -================== - -.. mscnplatformautosummary:: - :toctree: common - :nosignatures: - :template: classtemplate.rst - - mindflow.common.get_multi_step_lr - mindflow.common.get_poly_lr - mindflow.common.get_warmup_cosine_annealing_lr \ No newline at end of file diff --git a/docs/api_python/mindflow/mindflow.core.rst b/docs/api_python/mindflow/mindflow.core.rst new file mode 100644 index 000000000..3bf67302f --- /dev/null +++ b/docs/api_python/mindflow/mindflow.core.rst @@ -0,0 +1,17 @@ +mindflow.core +================== + +.. mscnplatformautosummary:: + :toctree: core + :nosignatures: + :template: classtemplate.rst + + mindflow.core.get_multi_step_lr + mindflow.core.get_poly_lr + mindflow.core.get_warmup_cosine_annealing_lr + mindflow.core.MTLWeightedLoss + mindflow.core.RelativeRMSELoss + mindflow.core.WaveletTransformLoss + mindflow.core.get_loss_metric + mindflow.core.batched_hessian + mindflow.core.batched_jacobian \ No newline at end of file diff --git a/docs/api_python/mindflow/mindflow.loss.rst b/docs/api_python/mindflow/mindflow.loss.rst deleted file mode 100644 index eb44e056a..000000000 --- a/docs/api_python/mindflow/mindflow.loss.rst +++ /dev/null @@ -1,12 +0,0 @@ -mindflow.loss -================== - -.. mscnplatformautosummary:: - :toctree: loss - :nosignatures: - :template: classtemplate.rst - - mindflow.loss.MTLWeightedLoss - mindflow.loss.RelativeRMSELoss - mindflow.loss.WaveletTransformLoss - mindflow.loss.get_loss_metric \ No newline at end of file diff --git a/docs/api_python/mindflow/mindflow.operators.rst b/docs/api_python/mindflow/mindflow.operators.rst deleted file mode 100644 index e44093e4b..000000000 --- a/docs/api_python/mindflow/mindflow.operators.rst +++ /dev/null @@ -1,10 +0,0 @@ -mindflow.operators -=================== - -.. mscnplatformautosummary:: - :toctree: operators - :nosignatures: - :template: classtemplate.rst - - mindflow.operators.batched_hessian - mindflow.operators.batched_jacobian \ No newline at end of file diff --git a/docs/api_python_en/mindflow/mindflow.common.rst b/docs/api_python_en/mindflow/mindflow.common.rst deleted file mode 100644 index e83f46661..000000000 --- a/docs/api_python_en/mindflow/mindflow.common.rst +++ /dev/null @@ -1,11 +0,0 @@ -mindflow.common -================== - -.. msplatformautosummary:: - :toctree: common - :nosignatures: - :template: classtemplate.rst - - mindflow.common.get_multi_step_lr - mindflow.common.get_poly_lr - mindflow.common.get_warmup_cosine_annealing_lr \ No newline at end of file diff --git a/docs/api_python_en/mindflow/mindflow.core.rst b/docs/api_python_en/mindflow/mindflow.core.rst new file mode 100644 index 000000000..3d4d207df --- /dev/null +++ b/docs/api_python_en/mindflow/mindflow.core.rst @@ -0,0 +1,17 @@ +mindflow.core +================== + +.. msplatformautosummary:: + :toctree: core + :nosignatures: + :template: classtemplate.rst + + mindflow.core.get_multi_step_lr + mindflow.core.get_poly_lr + mindflow.core.get_warmup_cosine_annealing_lr + mindflow.core.MTLWeightedLoss + mindflow.core.RelativeRMSELoss + mindflow.core.WaveletTransformLoss + mindflow.core.get_loss_metric + mindflow.core.batched_hessian + mindflow.core.batched_jacobian \ No newline at end of file diff --git a/docs/api_python_en/mindflow/mindflow.loss.rst b/docs/api_python_en/mindflow/mindflow.loss.rst deleted file mode 100644 index cb6abda15..000000000 --- a/docs/api_python_en/mindflow/mindflow.loss.rst +++ /dev/null @@ -1,12 +0,0 @@ -mindflow.loss -================== - -.. msplatformautosummary:: - :toctree: loss - :nosignatures: - :template: classtemplate.rst - - mindflow.loss.MTLWeightedLoss - mindflow.loss.RelativeRMSELoss - mindflow.loss.WaveletTransformLoss - mindflow.loss.get_loss_metric \ No newline at end of file diff --git a/docs/api_python_en/mindflow/mindflow.operators.rst b/docs/api_python_en/mindflow/mindflow.operators.rst deleted file mode 100644 index 937f97635..000000000 --- a/docs/api_python_en/mindflow/mindflow.operators.rst +++ /dev/null @@ -1,10 +0,0 @@ -mindflow.operators -=================== - -.. msplatformautosummary:: - :toctree: operators - :nosignatures: - :template: classtemplate.rst - - mindflow.operators.batched_hessian - mindflow.operators.batched_jacobian \ No newline at end of file -- Gitee