xnn.gnn.models.mace.set_message_blocks#

xnn.gnn.models.mace.set_message_blocks(model, block='auto')[source]#

Choose how the MACE interactions of model run their message pass.

In blocks of edges, the per-edge weights of the radial network exist for one block at a time, and each block is evaluated again in the backward pass: the largest structure that fits on a GPU grows by the size of those weights, at the cost of a second forward pass over the edges. The results equal the single pass up to the order of the node sums.

Parameters:
  • model (torch.nn.Module) – Any model; every MACE interaction in it is set.

  • block (int or str) – "auto" (default): in evaluation on a GPU, blocks only when the message passes of all edges would not fit in the free memory; "off": never; an integer: blocks of that many edges.

Returns:

model.

Return type:

torch.nn.Module