c3eb62763fcc5029c26b025ba1b60d7788d491a1,keras/engine/saving.py,,load_model,#Any#Any#Any#,510

Before Change


    model = None
    opened_new_file = not isinstance(filepath, h5py.Group)
    h5dict = H5Dict(filepath, "r")
    try:
        model = _deserialize_model(h5dict, custom_objects, compile)
    finally:
        if opened_new_file:
            h5dict.close()
    return model


def pickle_model(model):

After Change


    if H5Dict.is_supported_type(filepath):
        with H5Dict(filepath, mode="r") as h5dict:
            model = _deserialize_model(h5dict, custom_objects, compile)
    elif hasattr(filepath, "write") and callable(filepath.write):
        def load_function(h5file):
            return _deserialize_model(H5Dict(h5file), custom_objects, compile)
        model = load_from_binary_h5py(load_function, filepath)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: keras-team/keras
Commit Name: c3eb62763fcc5029c26b025ba1b60d7788d491a1
Time: 2019-03-30
Author: andhus@kth.se
File Name: keras/engine/saving.py
Class Name:
Method Name: load_model


Project Name: deepmipt/DeepPavlov
Commit Name: f528c38e26d59b231dd94b87d6603ca243fee766
Time: 2018-02-28
Author: yoptar@gmail.com
File Name: deeppavlov/core/commands/train.py
Class Name:
Method Name: train_model_from_config


Project Name: keras-team/keras
Commit Name: c3eb62763fcc5029c26b025ba1b60d7788d491a1
Time: 2019-03-30
Author: andhus@kth.se
File Name: keras/engine/saving.py
Class Name:
Method Name: save_model