diff --git a/src/operators/op_param.h b/src/operators/op_param.h index 6fe851b31d2c50a6c37388905129a414b00b5a98..8acfac36183158e19d5060a07ac741d54ecd3066 100644 --- a/src/operators/op_param.h +++ b/src/operators/op_param.h @@ -204,6 +204,10 @@ class OpParam { return ((Attribute)map.at(key)).Get(); } + static const bool HasAttr(const string &key, const AttributeMap &map) { + return map.count(key) > 0; + } + template static T *GetVarValue(const string &key, const VariableNameMap &var_map, const Scope &scope) { @@ -833,7 +837,13 @@ class ReshapeParam : public OpParam { input_shape_ = InputShapeFrom(inputs, scope); out_ = OutFrom(outputs, scope); shape_ = GetAttr>("shape", attrs); - inplace_ = GetAttr("inplace", attrs); + + if (HasAttr("inplace", attrs)) { + inplace_ = GetAttr("inplace", attrs); + } else { + inplace_ = false; + DLOG << "ReshapeParam lost inplace params. maybe fluid updated"; + } } const RType *InputX() const { return input_x_; }