code: def quadrature_scheme_lognormal_quantiles(
      loc, scale, quadrature_size, validate_args=False, name=None
  ):
      """Use LogNormal quantiles to form quadrature on positive-reals.
  
      Args:
        loc: `float`-like (batch of) scalar `Tensor`; the location parameter of
          the LogNormal prior.
        scale: `float`-like (batch of) scalar `Tensor`; the scale parameter of
          the LogNormal prior.
        quadrature_size: Python `int` scalar representing the number of quadrature
          points.
        validate_args: Python `bool`, default `False`. When `True` distribution
          parameters are checked for validity despite possibly degrading runtime
          performance. When `False` invalid inputs may silently render incorrect
          outputs.
        name: Python `str` name prefixed to Ops created by this class.
  
      Returns:
        grid: (Batch of) length-`quadrature_size` vectors representing the
          `log_rate` parameters of a `Poisson`.
        probs: (Batch of) length-`quadrature_size` vectors representing the
          weight associate with each `grid` value.
      """
      with tf.name_scope(
          name or "quadrature_scheme_lognormal_quantiles"
      ):
          # Create a LogNormal distribution.
          dist = transformed_distribution.TransformedDistribution(
              distribution=normal.Normal(loc=loc, scale=scale),
              bijector=exp_bijector.Exp(),
              validate_args=validate_args,
          )
          batch_ndims = tensorshape_util.rank(dist.batch_shape)
          if batch_ndims is None:
              batch_ndims = tf.shape(dist.batch_shape_tensor())[0]
  
          def _compute_quantiles():
              """Helper to build quantiles."""
              # Omit {0, 1} since they might lead to Inf/NaN.
              zero = tf.zeros([], dtype=dist.dtype)
              edges = tf.linspace(zero, 1.0, quadrature_size + 3)[1:-1]
              # Expand edges so its broadcast across batch dims.
              edges = tf.reshape(
                  edges,
                  shape=tf.concat(
                      [[-1], tf.ones([batch_ndims], dtype=tf.int32)],
                      axis=0,
                  ),
              )
              quantiles = dist.quantile(edges)
              # Cyclically permute left by one.
              perm = tf.concat(
                  [tf.range(1, 1 + batch_ndims), [0]], axis=0
              )
              quantiles = tf.transpose(a=quantiles, perm=perm)
              return quantiles
  
          quantiles = _compute_quantiles()
  
          # Compute grid as quantile midpoints.
          grid = (quantiles[..., :-1] + quantiles[..., 1:]) / 2.0
          # Set shape hints.
          new_shape = tensorshape_util.concatenate(
              dist.batch_shape, [quadrature_size]
          )
          tensorshape_util.set_shape(grid, new_shape)
  
          # By construction probs is constant, i.e., `1 / quadrature_size`. This is
          # important, because non-constant probs leads to non-reparameterizable
          # samples.
          probs = tf.fill(
              dims=[quadrature_size],
              value=tf.math.reciprocal(
                  tf.cast(quadrature_size, dist.dtype)
              ),
          )
  
          return grid, probs
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 2 for calling a global function with example usage: quadrature_scheme_lognormal_quantiles(loc, scale, quadrature_size, validate_args, name) and returns: grid,  probs, quantiles