class_docstr: Reversible Layer.
class_docstr_tok: ["Reversible","Layer","."]
docstr: Call self.forward in a pure way.
docstr_tok: ["Call","self.forward","in","a","pure","way","."]
code: def _pure_forward(self, x, weights, state, rng):
      """Call self.forward in a pure way."""
      old_weights, old_state, old_rng = (
          self.weights,
          self.state,
          self._rng,
      )
      self.weights, self.state, self._rng = weights, state, rng
      res = self.forward(x)
      self.weights, self.state, self._rng = (
          old_weights,
          old_state,
          old_rng,
      )
      return res
  
imports: from absl import logging
  import jax
  from trax import fastmath
  from trax.layers import base
  from trax.layers import combinators
label_desc: Use image node_id 2 for calling the ReversibleLayer obj's underlying member method code with example usage: obj._pure_forward(x, weights, state, rng) and returns: res