besskge.utils

General purpose utilities.

Functions

complex_multiplication(v1, v2)

Batched complex multiplication.

complex_rotation(v, r)

Batched rotation by unitary tensors.

gather_indices(x, index)

IPU-friendly gather function like torch.take_along_dim() for 2-dimensional tensors (indices along dim=1).

get_entity_filter(triples, filter_triples, ...)

Compare two sets of triples: for each triple (h,r,t) in the first set, find the entities e such that (e,r,t) (or (h,r,e), depending on filter_mode) appears in the second set of triples.