文章首发及后续更新:https://mwhls.top/4011.html,无图/无目录/格式错误/更多相关请至首发页查看。
新的更新内容请到mwhls.top查看。
欢迎提出任何疑问及批评,非常感谢!
错误代码
RuntimeError: mixed dtype (CPU): expect input to have scalar type of BFloat16
产生原因
- 将 tensor 与 numpy array 做运算,并将 Layernorm 应用到其计算结果。
解决方法
- 将 numpy array 换为 tensor。