Struct faiss::RemapDimensionsTransform
-
struct RemapDimensionsTransform : public faiss::VectorTransform
remap dimensions for intput vectors, possibly inserting 0s strictly speaking this is also a linear transform but we don’t want to compute it with matrix multiplies
Public Functions
-
RemapDimensionsTransform(int d_in, int d_out, const int *map)
-
RemapDimensionsTransform(int d_in, int d_out, bool uniform = true)
remap input to output, skipping or inserting dimensions as needed if uniform: distribute dimensions uniformly otherwise just take the d_out first ones.
-
virtual void apply_noalloc(idx_t n, const float *x, float *xt) const override
apply the transformation and return the result in a provided matrix
- Parameters:
n – number of vectors to transform
x – input vectors, size n * d_in
xt – output vectors, size n * d_out
-
virtual void reverse_transform(idx_t n, const float *xt, float *x) const override
reverse transform correct only when the mapping is a permutation
-
inline RemapDimensionsTransform()
-
virtual void check_identical(const VectorTransform &other) const override
-
virtual void train(idx_t n, const float *x)
Perform training on a representative set of vectors. Does nothing by default.
- Parameters:
n – nb of training vectors
x – training vecors, size n * d
-
float *apply(idx_t n, const float *x) const
apply the transformation and return the result in an allocated pointer
- Parameters:
n – number of vectors to transform
x – input vectors, size n * d_in
- Returns:
output vectors, size n * d_out
Public Members
-
std::vector<int> map
map from output dimension to input, size d_out -1 -> set output to 0
-
int d_in
-
int d_out
! input dimension
-
bool is_trained
set if the VectorTransform does not require training, or if training is done already
-
RemapDimensionsTransform(int d_in, int d_out, const int *map)