75cb8084111e035cd23e0aa3e777a0798bc39cf2,tensornets/utils.py,,save,#,155

Before Change



def save(model, weights_path):
    sess = tf.get_default_session()
    assert sess is not None, "The default session should be given."

    weights = get_weights(model)
    names = [w.name for w in weights]
    values = sess.run(weights)

After Change




def save(model, weights_path, sess):
    if sess is None:
        sess = tf.get_default_session()
        assert sess is not None, "The default session should be given."

    weights = get_weights(model)
    names = [w.name for w in weights]
    values = sess.run(weights)
    np.savez(weights_path, names=names, values=values)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 4

Instances


Project Name: taehoonlee/tensornets
Commit Name: 75cb8084111e035cd23e0aa3e777a0798bc39cf2
Time: 2020-03-26
Author: me@taehoonlee.com
File Name: tensornets/utils.py
Class Name:
Method Name: save


Project Name: soft-matter/trackpy
Commit Name: 2781d6379f4fe9f5140a6c3967785424873072a7
Time: 2013-01-23
Author: daniel.b.allan@gmail.com
File Name: mr/fitting.py
Class Name:
Method Name: NLS


Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 9b495df0e71f63aa84810e62c268a0553e60e368
Time: 2019-03-14
Author: ikostrikov@gmail.com
File Name: a2c_ppo_acktr/storage.py
Class Name: RolloutStorage
Method Name: feed_forward_generator


Project Name: taehoonlee/tensornets
Commit Name: 75cb8084111e035cd23e0aa3e777a0798bc39cf2
Time: 2020-03-26
Author: me@taehoonlee.com
File Name: tensornets/utils.py
Class Name:
Method Name: load


Project Name: taehoonlee/tensornets
Commit Name: 75cb8084111e035cd23e0aa3e777a0798bc39cf2
Time: 2020-03-26
Author: me@taehoonlee.com
File Name: tensornets/utils.py
Class Name:
Method Name: init