code: def stable_softmax(x):
      z = x - torch.max(x, dim=1, keepdim=True)[0]
      numerator = torch.exp(z)
      denominator = torch.sum(numerator, dim=1, keepdim=True)
      softmax = numerator / denominator
      return softmax
  
imports: import copy
  from collections import defaultdict
  from typing import List
  import torch
  import torch.nn.functional
  from avalanche.models import MultiTaskModule, avalanche_forward
label_desc: Use image node_id 1 for calling a global function with example usage: stable_softmax(x) and returns: softmax