Phase2PhaseSplittingMaskGenerator#
- class deepinv.physics.generator.Phase2PhaseSplittingMaskGenerator(img_size, device='cpu', rng=None)[source]#
Bases:
BernoulliSplittingMaskGeneratorPhase2Phase splitting mask generator for dynamic data.
To be exclusively used with
deepinv.loss.mri.Phase2PhaseLoss. Splits dynamic data (i.e. data of shape (B, C, T, H, W)) into even and odd phases in the T dimension.Used in Eldeniz et al.[1].
If input_mask not passed, a blank input mask is used instead.
- Parameters:
img_size (tuple[int]) – size of the tensor to be masked without batch dimension of shape (C, T, H, W). Note this can be overriden on-the-fly by passing in
img_sizeorinput_maskarguments tostep.device (str, torch.device) – device where the tensor is stored (default: ‘cpu’).
rng (torch.Generator) – unused.
- References:
- batch_step(input_mask=None, img_size=None)[source]#
Create one batch of splitting mask.
- Parameters:
input_mask (torch.Tensor, None) – optional mask to be split. If
None, all pixels are considered. If notNone, only pixels wheremask==1are considered. Batch dimension should not be included in shape.img_size (tuple) – if not
None, generate masks of this 2D image shape and overrideimg_sizeattribute, must be of form(H, W).
- Returns:
mask without batch dimension of shape specified either by
img_size,input_mask, or class attributeimg_size.- Return type: