   float *input_k = input + k*dim;
   float *gradInput_k = gradInput + k*dim;
   int target_k = ((int)target[k])-1;
-  float input_target_k = input_k[target_k];
   float g = (sizeaverage ? 1./((float)dim) : 1.);
 
   int i_start = threadIdx.x;


    THCudaTensor_fill(state, target, target_);

    cunn_OneVsAllMultiMarginCriterion_updateGradInput_kernel<1> <<<blocks,threads>>>(THCudaTensor_data(state, gradInput),
                                                                         THCudaTensor_data(state, input),
                                                                         THCudaTensor_data(state, target),
                                                                         1, gradInput->size[0],

    dim3 blocks(gradInput->size[0]);
    dim3 threads(LOGSOFTMAX_THREADS);

    cunn_OneVsAllMultiMarginCriterion_updateGradInput_kernel <<<blocks,threads>>>(THCudaTensor_data(state, gradInput),
                                                                         THCudaTensor_data(state, input),
                                                                         THCudaTensor_data(state, target),
                                                                         gradInput->size[0], gradInput->size[1],
