code: def gnmt_residual_fn(inputs, outputs):
      """Residual function that handles different inputs and outputs inner dims.
  
      Args:
        inputs: cell inputs, this is actual inputs concatenated with the attention
          vector.
        outputs: cell outputs
  
      Returns:
        outputs + actual inputs
      """
  
      def split_input(inp, out):
          out_dim = out.get_shape().as_list()[-1]
          inp_dim = inp.get_shape().as_list()[-1]
          return tf.split(inp, [out_dim, inp_dim - out_dim], axis=-1)
  
      actual_inputs, _ = tf.contrib.framework.nest.map_structure(
          split_input, inputs, outputs
      )
  
      def assert_shape_match(inp, out):
          inp.get_shape().assert_is_compatible_with(out.get_shape())
  
      tf.contrib.framework.nest.assert_same_structure(
          actual_inputs, outputs
      )
      tf.contrib.framework.nest.map_structure(
          assert_shape_match, actual_inputs, outputs
      )
      return tf.contrib.framework.nest.map_structure(
          lambda inp, out: inp + out, actual_inputs, outputs
      )
  
file_path: nlp-architect/examples/sparse_gnmt/gnmt_model.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from .gnmt import attention_model
  from .gnmt import model_helper
  from .gnmt.utils import misc_utils
label_desc: Use image node_id 1 for calling a global function with example usage: gnmt_residual_fn(inputs, outputs) and returns: tf, tf