Could you post the model definition?
This seems to work or did I misunderstand your question?
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
    
    def forward(self, x):
        return x + 1

model = MyModel()            
print(model.__class__.__name__)
>> MyModel