code: def resample(input, num_samples, dim=0, replacement=False):
      """
      Draws ``num_samples`` samples from ``input`` at dimension ``dim``.
  
      :param torch.Tensor input: the input tensor.
      :param int num_samples: the number of samples to draw from ``input``.
      :param int dim: dimension to draw from ``input``.
      :returns torch.Tensor: samples drawn randomly from ``input``.
      """
      weights = torch.ones(
          input.size(dim), dtype=input.dtype, device=input.device
      )
      indices = torch.multinomial(weights, num_samples, replacement)
      return input.index_select(dim, indices)
  
imports: import math
  import numbers
  import torch
  from torch.fft import irfft, rfft
  from .tensor_utils import next_fast_len
label_desc: Use image node_id 8 for calling a global function with example usage: resample(input, num_samples, dim, replacement) and returns: input