args = parser.parse_args()

# setup device
os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu
device = 'cuda' if torch.cuda.is_available() else 'cpu'

# get the dataset
data = Cifar10Provider(root=args.root, workers=8)

# neuron configure
neurons = {
    'relu': nn.ReLU(True),
    'leaky_relu': nn.LeakyReLU(negative_slope=args.neg_slope, inplace=True),
    'tanh': nn.Tanh(),
    'prelu': nn.PReLU(),
    'sprelu': sPReLU(),
    'selu': nn.SELU(),
    'seluv2': SeLUv2(gamma_=np.square(args.gain), fixpoint=args.fixpoint, epsilon_=args.epsilon)
}

# initialization method configure
initializer = Initializer(method=args.init_fn, nonlinearity=args.neuron,
                          neg_slope=args.neg_slope, manual=args.gain)


# normalization method configure
norm_fns = {
    'none': None,
    'bn': nn.BatchNorm2d
}
Ejemplo n.º 2
0
# get the dataset
data = Cifar10Provider(root=args.root, workers=8)

# neuron configure
neurons = {
    'relu':
    nn.ReLU(True),
    'leaky_relu':
    nn.LeakyReLU(negative_slope=args.neg_slope, inplace=True),
    'tanh':
    nn.Tanh(),
    'prelu':
    nn.PReLU(),
    'sprelu':
    sPReLU(),
    'selu':
    nn.SELU(),
    'seluv2':
    SeLUv2(gamma_=np.square(args.gain),
           fixpoint=args.fixpoint,
           epsilon_=args.epsilon)
}

# initialization method configure
initializer = Initializer(method=args.init_fn,
                          nonlinearity=args.neuron,
                          neg_slope=args.neg_slope,
                          manual=args.gain)

# normalization method configure