मैं अपने डेटा पर ट्यूटोरियल के विशेषज्ञ भाग को लागू करने की कोशिश कर रहा हूं लेकिन मैं आयाम त्रुटियों में चल रहा हूं। त्रुटि तक पहुंचने वाला कोड यहां दिया गया है।मैं टेंसरफ्लो में आयाम त्रुटि को कैसे ठीक करूं?
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
def max_pool_2x2(x):
return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],
strides=[1, 2, 2, 1], padding='SAME')
W_conv1 = weight_variable([1, 8, 1, 4])
b_conv1 = bias_variable([4])
x_image = tf.reshape(tf_in, [-1,2,8,1])
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
h_pool1 = max_pool_2x2(h_conv1)
और फिर जब मैं इस आदेश को चलाने का प्रयास:
W_conv2 = weight_variable([1, 4, 4, 8])
b_conv2 = bias_variable([8])
h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2) + b_conv2)
h_pool2 = max_pool_2x2(h_conv2)
मैं निम्नलिखित त्रुटियाँ मिलती है:
ValueError Traceback (most recent call last)
<ipython-input-41-7ab0d7765f8c> in <module>()
3
4 h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2) + b_conv2)
----> 5 h_pool2 = max_pool_2x2(h_conv2)
ValueError: ('filter must not be larger than the input: ', 'Filter: [', Dimension(2), 'x', Dimension(2), '] ', 'Input: [', Dimension(1), 'x', Dimension(4), '] ')
बस कुछ पृष्ठभूमि जानकारी, डेटा है कि मैं काम कर रहा हूँ के लिए एक सीएसवी फ़ाइल है जहां प्रत्येक पंक्ति में 10 फीचर्स और 1 खाली कॉलम होता है जो 1 या 0 हो सकता है। जो मैं प्राप्त करने की कोशिश कर रहा हूं वह खाली कॉलम में एक संभावना है जो कॉलम 1 के बराबर होगा।
'tf_in' क्या है? मुझे लगता है कि यह मूल 1x8 इनपुट है। – erickrf
'डेटा = genfromtxt ('cs-training.csv', delimiter = ',')'। 'एक = data.shape [1] -1'। 'tf_in = tf.placeholder (" float ", [none, a])'। – NickTheInventor