code: def add_noise(
      Z_cf: torch.Tensor,
      noise: "NormalActionNoise",
      act_low: float,
      act_high: float,
      step: int,
      exploration_steps: int,
      device: torch.device,
      **kwargs,
  ) -> torch.Tensor:
      """
      Add noise to the counterfactual embedding.
  
      Parameters
      ----------
      Z_cf
         Counterfactual embedding.
      noise
         Noise generator object.
      act_low
          Action lower bound.
      act_high
          Action upper bound.
      step
         Training step.
      exploration_steps
         Number of exploration steps. For the first `exploration_steps`, the noised counterfactual embedding
         is sampled uniformly at random.
      device
          Device to send data to.
  
      Returns
      -------
      Z_cf_tilde
         Noised counterfactual embedding.
      """
      # Generate noise.
      eps = torch.tensor(noise(Z_cf.shape)).float().to(device)
  
      if step > exploration_steps:
          Z_cf_tilde = Z_cf + eps
          Z_cf_tilde = torch.clamp(
              Z_cf_tilde, min=act_low, max=act_high
          )
      else:
          # For the first exploration_steps, the action is sampled from a uniform distribution between
          # [act_low, act_high] to encourage exploration. After that, the algorithm returns to the normal exploration.
          Z_cf_tilde = (
              act_low + (act_high - act_low) * torch.rand_like(Z_cf)
          ).to(device)
  
      return Z_cf_tilde
  
imports: import os
  import random
  from typing import List, Dict, Callable, Union, Optional, TYPE_CHECKING
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.utils.data import DataLoader, Dataset
  from alibi.explainers.backends.cfrl_base import CounterfactualRLDataset
  from alibi.models.pytorch.actor_critic import Actor, Critic
label_desc: Use image node_id 11 for calling a global function with example usage: add_noise(Z_cf, noise, act_low, act_high, step, exploration_steps, device) and returns: Z_cf_tilde