The code looks good. I assume you would like to calculate the similarity between two images?
Depending on the dataset you are using you could also get two images simultaneously and feed them both to your net. In the __forward__ method you could feed them one after the other.
But I think it’s a matter of taste.
However, you should call the model directly (model(input)) with your input instead of model.forward(input). This makes sure that all hooks are properly registered.
Just out of curiosity, did the hooks work in your case?