I guess you are detaching the output or loss in architect.step from the computation graph.
If you are only using PyTorch methods, Autograd will be able to record all operations and calculate the gradients in the backward pass using the created computation graph.
However, if you are using other libraries, e.g. numpy, you are detaching the tensors from the computation graph, and Autograd won’t be able to automatically compute the backward pass.
Let us know, if this might be the case or post some code snippets so that we can have a look.
PS: you can add code snippets by wrapping them in three backticks ```