code: def scan_reference(f, init, xs):
      carry = init
      ys = []
      for x in xs:
          (carry, y) = f(carry, x)
          ys.append(tf_np.reshape(y, (1,) + y.shape))
      ys = tf_np.concatenate(ys, 0)
      return carry, ys
  
imports: import functools
  import itertools
  from absl import flags
  from absl.testing import parameterized
  from jax import lax
  import numpy
  import tensorflow.compat.v2
  from trax.tf_numpy import extensions
  import trax.tf_numpy.numpy
label_desc: Use image node_id 7 for calling a global function with example usage: scan_reference(f, init, xs) and returns: carry,  ys