import tensorflow as tf


def euclidean_loss_layer(a, b, multiplier=100.0, use_l1=False, eps=0.01):
    """ Math:  out = (action - mlp_out)'*precision*(action-mlp_out)
                    = (u-uhat)'*A*(u-uhat)"""
    multiplier = tf.constant(multiplier, dtype='float') #for bc #10000
    uP =a*multiplier-b*multiplier
    if use_l1:
        return tf.reduce_mean(eps*tf.square(uP) + tf.abs(uP))
    return tf.reduce_mean(tf.square(uP))

def conv2d(img, w, b, strides=[1, 1, 1, 1], is_dilated=False):
    if is_dilated:
        layer = tf.nn.atrous_conv2d(img, w, rate=2, padding='SAME') + b
    else:
