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

@@ -726,7 +726,7 @@ namespace ANSCENTER {
std::vector<Object> ANSONNXSEG::postprocess(
const cv::Size& origSize,
const cv::Size& letterboxSize,
const std::vector<Ort::Value>& outputs,
std::vector<Ort::Value>& outputs,
const std::string& camera_id)
{
std::lock_guard<std::recursive_mutex> lock(_mutex);
@@ -738,9 +738,11 @@ namespace ANSCENTER {
std::to_string(outputs.size()));
}
// Extract output tensors
const float* detections = outputs[0].GetTensorData<float>();
const float* prototypes = outputs[1].GetTensorData<float>();
// Extract output tensors. GetTensorMutableData (not GetTensorData)
// on DML — const variant hangs on AMD after ~8 calls. Read-only
// despite the name.
const float* detections = outputs[0].GetTensorMutableData<float>();
const float* prototypes = outputs[1].GetTensorMutableData<float>();
// Get tensor shapes
auto detectionShape = outputs[0].GetTensorTypeAndShapeInfo().GetShape(); // [1, 116, N]