google-colaboratory - FailedPreconditionError:从容器读取资源变量 _AnonymousVar54 时出错:本地主机
问题描述
我在 google colab 上运行此代码,其中数据集是我自己的,即 X_train(我上传),图像大小为 15x15(我在代码中更改了,在需要的地方。为了保存输出图像,更改了位置。还有更多参数变化是 epochs=40000, batch_size=10, sample_interval=2000
我收到以下错误,并且只保存了一张图像:
/usr/local/lib/python3.6/dist-packages/keras/engine/training.py:297: UserWarning: Discrepancy between trainable weights and collected trainable weights, did you set `model.trainable` without calling `model.compile` after ?
'Discrepancy between trainable weights and collected trainable'
0 [D loss: 0.999931] [G loss: 1.000150]
---------------------------------------------------------------------------
FailedPreconditionError Traceback (most recent call last)
<ipython-input-4-caa940a5773c> in <module>()
2 if __name__ == '__main__':
3 wgan = WGAN()
----> 4 wgan.train(epochs=40000, batch_size=10, sample_interval=2000)
________________________________________
7 frames
________________________________________
/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
58 ctx.ensure_initialized()
59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60 inputs, attrs, num_outputs)
61 except core._NotOkStatusException as e:
62 if name is not None:
FailedPreconditionError: Error while reading resource variable _AnonymousVar54 from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/_AnonymousVar54/N10tensorflow3VarE does not exist.
[[node mul_12/ReadVariableOp (defined at /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3009) ]] [Op:__inference_keras_scratch_graph_4664]
Function call stack:
keras_scratch_graph
解决方案
推荐阅读
- java - 随机生成无重复索引的char数组
- amazon-web-services - 使用 Athena 查询 Glue Catalog 表时出错
- racket - 替换语法对象中的变量
- java - Bukkit - 如何在项目知识中创建 .replace(字符串列表)
- node.js - npm install -g 对任何东西都不起作用
- r - 如何以 R 语言以表格形式获取 csv + json 数据
- python - 使用文本检索两个子元素之间的文本
- cpython - 为什么 CPython 会创建同一个方法的多个实例?
- swift - Swift 将 Eureka 日期转换为字符串以进行 firebase 存储
- algorithm - 选择对象以满足需求链