mxnet
Public Types | Public Member Functions | Static Public Member Functions | List of all members
mxnet::runtime::MXNetDataType Class Reference

Runtime primitive data type. More...

#include <data_type.h>

Collaboration diagram for mxnet::runtime::MXNetDataType:
Collaboration graph

Public Types

enum  TypeCode { kInt = kDLInt, kUInt = kDLUInt, kFloat = kDLFloat, kHandle = MXNetTypeCode::kHandle }
 Type code for the MXNetDataType. More...
 

Public Member Functions

 MXNetDataType ()
 default constructor More...
 
 MXNetDataType (DLDataType dtype)
 Constructor. More...
 
 MXNetDataType (int code, int bits, int lanes)
 Constructor. More...
 
int code () const
 
int bits () const
 
int bytes () const
 
int lanes () const
 
bool is_scalar () const
 
bool is_bool () const
 
bool is_float () const
 
bool is_int () const
 
bool is_uint () const
 
bool is_handle () const
 
bool is_vector () const
 
MXNetDataType with_lanes (int lanes) const
 Create a new data type by change lanes to a specified value. More...
 
MXNetDataType with_bits (int bits) const
 Create a new data type by change bits to a specified value. More...
 
MXNetDataType element_of () const
 Get the scalar version of the type. More...
 
bool operator== (const MXNetDataType &other) const
 Equal comparator. More...
 
bool operator!= (const MXNetDataType &other) const
 NotEqual comparator. More...
 
 operator DLDataType () const
 Converter to DLDataType. More...
 

Static Public Member Functions

static MXNetDataType Int (int bits, int lanes=1)
 Construct an int type. More...
 
static MXNetDataType UInt (int bits, int lanes=1)
 Construct an uint type. More...
 
static MXNetDataType Float (int bits, int lanes=1)
 Construct an uint type. More...
 
static MXNetDataType Bool (int lanes=1)
 Construct a bool type. More...
 
static MXNetDataType Handle (int bits=64, int lanes=1)
 Construct a handle type. More...
 

Detailed Description

Runtime primitive data type.

This class is a thin wrapper of DLDataType. We also make use of MXNetDataType in compiler to store quick hint

Member Enumeration Documentation

◆ TypeCode

Type code for the MXNetDataType.

Enumerator
kInt 
kUInt 
kFloat 
kHandle 

Constructor & Destructor Documentation

◆ MXNetDataType() [1/3]

mxnet::runtime::MXNetDataType::MXNetDataType ( )
inline

default constructor

◆ MXNetDataType() [2/3]

mxnet::runtime::MXNetDataType::MXNetDataType ( DLDataType  dtype)
inlineexplicit

Constructor.

Parameters
dtypeThe DLDataType

◆ MXNetDataType() [3/3]

mxnet::runtime::MXNetDataType::MXNetDataType ( int  code,
int  bits,
int  lanes 
)
inline

Constructor.

Parameters
codeThe type code.
bitsThe number of bits in the type.
lanesThe number of lanes.

Member Function Documentation

◆ bits()

int mxnet::runtime::MXNetDataType::bits ( ) const
inline
Returns
number of bits in the data.

◆ Bool()

static MXNetDataType mxnet::runtime::MXNetDataType::Bool ( int  lanes = 1)
inlinestatic

Construct a bool type.

Parameters
lanesThe number of lanes
Returns
The constructed data type.

◆ bytes()

int mxnet::runtime::MXNetDataType::bytes ( ) const
inline
Returns
number of bytes to store each scalar.

◆ code()

int mxnet::runtime::MXNetDataType::code ( ) const
inline
Returns
The type code.

◆ element_of()

MXNetDataType mxnet::runtime::MXNetDataType::element_of ( ) const
inline

Get the scalar version of the type.

Returns
the result type.

◆ Float()

static MXNetDataType mxnet::runtime::MXNetDataType::Float ( int  bits,
int  lanes = 1 
)
inlinestatic

Construct an uint type.

Parameters
bitsThe number of bits in the type.
lanesThe number of lanes
Returns
The constructed data type.

◆ Handle()

static MXNetDataType mxnet::runtime::MXNetDataType::Handle ( int  bits = 64,
int  lanes = 1 
)
inlinestatic

Construct a handle type.

Parameters
bitsThe number of bits in the type.
lanesThe number of lanes
Returns
The constructed data type.

◆ Int()

static MXNetDataType mxnet::runtime::MXNetDataType::Int ( int  bits,
int  lanes = 1 
)
inlinestatic

Construct an int type.

Parameters
bitsThe number of bits in the type.
lanesThe number of lanes.
Returns
The constructed data type.

◆ is_bool()

bool mxnet::runtime::MXNetDataType::is_bool ( ) const
inline
Returns
whether type is a scalar type.

◆ is_float()

bool mxnet::runtime::MXNetDataType::is_float ( ) const
inline
Returns
whether type is a float type.

◆ is_handle()

bool mxnet::runtime::MXNetDataType::is_handle ( ) const
inline
Returns
whether type is a handle type.

◆ is_int()

bool mxnet::runtime::MXNetDataType::is_int ( ) const
inline
Returns
whether type is an int type.

◆ is_scalar()

bool mxnet::runtime::MXNetDataType::is_scalar ( ) const
inline
Returns
whether type is a scalar type.

◆ is_uint()

bool mxnet::runtime::MXNetDataType::is_uint ( ) const
inline
Returns
whether type is an uint type.

◆ is_vector()

bool mxnet::runtime::MXNetDataType::is_vector ( ) const
inline
Returns
whether type is a vector type.

◆ lanes()

int mxnet::runtime::MXNetDataType::lanes ( ) const
inline
Returns
number of lanes in the data.

◆ operator DLDataType()

mxnet::runtime::MXNetDataType::operator DLDataType ( ) const
inline

Converter to DLDataType.

Returns
the result.

◆ operator!=()

bool mxnet::runtime::MXNetDataType::operator!= ( const MXNetDataType other) const
inline

NotEqual comparator.

Parameters
otherThe data type to compre against.
Returns
The comparison resilt.

◆ operator==()

bool mxnet::runtime::MXNetDataType::operator== ( const MXNetDataType other) const
inline

Equal comparator.

Parameters
otherThe data type to compre against.
Returns
The comparison resilt.

◆ UInt()

static MXNetDataType mxnet::runtime::MXNetDataType::UInt ( int  bits,
int  lanes = 1 
)
inlinestatic

Construct an uint type.

Parameters
bitsThe number of bits in the type.
lanesThe number of lanes
Returns
The constructed data type.

◆ with_bits()

MXNetDataType mxnet::runtime::MXNetDataType::with_bits ( int  bits) const
inline

Create a new data type by change bits to a specified value.

Parameters
bitsThe target number of bits.
Returns
the result type.

◆ with_lanes()

MXNetDataType mxnet::runtime::MXNetDataType::with_lanes ( int  lanes) const
inline

Create a new data type by change lanes to a specified value.

Parameters
lanesThe target number of lanes.
Returns
the result type.

The documentation for this class was generated from the following file: