class_docstr: An implementation of exact Entmax with alpha=1.5 (B. Peters, V. Niculae, A. Martins). See
  :cite:`https://arxiv.org/abs/1905.05702 for detailed description.
  Source: https://github.com/deep-spin/entmax
code: def forward(ctx, input, dim=-1):
      ctx.dim = dim
  
      max_val, _ = input.max(dim=dim, keepdim=True)
      input = (
          input - max_val
      )  # same numerical stability trick as for softmax
      input = input / 2  # divide by 2 to solve actual Entmax
  
      tau_star, _ = Entmax15Function._threshold_and_support(input, dim)
      output = torch.clamp(input - tau_star, min=0) ** 2
      ctx.save_for_backward(output)
      return output
  
imports: from torch import nn
  from torch.autograd import Function
  import torch.nn.functional
  import torch
label_desc: Use image node_id 1 for calling the Entmax15Function obj's underlying member method code with example usage: obj.forward(ctx, input, dim) and returns: output