Neural network 可以在Keras中创建断开连接的隐藏层吗?

Neural network 可以在Keras中创建断开连接的隐藏层吗?,neural-network,keras,Neural Network,Keras,是否可以使用Keras创建具有不同激活功能的隐藏层,这些激活功能都连接到输入层而不是彼此连接 例如,有10个神经元的隐藏层,其中5个神经元具有ReLU激活,5个神经元具有Sigmoid激活功能。我想创建一个平板结构神经网络。您可以创建两个独立的密集层。这是最简单的方法 独立层: from keras.layers import * from keras.models import Model #model's input and the basic syntax for creating la

是否可以使用Keras创建具有不同激活功能的隐藏层,这些激活功能都连接到输入层而不是彼此连接


例如,有10个神经元的隐藏层,其中5个神经元具有ReLU激活,5个神经元具有Sigmoid激活功能。我想创建一个平板结构神经网络。

您可以创建两个独立的密集层。这是最简单的方法

独立层:

from keras.layers import *
from keras.models import Model

#model's input and the basic syntax for creating layers

inputTensor = Input(some_shape)
outputTensor = SomeLayer(blablabla)(inputTensor)
outputTensor = AnotherLayer(bblablabla)(outputTensor)


#keep creating other layers like the previous one
#when you reach the point you want to divide:

out1 = Dense(5,activation='relu')(outputTensor)
out2 = Dense(5,activation='sigmoid')(outputTensor)


#you may concatenate the results:
outputTensor = Concatenate()([out1,out2])


#keep creating more layers....


#create the model
model = Model(inputTensor,outputTensor)