I was able to add the last layer using:
network.add_module(module=nn.Linear(list(network.children())[-1][-1].in_features, 1024, bias = False), name='linear_closs')
However, I do not know how to change the forward function as described above.  Went through the post but it did not cover that aspect. Any ideas? Thanks!
Note: the change to forward function as below:

Add additional line closs_output = self.linear_closs(x)

Change output of forward from return x to return closs_output, x