From 1abba7263790f7d8a0b28ea1b6563b9eb5fc047b Mon Sep 17 00:00:00 2001 From: oubrejames Date: Fri, 1 Aug 2025 17:32:54 -0500 Subject: [PATCH 1/2] chore: added more logging to error throw --- src/engine.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/engine.cpp b/src/engine.cpp index 3e4b839..d3d58ea 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -224,9 +224,17 @@ rust::Vec Engine::infer(const rust::Vec &input) { input.size() / (dims.d[0] * dims.d[1] * dims.d[2] * mInputDataTypeSize); if (calculatedBatchSize < mMinBatchSize) { - throw std::runtime_error("Input is less the minimum batch size: " + - std::to_string(calculatedBatchSize) + " > " + - std::to_string(mMinBatchSize)); + throw std::runtime_error( + "Input batch size too small.\n" + "Calculation: input.size() = " + std::to_string(input.size()) + + ", dims = [" + std::to_string(dims.d[0]) + ", " + + std::to_string(dims.d[1]) + ", " + std::to_string(dims.d[2]) + "], " + + "mInputDataTypeSize = " + std::to_string(mInputDataTypeSize) + "\n" + + "Computed: " + std::to_string(input.size()) + " / (" + + std::to_string(dims.d[0]) + " * " + std::to_string(dims.d[1]) + " * " + + std::to_string(dims.d[2]) + " * " + std::to_string(mInputDataTypeSize) + + ") = " + std::to_string(calculatedBatchSize) + "\n" + + "Which is less than mMinBatchSize = " + std::to_string(mMinBatchSize)); } if (calculatedBatchSize > mMaxBatchSize) { From 74e3df004761ae46e3b1b9a67d9975a7b715fef5 Mon Sep 17 00:00:00 2001 From: oubrejames Date: Fri, 1 Aug 2025 18:49:04 -0500 Subject: [PATCH 2/2] chore: added more logging to if calculatedBatchSize > mMaxBatchSize --- src/engine.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/engine.cpp b/src/engine.cpp index d3d58ea..c86eadd 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -238,9 +238,17 @@ rust::Vec Engine::infer(const rust::Vec &input) { } if (calculatedBatchSize > mMaxBatchSize) { - throw std::runtime_error("Input is greater than maximum batch size: " + - std::to_string(calculatedBatchSize) + " > " + - std::to_string(mMaxBatchSize)); + throw std::runtime_error( + "Input batch size too large.\n" + "Calculation: input.size() = " + std::to_string(input.size()) + + ", dims = [" + std::to_string(dims.d[0]) + ", " + + std::to_string(dims.d[1]) + ", " + std::to_string(dims.d[2]) + "], " + + "mInputDataTypeSize = " + std::to_string(mInputDataTypeSize) + "\n" + + "Computed: " + std::to_string(input.size()) + " / (" + + std::to_string(dims.d[0]) + " * " + std::to_string(dims.d[1]) + " * " + + std::to_string(dims.d[2]) + " * " + std::to_string(mInputDataTypeSize) + + ") = " + std::to_string(calculatedBatchSize) + "\n" + + "Which is greater than mMaxBatchSize = " + std::to_string(mMaxBatchSize)); } // Check that vector has enough elements for full input.