code: def gather_tree(values, parents):
      """Tensor version of gather_tree_py"""
      res = tf.py_func(
          func=gather_tree_py, inp=[values, parents], Tout=values.dtype
      )
      res.set_shape(values.get_shape().as_list())
      return res
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import namedtuple
  import numpy
  import tensorflow
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling a global function with example usage: gather_tree(values, parents) and returns: res