code: def static_rnn(
      core: snt.Module, inputs: types.NestedTensor, unroll_length: int
  ):
      """Unroll core along inputs for unroll_length steps.
  
      Note: for time-major input tensors whose leading dimension is less than
      unroll_length, `None` would be provided instead.
  
      Args:
        core: an instance of snt.Module.
        inputs: a `nest` of time-major input tensors.
        unroll_length: number of time steps to unroll.
  
      Returns:
        step_outputs: a `nest` of time-major stacked output tensors of length
          `unroll_length`.
      """
      step_outputs = []
      for time_dim in range(unroll_length):
          inputs_t = tree.map_structure(
              lambda t, i_=time_dim: t[i_] if i_ < t.shape[0] else None,
              inputs,
          )
          step_output = core(inputs_t)
          step_outputs.append(step_output)
  
      step_outputs = _nest_stack(step_outputs)
      return step_outputs
  
file_path: acme/acme/agents/tf/svg0_prior/utils.py
imports: import collections
  from typing import Tuple, Optional, Dict, Iterable
  from acme import types
  from acme.tf import utils
  import sonnet
  import tensorflow
  import tree
label_desc: Use image node_id 1 for calling a global function with example usage: static_rnn(core, inputs, unroll_length) and returns: step_outputs