我必须在tf.nn.softmax中输入张量吗?

2024-06-26 15:21:18 发布

您现在位置:Python中文网/ 问答频道 /正文

为什么我可以将列表放入tf.nn.softmax()

我检查了tensorflow指南。它表明tf.nn.softmax()只能接受非空张量。谢谢

customized_softplus = keras.layers.Lambda (lambda x : tf.nn.softplus(x))
print(customized_softplus([-10.,-5.,0.,5.,10.]))

输出:

tf.Tensor([4.5417706e-05 6.7153489e-03 6.9314718e-01 5.0067153e+00 1.0000046e+01], shape=(5,), dtype=float32)

Tags: lambda列表layerstftensorflow指南plusnn