Skip to content

Commit

Permalink
Merge pull request #2184 from alibaba/feature/sync
Browse files Browse the repository at this point in the history
[MNN:Sync] Sync Internal 2.3.0
  • Loading branch information
jxt1234 authored Dec 30, 2022
2 parents abf8f38 + 5dc39a5 commit c247644
Show file tree
Hide file tree
Showing 376 changed files with 37,229 additions and 3,788 deletions.
4 changes: 4 additions & 0 deletions demo/exec/pictureRecognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ int main(int argc, const char* argv[]) {
return 0;
}
std::shared_ptr<Interpreter> net(Interpreter::createFromFile(argv[1]), Interpreter::destroy);
net->setCacheFile(".cachefile");
net->setSessionMode(Interpreter::Session_Backend_Auto);
net->setSessionHint(Interpreter::MAX_TUNING_NUMBER, 5);
ScheduleConfig config;
config.type = MNN_FORWARD_AUTO;
// BackendConfig bnconfig;
Expand Down Expand Up @@ -154,5 +157,6 @@ int main(int argc, const char* argv[]) {
MNN_PRINT("%d, %f\n", tempValues[i].first, tempValues[i].second);
}
}
net->updateCacheFile(session);
return 0;
}
1 change: 1 addition & 0 deletions docs/compile/cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ MNN使用CMake构建项目,CMake中的宏定义列表如下:
| MNN_IMGCODECS | 构建MNN的OpenCV功能是否开启`图像编解码`,默认为`OFF` |
| MNN_OPENCV_TEST | 构建MNN的OpenCV功能是否开启单元测试,默认为`OFF` |
| MNN_OPENCV_BENCH | 构建MNN的OpenCV功能是否开启性能benchmark,默认为`OFF` |
| MNN_VULKAN_IMAGE | 构建MNN的Vulkan后端时采用Image内存模式,以便支持FP16和部分移动端上GPU的加速,默认为`ON` |
15 changes: 15 additions & 0 deletions docs/cpp/Interpreter.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,21 @@ void setCacheFile(const char* cacheFile, size_t keySize = 128);
返回:`void`
---
### setExternalFile
```cpp
void setExternalFile(const char* file, size_t flag = 128);
```
设置额外文件,额外文件是指存储了模型中权重,常量等数据的文件,在创建`Session`时会从该文件中加载权重等数据。

*该函数需在`createSession`前调用*

参数:
- `file` 额外文件名
- `flag` 保留参数,现在未使用

返回:`void`

---
### updateCacheFile
```cpp
Expand Down
12 changes: 12 additions & 0 deletions docs/pymnn/Interpreter.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ Interpreter是MNN V2接口中模型数据的持有者。使用MNN推理时,有

返回类型:`None`

---
### `setExternalFile(path)`

设置额外数据文件路径,使用该文件中的数据作为权重或常量

参数:
- `path:str` 额外数据文件的路径

返回:`None`

返回类型:`None`

---
### `updateCacheFile(session, flag)`

Expand Down
14 changes: 14 additions & 0 deletions docs/pymnn/RuntimeManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ RuntimeManager持有运行时资源,在CPU时持有线程池,内存池等资

返回类型:`None`

---
### `set_external(path)`

设置额外数据文件路径,使用该文件中的数据作为权重或常量

参考:[Interpreter.setExternalFile](Interpreter.html#setexternalfile-path)

参数:
- `path:str`

返回:`None`

返回类型:`None`

---
### `update_cache()`

Expand Down
2 changes: 1 addition & 1 deletion docs/tools/convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Usage:
arg 为测试数据的文件夹,生成方式参考 "正确性校验" 一节
--thredhold arg 当启用 --testdir 后,设置正确性校验的误差允可范围
若不设置,默认是 0.01

--saveExternalData 将权重,常量等数据存储在额外文件中,默认为`false`
```
**说明1: 选项benchmarkModel将模型中例如卷积的weight,BN的mean、var等参数移除,减小转换后模型文件大小,在运行时随机初始化参数,以方便测试模型的性能。**

Expand Down
Loading

0 comments on commit c247644

Please sign in to comment.