title: model.fit(...) and "Failed to convert a NumPy array to a Tensor"
body: <p>I'm using TensorFlow 2.0 for text classification.</p>
  
  <p>The structure of the data looks more-or-less like this:</p>
  
  <h3>1st Approach:</h3>
  
  <pre class="lang-py prettyprint-override"><code>x: List[List[int]] # list of sentences consisting of a list of word IDs for each word in the sentence
  y: List[int] # binary truth indicator
  </code></pre>
  
  <p>However, when calling <code>model.fit(...)</code> I receive the following error message:</p>
  
  <p><code>Failed to find data adapter that can handle input: (&lt;class 'list'&gt; containing values of types {'(&lt;class \'list\'&gt; containing values of types {"&lt;class \'int\'&gt;"})', "(&lt;class 'list'&gt; containing values of types set())"}), &lt;class 'numpy.ndarray'&gt;</code></p>
  
  <p>Despite not using <code>set</code> anywhere. </p>
  
  <h3>2nd Approach:</h3>
  
  <p>I tried using a numpy array for the inner list as follows:</p>
  
  <pre class="lang-py prettyprint-override"><code>x: List[np.ndarray[np.int32]]
  y: np.ndarray[np.int32]
  </code></pre>
  
  <p>But I received the following error:</p>
  
  <p><code>Input arrays should have the same number of samples as target arrays. Found 32 input samples and 479 target samples.</code></p>
  
  <h3>3rd Approach:</h3>
  
  <p>This prompted me to change the data structure to:</p>
  
  <pre class="lang-py prettyprint-override"><code>x: np.ndarray[np.ndarray[np.int32]]
  y: np.ndarray[np.int32]
  </code></pre>
  
  <p>This resulted in the following error:</p>
  
  <p><code>Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray).</code></p>
  
  <h3>4th Approach :</h3>
  
  <p>Trying,</p>
  
  <pre class="lang-py prettyprint-override"><code>x: np.ndarray[List[int]]
  y: np.ndarray[int]
  </code></pre>
  
  <p>Resulted in the following, similar error message:</p>
  
  <p><code>Failed to convert a NumPy array to a Tensor (Unsupported object type list).</code></p>
  
  <h3>TLDR;</h3>
  
  <p>So the question is: What's going on? Why won't <code>model.fit(...)</code> accept these parameters?</p>
  
  <p>See my answer below.</p>