xnn.gnn.models.blocks.RadialNet#
- class xnn.gnn.models.blocks.RadialNet(hs, act=None, variance_in=1, variance_out=1, out_act=False)[source]#
Bases:
FullyConnectedNet,FastPathModulePer-edge radial network that can recompute its hidden layers in the backward.
An
e3nn.nn.FullyConnectedNet(same parameters andstate_dictkeys, outputs equal to round-off). When a gradient flows through it (forces, stress), the hidden layers’ activations,E x hiddenper layer whatever the tensor product’s size, are kept for the backward pass; with recomputation only the last hidden output is kept and the hidden layers run again in the backward, giving the same values. TorchScript always keeps the activations.On the fast path (evaluation mode, float32 on CUDA, three hidden SiLU layers of at most 128 features) the hidden layers run as one Triton kernel per tile of edges whose backward recomputes them (
xnn.gnn.fast.radial_kernels); training mode takes the layers as written.With
out_indexandout_scaleit returns the output columnsout_indextimesout_scale, mapping the last layer’s matrix once instead of every output row (the column order and scale of a fused tensor product’s weights; equal to mapping the output, to round-off).- Variables:
recompute (str) –
"auto"(default): recompute in evaluation mode fromRECOMPUTE_MIN_EDGESedges;"on": whenever a gradient is needed;"off": never. Set withset_recompute_radial().- Parameters:
- forward(x, out_index=None, out_scale=None)[source]#
Apply the network to
xof shape(E, hs[0]); without_scale(andout_index), its output columns mapped as in the class notes.Each layer is one matrix product whose scalar factor carries the layer’s normalization and the constant of the previous activation, then the activation: the same values as the layers applied one by one, in fewer kernels. TorchScript applies the layers one by one.