class_docstr: Counterfactual Reinforcement Learning. 
class_docstr_tok: ["Counterfactual","Reinforcement","Learning","."]
docstr: Validate the targets by checking the dimensions.
  
  Parameters
  ----------
  Y_t
      Targets to be checked.
code: def _validate_target(Y_t: Optional[np.ndarray]):
      """
      Validate the targets by checking the dimensions.
  
      Parameters
      ----------
      Y_t
          Targets to be checked.
      """
      if Y_t is None:
          raise ValueError("Target can not be `None`.")
  
      if len(Y_t.shape) not in [1, 2]:
          raise ValueError(
              f"Target shape should be at least 1 and at most 2. Found {len(Y_t.shape)} instead."
          )
  
imports: import logging
  import os
  from abc import ABC, abstractmethod
  from copy import deepcopy
  from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Union, cast
  import numpy
  from tqdm import tqdm
  from alibi.api.defaults import DEFAULT_DATA_CFRL, DEFAULT_META_CFRL
  from alibi.api.interfaces import Explainer, Explanation, FitMixin
  from alibi.explainers.backends.cfrl_base import generate_empty_condition, get_classification_reward, get_hard_distribution, identity_function
  from alibi.utils.frameworks import Framework, has_pytorch, has_tensorflow
label_desc: Use image node_id 11 for calling the CounterfactualRL obj's underlying member method code with example usage: obj._validate_target(Y_t) without return types