I am trying to get values of StyleGAN generator constant layer using the following code in Google Colab with GPU runtime
v1 = (tflib.run(['G_synthesis_1/4x4/Const/const:0'])[0])
But I am getting the following error:
> InvalidArgumentError: Cannot place the graph because a reference or
> resource edge connects colocation groups with incompatible assigned
> devices: /job:localhost/replica:0/task:0/device:GPU:0 vs
> /job:localhost/replica:0/task:0/device:CPU:0. The edge src node is
> G_synthesis_1/4x4/Const/const , and the dst node is
> _retval_G_synthesis_1/4x4/Const/const_0_0
Here is error paste-bin
And here is the reference code I am trying to replicate. The runtime type of notebook is set to GPU, so I would have assumed that the code would be run on it. Is it possible to run it in Colab?
I has a similar error and it was related to tfrecords. I migrated code from Tensorflow version 0.12 to version 2.12 and the read() method that came from tf.compat.v1 caused that error. I don't know exactly why but I had warnings that the method was depreciated.
In my case, the error occurred during the training and execution of the graph. So, I recommend reading how the graph exactly works because data flows through the graph not imminently after a particular line of code is executed.
The error also occurred with GPU and execution under CPU worked fine