Table of Contents
Shortcuts

# Class DataType

- Defined in File torch_tensorrt.h

## Class Documentation

class torch_tensorrt::DataType

  Supported Data Types that can be used with TensorRT engines

  This class is compatable with c10::DataTypes (but will check for TRT support) so there should not be a reason that you need to use this type explictly.

  Public Types

  enum Value

    Underlying enum class to support the DataType Class

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

    ex. torch_tensorrt::DataType type = DataType::kFloat;

    Values:

    enumerator kLong

      INT64.

    enumerator kFloat

      FP32.

    enumerator kHalf

      FP16.

    enumerator kChar

      INT8.

    enumerator kInt

      INT.

    enumerator kBool

      Bool.

    enumerator kUnknown

      Sentinel value.

  Public Functions

  DataType() = default

    Construct a new Data Type object.

  inline constexpr DataType(Value t)

    DataType constructor from enum.

  TORCHTRT_API DataType(c10::ScalarType t)

    Construct a new Data Type object from torch type enums.

    Parameters

      t –

  inline operator Value() const

    Get the enum value of the DataType object.

    Returns

      Value

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

    Comparision operator for DataType.

    Parameters

      other –

    Returns

      true

    Returns

      false

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

    Comparision operator for DataType.

    Parameters

      other –

    Returns

      true

    Returns

      false

  inline constexpr bool operator!=(DataType other) const

    Comparision operator for DataType.

    Parameters

      other –

    Returns

      true

    Returns

      false

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

    Comparision operator for DataType.

    Parameters

      other –

    Returns

      true

    Returns

      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

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.