class_docstr: 可用于 LSTM2LSTM 的序列到序列模型的 decode 过程中，该 attention 是在 decode 过程中根据上一个 step 的 hidden 计算对 encoder 结果的 attention
  
  :param int input_size: 输入的大小
  :param int key_dim: 一般就是 encoder_output 输出的维度
  :param int value_dim: 输出的大小维度, 一般就是 decoder hidden 的大小
  :param bias:
class_docstr_tok: ["\u53ef\u7528\u4e8e","LSTM2LSTM","\u7684\u5e8f\u5217\u5230\u5e8f\u5217\u6a21\u578b\u7684","decode","\u8fc7\u7a0b\u4e2d\uff0c\u8be5","attention","\u662f\u5728","decode","\u8fc7\u7a0b\u4e2d\u6839\u636e\u4e0a\u4e00\u4e2a","step","\u7684","hidden","\u8ba1\u7b97\u5bf9","encoder","\u7ed3\u679c\u7684","attention",":","param","int","input_size",":","\u8f93\u5165\u7684\u5927\u5c0f",":","param","int","key_dim",":","\u4e00\u822c\u5c31\u662f","encoder_output","\u8f93\u51fa\u7684\u7ef4\u5ea6",":","param","int","value_dim",":","\u8f93\u51fa\u7684\u5927\u5c0f\u7ef4\u5ea6",",","\u4e00\u822c\u5c31\u662f","decoder","hidden","\u7684\u5927\u5c0f",":","param","bias",":"]
code: def __init__(selfu, input_size, key_dim, value_dim, bias=False):
      super().__init__()
  
      selfu.input_proj = nn.Linear(input_size, key_dim, bias=bias)
      selfu.output_proj = nn.Linear(
          input_size + key_dim, value_dim, bias=bias
      )
  
imports: import math
  import torch
  import torch.nn.functional
  from torch import nn
  from .decoder.seq2seq_state import TransformerState
label_desc: Use image node_id 1 to create a new AttentionLayer object from inherited base classes: nn with example: obj = AttentionLayer(u, input_size, key_dim, value_dim, bias)