981e4266d4ea816b08a762193bd52f40cd1a3242,examples/mnist/keras/mnist_inference.py,,inference,#Any#Any#Any#,26

Before Change


  tf.gfile.MakeDirs(args.output)
  output_file = tf.gfile.GFile("{}/part-{:05d}".format(args.output, worker_num), mode="w")

  while True:
    try:
      // get images and labels from tf.data.Dataset
      img, lbl = sess.run(["inf_image:0", "inf_image:1"])

      // inference by feeding these images and labels into the input tensors
      // you can view the exported model signatures via:
      //     saved_model_cli show --dir <export_dir> --all

      // note that we feed directly into the graph tensors (bypassing the exported signatures)
      // these tensors will be shown in the "name" field of the signature definitions

      outputs = sess.run(["dense_2/Softmax:0"], feed_dict={"Placeholder:0": img})
      for p in outputs[0]:
        output_file.write("{}\n".format(np.argmax(p)))
    except tf.errors.OutOfRangeError:
      break

  output_file.close()


if __name__ == "__main__":

After Change



  for batch in ds:
    predictions = predict(conv2d_input=batch[0])
    labels = np.reshape(batch[1], -1).astype(np.int)
    preds = np.argmax(predictions["dense_1"], axis=1)
    for x in zip(labels, preds):
      output_file.write("{} {}\n".format(x[0], x[1]))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: yahoo/TensorFlowOnSpark
Commit Name: 981e4266d4ea816b08a762193bd52f40cd1a3242
Time: 2019-08-07
Author: leewyang@verizonmedia.com
File Name: examples/mnist/keras/mnist_inference.py
Class Name:
Method Name: inference


Project Name: freelunchtheorem/Conditional_Density_Estimation
Commit Name: 4ab356b54acaf031e0499fe3990b9de93401e093
Time: 2018-04-04
Author: jonas.rothfuss@gmx.de
File Name: cde/density_estimator/BaseDensityEstimator.py
Class Name: BaseMixtureEstimator
Method Name: _sample_rows_same


Project Name: NifTK/NiftyNet
Commit Name: bd333dd43d69b26015eb3f201afe1772ba701a41
Time: 2018-05-07
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/contrib/dataset_sampler/sampler_uniform_v2.py
Class Name: UniformSampler
Method Name: layer_op