code: def forward(ctx, input, dim, z=1):
      w_star = project_simplex(input, dim)
      ctx.save_for_backward(input, w_star.clone(), torch.tensor(dim))
      x = input.mul(w_star).sum(dim) - w_star.norm(p=2, dim=dim)
      return x
  
file_path: pytorch-struct/torch_struct/semirings/sparse_max.py
imports: import torch
  from .semirings import _BaseLog
label_desc: Use image node_id 1 for calling the _SimplexProject obj's underlying member method code with example usage: obj.forward(ctx, input, dim, z) and returns: x