18 py::class_<Device> device(
20 "Device context specifying device type and device id.");
21 device.def(py::init<>());
22 device.def(py::init<Device::DeviceType, int>());
23 device.def(py::init<const std::string &, int>());
24 device.def(py::init<const std::string &>());
25 device.def(
"__eq__", &Device::operator==);
26 device.def(
"__ene__", &Device::operator!=);
27 device.def(
"__repr__", [](
const Device &d) {
28 std::string device_type;
30 case Device::DeviceType::CPU:
33 case Device::DeviceType::CUDA:
36 case Device::DeviceType::SYCL:
40 utility::LogError(
"Unknown device type");
48 device.def(py::pickle(
55 "Cannot unpickle Device! Expecting a tuple of size "
58 return Device(t[0].cast<Device::DeviceType>(),
62 py::native_enum<Device::DeviceType>(device,
"DeviceType",
"enum.Enum")
filament::Texture::InternalFormat format
DeviceType GetType() const
Returns type of the device, e.g. DeviceType::CPU, DeviceType::CUDA.
std::string ToString() const
Returns string representation of device, e.g. "CPU:0", "CUDA:0".
int GetID() const
Returns the device index (within the same device type).
void pybind_core_device(py::module &m)
Generic file read and write utility for python interface.