TypeError:names_to_saveables必须是字符串映射到Tensors / Variables

时间:2018-05-08 02:08:44

标签: python-3.x tensorflow

这两个问题的同一问题(1 / 2)。当我在Lucid之后检索要使用tutorial显示的TF模型时,会发生这种情况。我的完整堆栈跟踪是:

  

/usr/local/lib/python3.6/dist-packages/h5py/的初始化的.py:36:   FutureWarning:转换issubdtype的第二个参数   不推荐floatnp.floating。将来,它将被对待   为np.float64 == np.dtype(float).type。来自._conv导入   register_converters为_register_converters

     

2018年5月8日   01:22:34.477907:我   tensorflow / stream_executor / cuda / cuda_gpu_executor.cc:898]成功   从SysFS读取的NUMA节点具有负值(-1),但必须存在   至少有一个NUMA节点,因此返回NUMA节点零

     

2018年5月8日   01:22:34.478221:我   tensorflow / core / common_runtime / gpu / gpu_device.cc:1344]找到设备0   具有属性:名称:特斯拉K80专业:3个未成年人:7   memoryClockRate(GHz):0.8235 pciBusID:0000:00:04.0 totalMemory:   11.17GiB freeMemory:362.12MiB

     

2018-05-08 01:22:34.478266:I tensorflow / core / common_runtime / gpu / gpu_device.cc:1423]添加可见   gpu设备:0 2018-05-08 01:22:34.871564:我   tensorflow / core / common_runtime / gpu / gpu_device.cc:911]设备   使用强度1边缘矩阵互连StreamExecutor:2018-05-08   01:22:34.871635:我   tensorflow / core / common_runtime / gpu / gpu_device.cc:917] 0   2018-05-08 01:22:34.871680:我   tensorflow / core / common_runtime / gpu / gpu_device.cc:930] 0:N   2018-05-08 01:22:34.871877:我   tensorflow / core / common_runtime / gpu / gpu_device.cc:1041]已创建   TensorFlow设备(/ job:localhost / replica:0 / task:0 / device:GPU:0 with   101 MB内存) - >物理GPU(设备:0,名称:特斯拉K80,pci总线   id:0000:00:04.0,计算能力:3.7)

     

追踪(最近的电话   最后):

     

文件   " /usr/local/lib/python3.6/dist-packages/tensorflow/python/tools/freeze_graph.py" ;,   380号线       app.run(main = main,argv = [sys.argv [0]] + unparsed)

     

File" /usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py",   第126行,在运行中       _sys.exit(main(argv))

     

File" /usr/local/lib/python3.6/dist-packages/tensorflow/python/tools/freeze_graph.py",   第274行,主要部分       FLAGS.saved_model_tags,checkpoint_version)

     

File" /usr/local/lib/python3.6/dist-packages/tensorflow/python/tools/freeze_graph.py",   第256行,在freeze_graph中       checkpoint_version = checkpoint_version)

     

File" /usr/local/lib/python3.6/dist-packages/tensorflow/python/tools/freeze_graph.py",   第130行,在freeze_graph_with_def_protos中       var_list = var_list,write_version = checkpoint_version)

     

File" /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py",   第1311行, init       self.build()File" /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py",   1320行,在构建中       self._build(self._filename,build_save = True,build_restore = True)

     

文件   " /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py" ;,   第1357行,在_build中       build_save = build_save,build_restore = build_restore)

     

File" /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py",   第787行,在_build_internal中       saveables = self._ValidateAndSliceInputs(names_to_saveables)

     

文件   " /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py" ;,   第688行,在_ValidateAndSliceInputs中       变量) TypeError:names_to_saveables必须是字符串映射到Tensors / Variables的字符串名称。不是变量:   Tensor(" conv2d_1 / bias:0",shape =(16,),dtype = float32)

我的网络图定义如下:

  

input_1

     

conv2d_1 / kernel

     

conv2d_1 / kernel / read

     

conv2d_1 /偏置

     

conv2d_1 / bias / read

     

conv2d_1 / convolution

     

conv2d_1 / BiasAdd

     

conv2d_1 / RELU

     

max_pooling2d_1 / MaxPool

     

conv2d_2 / kernel

     

conv2d_2 /内核/读

     

conv2d_2 /偏置

     

conv2d_2 / bias / read

     

conv2d_2 / convolution

     

conv2d_2 / BiasAdd

     

conv2d_2 / RELU

     

max_pooling2d_2 / MaxPool

     

conv2d_3 /内核

     

conv2d_3 / kernel / read

     

conv2d_3 / bias

     

conv2d_3 /偏压/读

     

conv2d_3 / convolution

     

conv2d_3 / BiasAdd

     

conv2d_3 / RELU

     

max_pooling2d_3 / MaxPool

     

conv2d_4 / kernel

     

conv2d_4 /内核/读

     

conv2d_4 / bias

     

conv2d_4 / bias / read

     

conv2d_4 / convolution

     

conv2d_4 / BiasAdd

     

conv2d_4 / Relu

     

up_sampling2d_1 /形状

     

up_sampling2d_1 / strided_slice /堆

     

up_sampling2d_1 / strided_slice / stack_1

     

up_sampling2d_1 / strided_slice / stack_2

     

up_sampling2d_1 / strided_slice

     

up_sampling2d_1 / Const

     

up_sampling2d_1 / MUL

     

up_sampling2d_1 / ResizeNearestNeighbor

     

conv2d_5 /内核

     

conv2d_5 / kernel / read

     

conv2d_5 / bias

     

conv2d_5 /偏压/读

     

conv2d_5 / convolution

     

conv2d_5 / BiasAdd

     

conv2d_5 / RELU   up_sampling2d_2 / Shape up_sampling2d_2 / strided_slice / stack

     

up_sampling2d_2 / strided_slice / stack_1

     

up_sampling2d_2 / strided_slice / stack_2 up_sampling2d_2 / strided_slice

     

up_sampling2d_2 / Const up_sampling2d_2 / mul

     

up_sampling2d_2 / ResizeNearestNeighbor conv2d_6 / kernel

     

conv2d_6 / kernel / read conv2d_6 / bias conv2d_6 / bias / read

     

conv2d_6 / convolution conv2d_6 / BiasAdd conv2d_6 / Relu

     

up_sampling2d_3 / Shape up_sampling2d_3 / strided_slice / stack

     

up_sampling2d_3 / strided_slice / stack_1

     

up_sampling2d_3 / strided_slice / stack_2 up_sampling2d_3 / strided_slice

     

up_sampling2d_3 / Const up_sampling2d_3 / mul

     

up_sampling2d_3 / ResizeNearestNeighbor conv2d_7 / kernel

     

conv2d_7 / kernel / read conv2d_7 / bias conv2d_7 / bias / read

     

conv2d_7 / convolution conv2d_7 / BiasAdd conv2d_7 / Relu output_node0

0 个答案:

没有答案