Beya2019 commented on pull request #6443:
URL: https://github.com/apache/incubator-tvm/pull/6443#issuecomment-692521267


   Hi, @kevinthesun
   
   I have move the check for NCHW from relay type infer into op strategy for 
corresponding targets. eg:
   ```
       layout = attrs.layout
       if layout == "NCHW":
           strategy.add_implementation(
               wrap_compute_roi_align(topi.vision.rcnn.roi_align_nchw),
               wrap_topi_schedule(topi.generic.schedule_roi_align),
               name="roi_align_nchw.generic",
           )
       elif layout == "NHWC":
           strategy.add_implementation(
               wrap_compute_roi_align(topi.vision.rcnn.roi_align_nhwc),
               wrap_topi_schedule(topi.generic.schedule_roi_align),
               name="roi_align_nhwc.generic",
           )
   ```
   
   we depend on the attrs.layout to call different compute and schedule. and we 
realize the nhwc layout basic compute refered to nchw layout compute to ensure 
the the basic process is passable.
   
   In additon, What I understand is: different targets support different 
layouts, and the user chooses the high-performance layout supported by his 
target. The right to choose which layout is open to users, users can use 
transform.ConvertLayout(desired_layouts) to convert between NHWC and NCHW 
layouts. And the nhwc layout compute we added is to ensure that the conversion 
will not cause compilation errors. In the feature, if other users have the 
performance demand for GPU or other targets, he can add the corresponding 
schedule to improve performance. The current implementation only provides a 
general method.


----------------------------------------------------------------
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.

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


Reply via email to