def sinattn(attnlayer, x, layer_norm, keyorvalue, key_padding, incremental_state):
    residual = x
    x = self.maybe_layer_norm(layer_norm, x, before=True)
    (x, attn) = attnlayer(query=x, key=keyorvalue, value=keyorvalue, key_padding_mask=key_padding, incremental_state=incremental_state, static_kv=True, need_weights=((not self.training) and self.need_attn))
    x = F.dropout(x, p=self.dropout, training=self.training)
    x = (residual + x)
    x = self.maybe_layer_norm(layer_norm, x, after=True)
    return (x, attn)
def sinattn(attnlayer, x, layer_norm, keyorvalue, key_padding, incremental_state):
    residual = x
    x = self.maybe_layer_norm(layer_norm, x, before=True)
    (x, attn) = attnlayer(query=x, key=keyorvalue, value=keyorvalue, key_padding_mask=key_padding, incremental_state=incremental_state, static_kv=True, need_weights=((not self.training) and self.need_attn))
    x = F.dropout(x, p=self.dropout, training=self.training)
    x = (residual + x)
    x = self.maybe_layer_norm(layer_norm, x, after=True)
    return (x, attn)