Shortcuts

Class TensorFormat

Class Documentation

class torch_tensorrt::TensorFormat

TensorFormat is an enum class which defines the memeory layout used to store Tensor Data.

Public Types

enum Value

Underlying enum class to support the TensorFormat Class

In the case that you need to use the TensorFormat class itself, interface using this enum vs. normal instatination

ex. torch_tensorrt::TensorFormat type = TensorFormat::kContiguous;

Values:

enumerator kContiguous

Contiguous / NCHW / Linear.

enumerator kChannelsLast

Channel Last / NHWC.

enumerator kUnknown

Sentinel value.

Public Functions

TensorFormat() = default

Construct a new TensorFormat object.

inline constexpr TensorFormat(Value t)

TensorFormat constructor from enum.

TORCHTRT_API TensorFormat(at::MemoryFormat t)

Construct a new TensorFormat object from torch type enums.

Parameters

t

inline operator Value() const

Get the enum value of the TensorFormat object.

Returns

Value

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

Comparision operator for TensorFormat.

Parameters

other

Returns

true

false

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

Comparision operator for TensorFormat.

Parameters

other

Returns

true

false

inline constexpr bool operator!=(TensorFormat other) const

Comparision operator for TensorFormat.

Parameters

other

Returns

true

false

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

Comparision operator for TensorFormat.

Parameters

other

Returns

true

false

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources