class_docstr: Reversible version of the Select combinator.
class_docstr_tok: ["Reversible","version","of","the","Select","combinator","."]
code: def __init__(self, indices, n_in=None, name=None):
      if n_in is None:
          n_in = max(indices) + 1
      if name is None:
          name = f"ReversibleSelect{indices}".replace(" ", "")
      super().__init__(n_in=n_in, n_out=len(indices), name=name)
      self._indices = indices
  
      # Calculate reverse indices.
      self._reverse_indices = []
      for i in range(n_in):
          if i not in indices:
              raise ValueError(
                  "To be reversible, all inputs to Select must be in "
                  "indices. Did not find %d in indices." % i
              )
          else:
              self._reverse_indices.append(indices.index(i))
  
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 1 to create a new ReversibleSelect object from inherited base classes: ReversibleLayer with example: obj = ReversibleSelect(indices, n_in, name)