title: TypeError: only integer scalar arrays can be converted to a scalar index (Tensorflow)
body: <p>when I run my pre-trained <code>text_encoder</code> like below to test my model on new queries and it completely runs</p>
  <pre><code>def find_matches(image_embeddings, queries, k=9, normalize=True):
     # Get the embedding for the query.
     query_embedding = text_encoder(tf.convert_to_tensor(queries))
     # Normalize the query and the image embeddings.
     if normalize:
       image_embeddings = tf.math.l2_normalize(image_embeddings, axis=1)
       query_embedding = tf.math.l2_normalize(query_embedding, axis=1)
     # Compute the dot product between the query and the image embeddings.
     dot_similarity = tf.matmul(query_embedding, image_embeddings, transpose_b=True)
     # Retrieve top k indices.
     results = tf.math.top_k(dot_similarity, k).indices.numpy()
     # Return matching image paths.
     return [[image_paths[idx] for idx in indices] for indices in results]
  </code></pre>
  <p>Output shapes of above</p>
  <pre><code>query_embedding shape is, (1, 128, 256)
  dot_similarity shape is, (1, 128, 4795)
  results shape is, (1, 128, 9)
  </code></pre>
  <p>and then when I run the below code to find matches for my desired query then it generates an error that <code>TypeError: only integer scalar arrays can be converted to a scalar index</code></p>
  <pre><code>query = &quot;a family standing next to the ocean on a sandy beach with a surf board&quot;
  matches = find_matches(image_embeddings, [query], normalize=True)[0]
  
  plt.figure(figsize=(20, 20))
  for i in range(9):
     ax = plt.subplot(3, 3, i + 1)
     plt.imshow(mpimg.imread(matches[i]))
     plt.axis(&quot;off&quot;)
  </code></pre>
  <p>error shows in this line</p>
  <pre><code>matches = find_matches(image_embeddings, [query], normalize=True)[0]
  </code></pre>
  <h2>whole code is in this <a href="https://colab.research.google.com/drive/1Jpw0Ym5mt2km-26VWdK8QuBY3Ei2szD0?usp=sharing" rel="nofollow noreferrer">COLAB FILE</a>.</h2>