Commit a67951e4 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

disable more slow tests

parent 0c5f373a
...@@ -9,59 +9,59 @@ import shutil ...@@ -9,59 +9,59 @@ import shutil
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
@nose.tools.raises(EarlyStopException) # @nose.tools.raises(EarlyStopException)
@attr('slow') # @attr('slow')
def test_early_stopping_linear_classifier(): # def test_early_stopping_linear_classifier():
config = read_config_files([ # config = read_config_files([
datafile('mnist_input_fn.py', __name__), # datafile('mnist_input_fn.py', __name__),
datafile('mnist_estimator.py', __name__), # datafile('mnist_estimator.py', __name__),
]) # ])
estimator = config.estimator # estimator = config.estimator
train_input_fn = config.train_input_fn # train_input_fn = config.train_input_fn
eval_input_fn = config.eval_input_fn # eval_input_fn = config.eval_input_fn
hooks = [ # hooks = [
EarlyStopping( # EarlyStopping(
'linear/metrics/accuracy/total', min_delta=0.001, patience=1), # 'linear/metrics/accuracy/total', min_delta=0.001, patience=1),
] # ]
train_spec = tf.estimator.TrainSpec(input_fn=train_input_fn) # train_spec = tf.estimator.TrainSpec(input_fn=train_input_fn)
eval_spec = tf.estimator.EvalSpec( # eval_spec = tf.estimator.EvalSpec(
input_fn=eval_input_fn, hooks=hooks, throttle_secs=2, steps=10) # input_fn=eval_input_fn, hooks=hooks, throttle_secs=2, steps=10)
try: # try:
tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec) # tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec)
finally: # finally:
shutil.rmtree(estimator.model_dir) # shutil.rmtree(estimator.model_dir)
@nose.tools.raises(EarlyStopException) # @nose.tools.raises(EarlyStopException)
@attr('slow') # @attr('slow')
def test_early_stopping_logit_trainer(): # def test_early_stopping_logit_trainer():
config = read_config_files([ # config = read_config_files([
datafile('mnist_input_fn.py', __name__), # datafile('mnist_input_fn.py', __name__),
]) # ])
train_input_fn = config.train_input_fn # train_input_fn = config.train_input_fn
eval_input_fn = config.eval_input_fn # eval_input_fn = config.eval_input_fn
hooks = [ # hooks = [
EarlyStopping('accuracy/value', min_delta=0.001, patience=1), # EarlyStopping('accuracy/value', min_delta=0.001, patience=1),
] # ]
train_spec = tf.estimator.TrainSpec(input_fn=train_input_fn) # train_spec = tf.estimator.TrainSpec(input_fn=train_input_fn)
eval_spec = tf.estimator.EvalSpec( # eval_spec = tf.estimator.EvalSpec(
input_fn=eval_input_fn, hooks=hooks, throttle_secs=2, steps=10) # input_fn=eval_input_fn, hooks=hooks, throttle_secs=2, steps=10)
def architecture(data, mode, **kwargs): # def architecture(data, mode, **kwargs):
return data, dict() # return data, dict()
optimizer = tf.train.GradientDescentOptimizer(learning_rate=1e-1) # optimizer = tf.train.GradientDescentOptimizer(learning_rate=1e-1)
loss_op = mean_cross_entropy_loss # loss_op = mean_cross_entropy_loss
estimator = Logits( # estimator = Logits(
architecture, optimizer, loss_op, n_classes=10, model_dir=None) # architecture, optimizer, loss_op, n_classes=10, model_dir=None)
try: # try:
tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec) # tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec)
finally: # finally:
shutil.rmtree(estimator.model_dir) # shutil.rmtree(estimator.model_dir)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment