def backward(self, top, propagate_down, bottom):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     if not propagate_down[0]:
         return
     b, bdiff = blob_to_CudaNdArray(bottom[0])
     _, tdiff = blob_to_CudaNdArray(top[0])
     bdiff[...] = self.f_backward(b, tdiff)
예제 #2
0
 def backward(self, top, propagate_down, bottom):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     if not propagate_down[0]:
         return
     b, bdiff = blob_to_CudaNdArray(bottom[0])
     _, tdiff = blob_to_CudaNdArray(top[0])
     bdiff[...] = self.f_backward(b, tdiff)
예제 #3
0
 def forward(self, bottom, top):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     y, _ = blob_to_CudaNdArray(bottom[0])
     t, _ = blob_to_CudaNdArray(bottom[1])
     l, _ = blob_to_CudaNdArray(top[0])
     s = (y.shape[0], int(np.prod(y.shape[1:])))
     l[...] = self.tn_forward(y.reshape(s), t.reshape(s))
예제 #4
0
 def forward(self, bottom, top):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     y, _ = blob_to_CudaNdArray(bottom[0])
     t, _ = blob_to_CudaNdArray(bottom[1])
     l, _ = blob_to_CudaNdArray(top[0])
     s = (y.shape[0], int(np.prod(y.shape[1:])))
     l[...] = self.tn_forward(y.reshape(s), t.reshape(s))
예제 #5
0
 def backward(self, top, propagate_down, bottom):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     y, dy = blob_to_CudaNdArray(bottom[0])
     t, _ = blob_to_CudaNdArray(bottom[1])
     _, dl = blob_to_CudaNdArray(top[0])
     s = (y.shape[0], int(np.prod(y.shape[1:])))
     dy[...] = self.tn_backward(y.reshape(s), t.reshape(s),
                                dl).reshape(dy.shape)
예제 #6
0
 def backward(self, top, propagate_down, bottom):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     y, dy = blob_to_CudaNdArray(bottom[0])
     t, _ = blob_to_CudaNdArray(bottom[1])
     _, dl = blob_to_CudaNdArray(top[0])
     s = (y.shape[0], int(np.prod(y.shape[1:])))
     dy[...] = self.tn_backward(
         y.reshape(s), t.reshape(s), dl).reshape(dy.shape)
예제 #7
0
    def backward(self, top, propagate_down, bottom):
        if not propagate_down[0]:
            return
        assert not propagate_down[1]

        from caffe_helper.theano_util import blob_to_CudaNdArray
        p, dp = blob_to_CudaNdArray(bottom[0])
        t, _ = blob_to_CudaNdArray(bottom[1])
        l, dz = blob_to_CudaNdArray(top[0])
        dp[...] = self.f_backward(p, t, dz)
예제 #8
0
    def backward(self, top, propagate_down, bottom):
        if not propagate_down[0]:
            return
        assert not propagate_down[1]

        from caffe_helper.theano_util import blob_to_CudaNdArray
        p, dp = blob_to_CudaNdArray(bottom[0])
        t, _ = blob_to_CudaNdArray(bottom[1])
        l, dz = blob_to_CudaNdArray(top[0])
        dp[...] = self.f_backward(p, t, dz)
 def forward(self, bottom, top):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     b, _ = blob_to_CudaNdArray(bottom[0])
     t, _ = blob_to_CudaNdArray(top[0])
     t[...] = self.f_forward(b)
예제 #10
0
 def forward(self, bottom, top):
     from caffe_helper.theano_util import blob_to_CudaNdArray
     b, _ = blob_to_CudaNdArray(bottom[0])
     t, _ = blob_to_CudaNdArray(top[0])
     t[...] = self.f_forward(b)