get

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

Extracts elements at specified positions from a tuple container.

Prototype

1
2
template <size_t N, typename ...Tps>
__aicore__ inline typename tuple_element<N, tuple<Tps...> >::type& get(tuple<Tps...>& t) noexcept
1
2
template <size_t N, typename ...Tps>
__aicore__ inline const typename tuple_element<N, tuple<Tps...> >::type& get(const tuple<Tps...>& t) noexcept
1
2
template <size_t N, typename ...Tps>
__aicore__ inline typename tuple_element<N, tuple<Tps...> >::type&& get(tuple<Tps...>&& t) noexcept
1
2
template <size_t N, typename ...Tps>
__aicore__ inline const typename tuple_element<N, tuple<Tps...> >::type&& get(const tuple<Tps...>&& t) noexcept

Parameters

Table 1 Template parameters

Parameter

Description

N

Constant during building, which indicates the index of the element to be extracted. The index starts from 0 and the value range is [0, 64).

Tps...

Template parameter package passed to the tuple. The number of tuple parameters is in the range of (0, 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.

t

Tuple object, which can be a left-value reference, a constant left-value reference, or a right-value reference.

Restrictions

The get function supports only the const and constexpr constant indexes. The index value range is [0, 64).

Returns

Element in the corresponding position in the tuple object

Example

1
2
AscendC::Std::tuple<uint32_t, float, bool> test{11, 2.2, true};
uint32_t const_uint32_t = AscendC::Std::get<0>(test);

For more examples, see Example.