title: How to check if a tensor is present in another tensor?
body: <p>What I want to do is check if the tensor <strong>t1 = [[[1. , 2. , 3.4]]]</strong> is present in another tensor <strong>t2 = [[[1. , 5. , 3.4], [1. , 2. , 3.4]]]</strong>. I tried using tf.equal() for this but it returns this</p>
  
  <pre><code>tf.equal(t2, t1) # Output : [[[True False True] [True True True]]]
  </code></pre>
  
  <p>What I want is a single bool value (True or False) telling whether <strong>t1</strong> is present in <strong>t2</strong> or not.
  Something like</p>
  
  <pre><code>if your_method(t2, t1):
    print("Yes, t1 is contained in t2.")
  </code></pre>
  
  <p>Is there a <strong>completely pythonic</strong> way to do this?<br>
  Also, I checked it, tf.listdiff() is not supported anymore.  </p>
  
  <p><strong>Edit:</strong>  </p>
  
  <p>Ok, I found a <a href="https://www.tensorflow.org/api_docs/python/tf/math/reduce_all" rel="nofollow noreferrer">tf.math.reduce_all()</a> method which can be applied to the above output tensor of   </p>
  
  <pre><code>[[[True False True] [True True True]]]
  </code></pre>
  
  <p>to reduce it to a tensor like  </p>
  
  <p><code>[[[True False True]]]</code>  </p>
  
  <p>But I still don't know how to obtain the correct answer (which would be a single bool value of True) out of this.<br>
  Also if I apply <a href="https://www.tensorflow.org/api_docs/python/tf/math/reduce_any" rel="nofollow noreferrer">tf.math.reduce_any()</a> to </p>
  
  <p><code>[[[True False True] [True True True]]]</code>   </p>
  
  <p>it can be reduced to   </p>
  
  <p><code>[[[True True True]]]</code>   </p>
  
  <p>(again giving me a tensor and not a single bool value) and then if I assume that the answer will be True as all the elements of the resultant tensor are True then this won't be correct as tf.math.reduce_all() also gives a similar result for the case when tf.equal()'s output would have been   </p>
  
  <p><code>[[[True False True] [False True False]]]</code>  </p>
  
  <p>that is, if for example <strong>t1 = [[[1., 2., 3.4]]]</strong> and <strong>t2 = [[[1., 5., 3.4], [6., 2., 7.8]]]</strong>.<br>
  Hope this helps.</p>