Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#183 from chenyanlann/master
Browse files Browse the repository at this point in the history
fix:修改c示例代码的bug
  • Loading branch information
winter-wang authored Nov 9, 2021
2 parents ee7f6ab + 4b24608 commit 0042267
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/quick_start/c_demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -125,7 +125,7 @@ int main() {


// 销毁相关对象, 回收相关内存
free(out_data)
free(out_data);
PD_OneDimArrayInt32Destroy(output_shape);
PD_TensorDestroy(output_tensor);
PD_OneDimArrayCstrDestroy(output_names);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0042267

Please sign in to comment.