import tensorflow as tf

    y_w_diff = y[:, :, 1:] - y[:, :, :-1]
    h_diff = tf.abs(tf.abs(x_h_diff) - tf.abs(y_h_diff))
    w_diff = tf.abs(tf.abs(x_w_diff) - tf.abs(y_w_diff))
    return h_diff + tf.transpose(w_diff)

def leaky_relu(x, leak=0.2, name='leaky_relu'):
    with tf.variable_scope(name):
        f1 = 0.5 * (1 + leak)
        f2 = 0.5 * (1 - leak)
        return f1 * x + f2 * abs(x)

def linear(x, shape, name, bias=False):
