python - StyleGAN2 在 Colab 中获取返回不兼容设备分配 GPU 与 CPU 的常量层的值
问题描述
我正在尝试使用带有 GPU 运行时的 Google Colab 中的以下代码获取 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
这是错误粘贴箱
这是我试图复制的参考代码。笔记本的运行时类型设置为 GPU,所以我假设代码将在其上运行。是否可以在 Colab 中运行它?
解决方案
推荐阅读
- javascript - 我无法在我的 javascript 项目中在 firebase auth 中创建用户。我应该怎么办?
- c# - 在 C# 中使用反射获取方法内的所有方法
- c++ - 为什么虚拟继承会导致指针偏移?
- powershell - PowerShell - 多个 Get-Date 调用返回不同的时间格式/文化
- javascript - 我无法理解如何使用 MEAN 编写在一群人之间分配资金的逻辑
- javascript - 如何将用户身份验证添加到 docsifyjs
- jquery - minpointlength 和 datalabels 的问题在 columnrange 中重叠
- php - ACF 分类法只返回孩子 - 想要父母和孩子
- node.js - 运行“nodemon app”命令时出错
- python - 具有阈值的图像的曲面图