'minimize method not taking argument

From the tensorflow doc i have read here, I have tried to minimise the adam optimizer.

optimizer = tf.compat.v1.train.AdamOptimizer
print("Using AdamOptimizer...")

train_step = optimizer.minimize(loss, global_step = global_step,var_list = [process_image])

But I receive this error below from the code. Even though I have passed through the 'loss' argument. I think it may be due to using Tensorflow 2?

enter image description here



Solution 1:[1]

Do you have a loss tensor called loss? In that case, you could try to write simply :

optimizer.minimize(loss = loss, ...)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anynamer