code: def build_noise_sampler(noise_type: R3FNoiseType, eps: float):
      """
      Given a `noise_type` (`R3FNoiseType`): builds a `torch.distribution`
      capable of generating noise within the passed in `eps` (`float`).
      """
      if noise_type == R3FNoiseType.UNIFORM:
          return torch.distributions.uniform.Uniform(low=-eps, high=eps)
      elif noise_type == R3FNoiseType.NORMAL:
          return torch.distributions.normal.Normal(loc=0.0, scale=eps)
      else:
          raise Exception(f"Unknown noise type: {noise_type}")
  
imports: from contextlib import AbstractContextManager
  from enum import Enum
  from typing import Dict
  import torch
  import torch.nn.functional
  from pytext.common.constants import Stage
  from pytext.config import ConfigBase
  from pytext.utils.precision import maybe_float
label_desc: Use image node_id 1 for calling a global function with example usage: build_noise_sampler(noise_type, eps) and returns: torch, torch