Filter#
- brainstate.typing.Filter#
Flexible filter type that can be a single filter or combination of filters.
This allows for complex filtering patterns by combining multiple filter criteria.
Examples
>>> # Single filter >>> simple_filter: Filter = "weight" >>> >>> # Tuple of filters (all must match) >>> combined_filter: Filter = (float, "weight") >>> >>> # List of filters (any can match) >>> alternative_filter: Filter = [int, float, "bias"] >>> >>> # Nested combinations >>> complex_filter: Filter = [ ... ("weight", lambda p, x: x.ndim == 2), # 2D weight matrices ... ("bias", lambda p, x: x.ndim == 1), # 1D bias vectors ... ]