结构体 faiss::VectorTransform

struct VectorTransform

应用于向量集合的任何变换

faiss::CenteringTransform, faiss::ITQTransform, faiss::LinearTransform, faiss::NormalizationTransform, faiss::RemapDimensionsTransform 继承

公共函数

inline explicit VectorTransform(int d_in = 0, int d_out = 0)

! 输出维度

virtual void train(idx_t n, const float *x)

在代表性向量集上执行训练。默认情况下不执行任何操作。

参数:
  • n – 训练向量的数量

  • x – 训练向量,大小为 n * d

float *apply(idx_t n, const float *x) const

应用变换并在分配的指针中返回结果

参数:
  • n – 要变换的向量数

  • x – 输入向量,大小为 n * d_in

返回值:

输出向量,大小为 n * d_out

virtual void apply_noalloc(idx_t n, const float *x, float *xt) const = 0

应用变换并在提供的矩阵中返回结果

参数:
  • n – 要变换的向量数

  • x – 输入向量,大小为 n * d_in

  • xt – 输出向量,大小为 n * d_out

virtual void reverse_transform(idx_t n, const float *xt, float *x) const

反向变换。可能未实现或可能返回近似结果

virtual void check_identical(const VectorTransform &other) const = 0
inline virtual ~VectorTransform()

公共成员

int d_in
int d_out

! 输入维度

bool is_trained

如果 VectorTransform 不需要训练,或者如果训练已经完成,则设置此标志