class_docstr: A Model that can be pickled because it contains no references to any
  Variables (e.g. it identifies Variables only by name).
  The Model must be able to find all of its Variables via get_vars
  for them to be pickled.
  Note that NoRefModel may have different Variable names after it is
  restored, e.g. if the unpickling is run with a different enclosing
  scope. NoRefModel will still work in these circumstances as long
  as get_params returns the same order of Variables after unpickling
  as it did before pickling.
  See also cleverhans.picklable_model for a different, complementary
  pickling strategy: models that can be pickled because they use *only*
  references to Variables and work regardless of Variable names.
class_docstr_tok: ["A","Model","that","can","be","pickled","because","it","contains","no","references","to","any","Variables","(","e.g",".","it","identifies","Variables","only","by","name",")",".","The","Model","must","be","able","to","find","all","of","its","Variables","via","get_vars","for","them","to","be","pickled",".","Note","that","NoRefModel","may","have","different","Variable","names","after","it","is","restored",",","e.g",".","if","the","unpickling","is","run","with","a","different","enclosing","scope",".","NoRefModel","will","still","work","in","these","circumstances","as","long","as","get_params","returns","the","same","order","of","Variables","after","unpickling","as","it","did","before","pickling",".","See","also","cleverhans.picklable_model","for","a","different",",","complementary","pickling","strategy",":","models","that","can","be","pickled","because","they","use","*","only","*","references","to","Variables","and","work","regardless","of","Variable","names","."]
code: def __setstate__(self, d):
      tf_variables = d[VARS]
      del d[VARS]
      tf_variable_names = None
      # older joblib files may not have "_tf_variable_names"
      if VAR_NAMES in d:
          tf_variable_names = d[VAR_NAMES]
          del d[VAR_NAMES]
      else:
          warnings.warn(
              "This joblib file has no " + VAR_NAMES + " field. "
              "The field may become required on or after 2019-04-11."
              "You can make your file compatible with the new format by"
              " loading the file and re-saving it."
          )
      # Deserialize everything except the Variables
      self.__dict__ = d
      # Deserialize the Variables
      sess = tf.get_default_session()
      if sess is None:
          raise RuntimeError(
              "NoRefModel requires a default " "TensorFlow session"
          )
      cur_vars = self.get_vars()
      if len(cur_vars) != len(tf_variables):
          print("Model format mismatch")
          print(
              "Current model has " + str(len(cur_vars)) + " variables"
          )
          print(
              "Saved model has " + str(len(tf_variables)) + " variables"
          )
          print("Names of current vars:")
          for var in cur_vars:
              print("\t" + var.name)
          if tf_variable_names is not None:
              print("Names of saved vars:")
              for name in tf_variable_names:
                  print("\t" + name)
          else:
              print(
                  "Saved vars use old format, no names available for them"
              )
          assert False
  
      found = [False] * len(cur_vars)
      if tf_variable_names is not None:
          # New version using the names to handle changes in ordering
          for value, name in safe_zip(tf_variables, tf_variable_names):
              value_found = False
              for idx, cur_var in enumerate(cur_vars):
                  if cur_var.name == name:
                      assert not found[idx]
                      value_found = True
                      found[idx] = True
                      cur_var.load(value, sess)
                      break
              assert value_found
          assert all(found)
      else:
          # Old version that works if and only if the order doesn't change
          for var, value in safe_zip(cur_vars, tf_variables):
              var.load(value, sess)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import warnings
  import joblib
  import tensorflow
  from cleverhans.model import Model
  from cleverhans.utils import ordered_union
  from cleverhans.utils import safe_zip
label_desc: Use image node_id 2 for calling the NoRefModel obj's underlying member method code with example usage: obj.__setstate__(d) without return types