Changing a list of tensors to a tensor of lists! I have a list of tensors created by
[some_function(x) for x in something]

and this list becomes like this
[&lt;tf.Tensor: shape=(), dtype=string, numpy=b'I have gone and you will go'&gt;, &lt;tf.Tensor: shape=(), dtype=string, numpy=b'we will go'&gt;]

But I want to have an object like this
&lt;tf.Tensor: shape=(3,), dtype=string, numpy=array([b'I have gone and you will go', b'we will go'], dtype=object)&gt;

Which is a tensor of list of strings (Opposite to the previous one). Is there any way to this, assuming that I have access to all these tensors, i.e. some_function(x) for x in something separately.
In order to stack list of tf tensors you could use the tf function stack hence the name
for ur case,

tf.stack([some_function(x) for x in something],axis=0)



or you could stack them in numpy and then convert the array to a tensor, to do so using numpy np.stack inputting a list and axis