2

Does anyone know how to replace tf.gather with other OPs which are supported by TFLite GPU delegate? I want to convert a TensorFlow model with a warp operation to a TFLite model to be used on Android devices, but the warp needs to use tf.gather to get corner pixel values and tf.gather seems not supported by GPU on Android.

def gather(y_coords, x_coords, name):
    with tf.name_scope("gather-" + name):
        linear_coordinates = batch_offsets + y_coords * width + x_coords
        gathered_values = tf.gather(flattened_grid, linear_coordinates)
        return tf.reshape(gathered_values, [batch_size, num_queries, channels])
Dharman
  • 30,962
  • 25
  • 85
  • 135
zyhe
  • 21
  • 1
  • Could you check with tf.gather_nd or tf.slice. For GPU delegate, Requirement is operations has to be 16 or 32 bit float operations . [Ref](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/delegates/gpu#:~:text=GPUs%20do%20their,on%20the%20GPU.) –  Jan 12 '23 at 15:52

0 Answers0