pnnx和ncnn输出不一致

0qx6xfy6  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(71)

error log | 日志或报错信息 | ログ

model | 模型 | モデル

  1. original model
    model.trace.pt ,是声纹识别中的ecapa_tdnn模型

how to reproduce | 复现步骤 | 再現方法

转换之后,pnnx和ncnn的输出不一致,ncnn 和 pnnx版本是 20240410

python model.trace_ncnn.py
python model.trace_pnnx.py

ecapa_ncnn.zip 包含: model.trace_ncnn.py / model.trace.ncnn.bin / model.trace.ncnn.param

ecapa_pnnx.zip 包含: model.trace_pnnx.py / model.trace.pnnx.bin / model.trace.pnnx.param

ecapa_pnnx_onnx.zip 包含: model.trace.pnnx.onnx

求大佬们指点

n8ghc7c1

n8ghc7c11#

输出相差了一点点点点,这属于计算精度误差了

$ python model.trace_pnnx.py 
tensor([[ 0.1400, -0.2828, -0.5181,  0.2307,  0.3460,  0.0774, -0.6353, -0.1958,
          0.1738, -0.3608,  0.5223,  0.1877, -0.1621,  0.1208, -0.2258, -0.1601,
         -0.0332, -0.0391, -0.3655, -0.1871, -0.0534, -0.2243,  0.3133,  0.1827,
          0.1061, -0.0615,  0.4327, -0.0981, -0.2923, -0.2476, -0.2380,  0.1585,
         -0.2637,  0.1604, -0.0508, -0.0714, -0.5845,  0.0253, -0.3980,  0.2251,
          0.0287,  0.0060, -0.0300,  0.0634,  0.6234,  0.1347,  0.3988, -0.2168,
         -0.0460,  0.6531, -0.2854,  0.0215, -0.1211, -0.0854, -0.2077,  0.0290,
         -0.1103, -0.1300,  0.0507,  0.2635,  0.3082,  0.6101, -0.1766, -0.1702,
         -0.1246,  0.4763,  0.2022, -0.4359,  0.3345,  0.1708,  0.0810, -0.1107,
         -0.1019,  0.1704, -0.1785, -0.1499,  0.1907, -0.0405,  0.1474, -0.1338,
         -0.2929,  0.2653, -0.1808,  0.3689,  0.4634,  0.0135,  0.4080, -0.0670,
         -0.1374,  0.1871,  0.1488,  0.1941, -0.0196, -0.2058, -0.3350,  0.1387,
         -0.0067,  0.2233, -0.0132, -0.1989, -0.0658, -0.2675, -0.1168, -0.1815,
          0.1731,  0.3961, -0.2183,  0.1531, -0.2926,  0.1886,  0.1728, -0.3310,
         -0.2079,  0.0906, -0.3737, -0.1360,  0.0023, -0.1594, -0.0015,  0.1914,
          0.0472, -0.1435, -0.2768,  0.0383, -0.2562,  0.3639,  0.0981,  0.0953,
         -0.1279, -0.2075,  0.0585,  0.0861, -0.2153, -0.0496, -0.1966,  0.0258,
         -0.1812,  0.2504,  0.2900,  0.6274,  0.0266, -0.1886, -0.5782, -0.1856,
         -0.3242, -0.3501,  0.0114,  0.0349,  0.1965, -0.4656, -0.1816,  0.2732,
          0.2555, -0.1971, -0.2233,  0.0791, -0.1702, -0.4078,  0.2046, -0.5315,
          0.1236, -0.1611,  0.3585, -0.0098, -0.0929, -0.2805, -0.1557, -0.1550,
          0.1120, -0.2177, -0.3681,  0.0665, -0.1866, -0.1149,  0.0270, -0.0657,
          0.2268,  0.1242,  0.0178,  0.0139, -0.1057, -0.0923, -0.0042, -0.3168,
          0.0623,  0.4113,  0.2128, -0.1400,  0.4844,  0.0825, -0.2412, -0.1169]],
       grad_fn=<AddmmBackward0>)

$ python model.trace_ncnn.py 
tensor([[ 0.1371, -0.2848, -0.5198,  0.2269,  0.3462,  0.0772, -0.6329, -0.1968,
          0.1769, -0.3590,  0.5221,  0.1877, -0.1586,  0.1209, -0.2247, -0.1585,
         -0.0346, -0.0390, -0.3672, -0.1852, -0.0543, -0.2275,  0.3149,  0.1836,
          0.1058, -0.0609,  0.4354, -0.0967, -0.2896, -0.2464, -0.2383,  0.1582,
         -0.2640,  0.1595, -0.0488, -0.0737, -0.5866,  0.0252, -0.3971,  0.2250,
          0.0305,  0.0064, -0.0324,  0.0652,  0.6223,  0.1339,  0.3989, -0.2176,
         -0.0451,  0.6506, -0.2841,  0.0227, -0.1209, -0.0862, -0.2075,  0.0258,
         -0.1110, -0.1296,  0.0518,  0.2613,  0.3066,  0.6104, -0.1778, -0.1723,
         -0.1245,  0.4752,  0.2035, -0.4364,  0.3353,  0.1685,  0.0800, -0.1085,
         -0.1026,  0.1649, -0.1793, -0.1479,  0.1923, -0.0388,  0.1465, -0.1330,
         -0.2922,  0.2659, -0.1829,  0.3662,  0.4643,  0.0128,  0.4088, -0.0655,
         -0.1377,  0.1870,  0.1475,  0.1973, -0.0193, -0.2070, -0.3344,  0.1375,
         -0.0049,  0.2222, -0.0130, -0.1970, -0.0688, -0.2658, -0.1176, -0.1812,
          0.1722,  0.3953, -0.2151,  0.1506, -0.2935,  0.1921,  0.1718, -0.3322,
         -0.2096,  0.0899, -0.3719, -0.1362,  0.0039, -0.1602,  0.0013,  0.1919,
          0.0451, -0.1426, -0.2742,  0.0406, -0.2549,  0.3642,  0.0979,  0.0947,
         -0.1268, -0.2079,  0.0608,  0.0876, -0.2172, -0.0494, -0.1987,  0.0238,
         -0.1812,  0.2502,  0.2886,  0.6268,  0.0262, -0.1877, -0.5772, -0.1860,
         -0.3232, -0.3521,  0.0103,  0.0332,  0.1984, -0.4655, -0.1832,  0.2703,
          0.2558, -0.1984, -0.2231,  0.0786, -0.1716, -0.4097,  0.2049, -0.5301,
          0.1247, -0.1590,  0.3614, -0.0090, -0.0922, -0.2836, -0.1541, -0.1544,
          0.1119, -0.2168, -0.3667,  0.0669, -0.1876, -0.1150,  0.0287, -0.0656,
          0.2287,  0.1224,  0.0184,  0.0113, -0.1083, -0.0906, -0.0057, -0.3168,
          0.0627,  0.4113,  0.2103, -0.1394,  0.4858,  0.0808, -0.2390, -0.1162]])

相关问题