Batch API¶
- class relational_transformers.RelationalBatch(node_idxs, f2p_nbr_idxs, col_name_idxs, table_name_idxs, is_padding, sem_types, is_targets, number_values, datetime_values, boolean_values, text_values, col_name_values)¶
A padded batch of relational cells.
This is the shared boundary used by PyTorch, Triton, ONNX, and RelativeDB. Integer tensors describe topology; value tensors contain already encoded model inputs. Boolean masks use
Truefor padding/targets.- Parameters:
node_idxs (Tensor)
f2p_nbr_idxs (Tensor)
col_name_idxs (Tensor)
table_name_idxs (Tensor)
is_padding (Tensor)
sem_types (Tensor)
is_targets (Tensor)
number_values (Tensor)
datetime_values (Tensor)
boolean_values (Tensor)
text_values (Tensor)
col_name_values (Tensor)
- ablate(cells)¶
Return a new batch with the same cell positions padded out.
Positions remain stable, so node and parent indices require no remap. Target cells may not be ablated.
- Parameters:
cells (Sequence[int])
- Return type:
- classmethod from_text_cells(cells, *, target, node_idxs=None, parents=None, table_idxs=None)¶
Build one batch row from
[column_embedding, value_embedding]cells.cellshas shape[S, 2*d_text]. This convenience path is useful for all-text examples; typed production callers should construct the full batch so scalar and datetime channels retain their semantics.- Parameters:
cells (ndarray | Tensor)
target (int | Sequence[int])
node_idxs (Sequence[int] | None)
parents (Mapping[int, Sequence[int]] | None)
table_idxs (Sequence[int] | None)
- Return type: