提交 ca55bd20 编写于 作者: Z Zhen Wang

use fp32 to initilize parameter values and then cast to fp16.

上级 02818171
......@@ -189,12 +189,12 @@ def train(args):
#Create test_prog and set layers' is_test params to True
test_prog = test_prog.clone(for_test=True)
if args.use_pure_fp16:
cast_parameters_to_fp16(startup_prog)
gpu_id = int(os.environ.get('FLAGS_selected_gpus', 0))
place = fluid.CUDAPlace(gpu_id) if args.use_gpu else fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(startup_prog)
if args.use_pure_fp16:
cast_parameters_to_fp16(exe, train_prog, fluid.global_scope())
trainer_id = int(os.getenv("PADDLE_TRAINER_ID", 0))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册