I have a problem in initialization. Please help me to get a PyTorch code for this. Input is like(256x256x1). Just write a dummy block for this 3x3 Conv. Feature maps in the starting is 16

The CIFAR10 tutorial might be a good starter, as it’s creating a new model.

The Conv2d docs give you some information about the expected input arguments, such as in_channels, out_channels, and kernel_size.

For your use case it seems that that first conv layer should be defined as:

conv = nn.Conv2d(in_channels=?, out_channels=16, kernel_size=3)

The following layers would then use in_channels=16, since this is the number of channels in the output activation from the preceding layer.

1 Like

It’s fine. Thanks. What about the residual networks?

You could reuse the approach used in torchvision's resnet implementation as seen here.

1 Like