-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]sparse-quantizer #374
[WIP]sparse-quantizer #374
Conversation
Signed-off-by: zhongxiaoyao.zxy <zhongxiaoyao.zxy@antgroup.com>
5a6c1ef
to
35a8807
Compare
src/quantization/sparse_computer.h
Outdated
} | ||
|
||
inline void | ||
ComputeDist(uint32_t u, float* dists) {//u是quant中存储的第u个稀疏向量 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computer and quantizer only consider compute distance from code to code, don't consider the storage
src/quantization/sparse_quantizer.h
Outdated
|
||
bool | ||
SparseQuantizer::InsertAll(const SparseVectors& sv) { | ||
// 首先释放旧的内存 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, for test the quantizer, this func of code can be moved to sparse_quantizer_test
src/quantization/sparse_quantizer.h
Outdated
} | ||
|
||
inline float Compute(int32_t nnz1, const uint32_t* ids1, const float* vals1, | ||
int32_t nnz2, const uint32_t* ids2, const float* vals2) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implement encode and decode
src/quantization/sparse_quantizer.h
Outdated
inline void | ||
SparseQuantizer::ComputeDist(SparseComputer& computer, uint32_t u, float* dists) const { | ||
|
||
if (u >= num_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reuse code in L130
src/quantization/sparse_quantizer.h
Outdated
|
||
inline float | ||
SparseQuantizer::ComputeDist(SparseComputer& computer, uint32_t u) const { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/quantization/sparse_quantizer.h
Outdated
} | ||
|
||
inline void | ||
SparseQuantizer::ProcessQuery(int32_t nnz, const uint32_t* ids, const float* vals, SparseComputer& computer) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implement in Encode
Implemented SparseQuantizer and SparseComputer classes, and completed functions such as sparse vector inner product calculation