经过tensorflow训练,vgg-net返回nan

时间:2017-11-24 16:29:54

标签: python tensorflow deep-learning vgg-net

我训练vgg-19 net到classfy cifar10,经过一次训练,只有一次,vgg-net返回nan

0 [[  4.45161677e+09   2.87961518e+10   4.20765041e+10 ...,          -2.33432433e+10
1.83500431e+10  -1.12923648e+10]
 [  1.18354002e+10   3.38799473e+10   5.86873242e+10 ...,  -4.18343895e+10
2.79392338e+10  -1.61746637e+10]
 [  1.26074880e+09   2.22301839e+10   5.25488333e+10 ...,  -2.92738212e+10
2.51925299e+10  -1.48290714e+10]
 ..., 
 [  1.05694116e+10   2.16351908e+10   5.02961357e+10 ...,  -3.12492278e+10
2.42959094e+10  -1.26112993e+10]
 [  4.72429568e+09   2.75032003e+10   5.14044682e+10 ...,  -3.51395635e+10
2.18048840e+10  -1.46147287e+10]
 [  2.97774285e+09   1.89559747e+10   4.06387917e+10 ...,  -2.35828470e+10
1.96148122e+10  -9.55916698e+09]]
1 [[ nan  nan  nan ...,  nan  nan  nan]
 [ nan  nan  nan ...,  nan  nan  nan]
 [ nan  nan  nan ...,  nan  nan  nan]
 ..., 
 [ nan  nan  nan ...,  nan  nan  nan]
 [ nan  nan  nan ...,  nan  nan  nan]
 [ nan  nan  nan ...,  nan  nan  nan]]

我使用tf.train.GradientDescentOptimizer来训练vgg网,主动功能是relu,tf.random_normal来初始权重并使用tf.nn.xw_plus_b作为完全连接层。所以我想知道,为什么vgg-net在训练后返回nan

1 个答案:

答案 0 :(得分:1)

降低学习率可以解决这个数值稳定性问题。