code: def restricted_softmax(src, dim: int = -1, margin: float = 0.0):
      src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0.0)
      out = (src - src_max).exp()
      out = out / (
          out.sum(dim=dim, keepdim=True) + (margin - src_max).exp()
      )
      return out
  
imports: import math
  from typing import Optional
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch.nn import Parameter
  from torch_geometric.nn.conv import MessagePassing
  from torch_geometric.nn.conv.gcn_conv import gcn_norm
  from torch_geometric.nn.inits import kaiming_uniform, uniform
  from torch_geometric.typing import Adj, OptPairTensor, OptTensor, SparseTensor
label_desc: Use image node_id 1 for calling a global function with example usage: restricted_softmax(src, dim, margin) and returns: out