privacy
privacy copied to clipboard
An op outside of the function building code is being passed a "Graph" tensor
Hello, I'm trying to make a differentially private GAN, however when computing the gradients for my discriminator I get the error message
TypeError: An op outside of the function building code is being passed
a "Graph" tensor. It is possible to have Graph tensors
leak out of the function building context by including a
tf.init_scope in your function building code.
For example, the following function will fail:
@tf.function
def has_init_scope():
my_constant = tf.constant(1.)
with tf.init_scope():
added = my_constant * 2
The graph tensor has name: strided_slice:0
What's odd is that I can run the training step for the discriminator (computing the gradients) twice, however on the third iteration I get this error.
I have tried my code with TensorFlow 2.x and 1.x but I seem to be getting the same error on either.
Update on this, the cause of the error was that I wasn't giving the number of microbatches to the optimizer. I'll keep looking into why this was creating that error, as the optimizer code looks like it can just infer the number of microbatches.
Hi, any solution for this error ? I'm facing now when i try model.summary() step.