Hello everybody,
I am sorry if the post is uncategorized but this is my first post in the forum and I am learning how it works.
I need to convert a pytorch based CNN into a keras based one. In particular I need to convert the pytorch code
conv2 = torch.nn.Conv2d(32, 64, 3, 2, 1)
x=torch.nn.functional.relu(self.conv2(x))
into a keras one. I tried with
conv2 = keras.layers.Conv2D(64,3,strides=(2,2),padding=‘same’,activation=‘relu’,name=‘conv2’)
but when I call the keras layer and the pytorch one, starting from the same input data and with the same initialization for weights and biases, I obtain two tensors (one in pytorch and one in keras) with the same size but different values. Everything works if I set stride=1 in both the cases.
Does the stride work differently in keras and in pytorch?
Does anyone have some suggestions for my issue?
Thank you.