nfmcclure/tensorflow_cookbook

Introductory CNN Model: TypeError: Value passed to parameter 'shape' has DataType float32 not in list of allowed values: int32, int64

femosh opened this issue · 0 comments

This generate the TypeError:
full2_weight = tf.Variable(tf.truncated_normal([fully_connected_size1, target_size],
stddev=0.1, dtype=tf.float32))
full2_bias = tf.Variable(tf.truncated_normal([target_size], stddev=0.1, dtype=tf.float32))

target_size is wrong, it is 2.0 instead of 10 (9+1).
However, the problem originated from:
from tensorflow.examples.tutorials.mnist import input_data

Use this to fix the problem:
from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
data_dir = 'temp'
mnist = input_data.read_data_sets(data_dir, one_hot=True)

data_dir = 'temp'
mnist = read_data_sets(data_dir)