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)
 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)