code: def __init__(self, weights_path, model_class):
      model = model_class()
  
      config = tf.ConfigProto()
      config.gpu_options.allow_growth = True
      sess = tf.Session(config=config).__enter__()
      saver = tf.train.Saver()
      checkpoint = tf.train.latest_checkpoint(weights_path)
      saver.restore(sess, checkpoint)
  
      self.inputs = model.x_input
      self.logits = model.pre_softmax
  
      self.session = tf.get_default_session()
      assert self.session.graph == self.inputs.graph
  
      with self.session.graph.as_default():
          self.bw_gradient_pre = tf.placeholder(
              tf.float32, self.logits.shape
          )
          bw_loss = tf.reduce_sum(self.logits * self.bw_gradient_pre)
          self.bw_gradients = tf.gradients(bw_loss, self.inputs)[0]
  
file_path: advertorch/advertorch_examples/attack_madry_et_al_models/madry_et_al_utils.py
imports: import os
  import sys
  from pathlib import Path
  import tensorflow
  import torch
  from advertorch.bpda import BPDAWrapper
  from advertorch_examples.utils import ROOT_PATH, mkdir
label_desc: Use image node_id 1 to create a new WrappedTfModel object from inherited base classes: object with example: obj = WrappedTfModel(weights_path, model_class)