054095d922edda5134e520522bc82a1b95cc5bd4,onnx_tf/backend_rep.py,TensorflowRep,run,#TensorflowRep#Any#,52

Before Change


    super(TensorflowRep, self).run(inputs, **kwargs)

    // TODO: handle name scope if necessary
    with self.graph.as_default():
      with tf.compat.v1.Session() as sess:
        if isinstance(inputs, dict):
          feed_dict = inputs
        elif isinstance(inputs, list) or isinstance(inputs, tuple):
          if len(self.inputs) != len(inputs):
            raise RuntimeError("Expected {} values for uninitialized "
                               "graph inputs ({}), but got {}.".format(
                                   len(self.inputs), ", ".join(self.inputs),
                                   len(inputs)))
          feed_dict = dict(zip(self.inputs, inputs))
        else:
          // single input
          feed_dict = dict([(self.inputs[0], inputs)])

        feed_dict = {
            self.tensor_dict[key]: feed_dict[key] for key in self.inputs
        }

        sess.run(tf.compat.v1.global_variables_initializer())
        outputs = [self.tensor_dict[output] for output in self.outputs]

        output_values = sess.run(outputs, feed_dict=feed_dict)
        return namedtupledict("Outputs", self.outputs)(*output_values)

  def export_graph(self, path):
    Export backend representation to a Tensorflow proto file.

    This function obtains the graph proto corresponding to the ONNX

After Change


      // single input
      feed_dict = dict([(self.inputs[0], inputs)])

    input_dict = dict(
        [(x[0], tf.constant(x[1])) for x in feed_dict.items()])

    output_values = self.tf_module(**input_dict)
    output_values = [val.numpy() if isinstance(val, tf.Tensor) else val for val in output_values]

    return namedtupledict("Outputs", self.outputs)(*output_values)

  def export_graph(self, path):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: onnx/onnx-tensorflow
Commit Name: 054095d922edda5134e520522bc82a1b95cc5bd4
Time: 2020-09-09
Author: smonov@gmail.com
File Name: onnx_tf/backend_rep.py
Class Name: TensorflowRep
Method Name: run


Project Name: onnx/onnx-tensorflow
Commit Name: 054095d922edda5134e520522bc82a1b95cc5bd4
Time: 2020-09-09
Author: smonov@gmail.com
File Name: onnx_tf/backend.py
Class Name: TensorflowBackend
Method Name: run_node


Project Name: tensorflow/privacy
Commit Name: 7c537572503ad61a9f09ac0a3d2e71833e5d09a9
Time: 2020-09-22
Author: shuangsong@google.com
File Name: tensorflow_privacy/privacy/membership_inference_attack/tf_estimator_evaluation_example.py
Class Name:
Method Name: main