ValueError: tf.function-decorated function tried to create variables on non-first call

在tensorflow2中如下保存模型的总是报错,很是头疼:

model.save(weight_file)

错误的位置定格在:

out_data = tf.keras.layers.Conv2D(filters, [3,3])(concat_data)

最终找到原因,需要先在__init__函数体中定义好,才能在call中进行调用:

    def __init__(self,**kwargs):super(Up_sampling, self).__init__(**kwargs)self.Conv2D_256 = tf.keras.layers.Conv2D(256, [3, 3])def call(self, input,filters):if filters==256:out_data = self.Conv2D_256(input)

这样就很好的解决问题了,错误消失!

Error-tf.function-decorated function tried to create variables on non-first call相关推荐

  1. ValueError: Creating variables on a non-first call to a function decorated with tf.function.解决方法

    参考Creating variables on a non-first call to a function decorated with tf.function.解决方法!_时时勤拂拭.的博客-CS ...

  2. Creating variables on a non-first call to a function decorated with tf.function.解决方法!

    Creating variables on a non-first call to a function decorated with tf.function.解决方法! Creating varia ...

  3. Bug之ValueError: tf.function-decorated function tried to create variables on non-first call.

    问题描述: tensorflow2.1 搭建模型时报以下错误 ValueError: tf.function-decorated function tried to create variables ...

  4. ValueError: tf.function-decorated function tried to create variables on non-first call

    问题: tf 1x 的代码迁移到 tf 2x时出现错误: ValueError: tf.function-decorated function tried to create variables on ...

  5. tf.function-decorated function tried to create variables on non-first call

    tf2.0在模型的call()中调用tf.keras.layers.embedding,出错 tf.function-decorated function tried to create variab ...

  6. ValueError: tf.function-decorated function tried to create variables on non-first call.

    问题:ValueError: tf.function-decorated function tried to create variables on non-first call. 解决方案-当您尝试 ...

  7. Mysql ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA

    ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declar ...

  8. yocto编译错误- Error executing a python function in exec_python_func() autogenerated

    yocto编译错误 主要错误信息 **ERROR: fsl-image-validation-imx-1.0-r0 do_rootfs: Error executing a python functi ...

  9. error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. 的解决方法

    vs2013编译出错信息:错误    1    error C4996: 'fopen': This function or variable may be unsafe. Consider usin ...

最新文章

  1. 照片换色 使用Python 或者 java
  2. C++回调函数用法(zz)
  3. boost::ptr_list相关的测试程序
  4. mysql权限说法正确的是,【多选题】下面关于修改 MySQL 配置的说法中,正确的是...
  5. ZOJ The Sum of Unitary Totient(min_25 筛)
  6. 关于微信分享的一些心得之recommend.js(直接复制就行)
  7. sonarqube 启动不了,异常提示:远程主机强迫关闭了一个现有的连接
  8. 用ShopEx网上开店之安装Zend插件[2]
  9. oracle多表查询while,oracle while的用法示例分享
  10. 存储成本降低80%,“大智慧”的选择
  11. Java中的包扫描(工具)
  12. 林森---博客园之二,对《闭包》的个人见解!希望能帮到不理解闭包的同学们!...
  13. pdfdom将pdf转成html,使用pdfdom将pdf转为html(示例代码)
  14. 静态创意和动态创意_8种独特且价格合理的名片的创意
  15. td可编辑(html标签可编辑)
  16. 度娘果然毫无节操,纯粹就是order by 广告费 desc
  17. 【解决方案】摄像机户外直播能在哪些地方运用?团建/项目启动会/户外婚礼等户外直播方案介绍
  18. signature=161034cb9eebb9b66e71be6081528fe7,Alternative Semantics for Verdi
  19. Java程序员应该学习的10件清单
  20. html文件导入excel 出现乱码,win7系统txt导入excel出现中文乱码的解决方法

热门文章

  1. zzulioj:1127: 矩阵乘积
  2. 【MM】委外加工标准流程(Subcontracting)
  3. The Mamba Mentality
  4. 多项式使用最小二乘法拟合数据
  5. 图像特征提取(一)——什么是特征点、特征描述、特征匹配
  6. 如何交换两个变量的值
  7. 【JAVA关于Date时间的处理-使用Calendar获取当天最早时间和最晚时间】
  8. Android4开发入门经典 之 第十二部分:最佳实践
  9. mysql设置数据库显示汉字_在CMD中操作mysql数据库出现中文乱码解决方案
  10. 主动式电容笔哪个牌子好?ipad平替电容笔排行榜