这是我的自定义填充层: class CustomZeroPadding2D(Layer): def __init__(self, **kwargs): super(CustomZeroPadding2D, self).__init__(**kwargs) def build(self, input_shape): super(CustomZeroPadding2D, self).build(input_shape) def call(self, x): print('K.int_shape(x)', K.int_shape(x)) print('K.int_shape(K.zeros_like(x))', K.int_shape(K.zeros_like(x))) res = concatenate([x, K.zeros_like(x)], axis=-1) return res def compute_output_shape(self, input_shape): output_shape = (input_shape[0], input_shape[1], input_shape[2]*2) return output_shape因为某些原因:K.int_shape(x) (None, 128, 128, 7)但K.int_shape(K.zeros_like(x)) (None, None, None, 7)在doc 中 instantiates an all-zeros variable of the same shape as another tensor,有什么问题?更新:连接不起作用的问题:ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 128, 128, 7), (None, None, None, 7)]
添加回答
举报
0/150
提交
取消