class_docstr: Class that validates and converts other data types to Trajectory.
  
  Note that validation and conversion allows values to contain dictionaries
  with extra keys as compared to the the specs in the data context.  These
  additional entries / observations are ignored and dropped during conversion.
  
  This non-strict checking allows users to provide additional info and
  observation keys at input without having to manually prune them before
  converting.
class_docstr_tok: ["Class","that","validates","and","converts","other","data","types","to","Trajectory",".","Note","that","validation","and","conversion","allows","values","to","contain","dictionaries","with","extra","keys","as","compared","to","the","the","specs","in","the","data","context",".","These","additional","entries","\/","observations","are","ignored","and","dropped","during","conversion",".","This","non-strict","checking","allows","users","to","provide","additional","info","and","observation","keys","at","input","without","having","to","manually","prune","them","before","converting","."]
docstr: Convers `value` to a Trajectory. Performs data validation and pruning.
  
  - If `value` is already a `Trajectory`, only validation is performed.
  - If `value` is a `Transition` with tensors containing two (`[B, T]`)
    outer dims, then it is simply repackaged to a `Trajectory` and then
    validated.
  - If `value` is a `Transition` with tensors containing one (`[B]`) outer
    dim, a `ValueError` is raised.
  
  Args:
    value: A `Trajectory` or `Transition` object to convert.
  
  Returns:
    A validated and pruned `Trajectory`.
  
  Raises:
    TypeError: If `value` is not one of `Trajectory` or `Transition`.
    ValueError: If `value` has structure that doesn't match the converter's
      spec.
    TypeError: If `value` has a structure that doesn't match the converter's
      spec.
    ValueError: If `value` is a `Transition` without a time dimension, as
      training Trajectories typically have batch and time dimensions.
code: def __call__(self, value: typing.Any) -> trajectory.Trajectory:
      """Convers `value` to a Trajectory. Performs data validation and pruning.
  
      - If `value` is already a `Trajectory`, only validation is performed.
      - If `value` is a `Transition` with tensors containing two (`[B, T]`)
        outer dims, then it is simply repackaged to a `Trajectory` and then
        validated.
      - If `value` is a `Transition` with tensors containing one (`[B]`) outer
        dim, a `ValueError` is raised.
  
      Args:
        value: A `Trajectory` or `Transition` object to convert.
  
      Returns:
        A validated and pruned `Trajectory`.
  
      Raises:
        TypeError: If `value` is not one of `Trajectory` or `Transition`.
        ValueError: If `value` has structure that doesn't match the converter's
          spec.
        TypeError: If `value` has a structure that doesn't match the converter's
          spec.
        ValueError: If `value` is a `Transition` without a time dimension, as
          training Trajectories typically have batch and time dimensions.
      """
      if isinstance(value, trajectory.Trajectory):
          pass
      elif isinstance(value, trajectory.Transition):
          value = trajectory.Trajectory(
              step_type=value.time_step.step_type,
              observation=value.time_step.observation,
              action=value.action_step.action,
              policy_info=value.action_step.info,
              next_step_type=value.next_time_step.step_type,
              reward=value.next_time_step.reward,
              discount=value.next_time_step.discount,
          )
      else:
          raise TypeError("Input type not supported: {}".format(value))
      _validate_trajectory(
          value,
          self._data_context.trajectory_spec,
          sequence_length=self._sequence_length,
          num_outer_dims=self._num_outer_dims,
      )
      value = nest_utils.prune_extra_keys(
          self._data_context.trajectory_spec, value
      )
      return value
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import typing
  import tensorflow
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.typing import types
  from tf_agents.utils import composite
  from tf_agents.utils import nest_utils
  import typing_extensions
label_desc: Use image node_id 2 for calling the AsTrajectory obj's underlying member method code with example usage: obj.__call__(value) and returns: value