Do you mean something like this?
while i, (input, label) in enumerate(data_loader):
    # Train
    input = Variable(input)
    label = Variable(label)
    output = mdl(input)
    loss = criterion(output, label)
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    # Every once in a while, modify model
    if i % 100 == 0:
        mdl.some_layer.weight.data = some_function(mdl.some_layer.weight.data, output.data)

I guess, acting directly on the parameter tensors does not affect the computation graph (which would not be affected anyway, as the computation has been performed and at the next iteration you would create a new Variable).