softmax结果输出异常
Created by: snowsteper
用fc层作为最后的输出层,激活函数用softmax, 得到的结果的每一维为不在[0, 1]区间
网络结构定义
pred = fluid.layers.fc(input=concat_layer, size=class_dim, act='softmax')
if is_infer:
return pred
cost = fluid.layers.cross_entropy(pred, label, soft_label=False)
avg_loss = fluid.layers.mean(cost)
return pred, avg_loss, label
预测输出样例, 每一个向量对应一个样本的预测输出 [[ -9.730734 -5.1658783 -4.312685 ... -9.696777 -9.710938 -9.711664 ] [ -5.516372 -2.8050585 -3.3510437 ... -5.5714464 -5.56005 -5.5435977 ] [-10.428526 1.9235992 0.12796116 ... -10.483575 -10.507859 -10.4472065 ] ... [ -7.946624 -2.8772902 -0.85136795 ... -7.904846 -7.9342504 -7.872521 ] [ -9.148515 -2.5952282 -3.140316 ... -9.204101 -9.194347 -9.149537 ] [-10.096511 4.156999 1.2503562 ... -10.243605 -10.187681 -10.082199 ]]