import tensorflow as tf

    inputs_shape = list(map(int, inputs.get_shape()))
    predictions_shape = list(map(int, predictions.get_shape()))
    nr_mix = int(predictions_shape[-1] / 10)
    logit_probs = predictions[:, :, :, :nr_mix]
    predictions = tf.reshape(predictions[:, :, :, nr_mix:], inputs_shape + [nr_mix * 3])
    means = predictions[:, :, :, :, :nr_mix]
    log_scales = tf.maximum(predictions[:, :, :, :, nr_mix:2 * nr_mix], -7.)
    coeffs = tf.nn.tanh(predictions[:, :, :, :, 2 * nr_mix:3 * nr_mix])
    inputs = tf.reshape(inputs, inputs_shape + [1]) + tf.zeros(inputs_shape + [nr_mix])
    m2 = tf.reshape(means[:, :, :, 1, :] + coeffs[:, :, :, 0, :] * inputs[:, :, :, 0, :],
                    [inputs_shape[0], inputs_shape[1], inputs_shape[2], 1, nr_mix])
    m3 = tf.reshape(
        means[:, :, :, 2, :] + coeffs[:, :, :, 1, :] * inputs[:, :, :, 0, :] +
        coeffs[:, :, :, 2, :] * inputs[:, :, :, 1, :],
        [inputs_shape[0], inputs_shape[1], inputs_shape[2], 1, nr_mix])
    means = tf.concat([
        tf.reshape(means[:, :, :, 0, :],
                   [inputs_shape[0], inputs_shape[1], inputs_shape[2], 1, nr_mix]), m2, m3
    ],
                      axis=3)
    centered_inputs = inputs - means
    inv_stdv = tf.exp(-log_scales)
