attention icon indicating copy to clipboard operation
attention copied to clipboard

some attention implements

Results 11 attention issues
Sort by recently updated
recently updated
newest added

ValueError: Dimension must be 5 but is 4 for 'attention_1/transpose_7' (op: 'Transpose') with input shapes: [?,8,?,8,?], [4]. 请问这个怎么解决 run example https://kexue.fm/archives/4765 代码测试 在Keras上对IMDB进行简单的测试

你好,我想把你的Keras版本改写成pytorch版本的,但是K.batch_dot(qw, kw, [4, 4])这个功能好像没有类似pytorch的函数可以转换,请问你有什么建议吗?谢谢

训练完后 加载模型时一直报错,找不到attention层,但我有import attention

拜读了您的《Attention is All You Need》浅读,对Q,K,V这三个矩阵的来源仍然不理解,我的一种理解是Q是attention layer的输入,K和V是需要训练的两个权重矩阵,这样理解对吗?

Could you give me a brief expanantion, please? Anyway thanks a lot.

我想问一下多头attention那里,通过一次线性映射产生K,Q,V,paper中说要8次不同的映射。代码实现时,是因为,8次不同的映射可以一次完成,只要权重参数的数量已经相当于8次映射的数量了么?

你好, 想请教一下,[attention_keras.py](https://github.com/bojone/attention/blob/master/attention_keras.py)中的[第21行](https://github.com/bojone/attention/blob/ae5944a3199b23152974f332ec812ead44507082/attention_keras.py#L21), `position_i = K.cumsum(K.ones_like(x[:,:,0]), 1)-1 #K.arange不支持变长,只好用这种方法生成` 这行代码具体在计算什么? 我翻阅了[论文原文](https://arxiv.org/pdf/1706.03762.pdf)和ones_like, cumsum的keras backend资料,对这行代码的用途猜测是计算论文中Position_Embedding公式的pos值,但不太理解具体是如何实现计算的,论文似乎也没有详细涉及。 请问能解释一下吗?谢谢!

position_ij = tf.concat([tf.cos(position_ij), tf.sin(position_ij)], 1) 论文中sin和cos是交叉的,偶数位置为sin,奇数位置为cos,如果按照你这么运算,前半部分是cos,后半部分是sin,是不是与论文不符,希望帮忙解惑,谢谢