bijx.checker_mask

bijx.checker_mask(shape, parity)[source]

Create checkerboard pattern binary mask.

Generates a checkerboard (alternating) pattern mask commonly used in coupling layers for spatial data like images. The pattern alternates between True/False based on the sum of coordinates.

Parameters:
  • shape – Spatial dimensions of the input array.

  • parity (bool) – Starting parity - if True, (0,0,…) position starts as True.

Returns:

BinaryMask instance with checkerboard pattern.

Example

>>> # 2x2 checkerboard with parity=0
>>> mask = checker_mask((2, 2), parity=False)
>>> mask.boolean_mask.shape
(2, 2)