why i am Getting Error in the placeholder Dimension in tensor flow?
I am trying to create a neural network.
Here is my neural network design
num_channels=3
filter_size_conv1=3
filter_size_conv2=3
filter_size_conv3=3
num_filters_conv1=32
num_filters_conv2=64
num_filters_conv3=128
num_classes=1
img_size=196.0
fc_layer_size=80000
num_channelss=3.0
#__________________Creating the MODEL______________________
x = tf.placeholder(tf.float32, shape=[None, img_size,img_size,num_channelss], name="x_placeholder")
y = tf.placeholder(tf.float32, shape=[None, num_classes], name="y_true")
y_true_cls = tf.argmax(y, axis=1)
#neural network Design
layer_conv1 = create_convolutional_layer(input=x,num_input_channels=num_channels,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv1")
layer_conv1_1 = create_convolutional_layer(input=layer_conv1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv2")
layer_conv1_1_1 = create_convolutional_layer(input=layer_conv1_1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv3")
max_pool_1=maxpool2d(layer_conv1_1_1,2,name="maxpool_1")
drop_out_1=dropout(max_pool_1,name="dropout_1")
flatten_layer=create_flatten_layer(drop_out_3)
layer_fc2 = create_fc_layer(input=flatten_layer,num_inputs=fc_layer_size,num_outputs=num_classes,use_relu=True)
y_pred = tf.nn.softmax(layer_fc2,name="y_pred")
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=y_pred))
#Defining objective
train = tf.train.AdamOptimizer(learning_rate=0.00001).minimize(cost)
print ("_____Neural Network Architecture Created Succefully_____")
epochs=10
matches = tf.equal(tf.argmax(y_pred,axis=1),tf.argmax(y,axis=1))
acc = tf.reduce_mean(tf.cast(matches,tf.float32))
#Initializing weights
init = tf.global_variables_initializer()
with tf.Session() as sess:
#writing output to the logs for tensorboard
writer=tf.summary.FileWriter("./logs",sess.graph)
sess.run(init)
for i in range(epochs):
#creating smaller batches
for j in range(0,steps-remaining,step_size):
sess.run([acc,train,cost],feed_dict={x:X_train[j:j+step_size],y:y_train[j:j+step_size]})
Now my input first from X_train to the model is of the dimension (7,196,196,3).
X_train contains 22 images.
Here is the Error Trace:
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'x_placeholder' with dtype float and shape [?,196,196,3]
[[Node: x_placeholder = Placeholder[dtype=DT_FLOAT, shape=[?,196,196,3], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
[[Node: Mean/_15 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_147_Mean", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
I am not able to find the bug, I am feeding in the right dimensions,still error.
python-3.x tensorflow
add a comment |
I am trying to create a neural network.
Here is my neural network design
num_channels=3
filter_size_conv1=3
filter_size_conv2=3
filter_size_conv3=3
num_filters_conv1=32
num_filters_conv2=64
num_filters_conv3=128
num_classes=1
img_size=196.0
fc_layer_size=80000
num_channelss=3.0
#__________________Creating the MODEL______________________
x = tf.placeholder(tf.float32, shape=[None, img_size,img_size,num_channelss], name="x_placeholder")
y = tf.placeholder(tf.float32, shape=[None, num_classes], name="y_true")
y_true_cls = tf.argmax(y, axis=1)
#neural network Design
layer_conv1 = create_convolutional_layer(input=x,num_input_channels=num_channels,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv1")
layer_conv1_1 = create_convolutional_layer(input=layer_conv1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv2")
layer_conv1_1_1 = create_convolutional_layer(input=layer_conv1_1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv3")
max_pool_1=maxpool2d(layer_conv1_1_1,2,name="maxpool_1")
drop_out_1=dropout(max_pool_1,name="dropout_1")
flatten_layer=create_flatten_layer(drop_out_3)
layer_fc2 = create_fc_layer(input=flatten_layer,num_inputs=fc_layer_size,num_outputs=num_classes,use_relu=True)
y_pred = tf.nn.softmax(layer_fc2,name="y_pred")
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=y_pred))
#Defining objective
train = tf.train.AdamOptimizer(learning_rate=0.00001).minimize(cost)
print ("_____Neural Network Architecture Created Succefully_____")
epochs=10
matches = tf.equal(tf.argmax(y_pred,axis=1),tf.argmax(y,axis=1))
acc = tf.reduce_mean(tf.cast(matches,tf.float32))
#Initializing weights
init = tf.global_variables_initializer()
with tf.Session() as sess:
#writing output to the logs for tensorboard
writer=tf.summary.FileWriter("./logs",sess.graph)
sess.run(init)
for i in range(epochs):
#creating smaller batches
for j in range(0,steps-remaining,step_size):
sess.run([acc,train,cost],feed_dict={x:X_train[j:j+step_size],y:y_train[j:j+step_size]})
Now my input first from X_train to the model is of the dimension (7,196,196,3).
X_train contains 22 images.
Here is the Error Trace:
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'x_placeholder' with dtype float and shape [?,196,196,3]
[[Node: x_placeholder = Placeholder[dtype=DT_FLOAT, shape=[?,196,196,3], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
[[Node: Mean/_15 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_147_Mean", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
I am not able to find the bug, I am feeding in the right dimensions,still error.
python-3.x tensorflow
add a comment |
I am trying to create a neural network.
Here is my neural network design
num_channels=3
filter_size_conv1=3
filter_size_conv2=3
filter_size_conv3=3
num_filters_conv1=32
num_filters_conv2=64
num_filters_conv3=128
num_classes=1
img_size=196.0
fc_layer_size=80000
num_channelss=3.0
#__________________Creating the MODEL______________________
x = tf.placeholder(tf.float32, shape=[None, img_size,img_size,num_channelss], name="x_placeholder")
y = tf.placeholder(tf.float32, shape=[None, num_classes], name="y_true")
y_true_cls = tf.argmax(y, axis=1)
#neural network Design
layer_conv1 = create_convolutional_layer(input=x,num_input_channels=num_channels,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv1")
layer_conv1_1 = create_convolutional_layer(input=layer_conv1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv2")
layer_conv1_1_1 = create_convolutional_layer(input=layer_conv1_1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv3")
max_pool_1=maxpool2d(layer_conv1_1_1,2,name="maxpool_1")
drop_out_1=dropout(max_pool_1,name="dropout_1")
flatten_layer=create_flatten_layer(drop_out_3)
layer_fc2 = create_fc_layer(input=flatten_layer,num_inputs=fc_layer_size,num_outputs=num_classes,use_relu=True)
y_pred = tf.nn.softmax(layer_fc2,name="y_pred")
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=y_pred))
#Defining objective
train = tf.train.AdamOptimizer(learning_rate=0.00001).minimize(cost)
print ("_____Neural Network Architecture Created Succefully_____")
epochs=10
matches = tf.equal(tf.argmax(y_pred,axis=1),tf.argmax(y,axis=1))
acc = tf.reduce_mean(tf.cast(matches,tf.float32))
#Initializing weights
init = tf.global_variables_initializer()
with tf.Session() as sess:
#writing output to the logs for tensorboard
writer=tf.summary.FileWriter("./logs",sess.graph)
sess.run(init)
for i in range(epochs):
#creating smaller batches
for j in range(0,steps-remaining,step_size):
sess.run([acc,train,cost],feed_dict={x:X_train[j:j+step_size],y:y_train[j:j+step_size]})
Now my input first from X_train to the model is of the dimension (7,196,196,3).
X_train contains 22 images.
Here is the Error Trace:
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'x_placeholder' with dtype float and shape [?,196,196,3]
[[Node: x_placeholder = Placeholder[dtype=DT_FLOAT, shape=[?,196,196,3], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
[[Node: Mean/_15 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_147_Mean", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
I am not able to find the bug, I am feeding in the right dimensions,still error.
python-3.x tensorflow
I am trying to create a neural network.
Here is my neural network design
num_channels=3
filter_size_conv1=3
filter_size_conv2=3
filter_size_conv3=3
num_filters_conv1=32
num_filters_conv2=64
num_filters_conv3=128
num_classes=1
img_size=196.0
fc_layer_size=80000
num_channelss=3.0
#__________________Creating the MODEL______________________
x = tf.placeholder(tf.float32, shape=[None, img_size,img_size,num_channelss], name="x_placeholder")
y = tf.placeholder(tf.float32, shape=[None, num_classes], name="y_true")
y_true_cls = tf.argmax(y, axis=1)
#neural network Design
layer_conv1 = create_convolutional_layer(input=x,num_input_channels=num_channels,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv1")
layer_conv1_1 = create_convolutional_layer(input=layer_conv1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv2")
layer_conv1_1_1 = create_convolutional_layer(input=layer_conv1_1,num_input_channels=num_filters_conv1,conv_filter_size=filter_size_conv1,num_filters=num_filters_conv1,name="conv3")
max_pool_1=maxpool2d(layer_conv1_1_1,2,name="maxpool_1")
drop_out_1=dropout(max_pool_1,name="dropout_1")
flatten_layer=create_flatten_layer(drop_out_3)
layer_fc2 = create_fc_layer(input=flatten_layer,num_inputs=fc_layer_size,num_outputs=num_classes,use_relu=True)
y_pred = tf.nn.softmax(layer_fc2,name="y_pred")
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=y_pred))
#Defining objective
train = tf.train.AdamOptimizer(learning_rate=0.00001).minimize(cost)
print ("_____Neural Network Architecture Created Succefully_____")
epochs=10
matches = tf.equal(tf.argmax(y_pred,axis=1),tf.argmax(y,axis=1))
acc = tf.reduce_mean(tf.cast(matches,tf.float32))
#Initializing weights
init = tf.global_variables_initializer()
with tf.Session() as sess:
#writing output to the logs for tensorboard
writer=tf.summary.FileWriter("./logs",sess.graph)
sess.run(init)
for i in range(epochs):
#creating smaller batches
for j in range(0,steps-remaining,step_size):
sess.run([acc,train,cost],feed_dict={x:X_train[j:j+step_size],y:y_train[j:j+step_size]})
Now my input first from X_train to the model is of the dimension (7,196,196,3).
X_train contains 22 images.
Here is the Error Trace:
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'x_placeholder' with dtype float and shape [?,196,196,3]
[[Node: x_placeholder = Placeholder[dtype=DT_FLOAT, shape=[?,196,196,3], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
[[Node: Mean/_15 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_147_Mean", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
I am not able to find the bug, I am feeding in the right dimensions,still error.
python-3.x tensorflow
python-3.x tensorflow
asked Dec 28 '18 at 12:49
user10573543user10573543
227
227
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53958878%2fwhy-i-am-getting-error-in-the-placeholder-dimension-in-tensor-flow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53958878%2fwhy-i-am-getting-error-in-the-placeholder-dimension-in-tensor-flow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown