title: Tensorflow - ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float)
body: <p>Continuation from previous question: <a href="https://stackoverflow.com/questions/58635521/tensorflow-typeerror-int-object-is-not-iterable/58635565#58635583">Tensorflow - TypeError: &#39;int&#39; object is not iterable</a></p>
  <p>My training data is a list of lists each comprised of 1000 floats. For example, <code>x_train[0] =</code></p>
  <pre><code>[0.0, 0.0, 0.1, 0.25, 0.5, ...]
  </code></pre>
  <p>Here is my model:</p>
  <pre><code>model = Sequential()
  
  model.add(LSTM(128, activation='relu',
                 input_shape=(1000, 1), return_sequences=True))
  model.add(Dropout(0.2))
  model.add(LSTM(128, activation='relu'))
  model.add(Dropout(0.2))
  model.add(Dense(32, activation='relu'))
  model.add(Dropout(0.2))
  model.add(Dense(1, activation='sigmoid'))
  
  opt = tf.keras.optimizers.Adam(lr=1e-3, decay=1e-5)
  
  model.compile(optimizer='rmsprop',
                loss='binary_crossentropy',
                metrics=['accuracy'])
  
  model.fit(x_train, y_train, epochs=3, validation_data=(x_test, y_test))
  </code></pre>
  <p>Here is the error I'm getting:</p>
  <pre><code>Traceback (most recent call last):
        File &quot;C:\Users\bencu\Desktop\ProjectFiles\Code\Program.py&quot;, line 88, in FitModel
          model.fit(x_train, y_train, epochs=3, validation_data=(x_test, y_test))
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\training.py&quot;, line 728, in fit
          use_multiprocessing=use_multiprocessing)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py&quot;, line 224, in fit
          distribution_strategy=strategy)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py&quot;, line 547, in _process_training_inputs
          use_multiprocessing=use_multiprocessing)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py&quot;, line 606, in _process_inputs
          use_multiprocessing=use_multiprocessing)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\data_adapter.py&quot;, line 479, in __init__
          batch_size=batch_size, shuffle=shuffle, **kwargs)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\data_adapter.py&quot;, line 321, in __init__
          dataset_ops.DatasetV2.from_tensors(inputs).repeat()
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py&quot;, line 414, in from_tensors
          return TensorDataset(tensors)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py&quot;, line 2335, in __init__
          element = structure.normalize_element(element)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\data\util\structure.py&quot;, line 111, in normalize_element
          ops.convert_to_tensor(t, name=&quot;component_%d&quot; % i))
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\ops.py&quot;, line 1184, in convert_to_tensor
          return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\ops.py&quot;, line 1242, in convert_to_tensor_v2
          as_ref=False)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\ops.py&quot;, line 1296, in internal_convert_to_tensor
          ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\tensor_conversion_registry.py&quot;, line 52, in _default_conversion_function
          return constant_op.constant(value, dtype, name=name)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\constant_op.py&quot;, line 227, in constant
          allow_broadcast=True)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\constant_op.py&quot;, line 235, in _constant_impl
          t = convert_to_eager_tensor(value, ctx, dtype)
        File &quot;C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\constant_op.py&quot;, line 96, in convert_to_eager_tensor
          return ops.EagerTensor(value, ctx.device_name, dtype)
      ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).
  </code></pre>
  <p>I've tried googling the error myself, I found something about using the <code>tf.convert_to_tensor</code> function. I tried passing my training and testing lists through this but the function won't take them.</p>