在训练神经网络模型使用tensorflow时,training模块训练多次会出现报错如:

1,Variable conv1/weights already exists, disallowed. Did you mean to set reuse=True in VarScope

2,Variable conv1/weights does not exist, or was not created with tf.get_variable

都属于自己定义的网络模型的参数问题,从最前面的conv1卷积层开始报错,因为不是第一次训练模型,参数会有冲突,此时需要告诉模型可以多次训练或者理解为清除之前的一些参数

解决办法:在不是第一次的训练模块training前(或者每次训练后)加上:

tf.reset_default_graph()

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import os
import numpy as np
import matplotlib.pyplot as plttf.reset_default_graph()

Variable conv1/weights already exists, disallowed. Did you mean to set reuse=True...tensorflow报错相关推荐

  1. 解决tensorflow报错ValueError: Variable conv1/weights already exists, disallowed.

    早上在跑别人的tensorflow代码时报错: Traceback (most recent call last):File "<ipython-input-23-712e8e1f02 ...

  2. ...weights already exists, disallowed. Did you mean to set reuse=True...(解决办法)

    model.inference(train_batch, BATCH_SIZE, N_CLASSES)这个里面应该有with tf.variable_scope('layer1'):这样的代码,改为w ...

  3. ValueError: Variable conv1/weights already exists.

    跑TensorFlow程序的过程中出现了错误,解决之后再次跑时,报如下错误: ValueError: Variable conv1/weights already exists, 原因: 这是因为我在 ...

  4. Variable W already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE……

    Variable W already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarS ...

  5. ValueError: Variable eval_net/l1/w1 already exists, disallowed. Did you mean to set reuse=True or...

    当在spyder中运行代码时报错如下: ValueError: Variable eval_net/l1/w1 already exists, disallowed. Did you mean to ...

  6. 【报错及解决】Variable w already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally

    一.问题描述 在构建tensorflow计算图的时候,如下代码运行报错 x = tf.placeholder(tf.float32,[None,3072]) #[None] y = tf.placeh ...

  7. tensorflow Variable already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUS

    问题描述 使用with tf.Session() as sess:后 下次循环进入再次使用 with tf.Session() 问题原因 tf.graph() 未清空 解决 在withtf.get_d ...

  8. ValueError: Variable rnn/basic_rnn_cell/kernel already exists, disallowed. Did you mean to set reuse

    ValueError: Variable rnn/basic_rnn_cell/kernel already exists, disallowed. Did you mean to set reuse ...

  9. Tensorflow报错:ValueError: Trying to share variable ..., but specified shape ... and found shape ...

    Tensorflow报错:ValueError: Trying to share variable CON/conv2/W, but specified shape (3, 3, 128, 256) ...

最新文章

  1. dataframe 转json
  2. 藏在标定板身后的秘密
  3. php substr四个参数,PHP substr()函数参数解释及用法讲解
  4. 关于xcode7编译旧项目崩溃-[UIApplication _runWithMainScene:transitionContext:completion:]
  5. url采集器_Linux「第三节」-centos7.5部署数据采集器Telegraf
  6. virtualbox的USB识别
  7. Linux环境下的JFreeChart中文乱码问题解决办法
  8. 从“No space left on device”到删除海量文件
  9. 线性回归,最小二乘法 C语言实现
  10. matlab中grid相关知识
  11. asp.net前端页面上使用if
  12. 软件包管理:rpm和yum
  13. <C++>一篇文章搞懂类和对象中常函数和常对象的实质以及避免空指针访问的小妙招
  14. 2018年 新年目标
  15. 盘古开源:分布式数据存储,实现更多人参与的下一代互联网新基建
  16. 静态路由基础,扩展配置 超详细滴
  17. 浅谈SAP FICO—总账科目
  18. 函数指针的作用:*visit函数
  19. selenium 安装教程
  20. 隐马尔科夫模型(HMM)浅见

热门文章

  1. 西蒙的管理决策理论—《可以量化的…
  2. 人机博弈 围棋程序GNU GO 所有版本源码及使用方法
  3. 雷达PRI变化信号生成Matlab仿真
  4. 轻松解决keil4跟keil5在同一个系统下不能共存的问题
  5. 动手的乐趣_1969功率放大器
  6. mysql中on用法_详解mysql中的Using与On的用法
  7. C4.5算法缺失值处理
  8. 红帽Redhat—Linux软件管理
  9. CHAPITRE II
  10. IDG刘雨坤:关于SaaS业务七点经验