docs: def generate_sample(self, initial_pos, num_samples, stepsize=None):
          """
          Returns a generator type object whose each iteration yields a sample
  
          Parameters
          ----------
          initial_pos: A 1d array like object
              Vector representing values of parameter position, the starting
              state in markov chain.
  
          num_samples: int
              Number of samples to be generated
  
          stepsize: float , defaults to None
              The stepsize for proposing new values of position and momentum in simulate_dynamics
              If None, then will be choosen suitably
  
          Returns
          -------
          generator: yielding a numpy.array type object for a sample
  
          Examples
          ---------
          >>> from pgmpy.sampling import NoUTurnSampler as NUTS, GradLogPDFGaussian
          >>> from pgmpy.factors.continuous import GaussianDistribution as JGD
          >>> import numpy as np
          >>> mean = np.array([11, -6])
          >>> covariance = np.array([[0.7, 0.2], [0.2, 14]])
          >>> model = JGD(['x', 'y'], mean, covariance)
          >>> sampler = NUTS(model=model, grad_log_pdf=GradLogPDFGaussian)
          >>> samples = sampler.generate_sample(initial_pos=np.array([1, 1]), num_samples=10, stepsize=0.4)
          >>> samples = np.array([sample for sample in samples])
          >>> samples
          array([[ 10.26357538,   0.10062725],
                 [ 12.70600336,   0.63392499],
                 [ 10.95523217,  -0.62079273],
                 [ 10.66263031,  -4.08135962],
                 [ 10.59255762,  -8.48085076],
                 [  9.99860242,  -9.47096032],
                 [ 10.5733564 ,  -9.83504745],
                 [ 11.51302059,  -9.49919523],
                 [ 11.31892143,  -8.5873259 ],
                 [ 11.29008667,  -0.43809674]])
          """
          initial_pos = _check_1d_array_object(initial_pos, 'initial_pos')
          _check_length_equal(initial_pos, self.model.variables, 'initial_pos', 'model.variables')
  
          if stepsize is None:
              stepsize = self._find_reasonable_stepsize(initial_pos)
  
          position_m = initial_pos
  
          for _ in range(0, num_samples):
  
              position_m = self._sample(position_m, stepsize)
  
              yield position_m