code: def to_tensor(
      X: Union[np.ndarray, tf.Tensor], **kwargs
  ) -> Optional[tf.Tensor]:
      """
      Converts tensor to `tf.Tensor`.
  
      Parameters
      ----------
      X
          Input array/tensor to be converted.
      **kwargs
          Other arguments. Not used.
  
      Returns
      -------
      `tf.Tensor` conversion.
      """
      if X is not None:
          if isinstance(X, tf.Tensor):
              return X
  
          return tf.constant(X)
  
      return None
  
imports: import os
  import random
  from typing import Any, List, Dict, Callable, Union, Optional, TYPE_CHECKING
  import numpy
  import tensorflow
  import tensorflow.keras
  from alibi.explainers.backends.cfrl_base import CounterfactualRLDataset
  from alibi.models.tensorflow.actor_critic import Actor, Critic
label_desc: Use image node_id 16 for calling a global function with example usage: to_tensor(X) and returns: None, tf, X