   n_threads *= nInputPlane;
   LRNComputeOutput<<<GET_BLOCKS(n_threads), CUDA_NUM_THREADS>>>(
     n_threads, THCudaTensor_data(state, input), THCudaTensor_data(state, scale), -beta, THCudaTensor_data(state, output));
+
+  THCudaTensor_free(state, input);
 }
 
 

      local_size, -beta, float(2. * alpha * beta / local_size),
      THCudaTensor_data(state, gradInput));

}

    imsize_w = input->size[3];
  }

  input = THCudaTensor_newContiguous(state, input);
  gradOutput = THCudaTensor_newContiguous(state, gradOutput);

  int n_threads = batchSize * imsize_h * imsize_w;
  LRNComputeDiff<<<GET_BLOCKS(n_threads), CUDA_NUM_THREADS>>>(
      n_threads, THCudaTensor_data(state, input), THCudaTensor_data(state, output),
