tensorflow报错:Function call stack: keras_scratch_graph

tensorflow报错

报错内容

tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable _AnonymousVar33 from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/_AnonymousVar33/N10tensorflow3VarE does not exist.
[[node mul_1/ReadVariableOp (defined at /Users/xxx/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1751) ]] [Op:__inference_keras_scratch_graph_2262]
Function call stack:
keras_scratch_graph

解决方法

我们本地的环境是tensorflow2.0及以上,出现了不兼容问题,可以解决的一种方法是在头部添加以下代码:

    import tensorflow.compat.v1 as tf #使用1.0版本的方法
    tf.disable_v2_behavior() #禁用2.0版本的方法

你可能感兴趣的:(错误集锦,tensorflow)