eed514dbe06041987dd9a0998ad205601afe62f1,examples/opensets/mnist_model2.py,,,#,35

Before Change


    print()
    print("Start training...")
    t = time()
    train_pp = (mnist.train.p
                .init_variable("loss_history", init_on_each_run=list)
                .init_model("dynamic", MyModel, "conv",
                            config={"loss": "ce",
                                    "optimizer": "Adam",
                                    "images_shape": lambda batch: batch.images.shape[1:]})
                .train_model("conv", fetches="loss", feed_dict={"input_images": "images",
                                                                "input_labels": "labels"},
                             append_to="loss_history")
                .run(BATCH_SIZE, shuffle=True, n_epochs=1, drop_last=True))
    print("End training", time() - t)

    print()
    print("Start testing...")
    t = time()
    test_pp = (mnist.test.p
                .import_model("conv", train_pp)
                .init_variable("all_predictions", init_on_each_run=list)
                .predict_model("conv", fetches="predicted_labels", feed_dict={"input_images": "images",
                                                                              "input_labels": "labels"},
                               append_to="all_predictions")
                .run(BATCH_SIZE, shuffle=True, n_epochs=1, drop_last=False))
    print("End testing", time() - t)

    print("Predictions")
    for pred in test_pp.get_variable("all_predictions"):
        print(pred.shape)

    conv = train_pp.get_model_by_name("conv")

After Change


    print()
    print("Start training...")
    t = time()
    train_pp = (mnist.train.p
                .init_variable("loss_history", init_on_each_run=list)
                .init_variable("current_loss", init_on_each_run=0)
                .init_model("dynamic", MyModel, "conv",
                            config={"loss": "ce",
                                    "optimizer": {"name":"Adam", "use_locking": True},
                                    "images_shape": lambda batch: batch.images.shape[1:]})
                .train_model("conv", fetches="loss", feed_dict={"input_images": "images",
                                                                "input_labels": "labels"},
                             save_to="current_loss")
                .print_variable("current_loss")
                .save_to_variable("loss_history", "current_loss", mode="a")
                .run(BATCH_SIZE, shuffle=True, n_epochs=1, drop_last=True, prefetch=6))
    print("End training", time() - t)


    print()
    print("Start testing...")
    t = time()
    test_pp = (mnist.test.p
                .import_model("conv", train_pp)
                .init_variable("all_predictions", init_on_each_run=list)
                .predict_model("conv", fetches="predicted_labels", feed_dict={"input_images": "images",
                                                                              "input_labels": "labels"},
                               append_to="all_predictions")
                .run(BATCH_SIZE, shuffle=True, n_epochs=1, drop_last=False, prefetch=4))
    print("End testing", time() - t)

    print("Predictions")
    for pred in test_pp.get_variable("all_predictions"):
        print(pred.shape)

    conv = train_pp.get_model_by_name("conv")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: analysiscenter/batchflow
Commit Name: eed514dbe06041987dd9a0998ad205601afe62f1
Time: 2017-10-16
Author: rhudor@gmail.com
File Name: examples/opensets/mnist_model2.py
Class Name:
Method Name:


Project Name: analysiscenter/batchflow
Commit Name: 9a89654a0f5de296e066a2ae6b3b4bbfc406cd99
Time: 2017-10-25
Author: rhudor@gmail.com
File Name: examples/simple_but_ugly/tf_models.py
Class Name:
Method Name:


Project Name: analysiscenter/batchflow
Commit Name: d87a501dbe2dd19ec8e55dec328318a235d769f0
Time: 2017-10-25
Author: rhudor@gmail.com
File Name: examples/simple_but_ugly/tf_models.py
Class Name:
Method Name:


Project Name: analysiscenter/batchflow
Commit Name: c14f703466aefe052878c3439509a7eae8dd7724
Time: 2017-10-16
Author: rhudor@gmail.com
File Name: examples/opensets/mnist_model2.py
Class Name:
Method Name: