ec849adaf4ceb42ed52ca142c839f627c34b9434,slm_lab/agent/net/net_util.py,,get_activation_fn,#Any#,11

Before Change


        layer = nn.Sigmoid()
    elif activation == "lrelu":
        layer = nn.LeakyReLU(negative_slope=0.05)
    elif activation == "tanh":
        layer = nn.Tanh()
    elif activation == "relu":
        layer = nn.ReLU()
    else:
        logger.debug("No activation fn or unrecognised activation fn")
        layer = nn.ReLU()
    return layer


def get_loss_fn(cls, loss_spec):

After Change



def get_activation_fn(activation):
    """Helper to generate activation function layers for net"""
    nn_name = NN_LOWCASE_LOOKUP.get(activation) or NN_LOWCASE_LOOKUP["relu"]
    ActivationClass = getattr(nn, nn_name)
    return ActivationClass()

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: kengz/SLM-Lab
Commit Name: ec849adaf4ceb42ed52ca142c839f627c34b9434
Time: 2018-05-21
Author: kengzwl@gmail.com
File Name: slm_lab/agent/net/net_util.py
Class Name:
Method Name: get_activation_fn


Project Name: Microsoft/nni
Commit Name: b7cd20e62f7dfb7b28407c84cd6b48098fddb915
Time: 2019-07-11
Author: Quanlu.Zhang@microsoft.com
File Name: src/sdk/pynni/nni/bohb_advisor/bohb_advisor.py
Class Name: BOHB
Method Name: handle_trial_end


Project Name: RasaHQ/rasa
Commit Name: 2ee9b54a85495f98c470a5b632c102d88025a78e
Time: 2018-08-03
Author: mr.voov@gmail.com
File Name: rasa_core/policies/embedding_policy.py
Class Name: EmbeddingPolicy
Method Name: _load_nn_architecture_params