       THCudaTensor_resizeAs(state, output, input);
       float *output_data = THCudaTensor_data(state, output);
       rreluUpdateOutputTrain<<<NUM_BLOCKS(n), BLOCK_SIZE, 0, THCState_getCurrentStream(state)>>>(
-        n, state->rngState->current_gen->gen_states,
-        input_data, noise_data, output_data, lower, upper);
+        n, gen_states, input_data, noise_data, output_data, lower, upper);
     }
     THCudaCheck(cudaGetLastError());
     THCudaTensor_free(state, input);

  THCudaTensor *noise, double lower, double upper, bool train, bool inplace, void *generator)
{
  THCUNN_assertSameGPU(state, 3, input, output, noise);
  if (state->rngState->current_gen == NULL)
  {
    THError("Random number generators have not been initialized.");
  }

  if (train)
  {

    if (inplace)
    {
      rreluUpdateOutputTrain<<<NUM_BLOCKS(n), BLOCK_SIZE, 0, THCState_getCurrentStream(state)>>>(
        n, gen_states, input_data, noise_data, input_data, lower, upper);
      THCudaTensor_set(state, output, input);
    }
    else
