code: def forward(self, input):
      return sparsemax(input, self.dim)
  
imports: from torch import nn
  from torch.autograd import Function
  import torch.nn.functional
  import torch
label_desc: Use image node_id 2 for calling the Sparsemax obj's underlying member method code with example usage: obj.forward(input) and returns: sparsemax