Пример #1
0
def main(model_id):
    import tensorflow as tf
    from tf_template.model import get_builder
    tf.logging.set_verbosity(tf.logging.INFO)
    builder = get_builder('example')
    evaluation = builder.eval()
    print(evaluation)
Пример #2
0
def main(model_id):
    import tensorflow as tf
    import tf_toolbox.testing
    from tf_template.model import get_builder

    builder = get_builder(model_id)

    def get_train_op():
        features, labels = builder.get_train_inputs()
        return builder.get_estimator_spec(features, labels,
                                          tf.estimator.ModeKeys.TRAIN).train_op

    update_ops_run = tf_toolbox.testing.do_update_ops_run(get_train_op)
    tf_toolbox.testing.report_train_val_changes(get_train_op)

    if update_ops_run:
        print('Update ops run :)')
    else:
        print('Update ops not run :(')
Пример #3
0
def main(model_id, skip_runs=10):
    import os
    import tensorflow as tf
    from tf_template.model import get_builder
    from tf_toolbox.profile import create_profile
    builder = get_builder(model_id)

    def graph_fn():
        mode = tf.estimator.ModeKeys.TRAIN
        features, labels = builder.get_inputs(mode)
        spec = builder.get_estimator_spec(features, labels, mode)
        return spec.train_op

    folder = os.path.join(os.path.realpath(os.path.dirname(__file__)),
                          '_profiles')
    if not os.path.isdir(folder):
        os.makedirs(folder)
    filename = os.path.join(folder, '%s.json' % model_id)

    create_profile(graph_fn, filename, skip_runs)
Пример #4
0
def main(model_id, mode):
    from tf_template.model import get_builder
    builder = get_builder(model_id)
    builder.vis_inputs()
Пример #5
0
def main(model_id):
    import tensorflow as tf
    from tf_template.model import get_builder
    tf.logging.set_verbosity(tf.logging.INFO)
    builder = get_builder('example')
    builder.vis_predictions()
Пример #6
0
def main(model_id, max_steps):
    import tensorflow as tf
    from tf_template.model import get_builder
    tf.logging.set_verbosity(tf.logging.INFO)
    builder = get_builder('example')
    builder.train(max_steps=max_steps)