Example #1
0
class Kawamura_Y:
    def __init__(self):
        self.model0 = FunctionSet(l=F.Convolution2D(1, 1, 5, stride=1, pad=2, nobias=True))
        self.model1 = FunctionSet(l=F.Convolution2D(1, 1, 5, stride=1, pad=2, nobias=True))
        #print self.model.l.W.shape

        self.model0.l.W[0,0,:,:] = np.array([[0,0,2,0,0],[0,0,-12,0,0],[0,0,6,0,0],[0,0,4,0,0],[0,0,0,0,0]]).astype(np.float32)/12.0
        self.model1.l.W[0,0,:,:] = np.array([[0,0,0,0,0],[0,0,-4,0,0],[0,0,-6,0,0],[0,0,12,0,0],[0,0,-2,0,0]]).astype(np.float32)/12.0
        #print self.model.l.W.shape
        self.model0.to_gpu()
        self.model1.to_gpu()

    def forward(self, x_data):
        y0 = self.model0.l(x_data)
        y1 = self.model1.l(x_data)
        return y0,y1
Example #2
0
class FTCS_Y:
    def __init__(self):
        self.model0 = FunctionSet(l=F.Convolution2D(1, 1, 3, pad=1, nobias=True))
        self.model0.l.W[0,0,:,:] = np.array([[0,-1,0],[0,0,0],[0,1,0]]).astype(np.float32)/2
        self.model0.to_gpu()

    def forward(self, x_data):
        y0 = self.model0.l(x_data)
        return y0
Example #3
0
class FTCS_Y:
    def __init__(self):
        self.model0 = FunctionSet(
            l=F.Convolution2D(1, 1, 3, pad=1, nobias=True))
        self.model0.l.W[0, 0, :, :] = np.array(
            [[0, -1, 0], [0, 0, 0], [0, 1, 0]]).astype(np.float32) / 2
        self.model0.to_gpu()

    def forward(self, x_data):
        y0 = self.model0.l(x_data)
        return y0
Example #4
0
class Kawamura_Y:
    def __init__(self):
        self.model0 = FunctionSet(
            l=F.Convolution2D(1, 1, 5, stride=1, pad=2, nobias=True))
        self.model1 = FunctionSet(
            l=F.Convolution2D(1, 1, 5, stride=1, pad=2, nobias=True))
        #print self.model.l.W.shape

        self.model0.l.W[0, 0, :, :] = np.array(
            [[0, 0, 2, 0, 0], [0, 0, -12, 0, 0], [0, 0, 6, 0, 0],
             [0, 0, 4, 0, 0], [0, 0, 0, 0, 0]]).astype(np.float32) / 12.0
        self.model1.l.W[0, 0, :, :] = np.array(
            [[0, 0, 0, 0, 0], [0, 0, -4, 0, 0], [0, 0, -6, 0, 0],
             [0, 0, 12, 0, 0], [0, 0, -2, 0, 0]]).astype(np.float32) / 12.0
        #print self.model.l.W.shape
        self.model0.to_gpu()
        self.model1.to_gpu()

    def forward(self, x_data):
        y0 = self.model0.l(x_data)
        y1 = self.model1.l(x_data)
        return y0, y1