The model works fine on TensorFlow 1.15 (newest release), but does not work on Tensorflow 2.0 when trying to call predict. The model is a Keras Model.
model.predict(self.A.todense())
Extracted error message:
/tensorflow-2.0.0/python3.6/tensorflow_core/python/framework/type_spec.py in type_spec_from_value(value)
490 491 raise TypeError("Could not build a TypeSpec for %r with type %s" %
--> 492 (value, type(value).name))
493 494
TypeError: Could not build a TypeSpec for matrix([[0, 1, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], ..., [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0]], dtype=int64) with type matrix
I had the same error come up when I was using Pandas objects, either DataFrames
or Series
, as input and target data. It looks like your input is of type matrix
, in which case this might be your problem as well; an easy fix would be any type conversion, np.array(self.A.todense())
would likely do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With