Convert from Keras to Pytorch - conv2d
I am trying to convert the following Keras code into PyTorch.
    tf.keras.Sequential([
          Conv2D(128, 1, activation=tf.nn.relu),
          Conv2D(self.channel_n, 1, activation=None),
    ])

When creating the model summary with self.channels=16 i get the following summary.
Model: &quot;sequential&quot;
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d (Conv2D)              (1, 3, 3, 128)            6272      
_________________________________________________________________
conv2d_1 (Conv2D)            (1, 3, 3, 16)             2064      
=================================================================
Total params: 8,336
Trainable params: 8,336
Non-trainable params: 0

How would one convert?
I have attempted it as such:
import torch
from torch import nn

class CellCA(nn.Module):
    def __init__(self, channels, dim=128):
        super().__init__()
        self.net = nn.Sequential(
            nn.Conv2d(in_channels=channels,out_channels=dim, kernel_size=1),
            nn.ReLU(),
            nn.Conv2d(in_channels=dim, out_channels=channels, kernel_size=1),
        )
    def forward(self, x):
        return self.net(x)

However, I get 4240 params

The attempt above is correct if you configure the initial channels in correcty (48 in this case).
