Tracking tensor transformations through a module

I’m working with a fairly large model, and I frequently run into issues where I unwillingly change the output of the model when working in a dev branch.

I’d like to avoid that by building a unit test that will track the values of each intermediate tensor built in the forward pass, and compare those values with that of the current master branch. With a deterministic network (or a fixed seed) and a fixed input, that should help in preventing silent bugs.

How can I go about doing this? Is it possible? Does it involve tracing?