random_sample.h 1.5 KB
Newer Older
PanZezhong's avatar
PanZezhong committed
1
2
#ifndef __INFINIOP_RANDOM_SAMPLE_API_H__
#define __INFINIOP_RANDOM_SAMPLE_API_H__
PanZezhongQY's avatar
PanZezhongQY committed
3

PanZezhong's avatar
PanZezhong committed
4
#include "../operator_descriptor.h"
PanZezhongQY's avatar
PanZezhongQY committed
5

6
typedef struct InfiniopDescriptor *infiniopRandomSampleDescriptor_t;
PanZezhongQY's avatar
PanZezhongQY committed
7

8
__INFINI_C __export infiniStatus_t infiniopCreateRandomSampleDescriptor(
9
10
11
12
    infiniopHandle_t handle,
    infiniopRandomSampleDescriptor_t *desc_ptr,
    infiniopTensorDescriptor_t result,
    infiniopTensorDescriptor_t probs);
PanZezhongQY's avatar
PanZezhongQY committed
13

14
__INFINI_C __export infiniStatus_t infiniopGetRandomSampleWorkspaceSize(
15
16
    infiniopRandomSampleDescriptor_t desc,
    size_t *size);
PanZezhongQY's avatar
PanZezhongQY committed
17

18
__INFINI_C __export infiniStatus_t infiniopCreateRandomSampleBatchDescriptor(
19
20
21
22
23
    infiniopHandle_t handle,
    infiniopRandomSampleDescriptor_t *desc_ptr,
    infiniopTensorDescriptor_t result,
    infiniopTensorDescriptor_t probs);

24
__INFINI_C __export infiniStatus_t infiniopRandomSample(
25
26
27
28
29
30
31
32
33
34
    infiniopRandomSampleDescriptor_t desc,
    void *workspace,
    size_t workspace_size,
    void *result,
    const void *probs,
    float random_val,
    float topp,
    int topk,
    float temperature,
    void *stream);
PanZezhongQY's avatar
PanZezhongQY committed
35

36
__INFINI_C __export infiniStatus_t infiniopRandomSampleBatch(
37
38
39
40
41
42
43
44
45
46
47
48
    infiniopRandomSampleDescriptor_t desc,
    void *workspace,
    size_t workspace_size,
    void *result,
    const void *probs,
    const float *random_val,
    const float *topp,
    const int *topk,
    const float *temperature,
    int batch_size,
    void *stream);

49
__INFINI_C __export infiniStatus_t infiniopDestroyRandomSampleDescriptor(
50
    infiniopRandomSampleDescriptor_t desc);
PanZezhongQY's avatar
PanZezhongQY committed
51
52

#endif