MtMMasker#
- class pretrain.models.MtMMasker(mask_ratio, mask_types, causal_ratio=0.1)[source]#
Bases:
torch.nn.modules.module.ModuleModule for masking spikes. Masking modes:
neuron: mask all time bins of a random set of neurons.causal: mask a fixed set of future time steps.inter_region: mask all neurons of one region; predictions are for that masked region.intra_region: randomly mask a fraction of neurons within a target region; predict those masked neurons from the rest of the target region only (all neurons outside the target region are zeroed out in the input).
CONFIG:
mask_ratio: fraction of neurons to mask (used by neuron and intra_region modes)causal_ratio: fraction of trailing time bins to mask (deterministic; the lastfloor(causal_ratio * T)bins are masked, with a floor of 1 bin).
- forward(spikes, regions, mask_mode=None, generator=None)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.