Skip to content

act

Activation factory wrapper around torch_geometric.nn.resolver.

Thin wrapper around torch_geometric.nn.resolver.activation_resolver that returns None when act is None, so callers don't need a None guard before assigning the result. Exists for API symmetry with create_norm, which adds dimensionality support that PyG's resolver does not have.

Functions:

  • create_act –

    Resolve an activation, returning None for act=None.

create_act

create_act(
    act: Union[str, Callable, None], **act_kwargs: Any
) -> Optional[Module]

Resolve an activation, returning None for act=None.

Parameters:

  • act (Union[str, Callable, None]) –

    Activation name (e.g., "relu", "leaky_relu"), a class, an instance, or None.

  • **act_kwargs (Any, default: {} ) –

    Forwarded to the activation constructor (ignored if act is already an instance).

Returns:

  • Optional[Module] –

    The instantiated activation module, or None if act is None.