@@ -791,6 +791,7 @@ All parameter, weight, gradient are variables in Paddle.
791
791
" reduce_strategy" ,
792
792
[](const BuildStrategy &self) { return self.reduce_ ; },
793
793
[](BuildStrategy &self, BuildStrategy::ReduceStrategy strategy) {
794
+ PADDLE_ENFORCE (!self.IsFinalized (), " BuildStrategy is finlaized." );
794
795
self.reduce_ = strategy;
795
796
},
796
797
R"DOC( The type is STR, there are two reduce strategies in ParallelExecutor,
@@ -804,6 +805,7 @@ All parameter, weight, gradient are variables in Paddle.
804
805
[](const BuildStrategy &self) { return self.gradient_scale_ ; },
805
806
[](BuildStrategy &self,
806
807
BuildStrategy::GradientScaleStrategy strategy) {
808
+ PADDLE_ENFORCE (!self.IsFinalized (), " BuildStrategy is finlaized." );
807
809
self.gradient_scale_ = strategy;
808
810
},
809
811
R"DOC( The type is STR, there are three ways of defining :math:`loss@grad` in
@@ -815,6 +817,7 @@ All parameter, weight, gradient are variables in Paddle.
815
817
" debug_graphviz_path" ,
816
818
[](const BuildStrategy &self) { return self.debug_graphviz_path_ ; },
817
819
[](BuildStrategy &self, const std::string &path) {
820
+ PADDLE_ENFORCE (!self.IsFinalized (), " BuildStrategy is finlaized." );
818
821
self.debug_graphviz_path_ = path;
819
822
},
820
823
R"DOC( The type is STR, debug_graphviz_path indicate the path that
@@ -824,6 +827,7 @@ All parameter, weight, gradient are variables in Paddle.
824
827
" enable_data_balance" ,
825
828
[](const BuildStrategy &self) { return self.enable_data_balance_ ; },
826
829
[](BuildStrategy &self, bool b) {
830
+ PADDLE_ENFORCE (!self.IsFinalized (), " BuildStrategy is finlaized." );
827
831
self.enable_data_balance_ = b;
828
832
}) // FIXME(chengudo): enable_data_balance seems not important
829
833
.def_property (
@@ -832,6 +836,7 @@ All parameter, weight, gradient are variables in Paddle.
832
836
return self.enable_sequential_execution_ ;
833
837
},
834
838
[](BuildStrategy &self, bool b) {
839
+ PADDLE_ENFORCE (!self.IsFinalized (), " BuildStrategy is finlaized." );
835
840
self.enable_sequential_execution_ = b;
836
841
},
837
842
R"DOC( The type is BOOL. If set True, the execution order of ops would be the same as what is in the program. Default False.)DOC" )
@@ -841,6 +846,7 @@ All parameter, weight, gradient are variables in Paddle.
841
846
return self.remove_unnecessary_lock_ ;
842
847
},
843
848
[](BuildStrategy &self, bool b) {
849
+ PADDLE_ENFORCE (!self.IsFinalized (), " BuildStrategy is finlaized." );
844
850
self.remove_unnecessary_lock_ = b;
845
851
},
846
852
R"DOC( The type is BOOL. If set True, some locks in GPU ops would be released and ParallelExecutor would run faster. Default False.)DOC" )
@@ -850,6 +856,7 @@ All parameter, weight, gradient are variables in Paddle.
850
856
return self.fuse_elewise_add_act_ops_ ;
851
857
},
852
858
[](BuildStrategy &self, bool b) {
859
+ PADDLE_ENFORCE (!self.IsFinalized (), " BuildStrategy is finlaized." );
853
860
self.fuse_elewise_add_act_ops_ = b;
854
861
},
855
862
R"DOC( The type is BOOL, fuse_elewise_add_act_ops indicate whether
0 commit comments