MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / import_and_eval

Function import_and_eval

tensorflow/examples/tf2_showcase/mnist.py:237–244  ·  view source on GitHub ↗
(flags_obj)

Source from the content-addressed store, hash-verified

235
236
237def import_and_eval(flags_obj):
238 export_path = os.path.join(flags_obj.model_dir, 'export')
239 model = tf.saved_model.restore(export_path)
240 _, (x_test, y_test) = tf.keras.datasets.mnist.load_data()
241 x_test = x_test / np.float32(255)
242 y_predict = model(x_test)
243 accuracy = compute_accuracy(y_predict, y_test)
244 print('Model accuracy: {:0.2f}%'.format(accuracy.numpy() * 100))
245
246
247def apply_clean(flags_obj):

Callers

nothing calls this directly

Calls 6

modelFunction · 0.85
compute_accuracyFunction · 0.85
joinMethod · 0.45
restoreMethod · 0.45
formatMethod · 0.45
numpyMethod · 0.45

Tested by

no test coverage detected