Fix AMD by changing from GetTensorData<T>() to GetTensorMutableData<T>()

This commit is contained in:
2026-04-28 13:25:02 +10:00
parent f4b74c837e
commit dcf974c35c
18 changed files with 359 additions and 48 deletions

View File

@@ -28,7 +28,11 @@ namespace ANSCENTER {
void warmupModel();
bool Init(const std::string& modelPath, const cv::Size& targetInputShape, bool useGPU = true);
bool preprocess(const cv::Mat& image, float*& blob, std::vector<int64_t>& inputTensorShape);
std::vector<Object> postprocess(const std::vector<Ort::Value>& outputTensors, const std::string& camera_id);
// outputTensors is non-const because GetTensorMutableData() (the
// ORT API that doesn't hang on AMD DirectML) requires a non-const
// Ort::Value receiver. See comment at the GetTensorMutableData
// call site in postprocess() for the full rationale.
std::vector<Object> postprocess(std::vector<Ort::Value>& outputTensors, const std::string& camera_id);
std::vector<Object> classify(const cv::Mat& image, const std::string& camera_id);
private: