【发布时间】:2019-05-31 19:14:32
【问题描述】:
我制作了一个简单的卷积 Tensorflow 模型,它使用 softmax 进行推理。当我在 python 中运行模型并为模型提供图像时,一切都会相应地工作。但是,当我使用 tflite 转换模型并从 android 运行它时,输出是一个全 0 的列表。不知何故,softmax 不起作用。当我删除 softmax 函数时,python 和 android 中的输出是相同的,我可以通过在 Java 中实现 softmax 函数来修复它,但应该有更好的方法吧?我试过改变 softmax 函数的轴,但它在 Java 中只返回 0。
谢谢!
y_test = tf.nn.softmax(test_network[0])
【问题讨论】:
-
softmax的输出全是零很奇怪。您能否提供一个输入示例,其中输出是一个零列表?另外,如果您使用的是量化版本,那么调用内核时的SoftmaxParams 是什么? beta 或 input_multiplier 或 input_left_shift 非常关键。
标签: android tensorflow softmax tensorflow-lite