Home
last modified time | relevance | path

Searched refs:loss_scale (Results 1 – 25 of 76) sorted by relevance

1234

/third_party/mindspore/mindspore/train/
Dloss_scale_manager.py66 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)
Damp.py21 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/
Dtest_yolov3.py98 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/
Dtest_resnet50_imagenet.py172 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/
Doptimizer.py129 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 …]
Dada_grad.py150 update_slots=True, loss_scale=1.0, weight_decay=0.0): argument
151 super(Adagrad, self).__init__(learning_rate, params, weight_decay, loss_scale)
Dftrl.py198 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)
Dmomentum.py151 …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)
Dsgd.py140 loss_scale=1.0): argument
142 super(SGD, self).__init__(learning_rate, params, weight_decay, loss_scale)
Dthor.py244 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/
Dtest_loss_scale.py26 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/
Dlenet_export.py35 loss_scale = 128.0 variable
36 loss_scale_manager = FixedLossScaleManager(loss_scale, False)
/third_party/mindspore/tests/ut/python/nn/optim/
Dtest_ftrl.py66 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)
Dtest_proximal_ada_grad.py66 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)
Dtest_optimizer.py52 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/
Dtest_ftrl.py47 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/
Dtest_fl_fasterrcnn.py188 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/
Dthor.py147 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/
Dtest_sgd_op.py54 loss_scale = 1.0
57 weight_decay, nesterov, loss_scale)
/third_party/mindspore/tests/st/ops/cpu/
Dtest_sgd_op.py54 loss_scale = 1.0
57 weight_decay, nesterov, loss_scale)
/third_party/mindspore/tests/st/model_zoo_tests/DeepFM/src/
Ddeepfm.py296 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/
Dtest_optimizer_with_loss_scale.py24 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/
Dtest_pynative_ftrl.py47 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/
Dtest_heterogeneous_excutor.py72 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/
Dtest_transformer.py203 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)

1234