Continuation from previous question: Tensorflow - TypeError: 'int' object is not iterable
My training data is a list of lists each comprised of 1000 floats. F
I had many different inputs and target variables and didn't know which one was causing the problem.
To find out on which variable it breaks you can add a print value in the library package using the path is specified in your stack strace:
File "C:\Users\bencu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\constant_op.py", line 96, in convert_to_eager_tensor
return ops.EagerTensor(value, ctx.device_name,
Adding a print
statement in this part of the code allowed me to see which input was causing the problem:
constant_op.py
:
....
dtype = dtype.as_datatype_enum
except AttributeError:
dtype = dtypes.as_dtype(dtype).as_datatype_enum
ctx.ensure_initialized()
print(value) # <--------------------- PUT PRINT HERE
return ops.EagerTensor(value, ctx.device_name, dtype)
After observing which value was problematic conversion from int
to astype(np.float32)
resolved the problem.