numpy - Tensorflow: TypeError with numpy_input_fn -


i coding convolutional neural network classify images in tensorflow there problem:

when try feed numpy array of flattened images (3 channels rgb values 0 255) tf.estimator.inputs.numpy_input_fn following error:

  typeerror: failed convert object of type <class 'dict'> tensor.    contents: {'x': <tf.tensor 'random_shuffle_queue_dequeuemany:1' shape=(8,    196608) dtype=uint8>}. consider casting elements supported type. 

my numpy_imput_fn looks this:

train_input_fn = tf.estimator.inputs.numpy_input_fn(     x={'x': train_x},     y=train_y,     batch_size=8,     num_epochs=none,     shuffle=true) 

in documentation function said x should dict of numpy array:

x: dict of numpy array object.

nevermind, having same problem fixed it. in model function had:

input_layer = tf.reshape(features, [-1, 256, 256, 1]) 

which raised type error. fix have access 'x' key in features dictionary:

input_layer = tf.reshape(features['x'], [-1, 256, 256, 1])  

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -