code: def l1_loss(pred: Tensor, target: Tensor) -> Tensor:
      """L1 loss.
  
      Args:
          pred (Tensor): The prediction.
          target (Tensor): The learning target of the prediction.
  
      Returns:
          Tensor: Calculated loss
      """
      if target.numel() == 0:
          return pred.sum() * 0
  
      assert pred.size() == target.size()
      loss = torch.abs(pred - target)
      return loss
  
file_path: mmdetection/mmdet/models/losses/smooth_l1_loss.py
imports: from typing import Optional
  import torch
  import torch.nn
  from torch import Tensor
  from mmdet.registry import MODELS
  from .utils import weighted_loss
label_desc: Use image node_id 2 for calling a global function with example usage: l1_loss(pred, target) and returns: loss, unknown