docstr: :param mean: Array/Tensor with shape [b1, b2, ..., bX, dim], usually [N, dim],
      representing the mean of a dim-Variate Gaussian distribution
  :param var: Array/Tensor with shape b1, b2, ..., bX, dim], usually [N, dim],
      representing the variance of a dim-Variate Gaussian distribution
  :return: points X, Tensor with shape [n_gh_total, b1, b2, ..., bX, dim],
      usually [n_gh_total, N, dim],
      and weights W, a Tensor with shape [n_gh_total, b1, b2, ..., bX, 1],
      usually [n_gh_total, N, 1]
docstr_tok: [":","param","mean",":","Array\/Tensor","with","shape","[","b1",",","b2",",","...",",","bX",",","dim","]",",","usually","[","N",",","dim","]",",","representing","the","mean","of","a","dim-Variate","Gaussian","distribution",":","param","var",":","Array\/Tensor","with","shape","b1",",","b2",",","...",",","bX",",","dim","]",",","usually","[","N",",","dim","]",",","representing","the","variance","of","a","dim-Variate","Gaussian","distribution",":","return",":","points","X",",","Tensor","with","shape","[","n_gh_total",",","b1",",","b2",",","...",",","bX",",","dim","]",",","usually","[","n_gh_total",",","N",",","dim","]",",","and","weights","W",",","a","Tensor","with","shape","[","n_gh_total",",","b1",",","b2",",","...",",","bX",",","1","]",",","usually","[","n_gh_total",",","N",",","1","]"]
code: def _build_X_W(
      self, mean: TensorType, var: TensorType
  ) -> Tuple[tf.Tensor, tf.Tensor]:
      """
      :param mean: Array/Tensor with shape [b1, b2, ..., bX, dim], usually [N, dim],
          representing the mean of a dim-Variate Gaussian distribution
      :param var: Array/Tensor with shape b1, b2, ..., bX, dim], usually [N, dim],
          representing the variance of a dim-Variate Gaussian distribution
      :return: points X, Tensor with shape [n_gh_total, b1, b2, ..., bX, dim],
          usually [n_gh_total, N, dim],
          and weights W, a Tensor with shape [n_gh_total, b1, b2, ..., bX, 1],
          usually [n_gh_total, N, 1]
      """
  
      batch_shape_broadcast = tf.ones(tf.rank(mean) - 1, dtype=tf.int32)
      shape_aux = tf.concat(
          [[self.n_gh_total], batch_shape_broadcast], axis=0
      )
  
      # mean, var: [b1, b2, ..., bX, dim], usually [N, dim]
      mean = tf.expand_dims(mean, 0)
      stddev = tf.expand_dims(tf.sqrt(var), 0)
      # mean, stddev: [1, b1, b2, ..., bX, dim], usually [1, N, dim]
  
      Z = tf.cast(
          tf.reshape(
              self.Z, tf.concat([shape_aux, [self.dim]], axis=0)
          ),
          mean.dtype,
      )
      dZ = tf.cast(
          tf.reshape(self.dZ, tf.concat([shape_aux, [1]], axis=0)),
          mean.dtype,
      )
  
      X = mean + stddev * Z
      W = dZ
      # X: [n_gh_total, b1, b2, ..., bX, dim], usually [n_gh_total, N, dim]
      # W: [n_gh_total,  1,  1, ...,  1,   1], usually [n_gh_total, N,   1]
  
      return X, W
  
file_path: GPflow/gpflow/quadrature/gauss_hermite.py
imports: from typing import Sequence, Tuple
  import numpy
  import tensorflow
  from check_shapes import check_shapes, inherit_check_shapes
  from ..base import TensorType
  from ..config import default_float
  from .base import GaussianQuadrature
label_desc: Use image node_id 2 for calling the NDiagGHQuadrature obj's underlying member method code with example usage: obj._build_X_W(mean, var) and returns: X,  W