未验证 提交 e5f18145 编写于 作者: Y Yanxing Shi 提交者: GitHub

Initial Commit fix (#36988)

上级 aef291f4
...@@ -2393,23 +2393,31 @@ All parameter, weight, gradient are variables in Paddle. ...@@ -2393,23 +2393,31 @@ All parameter, weight, gradient are variables in Paddle.
py::return_value_policy::copy); py::return_value_policy::copy);
py::class_<gpuDeviceProp>(m, "_gpuDeviceProperties") py::class_<gpuDeviceProp>(m, "_gpuDeviceProperties")
.def_readonly("name", &gpuDeviceProp::name) .def_property_readonly(
.def_readonly("major", &gpuDeviceProp::major) "name", [](const gpuDeviceProp &prop) { return prop.name; })
.def_readonly("minor", &gpuDeviceProp::minor) .def_property_readonly(
.def_readonly("is_multi_gpu_board", &gpuDeviceProp::isMultiGpuBoard) "major", [](const gpuDeviceProp &prop) { return prop.major; })
.def_readonly("is_integrated", &gpuDeviceProp::integrated) .def_property_readonly(
.def_readonly("multi_processor_count", "minor", [](const gpuDeviceProp &prop) { return prop.minor; })
&gpuDeviceProp::multiProcessorCount) .def_property_readonly(
.def_readonly("total_memory", &gpuDeviceProp::totalGlobalMem) "total_memory",
.def("__repr__", [](const gpuDeviceProp &gpu_device_prop) { [](const gpuDeviceProp &prop) { return prop.totalGlobalMem; })
std::ostringstream stream; .def_property_readonly(
stream << "_gpuDeviceProperties(name='" << gpu_device_prop.name "multi_processor_count",
<< "', major=" << gpu_device_prop.major [](const gpuDeviceProp &prop) { return prop.multiProcessorCount; })
<< ", minor=" << gpu_device_prop.minor << ", total_memory=" .def_property_readonly(
<< gpu_device_prop.totalGlobalMem / (1024 * 1024) "is_multi_gpu_board",
<< "MB, multi_processor_count=" [](const gpuDeviceProp &prop) { return prop.isMultiGpuBoard; })
<< gpu_device_prop.multiProcessorCount << ")"; .def_property_readonly(
return stream.str(); "is_integrated",
[](const gpuDeviceProp &prop) { return prop.integrated; })
.def("__repr__", [](const gpuDeviceProp &prop) {
std::stringstream ostr;
ostr << "_gpuDeviceProperties(name='" << prop.name
<< "', major=" << prop.major << ", minor=" << prop.minor
<< ", total_memory=" << prop.totalGlobalMem / (1024 * 1024)
<< "MB, multi_processor_count=" << prop.multiProcessorCount << ")";
return ostr.str();
}); });
#if !defined(PADDLE_WITH_HIP) && !defined(_WIN32) #if !defined(PADDLE_WITH_HIP) && !defined(_WIN32)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册