File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 25
25
tf .logging .set_verbosity (tf .logging .ERROR )
26
26
27
27
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
+
28
41
class BaseTest (tf .test .TestCase ):
29
42
def input_fn (self ):
30
43
features = tf .random_uniform ([55000 , 784 ])
You can’t perform that action at this time.
0 commit comments