seems incorrect, can not pass my test case@kazum
#######################################################################
# GatherNd
# --------------------------
def _gather_nd(in_shape, indices):
"""test operator GatherNd"""
np_indices = np.asarray(indices, dtype='int32')
tf.reset_default_graph()
with tf.Graph().as_default():
np_data = np.random.uniform(size=in_shape).astype("float32")
in_data = tf.placeholder(tf.float32, in_shape, name="in_data")
in_indices = tf.placeholder(tf.float32, np_indices.shape, name="in_indices")
out = tf.gather_nd(in_data, indices)
compare_tf_with_tvm([np_data, np_indices], ['in_data:0', 'in_indices:0'], out.name)
def test_forward_gather_nd():
_gather_nd((2, 3), [[0, 0], [1, 1]])
_gather_nd((2, 3), [[1], [0]])
_gather_nd((2, 3, 4), [[1]])
_gather_nd((4, 3, 2), [[0, 1], [1, 0]])
_gather_nd((2, 4), [[[0, 0]], [[0, 1]]])
_gather_nd((4, 2), [[[1]], [[0]]])
_gather_nd((2, 4, 2), [[[1]], [[0]]])
_gather_nd((2, 2, 3), [[[0, 1], [1, 0]], [[0, 0], [1, 1]]])
_gather_nd((2, 3, 3), [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]])