def next_feed_beam_first(self,batch, word_input): self.encoder_inputs_, self.seq_len_ = hp.batch(batch) self.beam_input_, _ = hp.batch(word_input) return { self.encoder_inputs: self.encoder_inputs_, self.source_embeddings: self.source_lookup, self.target_embeddings: self.target_lookup, self.encoder_sequence_len: self.seq_len_, self.beam_input: self.beam_input_, }
def next_feed(self,source_batch,target_batch): self.encoder_inputs_, self.encoder_seq_len_ = hp.batch(source_batch) self.decoder_targets_, self.decoder_seq_len_ = hp.batch([(sequence) + [self.target_EOS] for sequence in target_batch]) self.decoder_inputs_, _ = hp.batch([[self.target_EOS] + (sequence) for sequence in target_batch]) return { self.encoder_inputs: self.encoder_inputs_, self.decoder_inputs: self.decoder_inputs_, self.decoder_targets: self.decoder_targets_, self.source_embeddings: self.source_lookup, self.target_embeddings: self.target_lookup, self.encoder_sequence_len: self.encoder_seq_len_, self.decoder_sequence_len: self.decoder_seq_len_ }
def next_feed_beam(self,batch, word_input, state_input,attention, time, alignments): self.encoder_inputs_, self.seq_len_ = hp.batch(batch) self.beam_input_, _ = hp.batch(word_input) return { self.encoder_inputs: self.encoder_inputs_, self.source_embeddings: self.source_lookup, self.target_embeddings: self.target_lookup, self.encoder_sequence_len: self.seq_len_, self.beam_input: self.beam_input_, self.state_placeholder: state_input, self.attention_plc:attention, self.time_plc:time, self.align_plc:alignments, }
def next_feed(self, batch): self.encoder_inputs_, _ = hp.batch(batch) self.decoder_targets_, self.seq_len_ = hp.batch([ (sequence) + [self.EOS] for sequence in batch ]) self.decoder_inputs_, _ = hp.batch([[self.EOS] + (sequence) for sequence in batch]) return { self.encoder_inputs: self.encoder_inputs_, self.decoder_inputs: self.decoder_inputs_, self.decoder_targets: self.decoder_targets_, self.embeddings: self.lookup, self.sequence_len: self.seq_len_ }
def next_feed(self, input, para, lr): self.encoder_inputs_, self.en_seq_len_ = hp.batch(input) # self.encoder_inputs_, self.en_seq_len_ = hp.batch([[self.ST] + (sequence) + [self.EOS] for sequence in input]) self.auto_targets_, self.auto_seq_len_ = hp.batch([(sequence) + [self.ind['</s>']] for sequence in input]) self.auto_inputs_, _ = hp.batch([[self.ind['</s>']] + (sequence) for sequence in input]) self.para_targets_, self.para_seq_len_ = hp.batch([(sequence) + [self.ind['</s>']] for sequence in para]) self.para_inputs_, _ = hp.batch([[self.ind['</s>']] + (sequence) for sequence in para]) return { self.encoder_inputs: self.encoder_inputs_, self.encoder_sequence_len: self.en_seq_len_, self.auto_decoder_inputs: self.auto_inputs_, self.auto_decoder_targets: self.auto_targets_, self.auto_decoder_sequence_len: self.auto_seq_len_, self.para_decoder_inputs: self.para_inputs_, self.para_decoder_targets: self.para_targets_, self.para_decoder_sequence_len: self.para_seq_len_, self.lr: lr }