x = tf.random_normal([300], mean = 5, stddev = 1) y = tf.random_normal([300], mean = 5, stddev = 1) avg = tf.reduce_mean(x - y) cond = tf.less(avg, 0) left_op = tf.reduce_mean(tf.square(x-y)) right_op = tf.reduce_mean(tf.abs(x-y)) out = tf.where(cond, left_op, right_op) #tf.select() has been fucking deprecated
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter