code: def unsqueeze_expand(
      a: torch.Tensor, dim: int, size: int
  ) -> torch.Tensor:
      """
      Unsqueeze a dimension and expand over it in one go.
  
      Parameters
      ----------
      a
          Original tensor to unsqueeze.
      dim
          Dimension to unsqueeze.
      size
          Size for the new dimension.
  
      Returns
      -------
      torch.Tensor
          A tensor with an added dimension ``dim`` of size ``size``.
      """
      a = a.unsqueeze(dim)
      sizes = list(a.shape)
      sizes[dim] = size
      return a.expand(*sizes)
  
file_path: gluonts/src/gluonts/torch/util.py
imports: from typing import List, Optional, Type, Union
  import inspect
  import torch
label_desc: Use image node_id 9 for calling a global function with example usage: unsqueeze_expand(a, dim, size) and returns: a