StyleGAN2获取Colab中返回不兼容设备分配的GPU与CPU的常数层值

2024-06-02 17:37:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在GoogleColab和GPU运行时中使用以下代码获取StyleGAN生成器常量层的值

v1 = (tflib.run(['G_synthesis_1/4x4/Const/const:0'])[0])

但我得到了以下错误:

> 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

这里是error paste-bin

这是我正在尝试的参考代码replicate。笔记本的运行时类型设置为GPU,因此我假设代码将在其上运行。可以在Colab中运行它吗


Tags: the代码nodelocalhosttaskgpuisdevice