gpt4 book ai didi

android - 使用SNPE转换tensorflow dense layer时报错

转载 作者:太空狗 更新时间:2023-10-29 13:51:11 26 4
gpt4 key购买 nike

在转换自定义 tensorflow 图时,我看到与将密集层从 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

注意:我也将这个问题发布到高通开发者网络,但它似乎没有出现,可能是因为审核队列.

最佳答案

我在使用密集层 (tf.layers.dense API) 时遇到了同样的问题。出现此问题的原因是对权重应用了 reshape 操作(由 tf.layer.dense API 引入)。转换器将其误解为模型执行的一部分,因此尝试转换为它不能转换的层,因为它没有输入层。

您可以在卷积和完全连接之间使用 reshape(tf.reshape API) 来展平张量,它会很好地工作。

关于android - 使用SNPE转换tensorflow dense layer时报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47077327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com