class_docstr: Wrapped DqnAgent that supports recycled training.
class_docstr_tok: ["Wrapped","DqnAgent","that","supports","recycled","training","."]
code: def create_new_weights(
      self, k, weights, abs_weights, w_initializer, b_initializer
  ):
      w_shape = weights.get_shape().as_list()
      if len(w_shape) == 2:
          random_weights = w_initializer(weights.shape)
          if self.reset_algo == "random":
              score = tf.random.uniform(weights.shape, 0, 1)
          elif self.reset_algo == "low_score":
              score = -1 * abs_weights
          elif self.reset_algo == "high_score":
              score = abs_weights
          else:
              raise ValueError(
                  "reset_alg:%s  is not valid." % self.reset_algo
              )
          values, _ = tf.math.top_k(
              tf.reshape(score, [-1]), k=tf.size(score)
          )
          threshold_value = tf.gather(values, k - 1)
          mask = tf.where(
              tf.math.greater_equal(score, threshold_value),
              tf.ones_like(score, dtype=tf.int32),
              tf.zeros_like(score, dtype=tf.int32),
          )
          new_weights = tf.where(mask == 1, random_weights, weights)
  
      # bias
      elif len(w_shape) == 1:
          if self.reset_frac == 1.0:
              random_weights = b_initializer(weights.shape)
              mask = tf.ones_like(weights)
          # keep the bias if a subset of the weights is updated
          else:
              random_weights = weights
              mask = tf.zeros_like(weights)
          new_weights = random_weights
      return new_weights, mask
  
imports: import functools
  import os
  from absl import app
  from absl import flags
  from absl import logging
  import gin
  import numpy
  import reverb
  from rigl.rl.tfagents import sparse_tanh_normal_projection_network
  import tensorflow
  from tf_agents.agents import tf_agent
  from tf_agents.agents.sac import sac_agent
  from tf_agents.environments import suite_mujoco
  from tf_agents.keras_layers import inner_reshape
  from tf_agents.metrics import py_metrics
  from tf_agents.networks import nest_map
  from tf_agents.networks import sequential
  from tf_agents.policies import greedy_policy
  from tf_agents.policies import py_tf_eager_policy
  from tf_agents.policies import random_py_policy
  from tf_agents.replay_buffers import reverb_replay_buffer
  from tf_agents.replay_buffers import reverb_utils
  from tf_agents.train import actor
  from tf_agents.train import learner
  from tf_agents.train import triggers
  from tf_agents.train.utils import spec_utils
  from tf_agents.train.utils import strategy_utils
  from tf_agents.train.utils import train_utils
  from tf_agents.utils import common
  from tf_agents.utils import object_identity
label_desc: Use image node_id 14 for calling the RecycledSacAgent obj's underlying member method code with example usage: obj.create_new_weights(k, weights, abs_weights, w_initializer, b_initializer) and returns: new_weights,  mask