Solved by KFrank in post #2 
              
              
                Hi Ali! 

Well, you should tell us what “output” means, what “target” means, 
and what “N” and “M” are.  Otherwise, we will have to guess. 
But let me guess a little bit, and make the following comment: 
If you are performing a multi-class classification problem (but not 
a multi-label problem), the…