MultinomialOperation
Description
Samples the last axis by randomly extracting numSamples values and outputting the index.
Definition
struct MultinomialParam {
uint32_t numSamples = 1;
uint32_t randSeed = 0;
uint8_t rsv[8] = {0};
};
Parameters
Member |
Type |
Default Value |
Description |
|---|---|---|---|
numSamples |
uint32_t |
1 |
Number of random samples. The value of numSamples must be less than or equal to the dimension size of x. The maximum value is 64. |
randSeed |
uint32_t |
0 |
Random number seed. |
rsv[8] |
uint8_t |
{0} |
Reserved |
Input
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
x |
[batch, vocSize] |
float16 |
ND |
Input tensor. |
Output
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
output |
[batch, numSamples] |
int32 |
ND |
Index of the sampled data. dims[1] must be equal to numSamples. |
Restrictions
Ensure that the last axis is normalized.
API Calling Example
- Input
intensor =
[[0.0701, 0.1021, 0.1010, 0.1005], [0.1101, 0.1020, 0.1017, 0.0990], [0.0592, 0.1006, 0.1006, 0.1002]]
numSamples = 1
randSeed = 0
- Output
outtensor =
[[3], [3], [3]]
Parent topic: atb/infer_op_params.h