查阅资料发现原来是代码里定义的字符常量不是tf.bool类型
错误出处:

is_training = False
result = tf.cond(is_training,lambda: npu_ops.dropout(X, keep_prob),  # tf.nn.dropout(X, keep_prob),lambda: tf.identity(X),name='dropout')

解决办法,将其定义为tf.bool的常量即可

is_training = tf.constant(False, dtype=tf.bool)###
result = tf.cond(is_training,lambda: npu_ops.dropout(X, keep_prob),  # tf.nn.dropout(X, keep_prob),lambda: tf.identity(X),name='dropout')

tf报错之raise TypeError(“pred must not be a Python bool“)相关推荐

  1. Tensorflow:TypeError: pred must not be a Python bool

    这个问题常见且不小心就会遇到,记录下O(∩_∩)O哈! frr@frr:~/Documents/code/pointnet/models$ python pointnet_SE.py ('input_ ...

  2. Vue报错:Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object 的解决方法

    Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法 参考文章: (1)Vue ...

  3. 报错:Uncaught TypeError: 获取的元素节点.setAttribute is not a function

    我们在写代码的时候可能会遇到类似的报错: Uncaught TypeError: div1.setAttribute is not a function 源代码是这样的: <!DOCTYPE h ...

  4. 运行tensorflow-datasets遇到import tensorflow.compat.v2 as tf报错ImportError: No module named tensorflow.V2

    运行tensorflow-datasets遇到import tensorflow.compat.v2 as tf报错ImportError: No module named tensorflow.V2 ...

  5. 运行JS代码报错:Uncaught TypeError: Cannot read property‘style‘ of undefined

    运行JS代码报错:Uncaught TypeError: Cannot read property'style' of undefined 这个报错的原因通常是没有获取指定的标签: 这个报错的原因通常 ...

  6. 【Python】获取roc、auc时候报错:raise ValueError({0} format is not supported.format(y_type))

    代码: fpr, tpr, thresholds = roc_curve(y_test, test_prob, pos_label=1, sample_weight=None, drop_interm ...

  7. Python读取xls文件报错:raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+‘; not supported‘)

    Python读取xls文件报错:raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+': not supported') 只需要下载pyexce ...

  8. react 谷歌浏览器报错:Uncaught TypeError: Cannot read properties of undefined (reading ‘forEach‘)

    运行react项目,报错: Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')at Object.i ...

  9. 报错:Uncaught TypeError: $(…).dialog is not a function,处理方法。

    在写前端queryselfplan.js代码时运用 $.dialog({type: 'alert',content: '该计划未创建'}); 报错:Uncaught TypeError: $(-).d ...

最新文章

  1. python阿凡提麦子问题_阿凡提愚弄国王
  2. Gradle打包命令记录
  3. 电脑word文档打不开怎么办_word怎么转pdf?两个值得学习的高效转换法
  4. 度盘转存工具 v1.8
  5. 分级时间轮优化普通时间轮定时器
  6. RationalRose2003--WIN7破解
  7. 阅读文献Performance Gains in V2X Experiments Using Distributed Simulation in the Veins Framework
  8. Bugku之网站被黑
  9. 高质量程序设计指南(笔记)
  10. 《客户反映访问公司网站服务器很慢或打不开》排错思想
  11. 线性代数知识点总结——矩阵乘法、矩阵运算与性质、矩阵微积分
  12. 华硕笔记本电脑计算机打不开,华硕笔记本电脑无线开关打不开怎么办
  13. 云服务器配置java环境
  14. 学习通信原理之——从实验中理解频谱/功率谱/功率谱密度(MATLAB演示)
  15. 转:vim的复制粘贴小结
  16. 使用 Python 构建图片搜索引擎
  17. 网站与服务器维护怎么做?
  18. SpringSecurity(Web权限方案)
  19. 如何讲好一个商业故事(人力资源)
  20. wps未保存文件恢复

热门文章

  1. Metasploit Framework(MSF)的使用
  2. SQL server注入
  3. [知识图谱实战篇] 四.HTML+D3+CSS绘制关系图谱
  4. C语言API编写窗体界面和按钮
  5. MFC Edit控件 error:“DDX_Control”: 不能将参数 3 从“int”转换为“CWnd ”
  6. Git之常用的高效处理技巧
  7. LeetCode 208. 实现 Trie (前缀树) —— 提供一套前缀树模板
  8. Python3 pickle模块的使用详解
  9. Go + Excel 学习 Excelize rows.go
  10. 《python从入门到精通》——生成由数字、字母组成的4位验证码