Merged
fix: set C++14 for the TensorFlow custom op example #7361
zhangyujia77Add on 12 days ago
fix: set C++14 for the TensorFlow custom op example #7361
Merged
Total: 3 files changed+1-22
Mexamples/01_simd_cpp_api/02_features/00_framework/01_tensorflow/tensorflow_custom/CMakeLists.txt+1-0
| @@ -57,6 +57,7 @@ set_target_properties(custom_ops PROPERTIES | |||
| 57 | # ====================================================================================== | 57 | # ====================================================================================== |
| 58 | target_compile_options(custom_ops PRIVATE | 58 | target_compile_options(custom_ops PRIVATE |
| 59 | ${TF_CFLAGS} | 59 | ${TF_CFLAGS} |
| 60 | + -std=c++14 | ||
| 60 | ) | 61 | ) |
| 61 | 62 | ||
| 62 | target_link_libraries(custom_ops PRIVATE | 63 | target_link_libraries(custom_ops PRIVATE |
| @@ -48,17 +48,6 @@ | |||
| 48 | > .OriginOpType("AddCustom") // name in tf module | 48 | > .OriginOpType("AddCustom") // name in tf module |
| 49 | > .ParseParamsByOperatorFn(AutoMappingByOpFn); | 49 | > .ParseParamsByOperatorFn(AutoMappingByOpFn); |
| 50 | > ``` | 50 | > ``` |
| 51 | - 运行此样例前,需先进入[自定义算子工程样例](../../../99_acl_based/00_acl_compilation/custom_op)目录完成编译、打包和部署。 | ||
| 52 | - | ||
| 53 | - > [!NOTE]注意 | ||
| 54 | - > 需适配插件代码,路径为: `examples/01_simd_cpp_api/02_features/99_acl_based/00_acl_compilation/custom_op/framework/tf_plugin/tensorflow_add_custom_plugin.cc`,需修改插件代码中的TensorFlow调用算子名称OriginOpType为"AddCustom",如下所示: | ||
| 55 | - > | ||
| 56 | - > ```cpp | ||
| 57 | - > REGISTER_CUSTOM_OP("AddCustom") | ||
| 58 | - > .FrameworkType(TENSORFLOW) // type: TENSORFLOW | ||
| 59 | - > .OriginOpType("AddCustom") // name in tf module | ||
| 60 | - > .ParseParamsByOperatorFn(AutoMappingByOpFn); | ||
| 61 | - > ``` | ||
| 62 | 51 | ||
| 63 | - 安装TensorFlow插件包 | 52 | - 安装TensorFlow插件包 |
| 64 | 53 | ||
Mexamples/01_simd_cpp_api/02_features/00_framework/01_tensorflow/tensorflow_custom/README_en.md+0-11
| @@ -48,17 +48,6 @@ Run the following steps in the root directory of this example to build and execu | |||
| 48 | > .OriginOpType("AddCustom") // name in tf module | 48 | > .OriginOpType("AddCustom") // name in tf module |
| 49 | > .ParseParamsByOperatorFn(AutoMappingByOpFn); | 49 | > .ParseParamsByOperatorFn(AutoMappingByOpFn); |
| 50 | > ``` | 50 | > ``` |
| 51 | - Before running this example, navigate to the [Custom Operator Project Example](../../../99_acl_based/00_acl_compilation/custom_op) directory to complete building, packaging, and deployment. | ||
| 52 | - | ||
| 53 | - > [!NOTE] Notice | ||
| 54 | - > The plugin code needs to be adapted. The path is: `examples/01_simd_cpp_api/02_features/99_acl_based/00_acl_compilation/custom_op/framework/tf_plugin/tensorflow_add_custom_plugin.cc`. Modify the TensorFlow invocation operator name OriginOpType in the plugin code to "AddCustom" as shown below: | ||
| 55 | - > | ||
| 56 | - > ```cpp | ||
| 57 | - > REGISTER_CUSTOM_OP("AddCustom") | ||
| 58 | - > .FrameworkType(TENSORFLOW) // type: TENSORFLOW | ||
| 59 | - > .OriginOpType("AddCustom") // name in tf module | ||
| 60 | - > .ParseParamsByOperatorFn(AutoMappingByOpFn); | ||
| 61 | - > ``` | ||
| 62 | 51 | ||
| 63 | - Install the TensorFlow plugin package | 52 | - Install the TensorFlow plugin package |
| 64 | 53 | ||