human
10. Negative LogLikelihood criterion (numerically stable)

input:   batch_size x n_feats - log probabilities
target: batch_size x n_feats - one-hot representation of ground truth
output: scalar

Task is similar to the previous one, but now the criterion input is the output of log-softmax layer. This decomposition allows us to avoid problems with computation of forward and backward of log()."
Please write code following the instructions in jupyter notebook style.

=====
Write me a code to 10?
assistant
#Here is code to 10.

class ClassNLLCriterion(Criterion):
    def __init__(self):
        a = super(ClassNLLCriterion, self)
        super(ClassNLLCriterion, self).__init__()
        
    def updateOutput(self, input, target): 
        # Your code goes here. ################################################
        self.output = - np.sum(np.multiply(target, input))/input.shape[0]
        return self.output

    def updateGradInput(self, input, target):
        # Your code goes here. ################################################
        self.gradInput = - target/input.shape[0]
        return self.gradInput
    
    def __repr__(self):
        return "ClassNLLCriterion"