I guess you could use either the _modules list to change the layer needed (i.e. self._modules['fc1'] = nn.Linear(32, new_number_of_classes)) or possibly via the setattr(), getattr() methods.
Not entirely sure if this is the best approach though.