Returns a decorator that turns layers into layers supporting masking.
init_fnis left unchanged.
apply_fnis turned from a function that accepts a
mask=Nonekeyword argument (which indicates
inputs[mask]must be masked), into a function that accepts a
mask_constant=Nonekeyword argument (which indicates
inputs[inputs == mask_constant]must be masked).
kernel_fnis modified to
3.a. propagate the
kernel.mask2through intermediary layers, and,
remask_kernel == True, zeroes-out covariances between entries of which at least one is masked.
4. If the decorated layers has a
mask_fn, it is used to propagate masks forward through the layer, in both
kernel_fn. If not, it is assumed the mask remains unchanged.
Must be applied before the
Example of masking application in
Trueto zero-out kernel covariance entries between masked inputs after applying
kernel_fn. Some layers don’t need this and setting
remask_kernel=Falsecan save compute.
A decorator that turns functions returning
(init_fn, apply_fn, kernel_fn[, mask_fn])into functions returning
(init_fn, apply_fn_with_masking, kernel_fn_with_masking).