You can detach() a tensor, which is attached to the computation graph, but you cannot “detach” a model.
If you don’t disable the gradient calculation (e.g. via torch.no_grad()), the forward pass will create the computation graph and the model output tensor will be attached to it. You can check the .grad_fn of the output tensor to see, if it’s attached to a graph (shows a backward function) or not (is None).
In case you haven’t used the with torch.no_grad() context manager during validation, you might unnecessarily use more memory, but won’t have any other side effects and don’t need to reattach anything (which is also not possible).
The next training iteration will work as before.