Tensorflow 深度学习问题总结

1、报错信息:tensorflow.python.framework.errors_impl.InvalidArgumentError:  assertion failed: [predictions must be >= 0] [Condition x >= y did not hold element-wise:] [x (sub_2:0) = ] [[-nan][-nan][-nan]...] [y (Cast_2/x:0) = ] [0]
         [[{{node assert_greater_equal/Assert/AssertGuard/else/_1/assert_greater_equal/Assert/AssertGuard/Assert}}]] [Op:__inference_train_function_1223]

Function call stack:
train_function

问题原因:tf.sqrt()开根号导致在0处不可导NAN,可能出现梯度爆炸问题

解决方法:加个很小的数,或者将学习率调小

2、警告信息:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches (in this case, 10000 batches). You may need to use the repeat() function when building your dataset.

问题原因:batch_size和steps_per_epoch、validation_steps同时出现出现冲突

解决方法:保留batch_size或者steps_per_epoch、validation_step

3、The `batch_size` argument must not be specified for the given input type. Received input: <BatchData....

问题原因:可能数据集制作的时候就使用了.batch(64)做好了,就不用在fit中加入batch_size了?【纯属猜测,因为在自己环境跑没出现问题,而是在别人的平台上跑出现的问题】

解决方法:去掉batch_size参数

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值