Coordinate management

Coordinate managers make sparse support identity explicit. A CoordinateMapKey belongs to exactly one CoordinateManager; relations are cached by source key, target key, kernel geometry, semantic operation, and execution policy. This prevents tensors with equal stride but different rows from sharing a kernel map.

Feature-only operations preserve the input key. Support-changing operations insert a new map into the same manager so later inverse convolution and branch alignment can refer to the precise execution graph.

class torch_lattice.core.coords.CoordinateMapKey(manager_id, id, stride)[source]

Bases: object

Identity of one coordinate support owned by a coordinate manager.

Parameters:
manager_id: int
id: int
stride: tuple[int, int, int]
class torch_lattice.core.coords.RelationKey(source, target, operation, kernel_size, stride, padding, dilation, execution)[source]

Bases: object

Identity of a cached sparse relation and its execution representation.

Parameters:
source: CoordinateMapKey
target: CoordinateMapKey
operation: str
kernel_size: tuple[int, int, int]
stride: tuple[int, int, int]
padding: tuple[int, int, int]
dilation: tuple[int, int, int]
execution: tuple[Any, ...]
class torch_lattice.core.coords.CoordinateMap(coords, spatial_range, batch_counts)[source]

Bases: object

Parameters:
coords: Tensor
spatial_range: tuple[int, int, int, int] | None
batch_counts: tuple[int, ...] | None
class torch_lattice.core.coords.CoordinateManager[source]

Bases: object

Own coordinate supports and relations for one sparse execution graph.

insert(coords, stride, *, spatial_range, batch_counts)[source]
Return type:

CoordinateMapKey

Parameters:
get(key)[source]
Return type:

CoordinateMap

Parameters:

key (CoordinateMapKey)

relation(key)[source]
Return type:

Any | None

Parameters:

key (RelationKey)

set_relation(key, relation)[source]
Return type:

None

Parameters:
forward_relation(source, *, operation, kernel_size, stride, padding, dilation, execution)[source]
Return type:

tuple[CoordinateMapKey, Any] | None

Parameters:
set_forward_relation(key, relation)[source]
Return type:

None

Parameters:
set_inverse_relation(key, relation)[source]
Return type:

None

Parameters:
inverse_relation(source, *, operation, kernel_size, stride, padding, dilation, execution)[source]
Return type:

tuple[CoordinateMapKey, Any] | None

Parameters:
generated_target(source, *, operation, kernel_size, stride, padding, dilation)[source]

Return cached support generated by a coordinate-only operation.

Return type:

CoordinateMapKey | None

Parameters:
set_generated_target(source, target, *, operation, kernel_size, stride, padding, dilation)[source]

Cache one generated coordinate support by its exact geometry.

Return type:

None

Parameters:
hashmap(key, execution)[source]
Return type:

tuple[Any, Any] | None

Parameters:
set_hashmap(key, execution, value)[source]
Return type:

None

Parameters:
clear_relations()[source]
Return type:

None

property relation_count: int
property cached_relations: tuple[Any, ...]

Read-only snapshot of cached relation payloads for diagnostics.

property cached_hashmaps: tuple[tuple[Any, Any], ...]

Read-only snapshot of native hash maps for diagnostics.