code: def sparse_channels_to_rgb(X):
      assert (X >= 0).all()
  
      K = X.shape[-1]
  
      rgb = 0
      for i in range(K):
          ang = 360 * i / K
          color = hue_to_rgb(ang)
          color = color[tuple(None for _ in range(len(X.shape) - 1))]
          rgb += X[..., i, None] * color
  
      rgb += (
          np.ones(X.shape[:-1])[..., None]
          * (X.sum(-1) - X.max(-1))[..., None]
      )
      rgb /= 1e-4 + np.linalg.norm(rgb, axis=-1, keepdims=True)
      rgb *= np.linalg.norm(X, axis=-1, keepdims=True)
  
      return rgb
  
imports: import math
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: sparse_channels_to_rgb(X) and returns: rgb