xnn.gnn.fast.tensornet#
Fast path of the TensorNet embedding and interaction layers (Triton kernels).
The reference layers gather the neighbors’ tensor parts to the pairs, multiply
them with the filters and sum the products onto the centers as separate tensor
operations, each writing a (P, F), (P, 3, F) or (P, 3, 3, F) tensor
that autograd keeps for the backward pass (P pairs, the self pairs
included); the embedding does the same with the radial projections and the
direction products. Here the networks stay as they are (the pair embedding per
atom, the radial projections and the filter networks), and one kernel per layer
gathers, multiplies and adds onto the centers, applying the cutoff on the way:
no pair-sized tensor is written. The symmetric parts travel as their six
distinct entries. The backward pass is one kernel per layer that adds the
gradients of the atom-wise inputs onto the neighbors (and centers) and writes
those of the filter networks’ outputs, the cutoff and the directions.
The gradient reaches positions, cell and the networks’ weights, and the backward kernels are differentiable once more, by kernels of the same form (the pair sums are linear in each input), so that a force loss trains through the fused layers. Third derivatives are not supported. The atom-wise stages are compiled, in training mode with their first and second derivatives compiled as well.
Module Attributes
Edge counts above which |
|
every size, since the fused layers were faster than the reference from a single small molecule on (A100, A30, V100 and T4), in both precisions. |
Functions
|
The |
|
The embedding's parts from the fused pair sums |
|
|
|
The parts of |
|
|
|
The atom-wise stage |
|
Triton kernels on a CUDA device in float32 or float64. |