tensorflow model behaves differently in c++ and python
I report a bug about SavedModel, which does not work good when load in c++, it concens two api, tf.gather_nd and tf.Print. Here are the details: https://stackoverflow.com/questions/48578706/tensorflow-model-behaves-differently-in-c-and-python
@sukritiramesh have we encountered this before?
@sukritiramesh any suggestions? should I avoid using tf.gather_nd?
@drpngx @chengmengli06 I don't think we have encountered this before. Seems specific to tf.gather_nd and stn?
It seems tht there are two issues: tf.Print does not appear to work with saved model.
Then, for some reason gather_nd does not execute correctly when the graph is loaded from C++ @asimshankar
@chengmengli06 could you try to whittle the example down to the simplest example that exhibits the behavior?
@drpngx The attached example could reproduce the error, in python I use tf 1.3.0; in C++, I use tf 1.2 with xla opened, with xla closed it is still the same with xla opened. Using python tf1.2 could reproduce the same result. test_stn.tar.gz
[mengli.cml]$ md5sum stn_resize.bmp f96e7a6f18b3dc06eee62a6d54c1d500 stn_resize.bmp
[mengli.cml]$md5sum stn_out.bmp ceba9b22dc0c4e861ca022ae2e7ef22a stn_out.bmp
[mengli.cml]$md5sum stn_out_py.bmp $md5sum stn_out_py.bmp 307d8caf77b1199c09331a9158e2da6d stn_out_py.bmp
I compare stn_input.bmp, stn_resize.bmp, md5 of the two are exactly the same; however stn_out.bmp 's md5sum is not the same, and I compare the results, and the diff is shown in the following picture, with pix value diff by 1 in many locations.
stn_shrink_export.tar.gz @drpngx any ideas? I think it may due to something related to float precision? But I am not familiar with tensorflow code, as the pixel values only differs by one . I upload the model in savedmodel format by tf1.2. Hope this could be solved soon.
a[0][1] array([193, 166, 145], dtype=uint8) b[0][1] array([192, 165, 144], dtype=uint8)
@drpngx is the problem verified? when will you solve this problem?
@drpngx @sukritiramesh any improvements?
@chengmengli06 sorry I didn't have time to spend on this. You could try to modify the code of gather_nd, and print out the inputs in both cases. Either the inputs are not the same, or the operator behaves differently.
Hi There, We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing. If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.