I don't know how to create the model in the figure

I created a model with reference to the above figure in this paper. However, how to create the A branch with a pointwise convolution with a kernel size of 1, 1 with a stride of (1, 2) and A branch with an average pooling with a kernel size of parts in the diagram above? I don’t know. Below is the model I’ve written so far.

``````import torch
from torch import nn
import torch.nn.functional as F
class DepthwiseConv2d(torch.nn.Conv2d):
def __init__(self,
in_channels,
depth_multiplier=1,
kernel_size=3,
stride=1,
dilation=1,
bias=True,
):
out_channels = in_channels * depth_multiplier
super().__init__(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=kernel_size,
stride=stride,
dilation=dilation,
groups=in_channels,
bias=bias,
)
class InceptionEEGNet(nn.Module):
def __init__(self,bathsize): # input = (1,22,256)
super().__init__()
self.bathsize = bathsize
self.batchnorm2d_1 = nn.BatchNorm2d(64)
self.batchnorm2d_elu_1 = nn.Sequential(
nn.BatchNorm2d(256),
nn.ELU()
)
self.averagepooling = nn.Sequential(
nn.AvgPool2d((1,2)),
nn.Dropout2d(p=0.5)
)
self.inception_block_1 = nn.Sequential(
)
self.inception_block_2 = nn.Sequential(
)
self.inception_block_3 = nn.Sequential(
)
self.batchnorm2d_elu_2 = nn.Sequential(
nn.BatchNorm2d(256),
nn.ELU(),
nn.Dropout2d(p=0.5)
)

def forward(self,x):
x = self.conv2d_1(x)
x = self.batchnorm2d_1(x)
x = self.conv2d_2(x)
x = self.batchnorm2d_elu_1(x)
x = self.averagepooling(x)
x1 = self.inception_block_1(x)
x2 = self.inception_block_2(x)
x3 = self.inception_block_3(x)
x4 = self.inception_block_4(x)
x = torch.cat((x1, x2, x3, x4), 1)
x = self.batchnorm2d_elu_2(x)
x = self.conv2d_3(x)
x = self.batchnorm2d_elu_2(x)
x = x.squeeze()
return x

net = InceptionEEGNet(10)
x = torch.rand(10,1,16,125)
print(net(x).shape)
``````

Double post from here.