Thank you very much. I’ve added the loss fn and optimizer for both pytorch and keras cases. Would you please take a look? Regarding the padding mode in pytorch, how can I get the “same” mode as I used in keras case? I thought “padding=5” did the same thing as the keras model, or I’m wrong?
That’s what I got with the pytorch model:
ascadCNNbest (
(conv1): Conv1d (1, 64, kernel_size=(11,), stride=(1,), padding=(5,)), weights=((64, 1, 11), (64,)), parameters=768
(conv2): Conv1d (64, 128, kernel_size=(11,), stride=(1,), padding=(5,)), weights=((128, 64, 11), (128,)), parameters=90240
(conv3): Conv1d (128, 256, kernel_size=(11,), stride=(1,), padding=(5,)), weights=((256, 128, 11), (256,)), parameters=360704
(conv4): Conv1d (256, 512, kernel_size=(11,), stride=(1,), padding=(5,)), weights=((512, 256, 11), (512,)), parameters=1442304
(conv5): Conv1d (512, 512, kernel_size=(11,), stride=(1,), padding=(5,)), weights=((512, 512, 11), (512,)), parameters=2884096
(fc1): Linear(in_features=10752, out_features=4096), weights=((4096, 10752), (4096,)), parameters=44044288
(fc2): Linear(in_features=4096, out_features=4096), weights=((4096, 4096), (4096,)), parameters=16781312
(fc3): Linear(in_features=4096, out_features=256), weights=((256, 4096), (256,)), parameters=1048832
)
The keras one is as below,

Layer (type)                 Output Shape              Param #

input_1 (InputLayer)         (None, 700, 1)            0

block1_conv1 (Conv1D)        (None, 700, 64)           768

block1_pool (AveragePooling1 (None, 350, 64)           0

block2_conv1 (Conv1D)        (None, 350, 128)          90240

block2_pool (AveragePooling1 (None, 175, 128)          0

block3_conv1 (Conv1D)        (None, 175, 256)          360704

block3_pool (AveragePooling1 (None, 87, 256)           0

block4_conv1 (Conv1D)        (None, 87, 512)           1442304

block4_pool (AveragePooling1 (None, 43, 512)           0

block5_conv1 (Conv1D)        (None, 43, 512)           2884096

block5_pool (AveragePooling1 (None, 21, 512)           0

flatten (Flatten)            (None, 10752)             0

fc1 (Dense)                  (None, 4096)              44044288

fc2 (Dense)                  (None, 4096)              16781312

predictions (Dense)          (None, 256)               1048832