code: def sample(self, sample_shape=torch.Size()):
      shape = self._extended_shape(sample_shape)
      u = torch.rand_like(self.gamma.expand(shape))
  
      sample = self.quantile(u)
  
      if len(sample_shape) == 0:
          sample = sample.squeeze(0)
  
      return sample
  
file_path: gluonts/src/gluonts/nursery/robust-mts-attack/pts/distributions/piecewise_linear.py
imports: import torch
  import torch.nn.functional
  from torch.distributions import constraints, NegativeBinomial, Poisson, Distribution, TransformedDistribution, AffineTransform
  from torch.distributions.utils import broadcast_all, lazy_property
  from .utils import broadcast_shape
label_desc: Use image node_id 3 for calling the PiecewiseLinear obj's underlying member method code with example usage: obj.sample(sample_shape) and returns: sample