From 4be3b057cf5921f63b96d17d18a91df46037f23d Mon Sep 17 00:00:00 2001 From: huangxu96 <46740794+huangxu96@users.noreply.github.com> Date: Wed, 21 Apr 2021 17:43:01 +0800 Subject: [PATCH] fix bug in amp O2 (#32343) --- python/paddle/fluid/contrib/mixed_precision/fp16_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/contrib/mixed_precision/fp16_utils.py b/python/paddle/fluid/contrib/mixed_precision/fp16_utils.py index cf35963fe2b26..65b62e7e5ab55 100644 --- a/python/paddle/fluid/contrib/mixed_precision/fp16_utils.py +++ b/python/paddle/fluid/contrib/mixed_precision/fp16_utils.py @@ -103,7 +103,7 @@ def _insert_cast_op(block, op, idx, src_dtype, dest_dtype): if in_name not in {'X', 'Z'}: continue for in_var_name in op.input(in_name): - in_var = block.var(in_var_name) + in_var = block._find_var_recursive(in_var_name) if in_var.type not in _valid_types or in_var.dtype == dest_dtype: continue if in_var.dtype == src_dtype: