Пример #1
0
 def func(b):
     self.layer.b = b.reshape(self.layer.b.shape)
     Y, meta, fprop_state = self.layer.fprop(self.X,
                                             meta=dict(self.meta))
     meta['space_below'] = meta['space_above']
     c, meta, cost_state = cost.fprop(Y, self.Y, meta=dict(meta))
     return c
Пример #2
0
        def grad(b):
            self.layer.b = b.reshape(self.layer.b.shape)
            Y, meta, fprop_state = self.layer.fprop(self.X, meta=dict(self.meta))
            meta['space_below'] = meta['space_above']
            c, meta, cost_state = cost.fprop(Y, self.Y, meta=dict(meta))
            delta, meta = cost.bprop(Y, self.Y, meta=dict(meta), fprop_state=cost_state)
            meta['space_above'] = meta['space_below']
            [_, grad_b] = self.layer.grads(delta, meta=dict(meta), fprop_state=fprop_state)

            return grad_b.ravel()
Пример #3
0
        def grad(b):
            self.layer.b = b.reshape(self.layer.b.shape)
            Y, meta, fprop_state = self.layer.fprop(self.X,
                                                    meta=dict(self.meta))
            meta['space_below'] = meta['space_above']
            c, meta, cost_state = cost.fprop(Y, self.Y, meta=dict(meta))
            delta, meta = cost.bprop(Y,
                                     self.Y,
                                     meta=dict(meta),
                                     fprop_state=cost_state)
            meta['space_above'] = meta['space_below']
            [_, grad_b] = self.layer.grads(delta,
                                           meta=dict(meta),
                                           fprop_state=fprop_state)

            return grad_b.ravel()
Пример #4
0
 def func(b):
     self.layer.b = b.reshape(self.layer.b.shape)
     Y, meta, fprop_state = self.layer.fprop(self.X, meta=dict(self.meta))
     meta['space_below'] = meta['space_above']
     c, meta, cost_state = cost.fprop(Y, self.Y, meta=dict(meta))
     return c