MakeTensorTrait

Product Support

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

x

Atlas inference product's Vector Core

x

Atlas training products

x

Function

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

Example

For details, see Example.