(self, stack, grad_stack, step,
                               rev_layers, rev_and_fbos,
                               old_states, new_states, rngs,
                               optimizers, replicated_opt_params)
return stack, grad_stack, stats
Run reversible layers backwards.
Run reversible layers backwards.
Run reversible layers backwards .
def _run_backward_reversible(self, stack, grad_stack, step,
                               rev_layers, rev_and_fbos,
                               old_states, new_states, rngs,
                               optimizers, replicated_opt_params):
    """Run reversible layers backwards."""
    counter = 0
    stats = []
    step_int = int(step) if self._n_devices < 2 else int(step[0])
    for layer, reverse_and_fbo, old_state, new_state, rng in reversed(list(zip(
        rev_layers, rev_and_fbos,
        old_states, new_states, rngs))):
      if step_int % self._n_steps_per_log == 1:
        logging.info('running backward reversible layer %s', str(layer))
      counter -= 1
      stack, grad_stack, layer_stats = self._run_backward_one_reversible(
          layer, stack, grad_stack, step, rng, optimizers[counter],
          replicated_opt_params[counter], reverse_and_fbo, old_state, new_state)
      stats.append(layer_stats)
      if counter + self._n_async_layers < 0:
        self._collect_weights(rev_layers[counter + self._n_async_layers])
    return stack, grad_stack, stats
def _run_backward_reversible ( self , stack , grad_stack , step , rev_layers , rev_and_fbos , old_states , new_states , rngs , optimizers , replicated_opt_params ) : counter = 0 stats = [ ] step_int = int ( step ) if self . _n_devices < 2 else int ( step [ 0 ] ) for layer , reverse_and_fbo , old_state , new_state , rng in reversed ( list ( zip ( rev_layers , rev_and_fbos , old_states , new_states , rngs ) ) ) : if step_int % self . _n_steps_per_log == 1 : logging . info ( 'running backward reversible layer %s' , str ( layer ) ) counter -= 1 stack , grad_stack , layer_stats = self . _run_backward_one_reversible ( layer , stack , grad_stack , step , rng , optimizers [ counter ] , replicated_opt_params [ counter ] , reverse_and_fbo , old_state , new_state ) stats . append ( layer_stats ) if counter + self . _n_async_layers < 0 : self . _collect_weights ( rev_layers [ counter + self . _n_async_layers ] ) return stack , grad_stack , stats