From a719aa2d398621fe694e2808b98ec3da3026491c Mon Sep 17 00:00:00 2001 From: huangxu96 Date: Thu, 15 Apr 2021 05:55:27 +0000 Subject: [PATCH] fix bug in amp O2 --- 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 f9c3a613c4053..01988a34cdbe3 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: