diff --git a/paddle/fluid/imperative/layer.h b/paddle/fluid/imperative/layer.h index f210cd174532cc240988e0f3f45be03fe73e44bf..f409190a70b78e32b14c2f58127feeaeaba5f320 100644 --- a/paddle/fluid/imperative/layer.h +++ b/paddle/fluid/imperative/layer.h @@ -195,7 +195,7 @@ class VarBase { // data type. e.g.. FP32 inline void SetDataType(framework::proto::VarType::Type type) { auto tensor = var_->GetMutable(); - tensor->mutable_data(place_, type); + tensor->mutable_data(tensor->place(), type); } inline framework::proto::VarType::Type DataType() const { auto tensor = var_->Get();