(self, inputs, inference=False)
return [aff_p, aff_n]
Encode source sentence and use embedding to initialize state of two decoders to predict the
        next and previous sentences.

        Arguments:
            inputs (list): Length 3 list of [source_sentence, previous_sentence, next_sentence]
            inference (bool): Not implemented.
Encode source sentence and use embedding to initialize state of two decoders to predict the
        next and previous sentences.
Encode source sentence and use embedding to initialize state of two decoders to predict the next and previous sentences .
def fprop(self, inputs, inference=False):
        """
        Encode source sentence and use embedding to initialize state of two decoders to predict the
        next and previous sentences.

        Arguments:
            inputs (list): Length 3 list of [source_sentence, previous_sentence, next_sentence]
            inference (bool): Not implemented.
        """
        assert len(inputs) == 3

        s_sent = inputs[0]
        p_sent = inputs[1]
        n_sent = inputs[2]

        # process the source sentence
        emb_s = self.embed_s.fprop(s_sent, inference)
        enc_s = self.encoder.fprop(emb_s, inference)
        context_state = enc_s[:, -self.be.bsz:]

        # process the previous sentence
        emb_p = self.embed_p.fprop(p_sent, inference)
        dec_p = self.decoder_p.fprop(emb_p, inference=inference, init_state=context_state)
        x = dec_p
        for l in self.affine_p:
            x = l.fprop(x, inference)
        aff_p = x

        # process the next sentence
        emb_n = self.embed_n.fprop(n_sent, inference)
        dec_n = self.decoder_n.fprop(emb_n, inference=inference, init_state=context_state)
        x = dec_n
        for l in self.affine_n:
            x = l.fprop(x, inference)
        aff_n = x

        return [aff_p, aff_n]
def fprop ( self , inputs , inference = False ) : assert len ( inputs ) == 3 s_sent = inputs [ 0 ] p_sent = inputs [ 1 ] n_sent = inputs [ 2 ] # process the source sentence emb_s = self . embed_s . fprop ( s_sent , inference ) enc_s = self . encoder . fprop ( emb_s , inference ) context_state = enc_s [ : , - self . be . bsz : ] # process the previous sentence emb_p = self . embed_p . fprop ( p_sent , inference ) dec_p = self . decoder_p . fprop ( emb_p , inference = inference , init_state = context_state ) x = dec_p for l in self . affine_p : x = l . fprop ( x , inference ) aff_p = x # process the next sentence emb_n = self . embed_n . fprop ( n_sent , inference ) dec_n = self . decoder_n . fprop ( emb_n , inference = inference , init_state = context_state ) x = dec_n for l in self . affine_n : x = l . fprop ( x , inference ) aff_n = x return [ aff_p , aff_n ]