do you mean something like this,
import torch
import torch.nn as nn
import torch.functional as F


class MLP(nn.Module):

    def __init__(self, num_in, num_hidden, num_out):
        super().__init__()

        self.linear1 = nn.Linear(num_in, num_hidden)
        self.linear2 = nn.Linear(num_hidden, num_hidden)
        self.linear3 = nn.Linear(num_hidden, num_out)
        self.relu = nn.ReLU()
        self.softmax = nn.Softmax(dim=1)

    def forward(self, x):
        x = self.relu(self.linear1(x))
        x = self.relu(self.linear2(x))
        x = self.softmax(self.linear3(x), dim=1)
        return x

which gives output for your print statements
named_children()
linear1 Linear(in_features=2, out_features=16, bias=True)
linear2 Linear(in_features=16, out_features=16, bias=True)
linear3 Linear(in_features=16, out_features=2, bias=True)
relu ReLU()
softmax Softmax(dim=1)

named_modules()
 MLP(
  (linear1): Linear(in_features=2, out_features=16, bias=True)
  (linear2): Linear(in_features=16, out_features=16, bias=True)
  (linear3): Linear(in_features=16, out_features=2, bias=True)
  (relu): ReLU()
  (softmax): Softmax(dim=1)
)
linear1 Linear(in_features=2, out_features=16, bias=True)
linear2 Linear(in_features=16, out_features=16, bias=True)
linear3 Linear(in_features=16, out_features=2, bias=True)
relu ReLU()
softmax Softmax(dim=1)