Hi,
Actually, print(model) does not print the graph of network. The reason is that PyTorch uses eager execution which means graph will be constructed on the fly when you provide a data to the network and that is why PyTorch is highly dynamic and modular.
Print(model) only prints modules defined in __init__ functions. For instance, if you remove this line and add it in just forward function you will not see any ReLU in entire of your model definition.



 surya00060:

self.relu = nn.ReLU(inplace=True)


Change the definition to:
class Block(nn.Module):
    '''Depthwise conv + Pointwise conv'''
    def __init__(self, in_planes, out_planes, stride=1):
        super(Block, self).__init__()
        self.conv1 = nn.Conv2d(in_planes, in_planes, kernel_size=3, stride=stride, padding=1, groups=in_planes, bias=False)
        self.bn1 = nn.BatchNorm2d(in_planes)
        self.conv2 = nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, padding=0, bias=False)
        self.bn2 = nn.BatchNorm2d(out_planes)
    def forward(self, x):
        out = F.relu(self.bn1(self.conv1(x)))
        out = F.relu(self.bn2(self.conv2(out)))
        return out

And try to print model.
If you want to really see how your graph is construced, you can either use visualization tools such as tensorboard or torch script to create a static graph of model.
Bests