Signatures of nested polymorphic Function[s]

  • I have a python function “A” which calls other python functions “B” and “C” (please see a toy code snippet below)
  • now I wrapped each of these functions with tf.function. So when A gets called, it creates new concrete functions for A, B and C

Is there a way to determine with what input signatures B and C were called from inside A?

@tf.function
def a(...):
    # ...
    _ = b(...)
    _ = c(...)

@tf.function
def b(...):
    pass

@tf.function
def c(...):
    pass

Hi @Iaroslav_Elistratov , You can directly obtain a concrete function, by using get_concrete_function and then you can use structured_input_signature method on concrete function to get the input signature.
For more details please refer to this document. Thank You.

Hi @Kiran_Sai_Ramineni thank you so much for the idea, unfortunately if we call e.g. B on some inputs (before calling A); and then call A –– B will potentially have 2 concrete functions and it’s not clear which one of them was created inside A, so it looks like this approach doesn’t allow us to determine with what input signatures B was called from inside A