Hello.
Would like to know how exactly does the GradientTape context, record operations.
Browsing through github i followed the code to the C definition of the GradientTape PyObject, and functions to manipulate the tape and operations.
But what exactly triggers the recording.
The comments in the relevant files mention context / trace with regards to recording operations.
Any directions would be helpful.
Best regards.
Hi @Nihal_Kenkre, recording of gradients in GradientTape starts when tf.GradientTape.watch is called. Thank You.
Some more information on the question.
This is the GradientTape doc - tf.GradientTape | TensorFlow v2.16.1
It records the operations happening inside the GradientTape context.
Any pointers on how this is possible would be helpful.
There is python code for gradient tape which contains a tape class which then calls C extensions for GradientTape and Tape.
e.g. Tape Class
But i am not able to figure out the “Record Operations Trigger” which happens within the GradientTape context.
Is there a way to use the trace and traceback modules in python to do something like this? but how would they know where to start and stop.
Cheers