Keras Sequential in DL4J

Is there anything native inside dl4j or samediff to build a network like this:

model = Sequential()
model.add(Dense(units=64, activation=‘relu’, input_dim=100))
model.add(Dense(units=10, activation=‘softmax’))

to pack a ffn inside a sequential network model. as i understood with RNNToFeedforwardPreProcessor i get only a fully connected complet vector of all steps (time * veclen) instead of only veclen sized weights.

Best regards


@thomas could you clarify? Sequential in dl4j is multilayer network. This is just 1 dense layer and 1 output layer. Each of these can hold an activation function as a parameter.

It’s a bit late for me but if you can clarify a bit and need more help I can post an example tomorrow.

i only try to get the dense layer with a vector length for 1 step and not the whole sequence. as i understood in the api documentation inside of dl4j with an DenseLayer and RnnToFeedForwardPreprocessor i would receive a complete connected time series not only 1 time step.

Best regards and no hurry

EDIT: Or could i also use an RnnOutputLayer as a hidden dense layer inside an model. would be the same on math sides like i understand.

@thomas preprocessors are automatically added if you use setInputType.

Just declare the layers you want (in this case DenseLayers)
If you are trying to use the last dense layer for output use an output layer instead (equivalent but has all of the needed functionality for loss functions)

Thanks i will try with setInputType