Tencent / TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.
Other
4.4k stars 770 forks source link

TNN_NS::NCHW_FLOAT结果不对 #1914

Closed SerBad closed 1 year ago

SerBad commented 1 year ago

1. 环境(environment)

auto image = env->GetFloatArrayElements(imageSource, JNI_FALSE); TNN_NS::DimsVector target_dims = {1, 3, 256, 256}; auto input_mat = std::make_shared(TNN_NS::DEVICE_ARM, TNN_NS::NCHW_FLOAT, target_dims, image); const double input_data = static_cast<double >(input_mat->GetData());

image是一串0.0,input_data得到的是0 image是一串1.0,input_data得到的是0.007813 image是一串5.0,input_data得到的是2048.000493

TNN_NS::NCHW_FLOAT不该是输入什么就是什么值吗?为什么会和输入的值不一样,求解答。

6. 运行日志(runtime log)

 将日志粘贴在这里
 Paste log here or pastebin

7. 截图(Screenshots)

 将截图粘贴在这里
 Paste screenshorts here or pastebin
SerBad commented 1 year ago

const double input_data = static_cast<double >(input_mat->GetData());

这一部,我错了,这里应该是 const float input_data = static_cast<float >(input_mat->GetData());

SerBad commented 1 year ago

const double input_data = static_cast<double >(input_mat->GetData());

这一部,我错了,这里应该是 const float input_data = static_cast<float >(input_mat->GetData());