4
次のコードでは、conv_out.get_shape()
を出力すると出力が(1,14,14,1)
になります。私は第2、第3および第4の次元(14*14*1)
を掛けたい。私はそれをどのようにすることができますか?テンソルの次元を掛ける方法は?
input = tf.Variable(tf.random_normal([1,28,28,1]))
filter = tf.Variable(tf.random_normal([5,5,1,1]))
def conv2d(input,filter):
return tf.nn.conv2d(input,filter,strides=[1,2,2,1],padding='SAME')
conv_out = conv2d(input,filter)
sess = tf.InteractiveSession()
sess.run(tf.initialize_all_variables())
print conv_out.get_shape()
print conv_out.get_shape().as_list()[2]