code: def __init__(
      self,
      index,
      domain,
      frequency,
      phases,
      amplitudes,
      noise_std,
      num_samples,
      transform=None,
      target_transform=None,
      np_random=None,
  ):
      super(HarmonicTask, self).__init__(index, None)  # Regression task
      self.domain = domain
      self.frequency = frequency
      self.phases = phases
      self.amplitudes = amplitudes
      self.noise_std = noise_std
      self.num_samples = num_samples
  
      self.transform = transform
      self.target_transform = target_transform
  
      if np_random is None:
          np_random = np.random.RandomState(None)
  
      a_1, a_2 = self.amplitudes
      b_1, b_2 = self.phases
  
      self._inputs = self.domain + np_random.randn(num_samples, 1)
      self._targets = a_1 * np.sin(
          frequency * self._inputs + b_1
      ) + a_2 * np.sin(2 * frequency * self._inputs + b_2)
      if (noise_std is not None) and (noise_std > 0.0):
          self._targets += noise_std * np_random.randn(num_samples, 1)
  
file_path: pytorch-meta/torchmeta/toy/harmonic.py
imports: import numpy
  from torchmeta.utils.data import Task, MetaDataset
label_desc: Use image node_id 1 to create a new HarmonicTask object from inherited base classes: Task with example: obj = HarmonicTask(index, domain, frequency, phases, amplitudes, noise_std, num_samples, transform, target_transform, np_random)