xnn.common.models.ops#

Tensor operations shared across model families (cnn / dnn / gnn).

Kept here, at the models level, because they are common to more than one architecture type. Per-family helpers live under the family package instead (e.g. models/gnn/base.py), and graph-level reductions that every model needs live on InteratomicPotential (aggregate_energy).

Functions

build_triplets(edge_index, num_nodes)

Enumerate neighbour pairs (j, k) sharing a centre i.

scatter_sum(src, index, dim_size)

Sum rows of src into dim_size buckets given by index (dim 0).

shifted_softplus(x)

Shifted softplus ssp(x) = ln(0.5 e^x + 0.5) with ssp(0) = 0.