A C++ tensor helper is reduced from two loops to one, producing shorter code, cleaner assembly, and a measured 10% performance improvement.