code: def get_loss_fn(loss_name: str, cfg: AttrDict):
      set_cpu_device()
      loss_fn = LOSS_REGISTRY[loss_name](cfg)
      loss_fn.__dict__["loss_name"] = loss_name
  
      _recursive_register(loss_fn)
      return loss_fn
  
file_path: lightning-flash/src/flash/image/embedding/losses/vissl_losses.py
imports: from typing import List, Union
  from torch import Tensor
  from flash.core.registry import FlashRegistry
  from flash.core.utilities.imports import _VISSL_AVAILABLE
label_desc: Use image node_id 2 for calling a global function with example usage: get_loss_fn(loss_name, cfg) and returns: loss_fn