I have used the torch.optim.Adam Optimizer in my own model class ('LinkPredict).  When I try to train my model, the following error is thrown:
  File "...", line 350, in train
    optimizer = th.optim.Adam(all_params, lr=learning_rate, weight_decay=weight_decay)
  File "/.../torch/optim/adam.py", line 48, in __init__
    super(Adam, self).__init__(params, defaults)
  File "/.../torch/optim/optimizer.py", line 45, in __init__
    param_groups = list(params)
  File ".../torch/nn/modules/module.py", line 1089, in parameters
    for name, param in self.named_parameters(recurse=recurse):
  File .../torch/nn/modules/module.py", line 1115, in named_parameters
    for elem in gen:
  File ".../torch/nn/modules/module.py", line 1059, in _named_members
    for module_prefix, module in modules:
  File ".../torch/nn/modules/module.py", line 1250, in named_modules
    if self not in memo:
TypeError: unhashable type: 'LinkPredict'

My model is defined as follows:
class LinkPredict(nn.Module):
    """...."""

    def __init__(self,
...
                 ):
        super(LinkPredict, self).__init__()

Do you have any idea why this error is thrown and how I can solve it?
Thank you a lot in advance!