Home
last modified time | relevance | path

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

12

/external/tensorflow/tensorflow/python/training/experimental/
Dloss_scaling_gradient_tape_test.py34 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
83 loss_scale=[loss_scale_module.FixedLossScale,
88 def test_basic_tapes(self, loss_scale, strategy_fn, use_tf_function): argument
89 loss_scale = loss_scale(32)
94 with lsgt.LossScaleGradientTape(loss_scale) as g:
98 self.assertEqual(loss_scale(), 32)
103 loss_scale=[loss_scale_module.FixedLossScale,
108 def test_output_gradients(self, loss_scale, strategy_fn, use_tf_function): argument
109 loss_scale = loss_scale(32)
114 with lsgt.LossScaleGradientTape(loss_scale) as g:
[all …]
Dloss_scale_test.py36 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
66 loss_scale = loss_scale_module.FixedLossScale(loss_scale_value)
68 update_op, should_apply = loss_scale.update([constant_op.constant(0.)])
74 self.assertEqual(loss_scale_value, self.evaluate(loss_scale()))
76 update_op, should_apply = loss_scale.update(
81 self.assertEqual(loss_scale_value, self.evaluate(loss_scale()))
85 loss_scale = loss_scale_module.get(123)
86 config = loss_scale.get_config()
87 loss_scale = loss_scale_module.FixedLossScale.from_config(config)
88 self.assertEqual(self.evaluate(loss_scale()), 123.)
[all …]
Dloss_scale_optimizer_test.py38 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
136 loss_scale = 10.
138 opt, loss_scale)
142 self.assertEqual(loss_scale % strategy.num_replicas_in_sync, 0)
144 strategy, var, opt, loss_scale / strategy.num_replicas_in_sync)
156 loss_scale = 10.
157 opt = loss_scale_optimizer.MixedPrecisionLossScaleOptimizer(opt, loss_scale)
158 grad_check_fn = create_identity_with_grad_check_fn(loss_scale)
176 loss_scale = loss_scale_module.DynamicLossScale(
179 opt, loss_scale)
[all …]
Dmixed_precision.py42 def _wrap_optimizer(opt, loss_scale, use_v1_behavior): argument
55 return wrapper_cls(opt, loss_scale)
72 def enable_mixed_precision_graph_rewrite(opt, loss_scale='dynamic'): argument
212 return _enable_mixed_precision_graph_rewrite_base(opt, loss_scale,
220 def enable_mixed_precision_graph_rewrite_v1(opt, loss_scale='dynamic'): argument
328 return _enable_mixed_precision_graph_rewrite_base(opt, loss_scale,
332 def _enable_mixed_precision_graph_rewrite_base(opt, loss_scale, argument
355 opt = _wrap_optimizer(opt, loss_scale, use_v1_behavior=use_v1_behavior)
Dloss_scaling_gradient_tape.py28 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
93 loss_scale, argument
115 if not isinstance(loss_scale, loss_scale_module.LossScale):
117 "but got: %s" % (loss_scale,))
125 self._loss_scale = loss_scale
205 distribution, loss_scale_gradient_tapes, loss_scale, target, sources, argument
265 math_ops.greater(loss_scale(), 1)))
276 loss_scale_val = loss_scale()
310 _, ready_to_update = loss_scale.update(grads)
DBUILD10 name = "loss_scale",
11 srcs = ["loss_scale.py"],
35 ":loss_scale",
52 ":loss_scale",
78 ":loss_scale",
97 ":loss_scale",
122 ":loss_scale",
137 ":loss_scale",
Dloss_scale_optimizer.py26 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
64 def __init__(self, opt, loss_scale): argument
74 self._loss_scale = loss_scale_module.get(loss_scale)
133 loss_scale = self._loss_scale()
137 return loss_val * math_ops.cast(loss_scale, loss_val.dtype)
140 return loss * math_ops.cast(loss_scale, loss.dtype)
143 loss_scale = self._loss_scale()
144 loss_scale_reciprocal = 1 / loss_scale
/external/tensorflow/tensorflow/python/keras/mixed_precision/
Dpolicy_test.py35 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
73 self.assertEqual(repr(mp_policy.PolicyV1('float16', loss_scale=2)),
124 self.assertEqual(policy.loss_scale, None)
126 policy = mp_policy.PolicyV1('float32', loss_scale=None)
127 self.assertEqual(policy.loss_scale, None)
130 policy = mp_policy.PolicyV1('float32', loss_scale=ls)
131 self.assertIs(policy.loss_scale, ls)
133 policy = mp_policy.PolicyV1('float32', loss_scale='dynamic')
134 self.assertIsInstance(policy.loss_scale, loss_scale_module.DynamicLossScale)
137 self.assertIsInstance(policy.loss_scale, loss_scale_module.DynamicLossScale)
[all …]
Dloss_scale_optimizer.py33 from tensorflow.python.keras.mixed_precision import loss_scale as keras_loss_scale_module
40 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
567 def loss_scale(self): member in LossScaleOptimizer
645 return loss_val * math_ops.cast(self.loss_scale, loss_val.dtype)
648 return loss * math_ops.cast(self.loss_scale, loss.dtype)
671 loss_scale_reciprocal = 1. / self.loss_scale
773 loss_scale = keras_loss_scale_module.deserialize(
775 if isinstance(loss_scale, loss_scale_module.FixedLossScale):
777 config['initial_scale'] = loss_scale._loss_scale_value # pylint: disable=protected-access
778 elif isinstance(loss_scale, loss_scale_module.DynamicLossScale):
[all …]
Dloss_scale_optimizer_test.py43 from tensorflow.python.training.experimental import loss_scale as tf_loss_scale_module
95 loss_scale = 10.
97 initial_scale=loss_scale)
98 self.assertEqual(self.evaluate(opt.loss_scale), loss_scale)
99 self.assertIsInstance(opt.loss_scale, ops.Tensor)
103 self.assertEqual(loss_scale % strategy.num_replicas_in_sync, 0)
105 strategy, var, opt, loss_scale / strategy.num_replicas_in_sync)
117 loss_scale = 10.
119 initial_scale=loss_scale)
121 loss_scale)
[all …]
Dpolicy.py28 from tensorflow.python.keras.mixed_precision import loss_scale as keras_loss_scale_module
343 def __init__(self, name, loss_scale='auto'): argument
368 if loss_scale == 'auto':
369 loss_scale = 'dynamic' if name == 'mixed_float16' else None
373 if loss_scale and self._compute_dtype not in (None, 'float16'):
377 (loss_scale, name))
378 self._loss_scale = keras_loss_scale_module.get(loss_scale)
381 def loss_scale(self): member in PolicyV1
390 return '<PolicyV1 "%s", loss_scale=%s>' % (self._name, self.loss_scale)
400 config['loss_scale'] = keras_loss_scale_module.serialize(self.loss_scale)
Dloss_scale_benchmark.py33 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
71 loss_scale = loss_scale_module.FixedLossScale(2.)
79 loss_scale = loss_scale_module.DynamicLossScale(
83 loss_scale = None
84 if loss_scale:
85 opt = loss_scale_optimizer.LossScaleOptimizer(opt, loss_scale)
105 if loss_scale is None:
Dloss_scale.py27 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
30 def serialize(loss_scale): argument
31 return generic_utils.serialize_keras_object(loss_scale)
Dkeras_test.py59 from tensorflow.python.training.experimental import loss_scale as loss_scale_module
379 loss_scale=None))
399 loss_scale=2.))
416 loss_scale=2.))
665 loss_scale = 8.
675 expected_gradient = loss_scale / batch_size
687 initial_scale=loss_scale)
725 loss_scale = 8.
751 expected_gradient = loss_scale / 2
766 opt, dynamic=False, initial_scale=loss_scale)
[all …]
/external/tensorflow/tensorflow/tools/api/golden/v1/
Dtensorflow.mixed_precision.-fixed-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.FixedLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.train.experimental.-fixed-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.FixedLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.mixed_precision.experimental.-fixed-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.FixedLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.mixed_precision.experimental.-dynamic-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.DynamicLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.train.experimental.-dynamic-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.DynamicLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.mixed_precision.-dynamic-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.DynamicLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
/external/tensorflow/tensorflow/tools/api/golden/v2/
Dtensorflow.train.experimental.-fixed-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.FixedLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.mixed_precision.experimental.-fixed-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.FixedLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.keras.mixed_precision.experimental.-policy.pbtxt11 name: "loss_scale"
24 …argspec: "args=[\'self\', \'name\', \'loss_scale\'], varargs=None, keywords=None, defaults=[\'auto…
Dtensorflow.mixed_precision.experimental.-dynamic-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.DynamicLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"
Dtensorflow.train.experimental.-dynamic-loss-scale.pbtxt3 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.DynamicLossScale\'>"
4 is_instance: "<class \'tensorflow.python.training.experimental.loss_scale.LossScale\'>"

12