class_docstr: ModelWrapper for keras models
  
  By default, assumes that your model contains one input node, one output head
  and one loss function.
  Computes gradients of the output layer in respect to a CAV.
  
  Args:
      sess: Tensorflow session we will use for TCAV.
      model_path: Path to your model.h5 file, containing a saved trained
        model.
      labels_path: Path to a file containing the labels for your problem. It
        requires a .txt file, where every line contains a label for your
        model. You want to make sure that the order of labels in this file
        matches with the logits layers for your model, such that file[i] ==
        model_logits[i]
class_docstr_tok: ["ModelWrapper","for","keras","models","By","default",",","assumes","that","your","model","contains","one","input","node",",","one","output","head","and","one","loss","function",".","Computes","gradients","of","the","output","layer","in","respect","to","a","CAV",".","Args",":","sess",":","Tensorflow","session","we","will","use","for","TCAV",".","model_path",":","Path","to","your","model.h5","file",",","containing","a","saved","trained","model",".","labels_path",":","Path","to","a","file","containing","the","labels","for","your","problem",".","It","requires","a",".txt","file",",","where","every","line","contains","a","label","for","your","model",".","You","want","to","make","sure","that","the","order","of","labels","in","this","file","matches","with","the","logits","layers","for","your","model",",","such","that","file","[","i","]","==","model_logits","[","i","]"]
code: def __init__(
      self,
      sess,
      model_path,
      labels_path,
  ):
      self.sess = sess
      super(KerasModelWrapper, self).__init__()
      self.import_keras_model(model_path)
      self.labels = tf.io.gfile.GFile(labels_path).read().splitlines()
  
      # Construct gradient ops. Defaults to using the model's output layer
      self.y_input = tf.compat.v1.placeholder(tf.int64, shape=[None])
      self.loss = self.model.loss_functions[0](
          self.y_input, self.model.outputs[0]
      )
      self._make_gradient_tensors()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from abc import ABCMeta
  from abc import abstractmethod
  from six.moves import zip
  import numpy
  import six
  import tensorflow
  from google.protobuf import text_format
label_desc: Use image node_id 1 to create a new KerasModelWrapper object from inherited base classes: ModelWrapper with example: obj = KerasModelWrapper(sess, model_path, labels_path)