Source code for refann.element

# -*- coding: utf-8 -*-

import torch.nn as nn


#%% activation functions
[docs]def relu(): #here 'inplace=True' is used to save GPU memory return nn.ReLU(inplace=True)
[docs]def leakyrelu(): return nn.LeakyReLU(inplace=True)
[docs]def prelu(): return nn.PReLU()
[docs]def rrelu(): return nn.RReLU(inplace=True)
[docs]def elu(): return nn.ELU(inplace=True)
[docs]def activation(active_name='relu'): return eval('%s()'%active_name)