csrtable
This is summary documentation for hippynn.layers.pairs.csr_pairs.csrtable module. Click here for full documentation.
Links to Full Documentation:
This file was written with assistance from an LLM.
Light-weight CSRTable container built on PyTorch tensors and utilities.
This module defines:
- starts_from_counts() — fast CSR row-pointer construction.
- row_and_offset() — decode flat indices to (row, in-row offset).
- CSRTable — a minimal, device/dtype-agnostic CSR container with
constructors, filtering, row reindexing, and row-wise Cartesian joins.
Conventions
All index tensors are
torch.long.Shapes are given in brackets, e.g.
[R]for rows,[nnz]for entries.device/dtypefollow the tensors you pass in; no implicit moves/casts.We avoid heavyweight validation in hot paths; use lightweight invariants below.
Invariants
Given a CSRTable with starts: [R+1], cols: [nnz], and data:
startsis non-decreasing withstarts[0] == 0andstarts[-1] == nnz.For each row
r,row_len[r] = starts[r+1] - starts[r] >= 0.Every
vindatahas lengthnnzand aligns withcolsorder.
Functions
|
Map query values to their indices in keys, or -1 if not found. |
|
Decode the flattened CSR value domain into row ids and in-row offsets. |
|
Build a CSR row-pointer (starts) from per-row counts. |
Classes
|
A minimal CSR container allowing for multiple payload arrays.. |