def gamma(shape, scale, x): return -shape * tf.log(scale) - tf.lgamma(shape)\ + (shape - 1.) * tf.log(x) - x / scale