Is it possible to compare two gluon models to identify if there are equivalent? I want to have that feature to use it in some unittest where I am checking consistency of some loading and saving process.
I try to compare the dict returned by collect_params(), but if fails included with the same model.
p1 = net.collect_params()
p2 = net.collect_params()
self.assertTrue(p1 == p2). //it fails
Does anyone have a solution for that?
Thank you very much
Thanks @spanev.
Unfortunately it does not seems to work, when I create a model from the zoo, it seems that a postfix integer is added to the name of the parameter with a weird integer (as if it keeps track of the model I created).
For example with the following code:
I create two models from resnet152_v2, and I load the same parameters files. I expect that a function which check the equality between the two models states that the two models are identical.
Actually, you do not need the parameters file to see that you code will not work. In my case, the name of the parameters are all different. It seems that there is a postfix attached to the name. For example for the first param1, the param name are: resnetv27_batchnorm0_gamma, resnetv27_batchnorm=_beta, …
however for the params, the names are resnetv28_batchnorm0_gamma, resnetv28_batchnorm=_beta, …
I could do a ugly hack and get this postfix removed, but is there any other solutions?