tlc.core.objects.table_view¶

A thin map-style view over a Table that applies a sample-level transform on read.

Module Contents¶

Classes¶

Class

Description

TableView

A map-style view over a Table that applies a sample-level transform on every read.

API¶

class TableView(
source: Table | TableView,
transform: Callable[[Any], Any],
)¶

A map-style view over a Table that applies a sample-level transform on every read.

Implements the MapDataset protocol used by tlc.collect_metrics() and any torch.utils.data.DataLoader. Not itself a Table: it has no schema, no persistence, and no object-registry identity. Its url forwards to the underlying Table so metrics collected through it can be linked back to the source.

Views compose: wrapping a TableView in another TableView chains the transforms. source and url always resolve to the root Table, regardless of chain depth.

Construct via Table.with_transform() or by chaining TableView.with_transform().

property source: Table¶

The root Table underlying this view (walking through any chained TableView wrappers).

Useful for sampler construction (e.g. create_sampler(view.source, ...)).

property url: Url¶

The URL of the root Table. The view itself is not persisted.

with_transform(
transform: Callable[[Any], Any],
) TableView¶

Return a new TableView that applies transform on top of this view’s transform.

Parameters:

transform – A callable applied to each sample after this view’s transform has run. Must be picklable (top-level function or importable callable, not a lambda or local closure) when the view is consumed by a torch.utils.data.DataLoader with num_workers > 0.

Returns:

A TableView chaining transform on top of this view.