UpSampling2D
>>>input = numpy.array([[1,2,3],[4,5,6]])
>>>input_shape = Input(shape=(2,3,1))
>>>print(input)
[[1 2 3]
[4 5 6]]
>>>out = tf.keras.layers.UpSampling2D(size=(2,2))(input_shape)
>>>print(out)
[[1 1 2 2 3 3]
[1 1 2 2 3 3]
[4 4 5 5 6 6]
[4 4 5 5 6 6]]
UpSampling2D将原矩阵分别沿着原来的数值阵列对应的倍数复制。
tf.tile()
tf.tile(
input,#tensor输入
multiples,#tensor维度大小的输入
name=None
)
tf.tile应用
with tf.Session() as sess:
a = tf.constant([[1,2,3],[4,5,6]])
b = tf.tile(a,[2,2])
print(sess.run(a))
print(sess.run(b))
#output:
[[1 2 3]
[4 5 6]]
[[1 2 3 1 2 3]
[4 5 6 4 5 6]
[1 2 3 1 2 3]
[4 5 6 4 5 6]]
tile有平铺的意思,进行同一维度上的复制。