Fail if a noninitial defun trace of a Python function creates tf.Variables.
Only the first trace of a Python function via defun is permitted to create tf.Variables. Creating Variables on subsequent traces typically indicates user error and can lead to surprising behavior. Additionally, :%s/compile/trace/g to emphasize that defun is not a compiler (i.e., it does not in general preserve the semantics of the original Python function). PiperOrigin-RevId: 212036521
Loading
Please sign in to comment