code: def apply_noise(weights, noise_config):
      if noise_config is None:
          return weights
      noise_type = noise_config.get("type", "normal")
      if noise_type == "normal":
          ratio = noise_config.get("ratio", 1e-3)
          std = np.std(weights)
          noise = np.random.normal(0, std * ratio, size=weights.shape)
      elif noise_type == "uniform":
          ratio = noise_config.get("ratio", 1e-3)
          mean, _max = np.mean(weights), np.max(weights)
          width = (_max - mean) * ratio
          noise = np.random.uniform(-width, width, size=weights.shape)
      else:
          raise NotImplementedError
      return weights + noise
  
imports: from .basic_model import BasicModel
  import tensorflow
  import numpy
  import copy
label_desc: Use image node_id 1 for calling a global function with example usage: apply_noise(weights, noise_config) and returns: unknown, weights