Python 下面是一些Keras代码。我不明白“(x)”是什么意思
下面是keras中的一些代码。我不理解x在被调用方法的上下文中的含义。有人能帮我吗?layers.Dense返回一个可调用的对象,然后将其称为giving x作为输入 稠密函数创建层,层是必须作为输入提供给其他对象的对象。这是在调用层本身时指定的 也许这个片段会有帮助:Python 下面是一些Keras代码。我不明白“(x)”是什么意思,python,tensorflow,machine-learning,deep-learning,keras,Python,Tensorflow,Machine Learning,Deep Learning,Keras,下面是keras中的一些代码。我不理解x在被调用方法的上下文中的含义。有人能帮我吗?layers.Dense返回一个可调用的对象,然后将其称为giving x作为输入 稠密函数创建层,层是必须作为输入提供给其他对象的对象。这是在调用层本身时指定的 也许这个片段会有帮助: output_tensor = layers.Dense(10, activation='softmax')(x) 这意味着函数调用的值为xCheck文档: In [1]: from keras import layers U
output_tensor = layers.Dense(10, activation='softmax')(x)
这意味着函数调用的值为xCheck文档:
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>