test_task.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:pumpp 作者: bmcfee 项目源码 文件源码
def test_task_chord_fields(SPARSE):

    trans = pumpp.task.ChordTransformer(name='mychord', sparse=SPARSE)

    assert set(trans.fields.keys()) == set(['mychord/pitch',
                                            'mychord/root',
                                            'mychord/bass'])

    assert trans.fields['mychord/pitch'].shape == (None, 12)
    assert trans.fields['mychord/pitch'].dtype is np.bool

    if SPARSE:
        assert trans.fields['mychord/root'].shape == (None, 1)
        assert np.issubdtype(trans.fields['mychord/root'].dtype, np.int)
        assert trans.fields['mychord/bass'].shape == (None, 1)
        assert np.issubdtype(trans.fields['mychord/bass'].dtype, np.int)
    else:
        assert trans.fields['mychord/root'].shape == (None, 13)
        assert trans.fields['mychord/root'].dtype is np.bool
        assert trans.fields['mychord/bass'].shape == (None, 13)
        assert trans.fields['mychord/bass'].dtype is np.bool
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号