转换自定义张量流图时,我发现有关将密集层从pb转换为DLC格式的错误:
2017-11-02 13:43:35,260 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (dense/Tensordot/transpose) not consumed by converter: Transpose.
2017-11-02 13:43:35,261 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (dense/Tensordot/transpose_1) not consumed by converter: Transpose.
2017-11-02 13:43:35,261 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (dense/Tensordot/MatMul) not consumed by converter: MatMul.
2017-11-02 13:43:35,261 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (dense/BiasAdd) not consumed by converter: BiasAdd.
2017-11-02 13:43:35,261 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (logit/Tensordot/transpose) not consumed by converter: Transpose.
2017-11-02 13:43:35,262 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (logit/Tensordot/transpose_1) not consumed by converter: Transpose.
2017-11-02 13:43:35,262 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (logit/Tensordot/MatMul) not consumed by converter: MatMul.
2017-11-02 13:43:35,262 - 305 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (logit/BiasAdd) not consumed by converter: BiasAdd.
2017-11-02 13:43:35,263 - 123 - ERROR - Conversion failed: Some operations in the Tensorflow graph were not resolved to a layer!
我对此感到有点困惑,因为该层只是一个2D卷积后的密集层,我确信它是由SNPE支持的。错误的原因是什么?
图表的拓扑结构如下:
0 input_layer Placeholder
1 conv2d/kernel Const
2 conv2d/kernel/read Identity
└─── Input0 ─ conv2d/kernel
3 conv2d/bias Const
4 conv2d/bias/read Identity
└─── Input0 ─ conv2d/bias
5 conv2d/convolution Conv2D
└─── Input0 ─ input_layer
└─── Input1 ─ conv2d/kernel/read
6 conv2d/BiasAdd BiasAdd
└─── Input0 ─ conv2d/convolution
└─── Input1 ─ conv2d/bias/read
7 conv2d/Relu Relu
└─── Input0 ─ conv2d/BiasAdd
8 max_pooling2d/MaxPool MaxPool
└─── Input0 ─ conv2d/Relu
9 conv2d_1/kernel Const
10 conv2d_1/kernel/read Identity
└─── Input0 ─ conv2d_1/kernel
11 conv2d_1/bias Const
12 conv2d_1/bias/read Identity
└─── Input0 ─ conv2d_1/bias
13 conv2d_2/convolution Conv2D
└─── Input0 ─ max_pooling2d/MaxPool
└─── Input1 ─ conv2d_1/kernel/read
14 conv2d_2/BiasAdd BiasAdd
└─── Input0 ─ conv2d_2/convolution
└─── Input1 ─ conv2d_1/bias/read
15 conv2d_2/Relu Relu
└─── Input0 ─ conv2d_2/BiasAdd
16 max_pooling2d_2/MaxPool MaxPool
└─── Input0 ─ conv2d_2/Relu
17 conv2d_2/kernel Const
18 conv2d_2/kernel/read Identity
└─── Input0 ─ conv2d_2/kernel
19 conv2d_2/bias Const
20 conv2d_2/bias/read Identity
└─── Input0 ─ conv2d_2/bias
21 conv2d_3/convolution Conv2D
└─── Input0 ─ max_pooling2d_2/MaxPool
└─── Input1 ─ conv2d_2/kernel/read
22 conv2d_3/BiasAdd BiasAdd
└─── Input0 ─ conv2d_3/convolution
└─── Input1 ─ conv2d_2/bias/read
23 conv2d_3/Relu Relu
注意: 我还将此问题发布到高通开发人员网络,但似乎没有显示,可能是因为审核队列的
答案 0 :(得分:1)
在使用密集层(tf.layers.dense API)时,我遇到了同样的问题。出现此问题的原因是有一个重整操作应用于权重(由tf.layer.dense API引入)。转换器将其错误地解释为模型执行的一部分,因此由于没有输入层,因此尝试转换为它不能转换的层。
您可以在卷积和完全连接之间使用reshape(tf.reshape API)将张量展平,它将正常工作。