import tensorflow as tf

      return compute_l2_sigmoid_matching_distances

    if distance_kernel == common.DISTANCE_KERNEL_EXPECTED_LIKELIHOOD:

      def compute_gaussian_likelihoods(lhs, rhs):
        """Computes sample likelihoods."""
        num_lhs_samples = lhs.shape.as_list()[-2] - 2
        num_rhs_samples = rhs.shape.as_list()[-2] - 2
        lhs_means, lhs_stddevs, lhs_samples = tf.split(
            lhs, [1, 1, num_lhs_samples], axis=-2)
        rhs_means, rhs_stddevs, rhs_samples = tf.split(
            rhs, [1, 1, num_rhs_samples], axis=-2)
        rhs_likelihoods = distance_utils.compute_gaussian_likelihoods(
            lhs_means,
            lhs_stddevs,
            rhs_samples,
            min_stddev=distance_kernel_kwargs.get(
                distance_kernel + '_min_stddev', None),
            max_squared_mahalanobis_distance=distance_kernel_kwargs.get(
                distance_kernel + '_max_squared_mahalanobis_distance', None),
