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

Before Change


  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: 4

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: pyinstaller/pyinstaller
Commit Name: f87d98c6aa5a8dd8958c8b9e3ec6262c091acd28
Time: 2018-04-02
Author: bjones@ece.msstate.edu
File Name: PyInstaller/loader/rthooks/pyi_rth_qt5.py
Class Name:
Method Name:


Project Name: developmentseed/label-maker
Commit Name: 4b8f9a14f8c1a6d58b6979e17d9f3dd9b3cd063c
Time: 2020-08-17
Author: marthamorrissey93@gmail.com
File Name: label_maker/utils.py
Class Name:
Method Name: get_tile_tif


Project Name: openeventdata/mordecai
Commit Name: 963200b8ecdf80eeacb546991c645111319cb1af
Time: 2017-10-26
Author: ahalterman0@gmail.com
File Name: mordecai/geoparse.py
Class Name: Geoparse
Method Name: geoparse