class_docstr: A class used to set and get weights for Tensorflow networks.
  
  Attributes:
      sess (tf.Session): The tensorflow session used to run assignment.
      variables (Dict[str, tf.Variable]): Extracted variables from the loss
          or additional variables that are passed in.
      placeholders (Dict[str, tf.placeholders]): Placeholders for weights.
      assignment_nodes (Dict[str, tf.Tensor]): Nodes that assign weights.
class_docstr_tok: ["A","class","used","to","set","and","get","weights","for","Tensorflow","networks",".","Attributes",":","sess","(","tf.Session",")",":","The","tensorflow","session","used","to","run","assignment",".","variables","(","Dict","[","str",",","tf.Variable","]",")",":","Extracted","variables","from","the","loss","or","additional","variables","that","are","passed","in",".","placeholders","(","Dict","[","str",",","tf.placeholders","]",")",":","Placeholders","for","weights",".","assignment_nodes","(","Dict","[","str",",","tf.Tensor","]",")",":","Nodes","that","assign","weights","."]
docstr: Sets the weights to new_weights.
  
  Note:
      Can set subsets of variables as well, by only passing in the
      variables you want to be set.
  
  Args:
      new_weights: Dictionary mapping variable names to their
          weights.
docstr_tok: ["Sets","the","weights","to","new_weights",".","Note",":","Can","set","subsets","of","variables","as","well",",","by","only","passing","in","the","variables","you","want","to","be","set",".","Args",":","new_weights",":","Dictionary","mapping","variable","names","to","their","weights","."]
code: def set_weights(self, new_weights: dict):
      """Sets the weights to new_weights.
  
      Note:
          Can set subsets of variables as well, by only passing in the
          variables you want to be set.
  
      Args:
          new_weights: Dictionary mapping variable names to their
              weights.
      """
      if self.sess is None:
          for name, var in self.variables.items():
              var.assign(new_weights[name])
      else:
          assign_list, feed_dict = self._assign_weights(new_weights)
          self.sess.run(assign_list, feed_dict=feed_dict)
  
file_path: ray/python/ray/experimental/tf_utils.py
imports: from collections import OrderedDict, deque
  import numpy
  from ray.rllib.utils import force_list
  from ray.rllib.utils.framework import try_import_tf
label_desc: Use image node_id 6 for calling the TensorFlowVariables obj's underlying member method code with example usage: obj.set_weights(new_weights) without return types