结构体 faiss::CenteringTransform
-
struct CenteringTransform : public faiss::VectorTransform
从向量中减去每个分量的均值。
公共函数
-
explicit CenteringTransform(int d = 0)
-
virtual void train(idx_t n, const float *x) override
在 n 个向量上进行训练。
-
virtual void apply_noalloc(idx_t n, const float *x, float *xt) const override
减去均值
-
virtual void reverse_transform(idx_t n, const float *xt, float *x) const override
加上均值
-
virtual void check_identical(const VectorTransform &other) const override
-
float *apply(idx_t n, const float *x) const
应用变换并返回分配的指针中的结果
- 参数:
n – 要变换的向量的数量
x – 输入向量,大小为 n * d_in
- 返回值:
输出向量,大小为 n * d_out
公共成员
-
std::vector<float> mean
均值,大小为 d_in = d_out。
-
int d_in
-
int d_out
! 输入维度
-
bool is_trained
如果 VectorTransform 不需要训练,或者如果训练已经完成,则设置
-
explicit CenteringTransform(int d = 0)