class_docstr: Assign the `compute_td_error` method to the DQNTFPolicy
  
  This allows us to prioritize on the worker side.
class_docstr_tok: ["Assign","the","`","compute_td_error","`","method","to","the","DQNTFPolicy","This","allows","us","to","prioritize","on","the","worker","side","."]
code: def __init__(self):
      @make_tf_callable(self.get_session(), dynamic_shape=True)
      def compute_td_error(
          obs_t,
          act_t,
          rew_t,
          obs_tp1,
          terminateds_mask,
          importance_weights,
      ):
          # Do forward pass on loss to update td error attribute
          build_q_losses(
              self,
              self.model,
              None,
              {
                  SampleBatch.CUR_OBS: tf.convert_to_tensor(obs_t),
                  SampleBatch.ACTIONS: tf.convert_to_tensor(act_t),
                  SampleBatch.REWARDS: tf.convert_to_tensor(rew_t),
                  SampleBatch.NEXT_OBS: tf.convert_to_tensor(obs_tp1),
                  SampleBatch.TERMINATEDS: tf.convert_to_tensor(
                      terminateds_mask
                  ),
                  PRIO_WEIGHTS: tf.convert_to_tensor(
                      importance_weights
                  ),
              },
          )
  
          return self.q_loss.td_error
  
      self.compute_td_error = compute_td_error
  
imports: from typing import Dict
  import gymnasium
  import numpy
  import ray
  from ray.rllib.algorithms.dqn.distributional_q_tf_model import DistributionalQTFModel
  from ray.rllib.algorithms.simple_q.utils import Q_SCOPE, Q_TARGET_SCOPE
  from ray.rllib.evaluation.postprocessing import adjust_nstep
  from ray.rllib.models import ModelCatalog
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.tf.tf_action_dist import get_categorical_class_with_temperature
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.tf_mixins import LearningRateSchedule, TargetNetworkMixin
  from ray.rllib.policy.tf_policy_template import build_tf_policy
  from ray.rllib.utils.error import UnsupportedSpaceException
  from ray.rllib.utils.exploration import ParameterNoise
  from ray.rllib.utils.framework import try_import_tf
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.tf_utils import huber_loss, l2_loss, make_tf_callable, minimize_and_clip, reduce_mean_ignore_inf
  from ray.rllib.utils.typing import AlgorithmConfigDict, ModelGradients, TensorType
label_desc: Use image node_id 1 to create a new ComputeTDErrorMixin object  with example: obj = ComputeTDErrorMixin()