class_docstr: Empirical distribution associated with the sampled data. Note that the shape
  requirement for `log_weights` is that its shape must match the leftmost shape
  of `samples`. Samples are aggregated along the ``aggregation_dim``, which is
  the rightmost dim of `log_weights`.
  
  Example:
  
  >>> emp_dist = Empirical(torch.randn(2, 3, 10), torch.ones(2, 3))
  >>> emp_dist.batch_shape
  torch.Size([2])
  >>> emp_dist.event_shape
  torch.Size([10])
  
  >>> single_sample = emp_dist.sample()
  >>> single_sample.shape
  torch.Size([2, 10])
  >>> batch_sample = emp_dist.sample((100,))
  >>> batch_sample.shape
  torch.Size([100, 2, 10])
  
  >>> emp_dist.log_prob(single_sample).shape
  torch.Size([2])
  >>> # Vectorized samples cannot be scored by log_prob.
  >>> with pyro.validation_enabled():
  ...     emp_dist.log_prob(batch_sample).shape
  Traceback (most recent call last):
  ...
  ValueError: ``value.shape`` must be torch.Size([2, 10])
  
  :param torch.Tensor samples: samples from the empirical distribution.
  :param torch.Tensor log_weights: log weights (optional) corresponding
      to the samples.
class_docstr_tok: ["Empirical","distribution","associated","with","the","sampled","data",".","Note","that","the","shape","requirement","for","`","log_weights","`","is","that","its","shape","must","match","the","leftmost","shape","of","`","samples","`",".","Samples","are","aggregated","along","the","``","aggregation_dim","``",",","which","is","the","rightmost","dim","of","`","log_weights","`",".","Example",":",">",">",">","emp_dist","=","Empirical","(","torch.randn","(","2",",","3",",","10",")",",","torch.ones","(","2",",","3",")",")",">",">",">","emp_dist.batch_shape","torch.Size","(","[","2","]",")",">",">",">","emp_dist.event_shape","torch.Size","(","[","10","]",")",">",">",">","single_sample","=","emp_dist.sample","(",")",">",">",">","single_sample.shape","torch.Size","(","[","2",",","10","]",")",">",">",">","batch_sample","=","emp_dist.sample","(","(","100",",",")",")",">",">",">","batch_sample.shape","torch.Size","(","[","100",",","2",",","10","]",")",">",">",">","emp_dist.log_prob","(","single_sample",")",".shape","torch.Size","(","[","2","]",")",">",">",">","#","Vectorized","samples","can","not","be","scored","by","log_prob",".",">",">",">","with","pyro.validation_enabled","(",")",":","...","emp_dist.log_prob","(","batch_sample",")",".shape","Traceback","(","most","recent","call","last",")",":","...","ValueError",":","``","value.shape","``","must","be","torch.Size","(","[","2",",","10","]",")",":","param","torch.Tensor","samples",":","samples","from","the","empirical","distribution",".",":","param","torch.Tensor","log_weights",":","log","weights","(","optional",")","corresponding","to","the","samples","."]
code: def log_weights(self):
      return self._log_weights
  
file_path: pyro/pyro/distributions/empirical.py
imports: import torch
  from torch.distributions import constraints
  from pyro.distributions.torch import Categorical
  from pyro.distributions.torch_distribution import TorchDistribution
  from pyro.distributions.util import copy_docs_from
label_desc: Use image node_id 9 for calling the Empirical obj's underlying member method code with example usage: obj.log_weights() and returns: self