Previously, when performing a reduction on a sparse tensor, the result
would be different depending on iteration order. For expanded access pattern,
an empty row would contribute no entry in the output. For lex ordering, the
identity would end up in the output.
This code changes that behavior and keeps track of whether any entries were
actually reduced during lex ordering, making the output consistent between the
two iteration styles.
"to determine if" at first reading implies a boolean value, so please be a bit more specific (when not set ... when set ....)