You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_paramdict.py 455 B

12345678910111213141516171819202122
  1. # Copyright 2020 Tencent
  2. # SPDX-License-Identifier: BSD-3-Clause
  3. import pytest
  4. import ncnn
  5. def test_paramdict():
  6. pd = ncnn.ParamDict()
  7. assert pd.type(0) == 0
  8. assert pd.get(0, -1) == -1
  9. pd.set(1, 1)
  10. assert pd.type(1) == 2 and pd.get(1, -1) == 1
  11. pd.set(2, 2.0)
  12. assert pd.type(2) == 3 and pd.get(2, -2.0) == 2.0
  13. mat = ncnn.Mat(1)
  14. pd.set(3, mat)
  15. assert pd.type(3) == 4 and pd.get(3, ncnn.Mat()).dims == mat.dims