mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-30 15:35:33 +08:00
67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
|
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
// Proprietary and confidential.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include "faiss/Index.h"
|
|
|
|
#include "Operand.h"
|
|
#include "Index.h"
|
|
|
|
|
|
namespace zilliz {
|
|
namespace milvus {
|
|
namespace engine {
|
|
|
|
class IndexBuilder {
|
|
public:
|
|
explicit IndexBuilder(const Operand_ptr &opd);
|
|
|
|
virtual Index_ptr build_all(const long &nb,
|
|
const float *xb,
|
|
const long *ids,
|
|
const long &nt = 0,
|
|
const float *xt = nullptr);
|
|
|
|
virtual Index_ptr build_all(const long &nb,
|
|
const std::vector<float> &xb,
|
|
const std::vector<long> &ids,
|
|
const long &nt = 0,
|
|
const std::vector<float> &xt = std::vector<float>());
|
|
|
|
//void train(const long &nt,
|
|
// const std::vector<float> &xt);
|
|
//
|
|
//Index_ptr add(const long &nb,
|
|
// const std::vector<float> &xb,
|
|
// const std::vector<long> &ids);
|
|
//
|
|
//void set_build_option(const Operand_ptr &opd);
|
|
|
|
|
|
protected:
|
|
Operand_ptr opd_ = nullptr;
|
|
};
|
|
|
|
class BgCpuBuilder : public IndexBuilder {
|
|
public:
|
|
BgCpuBuilder(const Operand_ptr &opd);
|
|
|
|
virtual Index_ptr build_all(const long &nb,
|
|
const float *xb,
|
|
const long *ids,
|
|
const long &nt = 0,
|
|
const float *xt = nullptr) override;
|
|
};
|
|
|
|
using IndexBuilderPtr = std::shared_ptr<IndexBuilder>;
|
|
|
|
extern IndexBuilderPtr GetIndexBuilder(const Operand_ptr &opd);
|
|
|
|
}
|
|
}
|
|
}
|