public IWeightTensor Decode(IWeightTensor input, AttentionPreProcessResult attenPreProcessResult, int batchSize, IComputeGraph g) { var V = input; var lastStatus = this.m_decoders.LastOrDefault().Cell; var context = m_attentionLayer.Perform(lastStatus, attenPreProcessResult, batchSize, g); foreach (var decoder in m_decoders) { var e = decoder.Step(context, V, g); V = e; } return(V); }
public IWeightTensor Decode(IWeightTensor input, AttentionPreProcessResult attenPreProcessResult, int batchSize, IComputeGraph g) { IWeightTensor V = input; IWeightTensor lastStatus = m_decoders.LastOrDefault().Cell; IWeightTensor context = m_attentionLayer.Perform(lastStatus, attenPreProcessResult, batchSize, g); foreach (LSTMAttentionDecoderCell decoder in m_decoders) { IWeightTensor e = decoder.Step(context, V, g); V = e; } IWeightTensor eOutput = g.Dropout(V, batchSize, m_dropoutRatio, false); // eOutput = m_decoderFFLayer.Process(eOutput, batchSize, g); return(eOutput); }