def test_median_list_odd(self): observations = [ 0, 340, 70, 140, 200, 180, 210, 150, 100, 130, 140, 180, 190, 160, 290, 50, 220, 190, 200 ] calculated_median = median(observations) self.assertEqual(calculated_median, 180)
def test_median_list_even_pytorch_gpu(self): observations = [ 0, 340, 70, 140, 200, 180, 210, 150, 100, 130, 140, 180, 190, 160, 290, 50, 220, 190, 200, 210 ] calculated_median = median(observations, use_pytorch=True, device=Device.GPU) self.assertEqual(calculated_median, 185)
def test_median_list_odd_ex_2_pytorch_cpu(self): observations = [0.3, 0.4, 0.8, 1.4, 1.8, 2.1, 5.9, 11.6, 16.9] calculated_median = median(observations, use_pytorch=True, device=Device.CPU) self.assertEqual(calculated_median, 1.8)
def test_median_list_odd_ex_2(self): observations = [0.3, 0.4, 0.8, 1.4, 1.8, 2.1, 5.9, 11.6, 16.9] calculated_median = median(observations) self.assertEqual(calculated_median, 1.8)