class_docstr: A class that represents Random Fourier Features.
class_docstr_tok: ["A","class","that","represents","Random","Fourier","Features","."]
docstr: Check that the `batch_shape` of X, if any, is compatible with the
  `sample_shape` & `kernel_batch_shape`.
docstr_tok: ["Check","that","the","`","batch_shape","`","of","X",",","if","any",",","is","compatible","with","the","`","sample_shape","`","&","`","kernel_batch_shape","`","."]
code: def _check_forward_X_shape_compatibility(self, X: Tensor) -> None:
      r"""Check that the `batch_shape` of X, if any, is compatible with the
      `sample_shape` & `kernel_batch_shape`.
      """
      full_batch_shape_X = X.shape[:-2]
      len_full_batch_shape_X = len(full_batch_shape_X)
      if len_full_batch_shape_X == 0:
          # Non-batched X.
          return
      expected_batch_shape = self.sample_shape + self.kernel_batch_shape
      # Check if they're broadcastable.
      for b_idx in range(
          min(len(expected_batch_shape), len_full_batch_shape_X)
      ):
          neg_idx = -b_idx - 1
          if (
              full_batch_shape_X[neg_idx]
              != expected_batch_shape[neg_idx]
              and full_batch_shape_X[neg_idx] != 1
          ):
              raise ValueError(
                  "the batch shape of X is expected to follow the pattern: "
                  f"`... x {tuple(expected_batch_shape)}`"
              )
  
imports: from __future__ import annotations
  from copy import deepcopy
  from math import pi
  from typing import List, Optional
  import torch
  from botorch.models.converter import batched_to_model_list
  from botorch.models.deterministic import GenericDeterministicModel
  from botorch.models.model import Model, ModelList
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.models.multitask import MultiTaskGP
  from botorch.utils.sampling import manual_seed
  from botorch.utils.transforms import is_ensemble
  from gpytorch.kernels import Kernel, MaternKernel, RBFKernel, ScaleKernel
  from linear_operator.utils.cholesky import psd_safe_cholesky
  from torch import Tensor
  from torch.distributions import MultivariateNormal
  from torch.nn import Module
label_desc: Use image node_id 4 for calling the RandomFourierFeatures obj's underlying member method code with example usage: obj._check_forward_X_shape_compatibility(X) without return types