Question: hi i'm running the following query

```
SELECT * FROM `catalog_product_entity_text` WHERE `value` LIKE '%knife%' OR `value` LIKE '%Knife%' OR `value` LIKE '%KNIFE%' OR `value` LIKE '%razor%' OR `value` LIKE '%Razor%' OR `value` LIKE '%RAZOR%'

```

I wasnt sure if the column was case senitive

this pulls all the results with entity ids but thats useless for me i need product sku's how can i achieve this in the results i'm assuming i have to join but what table and how.

so the result i'd like to see is the product sku that matches my search criteria on the description

thanks 

solved it with this

select p.entity\_id, p.sku, a.entity\_id as description\_id, a.value from catalog\_product\_entity p inner join catalog\_product\_entity\_text a on p.entity\_id = a.entity\_id WHERE a.value LIKE '%knife%' OR a.value LIKE '%Knife%' OR a.value LIKE '%KNIFE%'

not sure if this is the most efficient way to do this though

on a DB with over 200,000 products and descriptions with large amounts of text

also not sure if this accounts for everything in the magento DB

Answer: 
First for repeating the 1-D tensor, you can use [tf.tile](https://www.tensorflow.org/api_docs/python/tf/tile)

so for example if you wish to a tensor of shape [n] to be of shape [n, m], you can use it as follows:

```
output = tf.tile(tf.expand_dims(input, axis=1), [1, m])

```

[tf.expand\_dims](https://www.tensorflow.org/api_docs/python/tf/expand_dims) will add a new dimension of size 1, so the shape will change from [n] to [n, 1], then [tf.tile](https://www.tensorflow.org/api_docs/python/tf/tile) will repeat it [1, m] time so the shape will become [n\*1, 1\*m] = [n, m]

or if you wish the output to be shaped [m, n], you can do:

```
output = tf.tile(tf.expand_dims(input, axis=0), [m, 1])

```

But I would like to add that to compute the difference between all elements in two 1D tensors, you don't need to repeat them, you can use broadcasting like this:

```
output = tf.expand_dims(input1, axis=1) - input2

```

so if `input1` is of shape [n] and `input2` is of shape [m], [tf.expand\_dims](https://www.tensorflow.org/api_docs/python/tf/expand_dims) will add a dimension to `input1` so it will be of shape [n, 1] and during subtraction, Tensorflow will try to match their shapes using broadcasting. Since the rank of the 2nd operand (`input2`) is less than the rank of the 1st operand (the expanded `input1`), it will prepend 1's to the shape of 2nd operand till it matches the rank of the 1st operand, so the shapes of the operands will be [n, 1] and [1, m]. Then during the subtraction, the dimensions of size 1 will be broadcasted as if they match the corresponding dimension size in the other operand. So the result will be shaped as [n, m]. That is why in Tensorflow [1,2,3]+1 is similar to [1,2,3]+[1,1,1] both giving [2,3,4] as an output.

This solution is more memory efficient since no real repetition is done before the subtraction, broadcasting deals with the shape mismatch implicitly.
there are several APIs to solve this problem:

1. [tf.repeat](https://tensorflow.google.cn/versions/r1.15/api_docs/python/tf/repeat): tf.repeat(input, repeats, axis=None, name=None). This API can be used after tf 1.15
2. [tf.keras.backend.repeat\_elements](https://tensorflow.google.cn/versions/r1.14/api_docs/python/tf/keras/backend/repeat_elements?hl=en): tf.keras.backend.repeat\_elements(x, rep, axis). "rep" should be Python integer, not Tensor.