code: def leggauss(
      deg: int,
      a: float = -1.0,
      b: float = 1.0,
      dtype: Optional[torch.dtype] = None,
      device: Optional[torch.device] = None,
  ) -> Tuple[Tensor, Tensor]:
      """Computes Gauss-Legendre quadrature nodes and weights. Wraps
      `numpy.polynomial.legendre.leggauss` and returns Torch Tensors.
  
      Args:
          deg: Number of sample points and weights. Integrates poynomials of degree
              `2 * deg + 1` exactly.
          a, b: Lower and upper bound of integration domain.
          dtype: Desired floating point type of the return Tensors.
          device: Desired device type of the return Tensors.
  
      Returns:
          A tuple of Gauss-Legendre quadrature nodes and weights of length deg.
      """
      dtype = dtype if dtype is not None else torch.get_default_dtype()
      x, w = numpy.polynomial.legendre.leggauss(deg=deg)
      x = torch.as_tensor(x, dtype=dtype, device=device)
      w = torch.as_tensor(w, dtype=dtype, device=device)
      if not (
          a == -1 and b == 1
      ):  # need to normalize for different domain
          x = (b - a) * (x + 1) / 2 + a
          w = w * ((b - a) / 2)
      return x, w
  
imports: import math
  from typing import List, Optional, Tuple
  import numpy
  import torch
  from botorch.exceptions.errors import UnsupportedError
  from gpytorch.constraints import Interval, Positive
  from gpytorch.kernels import Kernel
  from torch import nn, Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: leggauss(deg, a, b, dtype, device) and returns: x,  w