File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,13 @@ struct SetAttrDescVisitor : public boost::static_visitor<void> {
260
260
void operator ()(int v) const { attr_->set_i (v); }
261
261
void operator ()(float v) const { attr_->set_f (v); }
262
262
void operator ()(const std::string &v) const { attr_->set_s (v); }
263
- void operator ()(bool b) const { attr_->set_b (b); }
263
+
264
+ // Please refer to https://github.com/PaddlePaddle/Paddle/issues/7162
265
+ template <class T ,
266
+ class = typename std::enable_if<std::is_same<bool , T>::value>::type>
267
+ void operator ()(T b) const {
268
+ attr_->set_b (b);
269
+ }
264
270
265
271
void operator ()(const std::vector<int > &v) const {
266
272
VectorToRepeated (v, attr_->mutable_ints ());
@@ -274,9 +280,7 @@ struct SetAttrDescVisitor : public boost::static_visitor<void> {
274
280
void operator ()(const std::vector<bool > &v) const {
275
281
VectorToRepeated (v, attr_->mutable_bools ());
276
282
}
277
- void operator ()(proto::BlockDesc *desc) const {
278
- attr_->set_block_idx (desc->idx ());
279
- }
283
+ void operator ()(BlockDesc *desc) const { attr_->set_block_idx (desc->ID ()); }
280
284
void operator ()(boost::blank) const { PADDLE_THROW (" Unexpected branch" ); }
281
285
};
282
286
You can’t perform that action at this time.
0 commit comments