diff --git a/python/paddle/distributed/fleet/meta_optimizers/amp_optimizer.py b/python/paddle/distributed/fleet/meta_optimizers/amp_optimizer.py index 9ffb47789ee987ef6b53d2170d5b2c7692335dc2..e3a781424e6d5f034e8aa00a10c679a870d49c98 100755 --- a/python/paddle/distributed/fleet/meta_optimizers/amp_optimizer.py +++ b/python/paddle/distributed/fleet/meta_optimizers/amp_optimizer.py @@ -124,3 +124,6 @@ class AMPOptimizer(MetaOptimizerBase): use_fp16_test=False): return self.wrapped_opt.amp_init(place, scope, test_program, use_fp16_test) + + def get_loss_scaling(self): + return self.wrapped_opt.get_loss_scaling() diff --git a/python/paddle/fluid/tests/unittests/test_fleet_amp_init.py b/python/paddle/fluid/tests/unittests/test_fleet_amp_init.py index 6930a330a7c315780c11fe40cdc0ae90803d4fe6..a9a6b9c0660b448977a6f09547b63079b25181ef 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_amp_init.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_amp_init.py @@ -117,6 +117,7 @@ class TestFleetAMPInit(unittest.TestCase): optimizer.minimize(cost) print(fleet._get_applied_meta_list()) + loss_scale = optimizer.get_loss_scaling() place = paddle.CUDAPlace(0)