快捷方式

Struct Device

嵌套关系

嵌套类型

Struct 文档

struct Device

目标设备的数据结构设置。

公共函数

inline Device()

Device 结构的构造函数

公共成员

DeviceType device_type

设备的数据结构设置。此结构将保存目标设备相关参数,例如 device_type、gpu_id、dla_core。

int64_t gpu_id
int64_t dla_core
bool allow_gpu_fallback

(仅在以 DLA(设备)为目标时使用)如果 DLA 不支持引擎运行层,则允许引擎在 GPU 上运行

class DeviceType

TensorRT 引擎可以使用的受支持的 Device 类型

此类与 c10::DeviceTypes 兼容(但会检查 TRT 支持),但唯一适用的值是 at::kCUDA,它映射到 DeviceType::kGPU

要使用 DataType 类本身,请使用枚举而不是普通实例化进行接口

例如 torch_tensorrt::DeviceType type = DeviceType::kGPU;

公共类型

enum Value

支持 DeviceType 类的底层枚举类

如果您需要使用 DeviceType 类本身,请使用此枚举而不是普通实例化进行接口

例如 torch_tensorrt::DeviceType type = DeviceType::kGPU;

enumerator kGPU

目标 GPU 运行引擎。

enumerator kDLA

目标 DLA 运行引擎。

公共函数

DeviceType() = default

构造新的 Device Type 对象。

inline constexpr DeviceType(Value t)

从内部枚举构造新的 Device Type 对象。

DeviceType(c10::DeviceType t)

从 torch 设备枚举构造新的 Device Type 对象 注意:唯一有效的值是 torch::kCUDA(不支持 torch::kCPU)

参数

t

inline operator Value() const

Device 对象获取内部值。

返回值

explicit operator bool() = delete
inline constexpr bool operator==(DeviceType other) const

DeviceType 的比较运算符。

参数

other

返回值

true

返回值

false

inline constexpr bool operator!=(DeviceType other) const

DeviceType 的比较运算符。

参数

other

返回值

true

返回值

false

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

获取针对初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得解答

查看资源