code: def impulse_noise(x: Tensor, severity: int = 1) -> Tensor:
      """Applies impulse noise"""
      imagenet_amount = [0.03, 0.06, 0.09, 0.17, 0.27]
      cifar_amount = [0.01, 0.02, 0.03, 0.05, 0.07]
      amount = interpolate_severity(
          x, cifar_amount, imagenet_amount, severity
      )
      salt = torch.bernoulli(torch.full_like(x, amount / 2))
      pepper = torch.bernoulli(torch.full_like(x, 1 - amount / 2))
      return torch.max(torch.min(x, pepper), salt)
  
file_path: TorchDrift/torchdrift/data/functional/corruption_functions.py
imports: from torch import Tensor
  import torch
  import math
  import torchdrift.utils
label_desc: Use image node_id 5 for calling a global function with example usage: impulse_noise(x, severity) and returns: torch