code: def __setitem__(self, key, value):
      if not isinstance(value, TensorSpec) and not isinstance(
          value, TensorsSpec
      ):
          if not isinstance(value, dict):
              raise TensorforceError.type(
                  name="TensorsSpec",
                  argument="value",
                  dtype=type(value),
              )
          elif "type" in value or "shape" in value:
              value = TensorSpec(**value, overwrite=self.overwrite)
          else:
              value = TensorsSpec(value)
  
      if key == "horizons":
          if (
              not isinstance(value, TensorSpec)
              or value.type != "int"
              or value.shape != (2,)
          ):
              raise TensorforceError.value(
                  name="TensorsSpec", argument="horizons", value=value
              )
  
      elif key == "parallel":
          if (
              not isinstance(value, TensorSpec)
              or value.type != "int"
              or value.shape != ()
          ):
              raise TensorforceError.value(
                  name="TensorsSpec", argument="parallel", value=value
              )
  
      elif key == "reward":
          if (
              not isinstance(value, TensorSpec)
              or value.type != "float"
              or value.shape != ()
          ):
              raise TensorforceError.value(
                  name="TensorsSpec", argument="reward", value=value
              )
  
      elif key == "terminal":
          if (
              not isinstance(value, TensorSpec)
              or value.type != "int"
              or value.shape != ()
          ):
              raise TensorforceError.value(
                  name="TensorsSpec", argument="terminal", value=value
              )
  
      super().__setitem__(key, value)
  
file_path: tensorforce/tensorforce/core/utils/tensors_spec.py
imports: from tensorforce import TensorforceError
  from tensorforce.core.utils import ArrayDict, NestedDict, SignatureDict, TensorDict, TensorSpec
label_desc: Use image node_id 8 for calling the TensorsSpec obj's underlying member method code with example usage: obj.__setitem__(key, value) without return types