TensorFlow
tensorflow中卷积操作的padding参数
filters = tf.reshape(tf.constant([1., 1., 2.]), (3, 1, 1))
x = tf.reshape(tf.constant([1., 1., 0., 2., 1.]), (1, 5, 1))
tf.nn.convolution(x, filters, strides=2, padding="VALID").numpy().squeeze()
# [2, 4]
tf.nn.convolution(x, filters, strides=2, padding="SAME").numpy().squeeze()
# [3, 5, 3]
filters = tf.reshape(tf.constant([1., 1., 2.]), (3, 1, 1))
x = tf.reshape(tf.constant([1., 1., 0., 2., 1., 2.]), (1, 6, 1))
tf.nn.convolution(x, filters, strides=2, padding="VALID").numpy().squeeze()
# [2, 4]
tf.nn.convolution(x, filters, strides=2, padding="SAME").numpy().squeeze()
# [2, 4, 3]tf1与tf2的迁移
tensorflow中dataloader的一个小问题记录
Last updated