Skip to content

Commit

Permalink
fix amp with optiontional api bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo9674 committed Mar 26, 2022
1 parent 3b89542 commit fc0b3fe
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def GenerateForwardDefinition(self, is_inplaced):
if is_optional:
arg_str = f"const paddle::optional<const paddle::experimental::Tensor&> {name}"
amp_tensors_vector_optional_list.append(
f"if ({name}.is)initialized() amp_tensors_vector.push_back({name}.get()));\n"
f"if ({name}.is_initialized()) amp_tensors_vector.push_back({name}.get());\n"
)
amp_autocast_optional_list.append(
f"auto NEW_{name} = {name}.is_initialized() ? egr::EagerAmpAutoCast(\"{name}\", {name}, amp_dst_dtype, op_name) : {name};\n"
Expand Down

0 comments on commit fc0b3fe

Please sign in to comment.