NDT2Masker#

class pretrain.models.NDT2Masker(mask_ratio)[source]#

Bases: torch.nn.modules.module.Module

ShuffleInfill-style MAE masker for NDT2.

A single random shuffle is shared across the whole batch (same as ShuffleInfill). The first encoder_frac positions go to the encoder; the rest become decoder queries. All tensors keep their full padded length, no per-sample packing needed. The loss uses query_mask to 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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.