class_docstr: Implements the log-space semiring (logsumexp, +, -inf, 0).
  
  Gradients give marginals.
class_docstr_tok: ["Implements","the","log-space","semiring","(","logsumexp",",","+",",","-inf",",","0",")",".","Gradients","give","marginals","."]
code: def sum(xs, dim=-1):
      return torch.logsumexp(xs, dim=dim)
  
file_path: pytorch-struct/torch_struct/semirings/fast_semirings.py
imports: import torch
  import torch.distributions
  from .semirings import _BaseLog
  from .sample import _SampledLogSumExp
label_desc: Use image node_id 1 for calling the FastLogSemiring obj's underlying member method code with example usage: obj.sum(xs, dim) and returns: torch