Skip to content

Commit c8360b6

Browse files
committed
fix style
1 parent 766799e commit c8360b6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

paddle/fluid/framework/generator.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ const std::shared_ptr<Generator>& GetDefaultCUDAGenerator(int64_t device_id) {
4343
cuda_device_flags.resize(num_cuda_devices);
4444
default_cuda_generators.resize(num_cuda_devices);
4545
});
46-
if (device_id == -1) {
47-
platform::Place place;
48-
device_id = BOOST_GET_CONST(platform::CUDAPlace, place).GetDeviceId();
46+
if (device_id < 0) {
47+
PADDLE_THROW(platform::errors::InvalidArgument(
48+
"cuda device id shoule be greater than 0"));
4949
}
5050

5151
std::call_once(cuda_device_flags[device_id], [device_id]() {

paddle/fluid/pybind/generator_py.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ void BindGenerator(py::module* m_ptr) {
6060
&framework::Generator::SetIsInitPy);
6161
m.def("default_cpu_generator", &framework::DefaultCPUGenerator);
6262
m.def("default_cuda_generator", &framework::GetDefaultCUDAGenerator);
63-
} // end Generator
64-
} // end namespace pybind
63+
}
64+
} // namespace pybind
6565
} // namespace paddle

0 commit comments

Comments
 (0)