diff --git a/paddle/fluid/imperative/tracer.h b/paddle/fluid/imperative/tracer.h index 72236272913ca1fe67a57d7cc4b7e689c47b7411..3e03100ab01beb095a7aae0d7ca9cc62d24f126c 100644 --- a/paddle/fluid/imperative/tracer.h +++ b/paddle/fluid/imperative/tracer.h @@ -87,10 +87,7 @@ class Tracer { platform::Place ExpectedPlace() const { return expected_place_; } - template - void SetExpectedPlace(PlaceType place) { - expected_place_ = place; - } + void SetExpectedPlace(platform::Place place) { expected_place_ = place; } bool NoGrad() const { return no_grad_; } diff --git a/paddle/fluid/pybind/imperative.cc b/paddle/fluid/pybind/imperative.cc index bbdafbf3d54f0c01aff215a7f721a71409c85bc4..84b6ff267ed1e862dd12e3f05fdd0e8b5a2db708 100644 --- a/paddle/fluid/pybind/imperative.cc +++ b/paddle/fluid/pybind/imperative.cc @@ -536,18 +536,18 @@ void BindImperative(py::module *m_ptr) { [](imperative::Tracer &self, const py::object &obj) { if (py::isinstance(obj)) { auto p = obj.cast(); - self.SetExpectedPlace(*p); + self.SetExpectedPlace(*p); } else if (py::isinstance(obj)) { auto p = obj.cast(); - self.SetExpectedPlace(*p); + self.SetExpectedPlace(*p); } else if (py::isinstance(obj)) { auto p = obj.cast(); - self.SetExpectedPlace(*p); + self.SetExpectedPlace(*p); } else { - PADDLE_THROW( + PADDLE_THROW(platform::errors::InvalidArgument( "Incompatible Place Type: supports CUDAPlace, CPUPlace, " - "CUDAPinnedPlace, " - "but got Unknown Type!"); + "and CUDAPinnedPlace, " + "but got Unknown Type!")); } }) .def("_get_program_desc_tracer",