code: def _sample_multiple(
      sample_func, *args, num_samples: Optional[int] = None, **kwargs
  ) -> Tensor:
      """
      Sample from the sample_func, by passing expanded args and kwargs and
      reshaping the returned samples afterwards.
      """
      args_expanded = [_expand_param(a, num_samples) for a in args]
      kwargs_expanded = {
          k: _expand_param(v, num_samples)
          for k, v in kwargs.items()
          if v is not None
      }
      samples = sample_func(*args_expanded, **kwargs_expanded)
      return samples
  
imports: from typing import cast, Any, List, Optional, Tuple
  import mxnet
  import numpy
  from mxnet import autograd
  from gluonts.mx import Tensor
label_desc: Use image node_id 6 for calling a global function with example usage: _sample_multiple(sample_func) and returns: samples