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

Initial Commit fix (#36988)

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