El Dude
El Dude

Reputation: 5618

TensorFlow conv2d dataset shape not accepted

Trying to train a cnn2d with a list of two 8x8 images. This is what I get in return. Do I have to flatten the 2x8x8 array somehow? I am not sure what a supported type would be.

The images are a 8x8 checker board before and after a move.

TypeError: Failed to convert object of type <class 
'tensorflow.python.data.ops.dataset_ops.TensorSliceDataset'> to Tensor.
Contents: <TensorSliceDataset shapes: ((2, 8, 8), ()), types: 
(tf.float64, tf.float64)>. Consider casting elements to a supported type.

Sorry, I'm just starting out with TF.

Upvotes: 0

Views: 113

Answers (2)

T. Kelher
T. Kelher

Reputation: 1186

tensorflow plays around with Tensors as returned by almost all tensorflow layers and placeholders, etc. Check this link and look at the return parameter, same with this one. That's also what your error is pointing to, it wants a tensor, not a TensorSliceDataset. I'm not familiar at all with tensorflow datasets, for that I gladly refer to some Google links: 1. Doing some lookup work, I've the feeling you're trying an mnist example, and something went wrong.

If you'd want to share some code, then I can look at it tomorrow, perhaps the line where it goes wrong is enough, because I've the feeling you're passing data into the graph, instead of tensors. Data is always fed afterwards through a sess.run() or similar.

Hope I helped a bit!

Upvotes: 2

druskacik
druskacik

Reputation: 2497

Try to use .reshape(2, 64) method. Also, I recommend you to check out some codes dealing with MNIST dataset, which is the basic dataset to train yourself to deal with images (it's a database of handwritten digits). The images in the dataset are reshaped to (784,) from original (28,28).

Upvotes: 1

Related Questions