You could use forward hooks as described e.g. here, store the intermediate results in a dict or list for both models, and compare them using the same model input (and calling model.eval() to avoid random operations from e.g. dropout if these layers are used).
1 Like