In this tutorial, we will introduce how to fix Tensor’ object has no attribute ‘assign’ error. You can do by following our steps.
Look at this example code:
train_op = tf.group(train_op, [global_step.assign(new_global_step)])
In this code:
It will assign new_global_step to global_step.
However, running this code, you will get this error: Tensor’ object has no attribute ‘assign’
How to fix this attribute error?
We can use tf.assign(). For example:
train_op = tf.group(train_op, [tf.assign(global_step, new_global_step)])
Then, you will find this error is fixed.