wyc-ruiker commented on a change in pull request #4788: [FRONTEND][TFLITE]Gather, StridedSlice op support added URL: https://github.com/apache/incubator-tvm/pull/4788#discussion_r381906316
########## File path: tests/python/frontend/tflite/test_forward.py ########## @@ -267,6 +267,79 @@ def test_forward_slice(): _test_slice(np.arange(8, dtype=np.int32).reshape((2, 4)), begin=[0, 1], size=[-1, -1]) _test_slice(np.arange(5, dtype=np.int32).reshape((5, )), begin=[4], size=[-1]) +####################################################################### +# Gather +# ------ + +def _test_gather(dshape, indices, axis, dtype, quantized=False, oob=False): + """ One iteration of Gather """ + indices = np.asarray(indices).astype('int32') + data = np.random.uniform(1, 10, size=dshape) + data = data.astype(np.uint8) if quantized else data.astype(dtype) + with tf.Graph().as_default(): + in_data = array_ops.placeholder(shape=data.shape, dtype=data.dtype, name="in_data") + if axis: + out = array_ops.gather(in_data, indices, axis=axis) + else: + out = array_ops.gather(in_data, indices) #tflite conversion fails for None axis + input_range = {'in_data': (-100, 100)} if quantized else None + try: + compare_tflite_with_tvm([data], ['in_data:0'], [in_data], [out], + quantized=quantized, input_range=input_range) + except ValueError as e: + if not oob: Review comment: What does `oob` mean? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services