compileml.runtime — primitives

band_index

def band_index(latent_int: int, edges_int: collections.abc.Sequence[int]) -> int

from compileml.runtime import band_index

Index of the band containing latent_int.

Bands are left-closed, right-open on the interior cutoffs; values below the first edge belong to band 0 and values at or above the last edge belong to the final band.

Parameters#

NameTypeDefaultKind
latent_intintrequiredpositional
edges_intcollections.abc.Sequence[int]requiredpositional

Returns#

int

Example#

python
from compileml.runtime import band_index
 
i = band_index(artifact["bands"]["edges_int"], latent_int)