Skip to content

Commit 0a04b35

Browse files
committed
runs but unsure if wai
1 parent e73f2bd commit 0a04b35

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

official/mnist/mnist_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@
2525
tf.logging.set_verbosity(tf.logging.ERROR)
2626

2727

28+
class ClassifierBenchmark(tf.test.Benchmark):
29+
def benchmarkFit(self):
30+
train_data = np.asarray(np.random.uniform(size=(1000, 784)), dtype=np.float32)
31+
train_labels = np.asarray(np.random.uniform(size=(1000), high=9), dtype=np.int32)
32+
classifier = tf.estimator.Estimator(model_fn=mnist.mnist_model_fn, model_dir='')
33+
train_input_fn = tf.estimator.inputs.numpy_input_fn(
34+
{'images': train_data}, y=train_labels,
35+
batch_size=100, num_epochs=None, shuffle=True)
36+
start = time.time()
37+
classifier.train(input_fn=train_input_fn, steps=1)
38+
wall_time = time.time() - start
39+
self.report_benchmark(name="classifier", wall_time=wall_time)
40+
2841
class BaseTest(tf.test.TestCase):
2942
def input_fn(self):
3043
features = tf.random_uniform([55000, 784])

0 commit comments

Comments
 (0)