Did numpy override == operator, because i can't understand follow python code
<pre><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)
</code></pre>

<p>What does this line mean?</p>

<pre><code>labels = (np.arange(num_labels) == labels[:,None]).astype(np.float32)
</code></pre>

<p>code is from <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/udacity/2_fullyconnected.ipynb" rel="nofollow">https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/udacity/2_fullyconnected.ipynb</a></p>

<p>In numpy, the <code>==</code> operator means something different when comparing two numpy arrays (as is being done in that line of note), so yes, it is overloaded in that sense. It compares the two numpy arrays elementwise and returns a boolean numpy array of the same size as the two inputs. The same is true for other comparisons like <code>&gt;=</code>, <code>&lt;</code>, etc.</p>

<p>E.g. 
</p>

<pre><code>import numpy as np
print(np.array([5,8,2]) == np.array([5,3,2]))
# [True False True]
print((np.array([5,8,2]) == np.array([5,3,2])).astype(np.float32))
# [1. 0. 1.]
</code></pre>

python numpy