/third_party/mindspore/mindspore/train/ |
D | loss_scale_manager.py | 66 def __init__(self, loss_scale=128.0, drop_overflow_update=True): argument 67 if loss_scale < 1: 69 "but got {}".format(loss_scale)) 70 self._loss_scale = loss_scale 135 self.loss_scale = init_loss_scale 155 return self.loss_scale 165 self.loss_scale = max(self.loss_scale * self.decrease_ratio, 1) 170 self.loss_scale *= self.increase_ratio 195 return nn.DynamicLossScaleUpdateCell(self.loss_scale, self.scale_factor, self.scale_window)
|
D | amp.py | 21 from ..nn.wrap.loss_scale import _TrainPipelineWithLossScaleCell 196 loss_scale = 1.0 199 loss_scale = loss_scale_manager.get_loss_scale() 220 network = boost.BoostTrainOneStepCell(network, optimizer, loss_scale).set_train() 222 network = nn.TrainOneStepCell(network, optimizer, loss_scale).set_train()
|
/third_party/mindspore/tests/st/model_zoo_tests/yolov3/ |
D | test_yolov3.py | 98 loss_scale = 1024 113 loss_scale = float(loss_scale) 128 … opt = nn.Adam(filter(lambda x: x.requires_grad, net.get_parameters()), lr, loss_scale=loss_scale) 129 net = TrainingWrapper(net, opt, loss_scale)
|
/third_party/mindspore/tests/st/networks/models/resnet50/ |
D | test_resnet50_imagenet.py | 172 loss_scale = FixedLossScaleManager(config.loss_scale, drop_overflow_update=False) 194 loss_scale=config.loss_scale, use_nesterov=config.use_nesterov) 200 loss_scale=config.loss_scale, use_nesterov=config.use_nesterov) 204 loss_scale_manager=loss_scale, amp_level="O2", keep_batchnorm_fp32=False, 265 loss_scale = FixedLossScaleManager(thor_config.loss_scale, drop_overflow_update=False) 272 …ensor(lr), Tensor(damping), thor_config.momentum, thor_config.weight_decay, thor_config.loss_scale, 278 …model = THOR_Model(net, loss_fn=loss, optimizer=opt, loss_scale_manager=loss_scale, amp_level="O2",
|
/third_party/mindspore/mindspore/nn/optim/ |
D | optimizer.py | 129 def __init__(self, learning_rate, parameters, weight_decay=0.0, loss_scale=1.0): argument 135 if isinstance(loss_scale, int): 136 loss_scale = float(loss_scale) 137 validator.check_value_type("loss_scale", loss_scale, [float], self.cls_name) 138 validator.check_positive_float(loss_scale, "loss_scale", self.cls_name) 139 self.loss_scale = loss_scale 182 self.weight_decay = weight_decay * loss_scale 196 self.reciprocal_scale = Tensor(1.0 / loss_scale, mstype.float32) 197 self.need_scale = loss_scale != 1.0 490 weight_decay_ = cur_weight_decay * self.loss_scale [all …]
|
D | ada_grad.py | 150 update_slots=True, loss_scale=1.0, weight_decay=0.0): argument 151 super(Adagrad, self).__init__(learning_rate, params, weight_decay, loss_scale)
|
D | ftrl.py | 198 use_locking=False, loss_scale=1.0, weight_decay=0.0): argument 199 super(FTRL, self).__init__(learning_rate, params, weight_decay, loss_scale=loss_scale)
|
D | momentum.py | 151 …def __init__(self, params, learning_rate, momentum, weight_decay=0.0, loss_scale=1.0, use_nesterov… argument 152 super(Momentum, self).__init__(learning_rate, params, weight_decay, loss_scale)
|
D | sgd.py | 140 loss_scale=1.0): argument 142 super(SGD, self).__init__(learning_rate, params, weight_decay, loss_scale)
|
D | thor.py | 244 def thor(net, learning_rate, damping, momentum, weight_decay=0.0, loss_scale=1.0, batch_size=32, argument 361 …return ThorAscend(net, learning_rate, damping, momentum, weight_decay, loss_scale, batch_size, dec… 363 return ThorGpu(net, learning_rate, damping, momentum, weight_decay, loss_scale, batch_size, 372 …def __init__(self, net, learning_rate, damping, momentum, weight_decay=0.0, loss_scale=1.0, batch_… argument 376 super(ThorGpu, self).__init__(learning_rate, params, weight_decay, loss_scale) 390 self.loss_scale = Tensor(1 / (loss_scale * loss_scale), mstype.float32) 544 matrix_g = self.mul(matrix_g, self.loss_scale) 663 …def __init__(self, net, learning_rate, damping, momentum, weight_decay=0.0, loss_scale=1.0, batch_… argument 666 super(ThorAscend, self).__init__(learning_rate, params, weight_decay, loss_scale) 708 self.loss_scale = Tensor(1 / (loss_scale * loss_scale), mstype.float32) [all …]
|
/third_party/mindspore/tests/ut/python/parallel/ |
D | test_loss_scale.py | 26 from mindspore.nn.wrap.loss_scale import DynamicLossScaleUpdateCell 77 self.loss_scale = None 80 … self.loss_scale = Parameter(Tensor(scale_update_cell.get_loss_scale(), dtype=mstype.float32), 88 scaling_sens = self.loss_scale 107 overflow = self.loss_scaling_manager(self.loss_scale, cond)
|
/third_party/mindspore/mindspore/lite/examples/train_lenet/model/ |
D | lenet_export.py | 35 loss_scale = 128.0 variable 36 loss_scale_manager = FixedLossScaleManager(loss_scale, False)
|
/third_party/mindspore/tests/ut/python/nn/optim/ |
D | test_ftrl.py | 66 optimizer = FTRL(net.trainable_params(), weight_decay=0.9, loss_scale=2.0) 79 optimizer = FTRL(net.trainable_params(), weight_decay=0.9, loss_scale=2.0) 92 optimizer = FTRL(net.trainable_params(), weight_decay=0.9, loss_scale=2.0)
|
D | test_proximal_ada_grad.py | 66 optimizer = ProximalAdagrad(net.trainable_params(), weight_decay=0.9, loss_scale=1024.0) 79 optimizer = ProximalAdagrad(net.trainable_params(), weight_decay=0.9, loss_scale=1024.0) 92 optimizer = ProximalAdagrad(net.trainable_params(), weight_decay=0.9, loss_scale=1024.0)
|
D | test_optimizer.py | 52 use_nesterov=False, weight_decay=0.0, loss_scale=1.0) 58 use_nesterov=False, weight_decay=0.0, loss_scale=1.0)
|
/third_party/mindspore/tests/st/dynamic_shape/ |
D | test_ftrl.py | 47 optimizer = FTRL(net.trainable_params(), learning_rate=0.1, weight_decay=0.9, loss_scale=2.0) 68 … optimizer = LazyAdam(net.trainable_params(), learning_rate=0.1, weight_decay=0.9, loss_scale=2.0) 86 … optimizer = LazyAdam(net.trainable_params(), learning_rate=0.1, weight_decay=0.9, loss_scale=2.0)
|
/third_party/mindspore/tests/st/fl/cross_silo_faster_rcnn/ |
D | test_fl_fasterrcnn.py | 188 weight_decay=config.weight_decay, loss_scale=config.loss_scale) 191 net = TrainOneStepCell(net_with_loss, opt, sens=config.loss_scale, reduce_flag=True, 194 net = TrainOneStepCell(net_with_loss, opt, sens=config.loss_scale)
|
/third_party/mindspore/tests/st/networks/models/resnet50/src_thor/ |
D | thor.py | 147 def THOR(net, learning_rate, damping, momentum, weight_decay=0.0, loss_scale=1.0, batch_size=32, argument 152 …return THOR_Ascend(net, learning_rate, damping, momentum, weight_decay, loss_scale, batch_size, de… 159 …def __init__(self, net, learning_rate, damping, momentum, weight_decay=0.0, loss_scale=1.0, batch_… argument 162 super(THOR_Ascend, self).__init__(learning_rate, params, weight_decay, loss_scale) 212 self.weight_decay = weight_decay * loss_scale 218 self.loss_scale = Tensor(1 / (loss_scale * loss_scale), mstype.float32) 363 matrix_G = self.mul(matrix_G, self.loss_scale) 388 matrix_G = self.mul(matrix_G, self.loss_scale)
|
/third_party/mindspore/tests/st/ops/gpu/ |
D | test_sgd_op.py | 54 loss_scale = 1.0 57 weight_decay, nesterov, loss_scale)
|
/third_party/mindspore/tests/st/ops/cpu/ |
D | test_sgd_op.py | 54 loss_scale = 1.0 57 weight_decay, nesterov, loss_scale)
|
/third_party/mindspore/tests/st/model_zoo_tests/DeepFM/src/ |
D | deepfm.py | 296 def __init__(self, network, lr, eps, loss_scale=1000.0): argument 301 self.optimizer = Adam(self.weights, learning_rate=lr, eps=eps, loss_scale=loss_scale) 304 self.sens = loss_scale 396 loss_scale=self.train_config.loss_scale)
|
/third_party/mindspore/tests/ut/python/optimizer/ |
D | test_optimizer_with_loss_scale.py | 24 from mindspore.nn.wrap.loss_scale import TrainOneStepWithLossScaleCell 278 def adam_compile(loss_scale=1.0): argument 285 use_nesterov=False, weight_decay=0.0, loss_scale=loss_scale) 301 adam_compile(loss_scale=1e-40)
|
/third_party/mindspore/tests/st/pynative/dynamic_shape/ |
D | test_pynative_ftrl.py | 47 optimizer = FTRL(net.trainable_params(), learning_rate=0.1, weight_decay=0.9, loss_scale=2.0) 68 … optimizer = LazyAdam(net.trainable_params(), learning_rate=0.1, weight_decay=0.9, loss_scale=2.0)
|
/third_party/mindspore/tests/st/heterogeneous_excutor/ |
D | test_heterogeneous_excutor.py | 72 momentum=0.0009, weight_decay=0.001, loss_scale=0.0001) 85 weight_decay=0.001, loss_scale=0.0001)
|
/third_party/mindspore/tests/st/model_zoo_tests/transformer/ |
D | test_transformer.py | 203 loss_scale = np.array(callback.lossscale_list) 206 print("loss scale: {}".format(loss_scale)) 207 assert np.allclose(loss_scale[0:10], expect_loss_scale, 0, 0)
|