快捷方式

Class TensorFormat

类文档

class TensorFormat

TensorFormat 是一个枚举类,用于定义存储 Tensor 数据的内存布局。

公共类型

enum Value

底层的枚举类,用于支持 TensorFormat

如果你需要使用 TensorFormat 类本身,可以通过此枚举进行接口调用,而非正常实例化。

例如:torch_tensorrt::TensorFormat 类型 = TensorFormat::kContiguous;

enumerator kContiguous

连续 / NCHW / 线性。

enumerator kChannelsLast

通道最后 / NHWC。

enumerator kUnknown

哨兵值。

公共函数

TensorFormat() = default

构造一个新的 TensorFormat 对象。

inline constexpr TensorFormat(Value t)

从枚举构造 TensorFormat

TORCHTRT_API TensorFormat(at::MemoryFormat t)

从 torch 类型枚举构造一个新的 TensorFormat 对象。

参数

t

inline operator Value() const

获取 TensorFormat 对象的枚举值。

返回

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

TensorFormat 的比较运算符。

参数

其他

返回

返回

inline constexpr bool operator==(TensorFormat::Value other) const

TensorFormat 的比较运算符。

参数

其他

返回

返回

inline constexpr bool operator!=(TensorFormat other) const

TensorFormat 的比较运算符。

参数

其他

返回

返回

inline constexpr bool operator!=(TensorFormat::Value other) const

TensorFormat 的比较运算符。

参数

其他

返回

返回

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源