Bool value of Tensor with more than one value is ambiguous
程序员文章站
2022-05-27 12:46:30
...
在跟随 https://juejin.im/post/5b9f1af0e51d450e425eb32d 这篇文章搭建transformer的时候出现了报错:
Bool value of Tensor with more than one value is ambiguous
提示是在行:
if mask_attn
...
mask_attn是一个boolean矩阵,用来对query和key相乘之后对attention矩阵进行mask处理,在这个方法内部对默认值是None
解决方法,改为:
if mask is not None:
...
上一篇: RuntimeError: bool value of Tensor with more than one value is ambiguous
下一篇: JAVA中利用Docx4J组件操作word文档,进行docx格式文档的创建、写入、读取、转换html、图片处理示例、转换pdf
推荐阅读
-
moviepy AudioClip帧处理ValueError: The truth value of array with more than one element is ambiguous
-
python报错ValueError: The truth value of an array with more than one element is ambiguous. Use a.any()
-
Python报错:The truth value of an array with more than one element is ambiguous
-
Python ValueError: The truth value of an array with more than one element is ambiguous.
-
成功解决Python的ValueError: The truth value of an array with more than one element is ambiguous
-
moviepy AudioClip帧处理ValueError: The truth value of array with more than one element is ambiguous
-
RuntimeError: bool value of Tensor with more than one value is ambiguous
-
Bool value of Tensor with more than one value is ambiguous
-
[numpy问题]The truth value of an array with more than one element is ambiguous.
-
学习随笔-ValueError: The truth value of an array with more than one element is ambiguous