NDT2Masker#
- class pretrain.models.NDT2Masker(mask_ratio)[source]#
Bases:
torch.nn.modules.module.ModuleShuffleInfill-style MAE masker for NDT2.
A single random shuffle is shared across the whole batch (same as ShuffleInfill). The first
encoder_fracpositions go to the encoder; the rest become decoder queries. All tensors keep their full padded length, no per-sample packing needed. The loss usesquery_maskto ignore padding and spatially-invalid tokens.- forward(inputs)[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.