@@ -112,16 +112,16 @@ struct BuildStrategy {
112112 bool enable_auto_fusion_{false };
113113 // Fuse_all_optimizer_ops and fuse_all_reduce_ops require that gradients
114114 // should not be sparse types
115- boost ::optional<bool > fuse_all_optimizer_ops_{false };
116- boost ::optional<bool > fuse_all_reduce_ops_{boost::none};
115+ paddle ::optional<bool > fuse_all_optimizer_ops_{false };
116+ paddle ::optional<bool > fuse_all_reduce_ops_{boost::none};
117117 // fuse_relu_depthwise_conv can fuse the `relu ->
118118 // depthwise_conv`
119119 bool fuse_relu_depthwise_conv_{false };
120120 // NOTE(zcd): In reduce mode, fusing broadcast ops may make the program
121121 // faster. Because fusing broadcast OP equals delaying the execution of all
122122 // broadcast Ops, in this case, all nccl streams are used only for reduce
123123 // operations for a period of time.
124- boost ::optional<bool > fuse_broadcast_ops_{boost::none};
124+ paddle ::optional<bool > fuse_broadcast_ops_{boost::none};
125125 // replace batch_norm with sync_batch_norm.
126126 bool sync_batch_norm_{false };
127127
@@ -135,7 +135,7 @@ struct BuildStrategy {
135135 // By default, memory_optimize would be opened if gc is disabled, and
136136 // be closed if gc is enabled.
137137 // Users can forcely enable/disable memory_optimize by setting True/False.
138- boost ::optional<bool > memory_optimize_{boost::none};
138+ paddle ::optional<bool > memory_optimize_{boost::none};
139139
140140 // Turn on inplace by default.
141141 bool enable_inplace_{true };
@@ -180,6 +180,11 @@ struct BuildStrategy {
180180
181181 bool IsFinalized () const { return is_finalized_; }
182182
183+ void ClearFinalized () {
184+ pass_builder_ = nullptr ;
185+ is_finalized_ = false ;
186+ }
187+
183188 bool IsMultiDevPass (const std::string &pass_name) const ;
184189
185190 // Apply the passes built by the pass_builder_. The passes will be
0 commit comments