Richard Burton | dc0c6ed | 2020-04-08 16:39:05 +0100 | [diff] [blame] | 1 | # Copyright © 2020 Arm Ltd. All rights reserved. |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | import pytest |
| 4 | import pyarmnn as ann |
| 5 | |
| 6 | |
| 7 | def test_activation_function(): |
| 8 | assert 0 == ann.ActivationFunction_Sigmoid |
| 9 | assert 1 == ann.ActivationFunction_TanH |
| 10 | assert 2 == ann.ActivationFunction_Linear |
| 11 | assert 3 == ann.ActivationFunction_ReLu |
| 12 | assert 4 == ann.ActivationFunction_BoundedReLu |
| 13 | assert 5 == ann.ActivationFunction_SoftReLu |
| 14 | assert 6 == ann.ActivationFunction_LeakyReLu |
| 15 | assert 7 == ann.ActivationFunction_Abs |
| 16 | assert 8 == ann.ActivationFunction_Sqrt |
| 17 | assert 9 == ann.ActivationFunction_Square |
| 18 | |
| 19 | |
| 20 | def test_permutation_vector(): |
| 21 | pv = ann.PermutationVector((0, 2, 3, 1)) |
| 22 | assert pv[0] == 0 |
| 23 | assert pv[2] == 3 |
| 24 | |
| 25 | pv2 = ann.PermutationVector((0, 2, 3, 1)) |
| 26 | assert pv == pv2 |
| 27 | |
| 28 | pv4 = ann.PermutationVector((0, 3, 1, 2)) |
| 29 | assert pv.IsInverse(pv4) |
Cathal Corbett | bddb258 | 2021-11-23 11:49:23 +0000 | [diff] [blame] | 30 | |
| 31 | with pytest.raises(ValueError) as err: |
| 32 | pv4[4] |
| 33 | |
| 34 | assert err.type is ValueError |