5af01545fce906a682f44741b4f6b6bd2b1d2585,src/sdk/pynni/nni/hyperopt_tuner/hyperopt_tuner.py,,json2space,#Any#Any#,52

Before Change


        for i, x_i in enumerate(in_x):
            out_y.append(json2space(x_i, name+"[%d]" % i))
    else:
        logger.info("in_x is not a dict or a list in json2space fuinction %s", str(in_x))
    return out_y


def json2parameter(in_x, parameter, name=ROOT):

After Change


    out_y = copy.deepcopy(in_x)
    if isinstance(in_x, dict):
        if NodeType.TYPE in in_x.keys():
            _type = in_x[NodeType.TYPE]
            name = name + "-" + _type
            _value = json2space(in_x[NodeType.VALUE], name=name)
            if _type == "choice":
                out_y = eval("hp.hp.choice")(name, _value)
            else:
                if _type in ["loguniform", "qloguniform"]:
                    _value[:2] = np.log(_value[:2])
                out_y = eval("hp.hp." + _type)(name, *_value)
        else:
            out_y = dict()
            for key in in_x.keys():
                out_y[key] = json2space(in_x[key], name + "[%s]" % str(key))
    elif isinstance(in_x, list):
        out_y = list()
        for i, x_i in enumerate(in_x):
            if isinstance(x_i, dict):
                if NodeType.NAME not in x_i.keys():
                    raise RuntimeError(
                        "\"_name\" key is not found in this nested search space."
                    )
            out_y.append(json2space(x_i, name + "[%d]" % i))
    return out_y

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: Microsoft/nni
Commit Name: 5af01545fce906a682f44741b4f6b6bd2b1d2585
Time: 2019-05-15
Author: zhulifei@riseup.net
File Name: src/sdk/pynni/nni/hyperopt_tuner/hyperopt_tuner.py
Class Name:
Method Name: json2space


Project Name: Microsoft/nni
Commit Name: 5af01545fce906a682f44741b4f6b6bd2b1d2585
Time: 2019-05-15
Author: zhulifei@riseup.net
File Name: src/sdk/pynni/nni/hyperopt_tuner/hyperopt_tuner.py
Class Name:
Method Name: json2space


Project Name: Microsoft/nni
Commit Name: 5af01545fce906a682f44741b4f6b6bd2b1d2585
Time: 2019-05-15
Author: zhulifei@riseup.net
File Name: src/sdk/pynni/nni/hyperopt_tuner/hyperopt_tuner.py
Class Name:
Method Name: json2parameter


Project Name: home-assistant/home-assistant
Commit Name: 8703124c760df303d29571aa975a72cc4f868f09
Time: 2018-01-17
Author: pierre.staahl@gmail.com
File Name: homeassistant/components/media_player/yamaha.py
Class Name:
Method Name: setup_platform