output_tensor = layers.Dense(10, activation='softmax')(x)
以下是 keras 中的一些代码。我不明白(x)
在调用方法的上下文中是什么意思。谁能帮我?
layers.Dense
返回一个可调用的对象,然后将其称为 givingx
作为输入。
Dense
函数创建层,而层是必须提供其他内容作为输入的东西。此"其他内容"是在调用图层本身时指定的。
也许这个片段会有所帮助:
In [1]: from keras import layers
Using TensorFlow backend.
In [2]: x = layers.Input((1, ))
In [3]: l = layers.Dense(10, activation='softmax')
In [4]: callable(l)
Out[4]: True
In [5]: l(x)
Out[5]: <tf.Tensor 'dense_1/Softmax:0' shape=(?, 10) dtype=float32>