operator()
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Obtains the reference of the offsetth variable of the LocalTensor. As the left value, it is equivalent to the SetValue API. As the right value, it is equivalent to the GetValue API.
Prototype
1 | __aicore__ inline __inout_pipe__(S) __ubuf__ PrimType& operator()(const uint32_t offset) const |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
offset |
Input |
LocalTensor subscript index. |
Returns
Returns the PrimType reference of the element at the specified index.
PrimType is defined as follows:
1 2 | // PrimT is used to extract the basic data type from T. If T is of the basic data type, the data type is directly returned. If T is of the TensorTrait type, the LiteType basic data type in TensorTrait is extracted. using PrimType = PrimT<T>; |
Restrictions
None
Examples
1 2 3 4 5 6 | // Usage of operator(). As the left value, it is equivalent to the Setvalue API. As the right value, it is equivalent to the Getvalue API. // Input data (inputLocal): [100 100 100... 100] inputLocal(2) = 200; // Output data (inputLocal): [100 100 200... 100] auto x = inputLocal(2); // x is displayed as 200. |
Parent topic: LocalTensor