nvflare.app_common.filters.exclude_vars module¶
- class ExcludeVars(exclude_vars: Optional[Union[List[str], str]] = None)[source]¶
Bases:
Filter
Exclude/Remove variables from Shareable.
- Parameters
exclude_vars (Union[List[str], str, None] , optional) – variables/layer names to be excluded.
Notes
- Based on different types of exclude_vars, this filter has different behavior:
if a list of variable/layer names, only specified variables will be excluded. if a string, it will be converted into a regular expression, only matched variables will be excluded. if not provided or other formats the Shareable remains unchanged.
- process(shareable: Shareable, fl_ctx: FLContext) Shareable [source]¶
Called by upper layer to remove variables in weights/weight_diff dictionary.
When the return code of shareable is not ReturnCode.OK, this function will not perform any process and returns the shareable back.
- Parameters
shareable (Shareable) – shareable must conform to DXO format.
fl_ctx (FLContext) – only used for logging.
- Returns
a shareable with excluded weights
- Return type
Shareable