ec849adaf4ceb42ed52ca142c839f627c34b9434,slm_lab/agent/net/net_util.py,,get_activation_fn,#Any#,11
Before Change
"""Helper to generate activation function layers for net"""
layer = None
if activation == "sigmoid":
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
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()
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: 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: open-mmlab/mmdetection
Commit Name: f64c95616677f90aa79b556251d2c426ef4d07dc
Time: 2018-12-30
Author: thangvubk@gmail.com
File Name: mmdet/models/backbones/resnet.py
Class Name: ResNet
Method Name: __init__
Project Name: dpressel/mead-baseline
Commit Name: 3bc0a1906529329f57c749f6a175eca4b7907a96
Time: 2018-05-30
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/classify/model.py
Class Name: NBowBase
Method Name: _init_stacked