def outputs_onto_stack(outputs, stack, n):
  """"Returns the new stack after removing n items and pushing outputs there."""
  outputs = _make_tuple(outputs)
  stack = _make_tuple(stack)
  return _make_singleitem_or_original(outputs + stack[n:])
"Returns the new stack after removing n items and pushing outputs there.
trax/layers/combinators.py