mirror of
https://github.com/Tencent/ncnn.git
synced 2026-10-17 04:41:47 +08:00
23 lines
455 B
Python
23 lines
455 B
Python
# Copyright 2020 Tencent
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
import pytest
|
|
|
|
import ncnn
|
|
|
|
|
|
def test_paramdict():
|
|
pd = ncnn.ParamDict()
|
|
assert pd.type(0) == 0
|
|
assert pd.get(0, -1) == -1
|
|
|
|
pd.set(1, 1)
|
|
assert pd.type(1) == 2 and pd.get(1, -1) == 1
|
|
|
|
pd.set(2, 2.0)
|
|
assert pd.type(2) == 3 and pd.get(2, -2.0) == 2.0
|
|
|
|
mat = ncnn.Mat(1)
|
|
pd.set(3, mat)
|
|
assert pd.type(3) == 4 and pd.get(3, ncnn.Mat()).dims == mat.dims
|