code: def _collectOutputsAndGradients(self, sess, inputs, activations):
      trainable_variables = tf.compat.v1.get_collection(
          tf.compat.v1.GraphKeys.TRAINABLE_VARIABLES
      )
      gradients = tf.gradients(
          ys=[activations], xs=[inputs] + trainable_variables
      )
      variable_names = [v.name for v in trainable_variables]
      names = ["activations", "input_grad"] + variable_names
      values = sess.run([activations] + gradients)
      return collections.OrderedDict(list(zip(names, values)))
  
file_path: model_search/model_search/ops/svdf_cell_test.py
imports: import collections
  from absl import logging
  from model_search.ops import svdf_cell
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 1 for calling the SvdfCellTest obj's underlying member method code with example usage: obj._collectOutputsAndGradients(sess, inputs, activations) and returns: collections