Mapping output neurons to classes I have read few articles some say there is no need to have no. of units in output layer = no. of classes
why some say they both should be equal.
My questions are

If no. of neurons = no. of classes. How are the classes mapped to each neuron/unit in the output layer. To elaborate how does Neural Network decide which neuron/unit deals with which class.

After training a neural network using tensorflow on a multiclass classification problem using softmax in out put layer and no. of units in output layer = no. of classes. When I use this trained network on test sample, the output is a numpy array of probabilities of each class. How do I whther the first element of that array represents which class.

If no. of units is not equal to no. of classes can some one share a link of such an example for multiclass problems.
In multiclass classification problems, the number of output units (i.e. neurons) is equal to the number of classes. Only in binary classification, you have 2 classes but just 1 output unit.

The mapping between output units and classes is decided by you. You assign each class an index from $0$ to $N-1$, where $N$ is the number of classes. This values (or one-hot versions of them) are what you supply as expected output to the loss function. Output units form a vector of size $N$, with each unit being at a specific position in that vector. The unit at position $i$ represents the class with index $i$.

The output of the softmax is also a vector of $N$ probability values. The probability at position $i$ represents the probability of the input data belonging to the class with index $i$.