def _parse_mask(self, mask: Optional[DataArray]) -> Optional[Tensor]:
    if (mask is None):
        return None
    mask = utils.copy_to_tensor(mask)
    mask = utils.to_steps_nodes_channels(mask)
    self._check_same_dim(mask.size(0), 'n_steps', 'mask')
    self._check_same_dim(mask.size(1), 'n_nodes', 'mask')
    if (mask.size((- 1)) > 1):
        self._check_same_dim(mask.size((- 1)), 'n_channels', 'mask')
    mask = utils.cast_tensor(mask)
    return mask
def _parse_mask(self, mask: Optional[DataArray]) -> Optional[Tensor]:
    if (mask is None):
        return None
    mask = utils.copy_to_tensor(mask)
    mask = utils.to_steps_nodes_channels(mask)
    self._check_same_dim(mask.size(0), 'n_steps', 'mask')
    self._check_same_dim(mask.size(1), 'n_nodes', 'mask')
    if (mask.size((- 1)) > 1):
        self._check_same_dim(mask.size((- 1)), 'n_channels', 'mask')
    mask = utils.cast_tensor(mask)
    return mask