Solved by ptrblck in post #6 
              
              
                This is expected. 
Your current method uses the opt_func argument as a function not an object: 
def fit(epochs, lr, model, train_loader, val_loader, opt_func=torch.optim.SGD):
    [...]
    optimizer = opt_func(model.parameters(), lr) # !!! this is wrong if opt_func is already an optimizer object

s…