python - 使用混合精度和构建 EfficientNetB0 模型时出现 Dtype 错误
问题描述
系统信息
- 操作系统平台和发行版:MacOS
- TensorFlow 安装自:Colab
- TensorFlow 版本:2.5.0
- Python版本:python 3.7
- GPU型号和内存:Tesla T4
错误
TypeError: Input 'y' of 'Sub' Op has type float16 that does not match type float32 of argument 'x'
当前行为
在使用混合精度并构建 Keras 功能 API 模型 (EfficientNet B0) 时,它显示以下错误
TypeError: Input 'y' of 'Sub' Op has type float16 that does not match type float32 of argument 'x'
注意:由于某种原因 StackOverflow 不允许我发布图片。访问以下链接以更深入地了解该问题: https ://github.com/tensorflow/tensorflow/issues/49725
预期行为
我在上一个单元格中设置的全局策略是mixed_float16
. 运行时问题正常,tensorflow 2.4.1
因此错误与tensorflow 2.5.0
您可以使用以下笔记本重现相同的错误: https ://colab.research.google.com/drive/1TfNZSIJ_I7IZI35RsGFnTdj-6beMHV2_?usp=sharing
解决方案
推荐阅读
- c# - 失去焦点时如何保持 InputField 键盘打开?
- arrays - MIPS程序集中for循环中的数组索引
- reactjs - reducer 中所有动作的通用修改
- firebase - Imagemagick 在 Firebase 云功能 Spawn Child Process 中转换失败
- c - 当我尝试在某个目录中创建一个 txt 文件时,它的末尾有垃圾字符
- sql - 如何总结sqlite中的连接表?
- ionic-framework - Ionic 4:bgImage 未显示在 StreamingAudioOptions
- azure - Azure Function - Out 绑定后如何触发函数
- javascript - 即使指定了 IP 和 Geo,位置也不会改变
- swift3 - xcode 10.2 Swift 中没有这样的模块“IBMCloudAppID”