diff --git a/paddle/framework/feed_fetch_method.h b/paddle/framework/feed_fetch_method.h index be96dc32670c97e3d1a8fa47c44a50965ffa528c..826d180bfc5445224a8d9292f06eeb58d9a46b29 100644 --- a/paddle/framework/feed_fetch_method.h +++ b/paddle/framework/feed_fetch_method.h @@ -37,9 +37,9 @@ void SetFeedVariable(const LoDTensor& input, const std::string& var_name, } LoDTensor& GetFetchVariable(const std::string& var_name, size_t index) { - // If var_name Variable is not found in GlobalScope, a new variable will - // be created. - Variable* g_fetch_value = GetGlobalScope().Var(var_name); + // Since we want to fetch LodTensor from a variable, the variable must + // be created alreadly. + Variable* g_fetch_value = GetGlobalScope().FindVar(var_name); auto& fetch_outputs = *(g_fetch_value->GetMutable>()); PADDLE_ENFORCE_LT(index, fetch_outputs.size()); diff --git a/paddle/pybind/pybind.cc b/paddle/pybind/pybind.cc index 983f19b30d7c452f7451fc89da1628fbde8dff1d..008a9441db408e2db99ec86af645344f376d0b8f 100644 --- a/paddle/pybind/pybind.cc +++ b/paddle/pybind/pybind.cc @@ -12,7 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pybind/pybind.h" +#include "paddle/pybind/protobuf.h" + #include "paddle/framework/backward.h" #include "paddle/framework/executor.h" #include "paddle/framework/feed_fetch_method.h" @@ -25,7 +26,7 @@ limitations under the License. */ #include "paddle/platform/enforce.h" #include "paddle/platform/place.h" #include "paddle/pybind/exception.h" -#include "paddle/pybind/protobuf.h" +#include "paddle/pybind/pybind.h" #include "paddle/pybind/tensor_py.h" #include "paddle/string/to_string.h"