def _conform_kernel_to_tensor(kernel, tensor, shape):
""" Re-shape a convolution kernel to match the given tensor's color dimensions. """
l = len(kernel)
channels = shape[-1]
temp = np.repeat(kernel, channels)
temp = tf.reshape(temp, (l, l, channels, 1))
temp = tf.cast(temp, tf.float32)
temp /= tf.maximum(tf.reduce_max(temp), tf.reduce_min(temp) * -1)
return temp
评论列表
文章目录