Skip to main content

Classes

List

Internal Instances of the List class are used to represent lists of values in TopK. Usually created using data constructors such as f32_list(), i32_list(), etc.

SparseVector

Internal Instances of the SparseVector class are used to represent sparse vectors in TopK. Usually created using data constructors such as f32_sparse_vector() or u8_sparse_vector().

Matrix

Internal Instances of the Matrix class are used to represent matrices in TopK. Usually created using data constructors such as matrix().

Struct

Internal Instances of the Struct class are used to represent nested object values in TopK. Usually created using the struct() helper.

Functions

f8_vector()

Create a List type containing a 8-bit float vector. Example:
Parameters Returns List

f16_vector()

Create a List type containing a 16-bit float vector. Example:
Parameters Returns List

f32_vector()

Create a List type containing a 32-bit float vector. This function is an alias for f32_list(). Example:
Parameters Returns List

u8_vector()

Create a List type containing an 8-bit unsigned integer vector. This function is an alias for u8_list(). Example:
Parameters Returns List

i8_vector()

Create a List type containing an 8-bit signed integer vector. Example:
Parameters Returns List

binary_vector()

Create a List type containing a binary vector. Example:
Parameters Returns List

f32_sparse_vector()

Create a SparseVector type containing a 32-bit float sparse vector. Example:
Parameters Returns SparseVector

u8_sparse_vector()

Create a SparseVector type containing an 8-bit unsigned integer sparse vector. Example:
Parameters Returns SparseVector

bytes()

Create a List type containing bytes data. Example:
Parameters Returns List

u32_list()

Create a List type containing a list of 32-bit unsigned integers. Example:
Parameters Returns List

i32_list()

Create a List type containing a list of 32-bit signed integers. Example:
Parameters Returns List

i64_list()

Create a List type containing a list of 64-bit signed integers. Example:
Parameters Returns List

f32_list()

Create a List type containing a list of 32-bit floating point numbers. Example:
Parameters Returns List

f64_list()

Create a List type containing a list of 64-bit floating point numbers. Example:
Parameters Returns List

string_list()

Create a List type containing a list of strings. Example:
Parameters Returns List

struct()

Create a Struct type containing nested object values. Example:
Parameters Returns Struct

matrix()

Create a Matrix type containing matrix values. The values parameter can be a list of lists or a numpy array. When passing a numpy array, the matrix type is inferred from the array’s dtype (float32, float16, uint8, int8). When passing a list of lists, the optional value_type parameter specifies the matrix type. If value_type is not provided, the matrix defaults to f32.
Parameters Returns Matrix