Tensorflow error record: depreciation warning: elementwise

when learning simple neural network with tensorflow, the following error is reported:

DeprecationWarning: elementwise == comparison failed; this will raise an error

the reason is: when processing the data, I ran the following code, and then re-pasted a copy, running it again, making the data become three-dimensional, causing the mismatch of the data:

code:

image_size = 28
num_labels = 10

def reformat(dataset, labels):
  dataset = dataset.reshape((-1, image_size * image_size)).astype(np.float32)
  # Map 0 to [1.0, 0.0, 0.0 ...], 1 to [0.0, 1.0, 0.0 ...]
  labels = (np.arange(num_labels) == labels[:,None]).astype(np.float32)
  return dataset, labels
train_dataset, train_labels = reformat(train_dataset, train_labels)
valid_dataset, valid_labels = reformat(valid_dataset, valid_labels)
test_dataset, test_labels = reformat(test_dataset, test_labels)
print('Training set', train_dataset.shape, train_labels.shape)
print('Validation set', valid_dataset.shape, valid_labels.shape)
print('Test set', test_dataset.shape, test_labels.shape)

correct result:

Training set (200000, 784) (200000, 10)
Validation set (10000, 784) (10000, 10)
Test set (10000, 784) (10000, 10)

run error result:

Training set (200000, 784) (200000, 1, 10)
Validation set (10000, 784) (10000, 1, 10)
Test set (10000, 784) (10000, 1, 10)

obviously, the dimension of the data is wrong

solution: rerun the first time the program can be allowed only once.

Read More: