Equal method in Pytorch

I wonder whether a quick method that checks if the same model will have the same weight.

You could iterate the parameters of both models and compare them:

for a, b in zip(modelA.parameters(), modelB.parameters()):
    if not (a == b).all():
        print('False')
        break

Of course you can add more checks (e.g. for the shape etc.).
Also, the loop assumes the parameters are initialized in the same order, but I assume that’s also a requirement for your “equal” method.