FilesLast commitLast update
10 days ago
2 months ago
1 month ago
1 month ago
24 days ago
12 days ago
1 month ago
12 days ago
1 month ago
1 month ago
11 days ago
README

OneHot

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products √
Atlas inference products √
Atlas training products √

Function Description

  • Operator function: for the input self of length n, obtains an output out with n*k elements after the one_hot computation, where the value of k is numClasses.
  • Computation formula:

    out[i][j]={onValue,self[i]=joffValue,self[i]≠jout[i][j]=\left\{ \begin{aligned} onValue,\quad self[i] = j \\ offValue, \quad self[i] \neq j \end{aligned} \right.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Indicates the index tensor. UINT8, INT32, INT64 ND
depth Input Number of classes. INT32, INT64 ND
on_value Input Fill value for the index position. FLOAT16, FLOAT, INT8, UINT8, INT32, INT64 ND
off_value Input Fill value for non-index positions. FLOAT16, FLOAT, INT8, UINT8, INT32, INT64 ND
axis Input attribute Dimension where the encoding vector is inserted. INT32 ND
y Output Indicates the one-hot tensor. FLOAT16, FLOAT, INT8, UINT8, INT32, INT64 ND

Constraint Description

None

Invocation Description

Invocation Method Sample Code Description
aclnn API test_aclnn_one_hot Invokes the OneHot operator through the aclnnOneHot API.