code: def forward(ctx, input, dim):
      ctx.save_for_backward(input, torch.tensor(dim))
      return torch.logsumexp(input, dim=dim)
  
file_path: pytorch-struct/torch_struct/semirings/sample.py
imports: import torch
  import torch.distributions
  from .semirings import _BaseLog
label_desc: Use image node_id 1 for calling the _SampledLogSumExp obj's underlying member method code with example usage: obj.forward(ctx, input, dim) and returns: torch