code: def compute_output_spec(fn, *args, **kwargs):
      with StatelessScope():
          graph_name = auto_name("scratch_graph")
          with tf.__internal__.FuncGraph(graph_name).as_default():
  
              def convert_keras_tensor_to_tf(x):
                  if isinstance(x, KerasTensor):
                      if x.sparse:
                          return tf.compat.v1.sparse_placeholder(
                              shape=x.shape, dtype=x.dtype
                          )
                      else:
                          return tf.compat.v1.placeholder(
                              shape=x.shape, dtype=x.dtype
                          )
                  if isinstance(x, types.FunctionType):
  
                      def _fn(*x_args, **x_kwargs):
                          out = x(*x_args, **x_kwargs)
                          out = convert_keras_tensor_to_tf(out)
                          return out
  
                      return _fn
                  return x
  
              args, kwargs = tf.nest.map_structure(
                  convert_keras_tensor_to_tf, (args, kwargs)
              )
              tf_out = fn(*args, **kwargs)
  
              def convert_tf_to_keras_tensor(x):
                  if tf.is_tensor(x):
                      return KerasTensor(
                          x.shape,
                          x.dtype,
                          sparse=isinstance(x, tf.SparseTensor),
                      )
                  return x
  
              output_spec = tf.nest.map_structure(
                  convert_tf_to_keras_tensor, tf_out
              )
      return output_spec
  
imports: import types
  import numpy
  import tensorflow
  from tensorflow.compiler.tf2xla.python.xla import dynamic_update_slice
  from keras.backend.common import KerasVariable
  from keras.backend.common import global_state
  from keras.backend.common import standardize_dtype
  from keras.backend.common.keras_tensor import KerasTensor
  from keras.backend.common.name_scope import name_scope
  from keras.backend.common.stateless_scope import StatelessScope
  from keras.backend.common.stateless_scope import in_stateless_scope
  from keras.utils.naming import auto_name
label_desc: Use image node_id 6 for calling a global function with example usage: compute_output_spec(fn) and returns: output_spec, x, x, _fn, KerasTensor, tf, tf, out