input_size = [765, 500, 72]
model = Sequential()
add = model.add
add(l.Conv1D(256, kernel_size=3, strides=2, activation='relu')
add(l.Dropout(0.5))
add(l.Conv1D(256, kernel_size=3, strides=2, activation='relu')
add(l.Dropout(0.5))
add(l.GlobalAveragePooling1D())
add(l.Dense(100, activation="relu"))
add(l.Dense(3, activation="softmax"))
(None, 249, 256)
(None, 249, 256)
(None, 124, 256)
(None, 124, 256)
(None, 256)
(None, 100)
(None, 3)
This is tensorflow model struc and summary. Tensorflow to Pytorch CNN model. Use Conv1D
[Tensorflow Model summary]
To jump-start your research, here is an example usage of
nn.Conv1d
:Regarding this case keep in mind a few PyTorch-related things :
Unlike Tensorflow, it handles data in the
BHC
format.You have to provide the input feature sizes for each linear layer.
The activation function is not included in
nn.Conv1d
, you have to use a dedicated module for that (eg.nn.ReLU
).