Skip to content Skip to sidebar Skip to footer

Loss Function Is Returning Nan Tensorflow

I've written a simple tensorflow program here that reads in a feature list and tries to predict the class. with tf.Session() as sess: sess.run(tf.initialize_all_variables()

Solution 1:

  • the inputs have nan's, fix it by X[np.isnan(X)] = 0.
  • the inputs are not scaled, use sklearn's StandardScaler to normalize your inputs.

  • Set the weights to a small initial value use stddev in random_normal.

  • Fix the bug in calculation of output: output = tf.add(tf.matmul(l3, output_layer['weights']),output_layer['biases'] ) .

Post a Comment for "Loss Function Is Returning Nan Tensorflow"