def benchmarkEagerLinearRegression(self):
    num_epochs = 10
    num_batches = 200
    batch_size = 64
    dataset = linear_regression.synthetic_dataset(w=tf.random_uniform([3, 1]), b=tf.random_uniform([1]), noise_level=0.01, batch_size=batch_size, num_batches=num_batches)
    burn_in_dataset = dataset.take(10)
    model = linear_regression.LinearModel()
    with tf.device(device()):
        optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.1)
        linear_regression.fit(model, burn_in_dataset, optimizer)
        start_time = time.time()
        for _ in range(num_epochs):
            linear_regression.fit(model, dataset, optimizer)
        wall_time = (time.time() - start_time)
        examples_per_sec = (((num_epochs * num_batches) * batch_size) / wall_time)
        self.report_benchmark(name=('eager_train_%s' % ('gpu' if (tfe.num_gpus() > 0) else 'cpu')), iters=(num_epochs * num_batches), extras={'examples_per_sec': examples_per_sec}, wall_time=wall_time)
def benchmarkEagerLinearRegression(self):
    num_epochs = 10
    num_batches = 200
    batch_size = 64
    dataset = linear_regression.synthetic_dataset(w=tf.random_uniform([3, 1]), b=tf.random_uniform([1]), noise_level=0.01, batch_size=batch_size, num_batches=num_batches)
    burn_in_dataset = dataset.take(10)
    model = linear_regression.LinearModel()
    with tf.device(device()):
        optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.1)
        linear_regression.fit(model, burn_in_dataset, optimizer)
        start_time = time.time()
        for _ in range(num_epochs):
            linear_regression.fit(model, dataset, optimizer)
        wall_time = (time.time() - start_time)
        examples_per_sec = (((num_epochs * num_batches) * batch_size) / wall_time)
        self.report_benchmark(name=('eager_train_%s' % ('gpu' if (tfe.num_gpus() > 0) else 'cpu')), iters=(num_epochs * num_batches), extras={'examples_per_sec': examples_per_sec}, wall_time=wall_time)