WARNING: The order in which updates are applied is nondeterministic, so the output will be nondeterministic if
indices
contains duplicates.Solution:
https://github.com/tensorflow/tensorflow/issues/8102
If you are in the unpooling business:
@teramototoya what I did as a hack: with https://www.tensorflow.org/api_docs/python/tf/unique_with_counts i counted the multiplication in the indices and i divided the tensor which was holding the values (aka tensor named 'updates' in the first comment) with this counter
so when add() comes it will undo what the division made
so when add() comes it will undo what the division made
you can check this simple script: https://github.com/csnemes2/conv-net-viz/blob/master/ut_unpool.py
If not, so your problem is general, then you have to somehow flatten your indices, and then tf.unique, see this post:
https://stackoverflow.com/questions/44117430/how-to-use-tf-scatter-nd-without-accumulation
https://stackoverflow.com/questions/44117430/how-to-use-tf-scatter-nd-without-accumulation
Use a count auxilliary tensor.
cntOnes = tf.ones_like(dmVis, tf.float32)
vals = tf.stack([dmVis, mlVis, cntOnes], axis=1)
scatter_shape = tf.constant([bs, h*upsample, w*upsample, 3])
dmc = tf.scatter_nd(locVis, vals, scatter_shape)
dm, ml, cnt = tf.unstack(dmc, axis=-1)
cnt = cnt + epsilon
dm = dm / cnt
No comments:
Post a Comment