I want to clone the model. However, PyTorch fails to detach and clone the model.
temp_enc = model.encoder_net.detach().clone()

Error I get
torch.nn.modules.module.ModuleAttributeError: 'Encoder' object has no attribute 'detach'

When I clone without detaching I receive similar error:
torch.nn.modules.module.ModuleAttributeError: 'Encoder' object has no attribute 'clone'