xnn.gnn.models.dimenet.TripletPlanner#

class xnn.gnn.models.dimenet.TripletPlanner[source]#

Bases: object

The triplets of a batch, built outside the model step for a captured training step.

A captured step (xnn.common.train.graphed) needs fixed shapes and no host synchronization, and the triplet count of a batch is known only after enumerating them. A data-loader worker therefore builds them on the CPU, {"kj": ..., "ji": ...} (directed_triplets()), pads them to a fixed count, and attaches them to the batch as index_plan, where DimeNet.forward() takes them from. Holds no state, so the workers receive it cheaply.

offsets = {'ji': 'edges', 'kj': 'edges'}#

The count each plan entry indexes (for batching the plans of single structures).

static sizes(plan)[source]#

The sizes a padded batch fixes: the triplet count.

Parameters:

plan (Dict[str, Tensor])

Return type:

Dict[str, int]

static pad(plan, sizes, dummy_edge)[source]#

plan filled up to sizes["triplets"] with triplets of the padding edge dummy_edge (an edge between padding atoms, outside every real structure).

Parameters:
Return type:

Dict[str, Tensor]