Learn R Programming

animl (version 3.2.0)

compute_batched_distance_matrix: Computes the distance matrix in a batched manner to save memory.

Description

Computes the distance matrix in a batched manner to save memory.

Usage

compute_batched_distance_matrix(
  input1,
  input2,
  metric = "cosine",
  batch_size = 10
)

Value

distance matrix

Arguments

input1

2-D array of query features

input2

2-D array of database features

metric

The distance metric to use. Options include 'euclidean', 'cosine', etc

batch_size

The number of rows from input1 to process at a time

Examples

Run this code
if (FALSE) {
dist_matrix <- compute_batched_distance_matrix(query_embeddings, database_embeddings, 
                                               metric='cosine', batch_size=12)}

Run the code above in your browser using DataLab