In the FSMN-VAD framing op (cpp/extensions/speech/operations.cpp, #1298) we replaced raw float* pointers and manual pointer arithmetic over tensor buffers with std::span: wrapping reinterpret_cast<T*>(tensor->data_.get()) in a span, taking a subspan per row/window, and using range-based algorithms (std::ranges::fill, range-for). This is more expressive and less error-prone than raw pointer math.
The scope of this issue is to apply the same treatment to the other native ops that still index tensor buffers through raw pointers:
cpp/extensions/cv/image_ops.cpp
cpp/extensions/math/operations.cpp
cpp/extensions/cv/box_ops.cpp
Core files (cpp/core/{tensor,model}.cpp) also use raw buffer access, but per the core guidelines they should be touched with more care — out of scope here unless it is a clear, low-risk win.
In the FSMN-VAD framing op (
cpp/extensions/speech/operations.cpp, #1298) we replaced rawfloat*pointers and manual pointer arithmetic over tensor buffers withstd::span: wrappingreinterpret_cast<T*>(tensor->data_.get())in aspan, taking asubspanper row/window, and using range-based algorithms (std::ranges::fill, range-for). This is more expressive and less error-prone than raw pointer math.The scope of this issue is to apply the same treatment to the other native ops that still index tensor buffers through raw pointers:
cpp/extensions/cv/image_ops.cppcpp/extensions/math/operations.cppcpp/extensions/cv/box_ops.cppCore files (
cpp/core/{tensor,model}.cpp) also use raw buffer access, but per the core guidelines they should be touched with more care — out of scope here unless it is a clear, low-risk win.