class BPNet(nn.Module): def __init__(self, in_dim, n_hidden_1, n_hidden_2,\ n_hidden_3, n_hidden_4, n_hidden_5, out_dim): super(BPNet, self).__init__() self.layer1 = nn.Sequential(nn.Linear(in_dim, n_hidden_1)) self.layer2 = nn.Sequential(nn.Linear(n…