This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import chainer | |
import chainer.functions as F | |
import chainer.links as L | |
import numpy as np | |
class FRN(chainer.Chain): | |
def __init__(self, in_c): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import math | |
import random | |
import chainer | |
import chainer.functions as F | |
import chainer.links as L | |
import numpy as np | |
from chainer import reporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local PReLU, parent = torch.class('nn.NG','nn.Module') | |
function PReLU:__init(nOutputPlane) | |
parent.__init(self) | |
-- if no argument provided, use shared model (weight is scalar) | |
self.nOutputPlane = nOutputPlane or 0 | |
self.weight = torch.Tensor(nOutputPlane or 1):fill(0) | |
self.gradWeight = torch.Tensor(nOutputPlane or 1) | |
self.buf = torch.Tensor() | |
self.buf2 = torch.Tensor() |