f6bd12eb18056ea0ca0364b6e458f96ec0ff7585,rllib/utils/schedules/tests/test_schedules.py,TestSchedules,test_exponential_schedule,#TestSchedules#,58

Before Change


        config = dict(initial_p=2.0, decay_rate=0.99, schedule_timesteps=100)

        for fw in framework_iterator(frameworks=["tf", "tfe", "torch", None]):
            fw_ = fw if fw != "tfe" else "tf"
            exponential = from_config(
                ExponentialSchedule, config, framework=fw_)
            for t in ts:
                out = exponential(t)
                check(out, 2.0 * 0.99**(t / 100), decimals=4)

    def test_piecewise_schedule(self):
        ts = [0, 5, 10, 100, 90, 2, 1, 99, 27]
        expected = [50.0, 60.0, 70.0, 14.5, 14.5, 54.0, 52.0, 14.5, 140.0]

After Change


    def test_exponential_schedule(self):
        decay_rate = 0.2
        ts = [0, 5, 10, 100, 90, 2, 1, 99, 23]
        expected = [2.0 * decay_rate**(t / 100) for t in ts]
        config = dict(
            initial_p=2.0, decay_rate=decay_rate, schedule_timesteps=100)

        for fw in framework_iterator(
                frameworks=["tf2", "tf", "tfe", "torch", None]):
            exponential = from_config(
                ExponentialSchedule, config, framework=fw)
            for t, e in zip(ts, expected):
                out = exponential(t)
                check(out, e, decimals=4)

            ts_as_tensors = self._get_framework_tensors(ts, fw)
            for t, e in zip(ts_as_tensors, expected):
                out = exponential(t)
                assert fw != "tf" or isinstance(out, tf.Tensor)
                check(out, e, decimals=4)

    def test_piecewise_schedule(self):
        ts = [0, 5, 10, 100, 90, 2, 1, 99, 27]
        expected = [50.0, 60.0, 70.0, 14.5, 14.5, 54.0, 52.0, 14.5, 140.0]
        config = dict(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 20

Instances


Project Name: ray-project/ray
Commit Name: f6bd12eb18056ea0ca0364b6e458f96ec0ff7585
Time: 2020-07-30
Author: sven@anyscale.io
File Name: rllib/utils/schedules/tests/test_schedules.py
Class Name: TestSchedules
Method Name: test_exponential_schedule


Project Name: ray-project/ray
Commit Name: f6bd12eb18056ea0ca0364b6e458f96ec0ff7585
Time: 2020-07-30
Author: sven@anyscale.io
File Name: rllib/utils/schedules/tests/test_schedules.py
Class Name: TestSchedules
Method Name: test_exponential_schedule


Project Name: ray-project/ray
Commit Name: f6bd12eb18056ea0ca0364b6e458f96ec0ff7585
Time: 2020-07-30
Author: sven@anyscale.io
File Name: rllib/utils/schedules/tests/test_schedules.py
Class Name: TestSchedules
Method Name: test_polynomial_schedule


Project Name: ray-project/ray
Commit Name: f6bd12eb18056ea0ca0364b6e458f96ec0ff7585
Time: 2020-07-30
Author: sven@anyscale.io
File Name: rllib/utils/schedules/tests/test_schedules.py
Class Name: TestSchedules
Method Name: test_linear_schedule