(self, shared_outputs=None)
Allocate backend memory for dW's. Sync initial affine layer weights.
Allocate backend memory for dW's. Sync initial affine layer weights.
Allocate backend memory for dW s . Sync initial affine layer weights .
def allocate(self, shared_outputs=None):
        """
        Allocate backend memory for dW's. Sync initial affine layer weights.
        """
        super(SkipThought, self).allocate(shared_outputs)
        self.error_ctx = self.be.iobuf((self.nhidden, self.encoder.nsteps))

        self.dW_embed = self.be.empty_like(self.embed_s.dW)
        self.dW_linear = self.be.empty_like(self.affine_p[0].dW)
        self.dW_bias = self.be.empty_like(self.affine_p[1].dW)

        # two affine layers are init differently, need to syn the weights
        self.affine_p[0].W[:] = self.affine_n[0].W
def allocate ( self , shared_outputs = None ) : super ( SkipThought , self ) . allocate ( shared_outputs ) self . error_ctx = self . be . iobuf ( ( self . nhidden , self . encoder . nsteps ) ) self . dW_embed = self . be . empty_like ( self . embed_s . dW ) self . dW_linear = self . be . empty_like ( self . affine_p [ 0 ] . dW ) self . dW_bias = self . be . empty_like ( self . affine_p [ 1 ] . dW ) # two affine layers are init differently, need to syn the weights self . affine_p [ 0 ] . W [ : ] = self . affine_n [ 0 ] . W