parameters: (self, shape=(), rate=None)
return_statement: return value
docstring: Sampling.
  
          Args:
              shape (tuple): The shape of the sample. Default: ().
              rate (Tensor): The rate of the distribution. Default: self.rate.
  
          Returns:
              Tensor, shape is shape + batch_shape.
docstring_summary: Sampling.
docstring_tokens: Sampling .
function: def _sample(self, shape=(), rate=None):
          """
          Sampling.
  
          Args:
              shape (tuple): The shape of the sample. Default: ().
              rate (Tensor): The rate of the distribution. Default: self.rate.
  
          Returns:
              Tensor, shape is shape + batch_shape.
          """
          shape = self.checktuple(shape, 'shape')
          rate = self._check_param_type(rate)
  
          # now Poisson sampler supports only fp32
          rate = self.cast(rate, mstype.float32)
          origin_shape = shape + self.shape(rate)
          if origin_shape == ():
              sample_shape = (1,)
          else:
              sample_shape = origin_shape
          sample_poisson = self.poisson(sample_shape, rate, self.seed)
          value = self.cast(sample_poisson, self.dtype)
          if origin_shape == ():
              value = self.squeeze(value)
          return value
function_tokens: def _sample ( self , shape = ( ) , rate = None ) : shape = self . checktuple ( shape , 'shape' ) rate = self . _check_param_type ( rate ) # now Poisson sampler supports only fp32 rate = self . cast ( rate , mstype . float32 ) origin_shape = shape + self . shape ( rate ) if origin_shape == ( ) : sample_shape = ( 1 , ) else : sample_shape = origin_shape sample_poisson = self . poisson ( sample_shape , rate , self . seed ) value = self . cast ( sample_poisson , self . dtype ) if origin_shape == ( ) : value = self . squeeze ( value ) return value