I’ve gotten an error like this before:
Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment

but my code is way to large and confusing to paste here. I tried to make a self contained jupyter note but failed. Anyone know how?
Will paste my attempts:
import torch
import torch.nn as nn

import copy
from collections import OrderedDict

model = nn.Sequential( OrderedDict( [ ('fc0', nn.Linear(3,1)) ] ) )
#model.fc0.weight = nn.Parameter( torch.randn(3,1) + 3 )
for i in range(3):
    w_new = nn.Parameter(model.fc0.weight.clamp(0))
    model.fc0.weight = w_new

model_copy = copy.deepcopy(model)