Dispatching

Convenience macros to dispath functions based on tensor data type.

AUGPY_DISPATCH(TYPE, NAME, ...)

Dispatch all dtypes. Declares tensor dtype as scalar_t, signed version of dtype as sscalar_t, and float (8, 16 bits) double (32, 64 bits) as temp_t.

Parameters
  • TYPE: tensor dtype, see DLDataType

  • NAME: name of the dispatched function; used when exceptions are thrown

  • ...: code to execute

AUGPY_DISPATCH_NOEXC(TYPE, NAME, ...)

Dispatch all dtypes. Does not throw exception when dtype cannot be dispatched. Declares tensor dtype as scalar_t, signed version of dtype as sscalar_t, and float (8, 16 bits) double (32, 64 bits) as temp_t.

Parameters
  • TYPE: tensor dtype, see DLDataType

  • NAME: name of the dispatched function; used when exceptions are thrown

  • ...: code to execute

AUGPY_DISPATCH_F(TYPE, NAME, ...)

Dispatch all dtypes that can use float as temp_t. Declares tensor dtype as scalar_t, signed version of dtype as sscalar_t, and float as temp_t.

Parameters
  • TYPE: tensor dtype, see DLDataType

  • NAME: name of the dispatched function; used when exceptions are thrown

  • ...: code to execute

AUGPY_DISPATCH_F_NOEXC(TYPE, NAME, ...)

Dispatch all dtypes that can use float as temp_t. Does not throw exception when dtype cannot be dispatched. Declares tensor dtype as scalar_t, signed version of dtype as sscalar_t, and float as temp_t.

Parameters
  • TYPE: tensor dtype, see DLDataType

  • NAME: name of the dispatched function; used when exceptions are thrown

  • ...: code to execute

AUGPY_DISPATCH_D(TYPE, NAME, ...)

Dispatch all dtypes that must use double as temp_t. Declares tensor dtype as scalar_t, signed version of dtype as sscalar_t, and double as temp_t.

Parameters
  • TYPE: tensor dtype, see DLDataType

  • NAME: name of the dispatched function; used when exceptions are thrown

  • ...: code to execute

AUGPY_DISPATCH_D_NOEXC(TYPE, NAME, ...)

Dispatch all dtypes that must use double as temp_t. Does not throw exception when dtype cannot be dispatched. Declares tensor dtype as scalar_t, signed version of dtype as sscalar_t, and double as temp_t.

Parameters
  • TYPE: tensor dtype, see DLDataType

  • NAME: name of the dispatched function; used when exceptions are thrown

  • ...: code to execute