make_tuple

Applicability

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

Creates tuple objects conveniently as a practical function template. make_tuple can automatically infer the element type to simplify the code and construct an element list.

Prototype

1
2
template <typename ...Tps>
__aicore__ inline constexpr tuple<unwrap_decay_t<Tps>...> make_tuple(Tps&& ...args)

Parameters

Table 1 Template parameters

Parameter

Description

Tps...

Template parameter package passed to the tuple, indicating the type of parameters passed to make_tuple. The number of parameters ranges from 0 to 64.

For the Atlas A3 training products/Atlas A3 inference products, the supported data types are bool, int4b_t, int8_t, uint8_t, int16_t, uint16_t, half, bfloat16_t, int32_t, uint32_t, float, int64_t, uint64_t, LocalTensor and GlobalTensor.

For the Atlas A2 training products/Atlas A2 inference products, the supported data types are bool, int4b_t, int8_t, uint8_t, int16_t, uint16_t, half, bfloat16_t, int32_t, uint32_t, float, int64_t, uint64_t, LocalTensor and GlobalTensor.

args

Function parameter package, indicating the actual parameters passed to make_tuple. The number of parameters ranges from 0 to 64.

Restrictions

  • The tuple instantiation depth is 64, that is, aggregation of basic data types with a maximum of 64 elements is supported.
  • Data types of the elements to be specified in make_tuple must be forcibly converted. Otherwise, the compiler infers the data types, which may be different from the expectation.
  • Variable-length data types such as arrays are not supported.
  • Implicit conversion constructors are not supported.

Returns

A tuple object that contains copies of the passed parameters

Example

1
AscendC::Std::tuple<uint32_t, float, bool> test = AscendC::Std::make_tuple(22, 3.3, true);

For more examples, see Example.