# tensorplay.ao.pruning.custom_from_mask Source: https://www.tensorplay.cn/docs/generated/tensorplay.ao.pruning.custom_from_mask.html ```python tensorplay.ao.pruning.custom_from_mask(module: Module, name: str, mask: Tensor) → Module ``` Prune module[name] with a pre-computed binary mask. Modifies the module in place (and also returns it) by: - adding a named buffer called name + '_mask' holding mask; - replacing the parameter name by its masked version, while the original (unmasked) values are stored in a new parameter named name + '_orig'. Parameters: - module – module containing the tensor to prune. - name – parameter name within module on which pruning acts. - mask – binary mask to be applied to the parameter. Returns: The modified (i.e. pruned) module. Examples ``` >>> # xdoctest: +SKIP >>> m = custom_from_mask( ... nn.Linear(5, 3), name="bias", mask=tensorplay.tensor([0, 1, 0]) ... ) >>> print(m.bias_mask) tensor([0., 1., 0.]) ```