-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathweights_compress.i
21 lines (21 loc) · 1.63 KB
/
weights_compress.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
%module weights_quantization
%{
#include <Python.h>
#include "numpy/arrayobject.h"
void compress_layer_weights(PyObject *pComprsLabel, PyObject *pCodeBook, PyObject *pWeights, int nWeight, int nBit);
void decompress_layer_weights(PyObject *pWeights, PyObject *pComprsLabel, PyObject *pCodeBook, int nWeight, int nBit);
void quantize_layer_weights(PyObject *pWeights, int nWeight, int nBit);
void quantize_buffer(PyObject *pWeights, PyObject * newWeights, int nWeight, PyObject * scale);
void dequantize_buffer(PyObject *pWeights, PyObject * newWeights, int nWeight, PyObject * scale);
void quantize_buffer_maxmin(PyObject *pWeights, PyObject * newWeights, int nWeight, int nSeg, PyObject * maxmin);
void dequantize_buffer_maxmin(PyObject *pWeights, PyObject * newWeights, int nWeight, int nSeg,PyObject * maxmin);
%}
#include <Python.h>
#include "numpy/arrayobject.h"
void compress_layer_weights(PyObject *pComprsLabel, PyObject *pCodeBook, PyObject *pWeights, int nWeight, int nBit);
void decompress_layer_weights(PyObject *pWeights, PyObject *pComprsLabel, PyObject *pCodeBook, int nWeight, int nBit);
void quantize_layer_weights(PyObject *pWeights, int nWeight, int nBit);
void quantize_buffer(PyObject *pWeights, PyObject * newWeights, int nWeight, PyObject * scale);
void dequantize_buffer(PyObject *pWeights, PyObject * newWeights, int nWeight, PyObject * scale);
void quantize_buffer_maxmin(PyObject *pWeights, PyObject * newWeights, int nWeight, int nSeg, PyObject * maxmin);
void dequantize_buffer_maxmin(PyObject *pWeights, PyObject * newWeights, int nWeight, int nSeg,PyObject * maxmin);