def image_processing_layer(self, X):
K = 1 / 12. * tf.constant(
[
[-1, 2, -2, 2, -1],
[2, -6, 8, -6, 2],
[-2, 8, -12, 8, -2],
[2, -6, 8, -6, 2],
[-1, 2, -2, 2, -1]
], dtype= tf.float32
)
#kernel = tf.pack([K, K, K])
#kernel = tf.pack([kernel, kernel, kernel])
kernel = tf.stack([K, K, K])
kernel = tf.stack([kernel, kernel, kernel])
return tf.nn.conv2d(X, tf.transpose(kernel, [2, 3, 0, 1]), [1, 1, 1, 1], padding='SAME')
评论列表
文章目录