Documentation ¶
Overview ¶
Package faiss provides implementation of Go API for https://github.com/facebookresearch/faiss
Package faiss provides implementation of Go API for https://github.com/facebookresearch/faiss
Index ¶
Constants ¶
View Source
const ( // ------------------------------------------------------------- // Metric Type Definition // (https://github.com/facebookresearch/faiss/wiki/MetricType-and-distances) // ------------------------------------------------------------- // DistanceNone is unknown distance type. DistanceNone metricType = iota - 1 // InnerProduct is inner product. InnerProduct // L2 is l2 norm. L2 // ------------------------------------------------------------- // ErrorCode is false // -------------------------------------------------------------. ErrorCode = C._Bool(false) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Faiss ¶
type Faiss interface { // SaveIndex stores faiss index to strage. SaveIndex() error // SaveIndexWithPath stores faiss index to specified storage. SaveIndexWithPath(idxPath string) error // Train trains faiss index. Train(nb int, xb []float32) error // Add returns faiss ntotal. Add(nb int, xb []float32, xids []int64) (int, error) // Search returns search result as []algorithm.SearchResult. Search(k, nq int, xq []float32) ([]algorithm.SearchResult, error) // Remove removes from faiss index. Remove(size int, ids []int64) (int, error) // Close faiss index. Close() }
Faiss is core interface.
type Option ¶
type Option func(*faiss) error
Option represents the functional option for faiss.
func WithDimension ¶
WithDimension represents the option to set the dimension for faiss.
func WithIndexPath ¶
WithIndexPath represents the option to set the index path for faiss.
func WithMetricType ¶
WithMetricType represents the option to set the metric type for faiss.
func WithNbitsPerIdx ¶
WithNbitsPerIdx represents the option to set the n bits per index for faiss.
Click to show internal directories.
Click to hide internal directories.