tensorflow错误

UnboundLocalError: local variable ‘logs’ referenced before assignment:

tensorflow model.fit(feature,label)
UnboundLocalError: local variable ‘logs’ referenced before assignment
训练集数据过小,增加数据即可
详见https://github.com/tensorflow/tensorflow/issues/38064

AttributeError:module tensorflow no attribute app:

import tensorflow as tf

可能版本问题,使用

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
用tf.compat.v1.flags替换tf.app.flags

用tf.compat.v1.app.run()替换tf.app.run()

 

AttributeError: module 'tensorflow' has no attribute 'ConfigProto':

config = tf.compat.v1.ConfigProto(allow_soft_placement=True)替换config = tf.ConfigProto(allow_soft_placement=True)

AttributeError: module 'tensorflow' has no attribute 'Session':

tf.compat.v1.Session(config=config)替换tf.Session(config=config)

AttributeError: module 'tensorflow.compat.v1' has no attribute 'contrib':

发现contrib的内容可以集成到下面三个包中。
tf.keras.layers.Layer
tf.keras.Model
tf.Module

tf.keras.regularizers.l2(weight_decay)替换tf.contrib.layers.l2_regularizer(weight_decay)

我们可以通过安装tf_slim模块来替换contrib中slim,安装tf_slim模块

pip install tf_slim
import tf_slim as slim

报错:ValueError: Object arrays cannot be loaded when allow_pickle=False

1.pip install numpy=1.16.2
2.np.load(data_path, encoding='latin', allow_pickle=True).item()
#在np.load()加上allow_pickle=True
异常:mxnet.base.MXNetError: [23:42:39] C:\Jenkins\workspace\mxnet-tag\mxnet\src\storage\storage.cc:143: Compile with USE_CUDA=1 to enable GPU usage
原因:默认安装mxnet是cpu版本,卸载重装gpub版本 mxnet-cu91,和下载的cuda版本一致。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值