class_docstr: Tests for `Retrace` ops.
class_docstr_tok: ["Tests","for","`","Retrace","`","ops","."]
docstr: Constructs a tf subgraph from `retrace_core` op.
  
  A retrace core namedtuple is built from a two-sequence, three-timestep
  input minibatch.
  
  Returns:
    Tuple of size 3 containing non-differentiable inputs, differentiable
    inputs and retrace_core namedtuple.
docstr_tok: ["Constructs","a","tf","subgraph","from","`","retrace_core","`","op",".","A","retrace","core","namedtuple","is","built","from","a","two-sequence",",","three-timestep","input","minibatch",".","Returns",":","Tuple","of","size","3","containing","non-differentiable","inputs",",","differentiable","inputs","and","retrace_core","namedtuple","."]
code: def _get_retrace_core(self):
      """Constructs a tf subgraph from `retrace_core` op.
  
      A retrace core namedtuple is built from a two-sequence, three-timestep
      input minibatch.
  
      Returns:
        Tuple of size 3 containing non-differentiable inputs, differentiable
        inputs and retrace_core namedtuple.
      """
      # Here we essentially replicate the preprocessing that `retrace` does
      # as it constructs the inputs to `retrace_core`.
      # These ops must be Tensors so that we can use them in the
      # `testNoOtherGradients` unit test. TensorFlow can only compute gradients
      # with respect to other parts of the graph
      lambda_ = tf.constant(self.lambda_)
      q_tm1 = tf.constant(self.qs[:3])
      a_tm1 = tf.constant(self.actions[:3])
      r_t = tf.constant(self.rewards[:3])
      pcont_t = tf.constant(self.pcontinues[:3])
      target_policy_t = tf.constant(self.target_policy_probs[1:4])
      behaviour_policy_t = tf.constant(self.behaviour_policy_probs[1:4])
      targnet_q_t = tf.constant(self.targnet_qs[1:4])
      a_t = tf.constant(self.actions[1:4])
      static_args = [
          lambda_,
          a_tm1,
          r_t,
          pcont_t,
          target_policy_t,
          behaviour_policy_t,
          targnet_q_t,
          a_t,
      ]
      diff_args = [q_tm1]
      return (
          static_args,
          diff_args,
          retrace_ops.retrace_core(
              lambda_,
              q_tm1,
              a_tm1,
              r_t,
              pcont_t,
              target_policy_t,
              behaviour_policy_t,
              targnet_q_t,
              a_t,
          ),
      )
  
file_path: trfl/trfl/retrace_ops_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from six.moves import xrange
  import tensorflow.compat.v1
  from trfl import retrace_ops
label_desc: Use image node_id 3 for calling the RetraceOpsTest obj's underlying member method code with example usage: obj._get_retrace_core() and returns: static_args,  diff_args,  retrace_ops