diff --git a/src/operators/op_param.h b/src/operators/op_param.h index f67daf79d0b0771e878a8a2c9d71acb24522f371..8f289b24ffa16e4af92ddff77b722fd458bc7c84 100644 --- a/src/operators/op_param.h +++ b/src/operators/op_param.h @@ -213,6 +213,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) { @@ -862,7 +866,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_; }