快捷鍵

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 的完整開發者文件

檢視文件

教學

取得初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並獲得問題解答

檢視資源