parameters: (self, features)
return_statement: return features, True
docstring: Returns `features` with state packed, indicates if packing was done.
docstring_summary: Returns `features` with state packed, indicates if packing was done.
docstring_tokens: Returns features with state packed indicates if packing was done .
function: def _gather_state(self, features):
      """Returns `features` with state packed, indicates if packing was done."""
      prefixed_state_re = re.compile(r"^" + feature_keys.State.STATE_PREFIX +
                                     r"_(\d+)$")
      numbered_state = []
      for key, tensor in features.items():
        search_result = prefixed_state_re.search(key)
        if search_result:
          numbered_state.append((int(search_result.group(1)), key, tensor))
      if not numbered_state:
        return features, False
      features = features.copy()
      for _, key, _ in numbered_state:
        del features[key]
      numbered_state.sort(key=lambda number, *_: number)
      features[feature_keys.State.STATE_TUPLE] = nest.pack_sequence_as(
          structure=self.model.get_start_state(),
          flat_sequence=[tensor for _, _, tensor in numbered_state])
      return features, True
function_tokens: def _gather_state ( self , features ) : prefixed_state_re = re . compile ( r"^" + feature_keys . State . STATE_PREFIX + r"_(\d+)$" ) numbered_state = [ ] for key , tensor in features . items ( ) : search_result = prefixed_state_re . search ( key ) if search_result : numbered_state . append ( ( int ( search_result . group ( 1 ) ) , key , tensor ) ) if not numbered_state : return features , False features = features . copy ( ) for _ , key , _ in numbered_state : del features [ key ] numbered_state . sort ( key = lambda number , * _ : number ) features [ feature_keys . State . STATE_TUPLE ] = nest . pack_sequence_as ( structure = self . model . get_start_state ( ) , flat_sequence = [ tensor for _ , _ , tensor in numbered_state ] ) return features , True