TensorFlow Conv2d玩具计划挂起

时间:2019-01-09 23:56:53

标签: tensorflow

我想要的是一种快速而肮脏的方法来查看2d卷积的输出,以了解幕后的“相同”填充和“有效”填充。下面的方法可以解决问题,除了它的可靠性在漂亮地打印了一个数组之后直接挂起。

没有错误消息,只是挂起。我到底在俯视什么?

def conv(x):
    h1  = tf.layers.conv2d(inputs = x, filters = 4, kernel_size = [3, 3], strides = [1, 2], padding = 'same', activation = None,kernel_initializer = tf.ones_initializer(),name = None)
    return h1

X = tf.placeholder(tf.float32, shape = (1, 1, 7, 5))
conv_out = conv(X)

init = tf.global_variables_initializer()

with tf.Session() as sess:
    sess.run(init)
    ones = np.ones((1, 1, 7, 5))
    pprint(ones)
    foo = sess.run(conv_out, feed_dict={X: ones})
    print('done')

0 个答案:

没有答案