0cfe82c6beb9a28a5ff7da81b86fa0e93c388f14,tasks/save_reload_model.py,,,#,10

Before Change



if os.path.exists("tcn.npz"):
    // Load checkpoint if file exists.
    w = np.load("tcn.npz", allow_pickle=True)["w"]
    print("Model reloaded.")
    model.set_weights(w.tolist())
else:
    // Save the checkpoint.

After Change


                           TCN(nb_filters=12,
                               dropout_rate=0.5,
                               kernel_size=6,
                               dilations=[1, 2, 4]),
                           Dropout(0.5),
                           Dense(units=1, activation="sigmoid")])

// get model as json string and save to file
model_as_json = model.to_json()
with open(r"model.json", "w") as json_file:
    json_file.write(model_as_json)
// save weights to file (for this format, need h5py installed)
model.save_weights("weights.h5")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: philipperemy/keras-tcn
Commit Name: 0cfe82c6beb9a28a5ff7da81b86fa0e93c388f14
Time: 2019-11-20
Author: premy@cogent.co.jp
File Name: tasks/save_reload_model.py
Class Name:
Method Name:


Project Name: nilmtk/nilmtk
Commit Name: 51f56cd2f529cbf92c0492c34510c040ed1b77fd
Time: 2014-05-22
Author: jack-list@xlk.org.uk
File Name: nilmtk/elecmeter.py
Class Name: ElecMeter
Method Name: power_series


Project Name: librosa/librosa
Commit Name: cb82400b9fb1d3997ed02f616209485d5ef0005f
Time: 2015-08-31
Author: brian.mcfee@nyu.edu
File Name: tests/test_core.py
Class Name:
Method Name: test_piptrack


Project Name: GoogleCloudPlatform/ml-on-gcp
Commit Name: 95699795707ac307efac41c9be4defe5619335d0
Time: 2019-08-08
Author: yuhanliu@google.com
File Name: example_zoo/tools/process.py
Class Name:
Method Name: