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>For Numpy arrays the <code>==</code> operator is a element-wise operation which returns a boolean array. The <code>astype</code> function transforms the boolean values <code>True</code> to <code>1.0</code> and <code>False</code> to <code>0.0</code> as stated in the comment.</p>

python numpy