コード例 #1
0
ファイル: tutorial.py プロジェクト: hugh-whitesource/spock
def main():
    # A simple description
    description = 'spock Advanced Tutorial'
    # Build out the parser by passing in Spock config objects as *args after description
    config = ConfigArgBuilder(ModelConfig, DataConfig, SGDConfig, desc=description).generate()
    # Instantiate our neural net using
    basic_nn = BasicNet(model_config=config.ModelConfig)
    # Make some random data (BxH): H has dim of features in
    x_data = torch.rand(config.DataConfig.n_samples, config.ModelConfig.n_features)
    y_data = torch.randint(0, 3, (config.DataConfig.n_samples,))
    # Run some training
    train(x_data, y_data, basic_nn, config.ModelConfig, config.DataConfig, config.SGDConfig)
コード例 #2
0
ファイル: tutorial.py プロジェクト: hugh-whitesource/spock
def main():
    # A simple description
    description = 'spock Tutorial'
    # Build out the parser by passing in Spock config objects as *args after description
    config = ConfigArgBuilder(
        ModelConfig, desc=description,
        create_save_path=True).save(file_extension='.toml').generate()
    # Instantiate our neural net using
    basic_nn = BasicNet(model_config=config.ModelConfig)
    # Make some random data (BxH): H has dim of features in
    test_data = torch.rand(10, config.ModelConfig.n_features)
    result = basic_nn(test_data)
    print(result)