此层每侧都有填充4个像素,但是在张量流中,它仅具有“ SAME”和“ VALID”填充模式。如何在张量流中实现这一层?
layer {
name: "conv3"
type: "Deconvolution"
bottom: "conv26"
top: "conv3"
param {
lr_mult: 0.1
}
param {
lr_mult: 0.1
}
convolution_param {
num_output: 1
kernel_size: 9
stride: 3
pad: 4
weight_filler {
type: "gaussian"
std: 0.001
}
bias_filler {
type: "constant"
value: 0
}
}
}
答案 0 :(得分:0)
您可以使用tf.pad进行自定义填充。为每个空间维度填充名称为my_tensor
的张量(batch_size, height, width, channels)
,形状为my_padded_tensor = tf.pad(
tensor=my_tensor,
paddings=tf.constant([[0, 0,], [4, 4], [4,4], [0,0]], dtype=tf.int32),
mode='CONSTANT',
constant_values=0
)
,并且在两个空间的两侧都带有四个零:
{{1}}