“fb63cd89d4343270ad96598aac177a7ad8d36c21”上不存在“paddle/phi/kernels/gpu/unfold_kernel.cu”
未验证 提交 37715dab 编写于 作者: Z zhangbo9674 提交者: GitHub

fix bug of optional_tensor in amp logic (#42561) (#42577)

上级 1f9b60df
...@@ -906,7 +906,10 @@ class DygraphForwardFunctionGenerator(DygraphFunctionGeneratorBase): ...@@ -906,7 +906,10 @@ class DygraphForwardFunctionGenerator(DygraphFunctionGeneratorBase):
f"if ({name}.get_ptr() != nullptr) amp_tensors_vector.push_back({{ *({name}.get_ptr()) }});\n" f"if ({name}.get_ptr() != nullptr) amp_tensors_vector.push_back({{ *({name}.get_ptr()) }});\n"
) )
amp_autocast_optional_list.append( amp_autocast_optional_list.append(
f"auto NEW_{name} = ({name}.get_ptr() != nullptr) ? paddle::make_optional<const paddle::experimental::Tensor&>(egr::EagerAmpAutoCast(\"{name}\", *({name}.get_ptr()), amp_dst_dtype, op_name)) : {name};\n" f"auto NEW_{name}_temp_tensor = ({name}.get_ptr() != nullptr) ? egr::EagerAmpAutoCast(\"{name}\", *({name}.get_ptr()), amp_dst_dtype, op_name) : paddle::experimental::Tensor();\n"
)
amp_autocast_optional_list.append(
f"auto NEW_{name} = ({name}.get_ptr() != nullptr) ? paddle::make_optional<const paddle::experimental::Tensor&>(NEW_{name}_temp_tensor) : {name};\n"
) )
else: else:
if is_inplaced and inplace_map and name in inplace_map.keys( if is_inplaced and inplace_map and name in inplace_map.keys(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册