Lunderberg commented on issue #12852:
URL: https://github.com/apache/tvm/issues/12852#issuecomment-1253867588

   Ah, I think I found the better fix.  There's some copy/paste between 
`Inverse` and `NonSurjectiveInverse` that I should have cleaned up when 
implementing it, and there's better handling in `Inverse` that didn't make its 
way into `NonSurjectiveInverse`.  In `NonSurjectiveInverse`, the following 
section should be used.  This way, for any extent = 1 ranges, it still 
appropriately generates the inverse.
   
   ```c++
   // Unpack the map to an array, maintaining the same parameter order.
     Array<PrimExpr> inverse_exprs;
     for (int i = 0, n = (*this)->initial_indices.size(); i < n; ++i) {
       Var index = (*this)->initial_indices[i];
       if (is_one(initial_ranges[i]->extent) && 
!inverse_exprs_map.count(index)) {
         inverse_exprs.push_back(initial_ranges[i]->min);
       } else {
         inverse_exprs.push_back(inverse_exprs_map.at(index));
       }
     }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to