Skip to content

Commit b4cb00d

Browse files
committed
Debug
1 parent 52e1ef5 commit b4cb00d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

shared/api/c_api_processor.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "ortx_processor.h"
55
#include "image_processor.h"
6+
#include <iostream>
67

78
#include "c_api_utils.hpp"
89

@@ -89,8 +90,10 @@ extError_t ORTX_API_CALL OrtxImagePreProcess(OrtxProcessor* processor, OrtxRawIm
8990
}
9091

9192
auto result_ptr = std::make_unique<TensorResult>();
93+
std::cout << "OrtxImagePreProcess: num_images=" << images_ptr->num_images << std::endl;
9294
status =
9395
processor_ptr->PreProcess(ort_extensions::span(images_ptr->images.get(), images_ptr->num_images), *result_ptr);
96+
std::cout << "OrtxImagePreProcess: Finish PreProcess" << std::endl;
9497
if (status.IsOk()) {
9598
*result = static_cast<OrtxTensorResult*>(result_ptr.release());
9699
} else {

shared/api/image_processor.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
#include <string_view>
5+
#include <iostream>
56

67
#include "nlohmann/json.hpp"
78
#include "file_sys.h"
@@ -154,21 +155,26 @@ ImageProcessor::PreProcess(ort_extensions::span<ImageRawData> image_data,
154155
OrtxStatus ImageProcessor::PreProcess(ort_extensions::span<ImageRawData> image_data, TensorResult& r) const {
155156
std::vector<TensorArgs> inputs(image_data.size());
156157
std::vector<TensorPtr> input_tensor_objects(image_data.size());
158+
std::cout << "ImageProcessor::PreProcess image_data size=" << image_data.size() << std::endl;
157159
for (size_t i = 0; i < image_data.size(); ++i) {
158160
auto& ts_input = inputs[i];
159161
ImageRawData& image = image_data[i];
160162
std::vector<int64_t> shape = {static_cast<int64_t>(image.size())};
163+
for (int n : shape) {
164+
std::cout << n << ",";
165+
}
166+
std::cout << std::endl;
161167
input_tensor_objects[i] = std::make_unique<ortc::Tensor<uint8_t>>(shape, image.data());
162168
ts_input.push_back(input_tensor_objects[i].get());
163169
}
164-
170+
std::cout << "ImageProcessor::PreProcess Finish loop" << std::endl;
165171
std::vector<TensorArgs> outputs;
166172
OrtxRunner runner(op_plan_);
167173
auto status = runner.Run(inputs, outputs);
168174
if (!status.IsOk()) {
169175
return status;
170176
}
171-
177+
std::cout << "ImageProcessor::PreProcess Finish Push" << std::endl;
172178
// clear the input tensors
173179
input_tensor_objects.clear();
174180

@@ -182,6 +188,7 @@ OrtxStatus ImageProcessor::PreProcess(ort_extensions::span<ImageRawData> image_d
182188
if (status.IsOk()) {
183189
r.SetTensors(std::move(img_result));
184190
}
191+
std::cout << "ImageProcessor::PreProcess Finish" << std::endl;
185192

186193
return status;
187194
}

0 commit comments

Comments
 (0)