code: def _sparsemax_forward(X, dim, k):
      max_val, _ = X.max(dim=dim, keepdim=True)
      X = X - max_val  # same numerical stability trick as softmax
      tau, supp_size = _sparsemax_threshold_and_support(X, dim=dim, k=k)
      output = torch.clamp(X - tau, min=0)
      return output, {"supp_size": supp_size}
  
imports: import torch
  import torch.nn
  from torch.autograd import Function
label_desc: Use image node_id 5 for calling a global function with example usage: _sparsemax_forward(X, dim, k) and returns: output,  dict