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

Before Change


    if h5py is None:
        raise ImportError("`load_model` requires h5py.")
    model = None
    opened_new_file = not isinstance(filepath, h5py.Group)
    h5dict = H5Dict(filepath, "r")
    try:
        model = _deserialize_model(h5dict, custom_objects, compile)
    finally:

After Change


    if h5py is None:
        raise ImportError("`load_model` requires h5py.")

    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)
    else:
        raise ValueError("unexpected type {} for `filepath`".format(type(filepath)))

    return model


def pickle_model(model):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

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: deepmind/sonnet
Commit Name: dc09af160f9f04c13fd0764b2712176b83538182
Time: 2017-11-09
Author: noreply@google.com
File Name: sonnet/python/modules/conv.py
Class Name: SeparableConv2D
Method Name: __init__


Project Name: dmlc/gluon-nlp
Commit Name: aeb516494daa207720b428072ab49eeea7bfff75
Time: 2019-06-13
Author: xshiab@ust.hk
File Name: scripts/text_generation/sequence_sampling.py
Class Name:
Method Name: