class_docstr: A base class that checks the type of the input data.
  
  Args:
      dtype: The type of the object.
  
  .. testcode::
      :skipif: True
  
      spec = TypeSpec(tf.Tensor)
      spec.validate(tf.ones((2, 3))) # passes
      spec.validate(torch.ones((2, 3))) # ValueError
code: def __ne__(self, other: "TypeSpec") -> bool:
      return not self == other
  
imports: import abc
  from copy import deepcopy
  import numpy
  from typing import Any, Optional, Dict, List, Tuple, Union, Type
  from ray.rllib.utils import try_import_jax, try_import_tf, try_import_torch
  from ray.rllib.utils.annotations import OverrideToImplementCustomLogic
  from ray.rllib.utils.annotations import DeveloperAPI, override
  from ray.rllib.utils.typing import TensorType
label_desc: Use image node_id 5 for calling the TypeSpec obj's underlying member method code with example usage: obj.__ne__(other) and returns: unknown