コード例 #1
0
ファイル: test_types.py プロジェクト: zhangzhe1103/armnn
def test_permutation_vector():
    pv = ann.PermutationVector((0, 2, 3, 1))
    assert pv[0] == 0
    assert pv[2] == 3

    pv2 = ann.PermutationVector((0, 2, 3, 1))
    assert pv == pv2

    pv4 = ann.PermutationVector((0, 3, 1, 2))
    assert pv.IsInverse(pv4)
コード例 #2
0
def test_permutation_vector():
    pv = ann.PermutationVector((0, 2, 3, 1))
    assert pv[0] == 0
    assert pv[2] == 3

    pv2 = ann.PermutationVector((0, 2, 3, 1))
    assert pv == pv2

    pv4 = ann.PermutationVector((0, 3, 1, 2))
    assert pv.IsInverse(pv4)

    with pytest.raises(ValueError) as err:
        pv4[4]

    assert err.type is ValueError
コード例 #3
0
ファイル: test_descriptors.py プロジェクト: vnn0804/armnn
def test_permute_descriptor_default_values():
    pv = ann.PermutationVector((0, 2, 3, 1))
    desc = ann.PermuteDescriptor(pv)
    assert desc.m_DimMappings.GetSize() == 4
    assert desc.m_DimMappings[0] == 0
    assert desc.m_DimMappings[1] == 2
    assert desc.m_DimMappings[2] == 3
    assert desc.m_DimMappings[3] == 1
コード例 #4
0
def test_transpose_descriptor_default_values():
    pv = ann.PermutationVector((0, 3, 2, 1, 4))
    desc = ann.TransposeDescriptor(pv)
    assert desc.m_DimMappings.GetSize() == 5
    assert desc.m_DimMappings[0] == 0
    assert desc.m_DimMappings[1] == 3
    assert desc.m_DimMappings[2] == 2
    assert desc.m_DimMappings[3] == 1
    assert desc.m_DimMappings[4] == 4