Does session.run ([op1,op2]) in tensorflow have priority when assigning cpu or gpu?

Does session.run ([op1,op2]) in

tensorflow give priority to the allocation of cpu and gpu when fetch has multiple op? Because if op1 is to add 1 to a variable x and then assign to assign op2 to the same x minus 1, then the value of x is uncertain.

import tensorflow as tf
x=tf.Variable (0)
a=tf.constant (1)
b=tf.add (xpene a)
c=tf.assign (xpene b)
d=tf.subtract (xmeme a)
e=tf.assign (xmeme d)
init_op=tf.initialize_all_variables ()
sess=tf.InteractiveSession ()
sess.run (init_op)
sess.run ([cenere])

clipboard.png

I tried several times and found that the value of x is random + 1 or-1 or keep the original value. Does cpu or gpu have no priority when assigning op in sess.run?

Mar.05,2021
Menu