ea93013082ecd0bd2835573403c7d65f69d81cd8,thinc/tests/test_config.py,,test_objects_from_config,#,465

Before Change


    def decaying(base_rate: float, repeat: int) -> List[float]:
        return repeat * [base_rate]

    config = Config().from_str(TEST_CONFIG)
    loaded = registry.make_from_config(config)
    optimizer = loaded["optimizer"]
    assert optimizer.b1 == 0.2
    assert optimizer.learn_rate == [0.001, 0.001, 0.001, 0.001]

After Change




def test_objects_from_config():
    config = {
        "optimizer": {
            "@optimizers": "my_cool_optimizer.v1",
            "beta1": 0.2,
            "learn_rate": {
                "@schedules": "my_cool_repetitive_schedule.v1",
                "base_rate": 0.001,
                "repeat": 4,
            },
        }
    }

    @thinc.registry.optimizers.register("my_cool_optimizer.v1")
    def make_my_optimizer(learn_rate: List[float], beta1: float):
        return RAdam(learn_rate, beta1=beta1)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: explosion/thinc
Commit Name: ea93013082ecd0bd2835573403c7d65f69d81cd8
Time: 2020-01-08
Author: ines@ines.io
File Name: thinc/tests/test_config.py
Class Name:
Method Name: test_objects_from_config


Project Name: HyperGAN/HyperGAN
Commit Name: e4fd7cb66ca799fcb11af9ec50ac778186d0a9d7
Time: 2017-06-03
Author: martyn@255bits.com
File Name: tests/discriminators/pyramid_discriminator_test.py
Class Name: PyramidDiscriminatorTest
Method Name: test_create


Project Name: reinforceio/tensorforce
Commit Name: e08f71bf13a17b383cace9fda9b8a7d4ccb2b173
Time: 2016-12-30
Author: aok25@cl.cam.ac.uk
File Name: tensorforce/examples/openai_gym2.py
Class Name:
Method Name: main