'Forward propagation for sequence to sequence container. Calls
fprop for the Encoder container followed by fprop for the Decoder
container. If inference is True, the Decoder will be called with
individual time steps in a for loop.'

def fprop(self, inputs, inference=False, beta=0.0):

    self.decoder.switch_mode(inference)
    if (not inference):
        (x, z) = inputs
        x = self.encoder.fprop(x, inference=inference, beta=0.0)
        init_state_list = self.encoder.get_final_states(self.decoder_connections)
        x = self.decoder.fprop(z, inference=inference, init_state_list=init_state_list)
    else:
        x = inputs
        new_steps = 1
        if self.hasLUT:
            z_shape = new_steps
        else:
            z_shape = (self.out_shape[0], new_steps)
        z = x.backend.iobuf(z_shape)
        x = self.encoder.fprop(x, inference=inference, beta=0.0)
        init_state_list = self.encoder.get_final_states(self.decoder_connections)
        steps = self.in_shape[1]
        if self.hasLUT:
            z_argmax = x.backend.zeros((1, (z.shape[0] * z.shape[1])))
        for t in range(steps):
            z = self.decoder.fprop(z, inference=inference, init_state_list=init_state_list)
            init_state_list = [recurrent.final_state() for recurrent in self.decoder._recurrent]
            self.xbuf[:, (t * self.be.bsz):((t + 1) * self.be.bsz)] = z
            if self.hasLUT:
                z_argmax[:] = self.be.argmax(z, axis=0)
                z = z_argmax
        x = self.xbuf
    if inference:
        self.revert_tensors()
    return x
