class_docstr: A Qtopt Agent.
  
  Implements the Qt-Opt algorithm from
  
  "QT-Opt: Scalable Deep Reinforcement Learning for Vision-Based Robotic "
    "Manipulation"
  
   Dmitry Kalashnikov et al., 2018
   https://arxiv.org/abs/1806.10293
code: def _setup_data_converter(self, q_network, gamma, n_step_update):
      if q_network.state_spec:
          if not self._in_graph_bellman_update:
              self._data_context = data_converter.DataContext(
                  time_step_spec=self._time_step_spec,
                  action_spec=self._action_spec,
                  info_spec=self._collect_policy.info_spec,
                  policy_state_spec=self._q_network.state_spec,
                  use_half_transition=True,
              )
              self._as_transition = data_converter.AsHalfTransition(
                  self.data_context, squeeze_time_dim=False
              )
          else:
              self._data_context = data_converter.DataContext(
                  time_step_spec=self._time_step_spec,
                  action_spec=self._action_spec,
                  info_spec=self._collect_policy.info_spec,
                  policy_state_spec=self._q_network.state_spec,
                  use_half_transition=False,
              )
              self._as_transition = data_converter.AsTransition(
                  self.data_context,
                  squeeze_time_dim=False,
                  prepend_t0_to_next_time_step=True,
              )
      else:
          if not self._in_graph_bellman_update:
              self._data_context = data_converter.DataContext(
                  time_step_spec=self._time_step_spec,
                  action_spec=self._action_spec,
                  info_spec=self._collect_policy.info_spec,
                  policy_state_spec=self._q_network.state_spec,
                  use_half_transition=True,
              )
  
              self._as_transition = data_converter.AsHalfTransition(
                  self.data_context, squeeze_time_dim=True
              )
          else:
              # This reduces the n-step return and removes the extra time dimension,
              # allowing the rest of the computations to be independent of the
              # n-step parameter.
              self._as_transition = data_converter.AsNStepTransition(
                  self.data_context, gamma=gamma, n=n_step_update
              )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import typing
  import gin
  import tensorflow
  from tf_agents.agents import data_converter
  from tf_agents.agents import tf_agent
  from tf_agents.networks import utils
  from tf_agents.policies import epsilon_greedy_policy
  from tf_agents.policies import qtopt_cem_policy
  from tf_agents.specs import tensor_spec
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import eager_utils
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 4 for calling the QtOptAgent obj's underlying member method code with example usage: obj._setup_data_converter(q_network, gamma, n_step_update) without return types