Skip to main content

subsets.from_mask

subsets.from_mask(masks, /)

The entries where each bool mask is True.

This is laplace-torch’s subnetwork_indices, given as masks.

Parameters

Name Type Description Default
masks Mapping[str, Tensor] Module parameter name mapped to a bool mask shaped like its parameter. A mask under a tied alias goes to the name subsets.all lists. required

Returns

Name Type Description
Subset The Subset, which gives a Selection. When called, it raises StructureError when the model has no module, a name is not a parameter of the module, two masks fall on one tied tensor, or Selection.from_masks refuses the masks (not bool, another shape, no entry selected).