How to specify which nodes in the feature map get applied with different filters/layers in Tensorflow
For example, say I wanted to apply a 1D Convolution to FFT data and Raw time series data in the first layer (suppose the first 400 nodes, as an example), but use a simple feed forward network to some 1D Statistical features on the remaining, say 20 nodes. Then combine those outputs in the next layer.
I'm mostly used to just adding a layer which is able to interact with any node in the previous layer, which is why I'm confused here. Any help is appreciated, thanks.
edit:
One thing I forgot to add to the answer above, segments of the feature vector can be selected by taking a tf.slice
of the input data, or by using similar slicing notation as you would in numpy arrays i.e Data = Input(shape...) first_10 = Data[:10]
Solution 1:
This seems easiest with the functional API. You should be able to do something like
def model(input_shape):
Data = Input(shape=input_shape, name="Input")
ConvOutput = Conv1D()(Data)
SimpleFeatures = Dense()(Data)
Combined = tf.concat()([ConvOutput, SimpleFeatures])
return Model(inputs=Data, outputs=Combined)
to control the input/output of specific layers, as well as combining the results of multiple different nodes.