From 4b246082301607c2a446edb2684389e89c175909 Mon Sep 17 00:00:00 2001 From: chenyanlann <62465397+chenyanlann@users.noreply.github.com> Date: Wed, 3 Nov 2021 16:39:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9c=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.input_shape的类型应为int32_t 2.input_data的类型应为float* 3.free(input_data)后缺少分号 --- docs/quick_start/c_demo.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/quick_start/c_demo.md b/docs/quick_start/c_demo.md index 55d32c9b3a669..3ef7485dc8306 100644 --- a/docs/quick_start/c_demo.md +++ b/docs/quick_start/c_demo.md @@ -90,8 +90,8 @@ int main() { PD_Predictor* predictor = PD_PredictorCreate(config); // 准备输入数据 - float input_shape[4] = {1, 3, 244, 244}; - float input_data = (float*)calloc(1 * 3 * 224 * 224, sizeof(float)); + int32_t input_shape[4] = {1, 3, 244, 244}; + float* input_data = (float*)calloc(1 * 3 * 224 * 224, sizeof(float)); // 获取输入 Tensor PD_OneDimArrayCstr* input_names = PD_PredictorGetInputNames(predictor); @@ -125,7 +125,7 @@ int main() { // 销毁相关对象, 回收相关内存 - free(out_data) + free(out_data); PD_OneDimArrayInt32Destroy(output_shape); PD_TensorDestroy(output_tensor); PD_OneDimArrayCstrDestroy(output_names); @@ -251,8 +251,8 @@ PD_Predictor* predictor = PD_PredictorCreate(config); ```c // 准备输入数据 -float input_shape[4] = {1, 3, 244, 244}; -float input_data = (float*)calloc(1 * 3 * 224 * 224, sizeof(float)); +int32_t input_shape[4] = {1, 3, 244, 244}; +float* input_data = (float*)calloc(1 * 3 * 224 * 224, sizeof(float)); // 获取输入 Tensor PD_OneDimArrayCstr* input_names = PD_PredictorGetInputNames(predictor); @@ -296,7 +296,7 @@ PD_TensorCopyToCpuFloat(output_tensor, out_data); ```c // 销毁相关对象, 回收相关内存 -free(out_data) +free(out_data); PD_OneDimArrayInt32Destroy(output_shape); PD_TensorDestroy(output_tensor); PD_OneDimArrayCstrDestroy(output_names);