昇腾社区首页
中文
注册

ApplyGradientsStrategy

功能描述

枚举类型,设置了实施梯度的策略。

类成员常量

  • DIRECT_APPLY:"direct_apply",直接实施。
  • SUM_SAME_ID_GRADIENTS_AND_APPLY:"sum_same_id_gradient_and_apply",对具有相同id的梯度求和。

使用示例

import temsorflow as tf

from mx_rec.constants.constants import ApplyGradientsStrategy

# global_env.apply_gradients_strategy 为环境变量apply_gradients_strategy的取值
if global_env.apply_gradients_strategy == ApplyGradientsStrategy.SUM_SAME_ID_GRADIENTS_AND_APPLY.value:
        # 执行相应的梯度更新操作