- class ExcludeVars(exclude_vars: List[str] | str | None = None, data_kinds: List[str] | None = None)¶
Exclude/Remove variables from Shareable.
exclude_vars (Union[List[str], str, None] , optional) – variables/layer names to be excluded.
data_kinds – kinds of DXO object to filter
- 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_dxo(dxo: DXO, shareable: Shareable, fl_ctx: FLContext) None | DXO ¶
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.
dxo (DXO) – DXO to be filtered.
shareable – that the dxo belongs to
fl_ctx (FLContext) – only used for logging.
Returns: filtered dxo