MakeTensorTrait

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Generates a TensorTrait instantiation object.

Prototype

1
2
template <typename T, TPosition pos, typename LayoutType>
__aicore__ inline constexpr auto MakeTensorTrait(const LayoutType& t)

Parameters

Parameter

Description

T

Only the following basic data types are supported: int4b_t, uint8_t, int8_t, int16_t, uint16_t, bfloat16_t, int32_t, uint32_t, int64_t, uint64_t, float, and half.

In the TensorTrait structure, the using keyword is used to define a type alias LiteType, which is the same as the template parameter T.

The LocalTensor/GlobalTensor defined by TensorTrait does not contain ShapeInfo.

For example, the tensor corresponding to LocalTensor<float> that does not contain ShapeInfo is LocalTensor<TensorTrait<float>>.

pos

Logical position for storing data, which is of the Tposition type.

LayoutType

Layout data type. The input data type LayoutType must meet the requirements described in Restrictions.

Returns

Instantiated TensorTrait object.

Restrictions

None

Examples

See Examples.