Closed chenguanqi closed 6 years ago
I modified the function ContrastLayer(self, input, k_s=3) as follow: def ContrastLayer(self, input, k_s=3):
# return tf.subtract(input_, tf.nn.avg_pool(tf.pad(input_, [[0, 0], [h_s, h_s], [h_s, h_s], [0, 0]], 'SYMMETRIC') ,ksize=[1, k_s, k_s, 1], strides=[1, 1, 1, 1], padding='VALID'))
h_s = k_s // 2
if k_s % 2 == 0:
return tf.subtract(input_, tf.nn.avg_pool(tf.pad(input_, [[0, 0], [h_s, h_s], [h_s, h_s], [0, 0]], 'SYMMETRIC'), ksize=[1, k_s, k_s, 1], strides=[1, 1, 1, 1], padding='VALID'))
else:
return tf.subtract(input_, tf.nn.avg_pool(tf.pad(input_, [[0, 0], [h_s, h_s+1], [h_s, h_s+1], [0, 0]], 'SYMMETRIC'),ksize=[1, k_s, k_s, 1], strides=[1, 1, 1, 1], padding='VALID'))
Is it right?
我也遇到这个问题,我直接改成 h_s = int(k_s / 2) 了
我也遇到这个问题,我直接改成 h_s = int(k_s / 2) 了
好的,谢谢
Hi, when I run the code in tf=1.3.0, I met the following error: File "NLDF.py", line 126, in ContrastLayer return tf.subtract(input, tf.nn.avgpool(tf.pad(input, [[0, 0], [h_s, h_s], [h_s, h_s], [0, 0]], 'SYMMETRIC'), TypeError: Value passed to parameter 'paddings' has DataType float32 not in list of allowed values: int32, int64. How can I fix it?