Your code works fine and shows a zero absolute difference between the manual and grouped approach.
The issue with the constant print values is raised, because you are using print(outputs_grouped.abs().max()) instead of print(output_grouped.abs().max()) in the last loop.