【TVM手冊】四、AutoTVM

NCHW and NHWC

  • [TOPI][AutoTVM] NHWC conv2d templates for ARM #3859
    • we are enabling NHWC conv2d templates for ARM as a nearly final solution. The benefits include:
    • Enable NHWC schedule directly. Previously, we need to transpose between NCHW and NHWC.
    • AutoTVM now can tune NHWC directly. Previously, we need to build a NCHW network to tune.
    • Potential performance advantage in NHWC which known to community.
  • [RFC] Frontend layout transformation #2519
    • Currently, frontend models has two different input layout: NHWC and NCHW. Tensorflow and TFLite are NHWC layout, while like CoreML frontend is NCHW layout.
    • For converting model with NHWC input layout, currently there is no unified way. Some framework convert NHWC into NCHW input layout. For example, Intel OpenVINO, Tensorflow-CoreML converters (https://github.com/tf-coreml/tf-coreml). This has some advantages, for example on GPU. And for TVM, we support NCHW very well, for example:
  • [TFLite] Convert TFLite NCHW to NHWC #3141
    • As discussed in above RFC, we agree to make TFLite frontend input layout from NCHW to NHWC. This PR does this.
    • Affected:
      We could not use Auto TVM to tuning on ARM CPU. Because ARM CPU schedule only implement NCHW currently. We should add SpatialPack + NHWC for conv2d / depthwise convolution on ARM CPU.
  • [TOPI][AlterOpLayout][ARM] Enabling NHWC to NCHW layout transformation. #4249
    • Enables NHWC to NCHW conversion for ARM. Follows AlterOpLayout principle to propagate the layout as deep as possible. For my toy network with 5 convs, it results in only 2 layout transforms - 1 at the beginning, and one at the end.
    • Layout conversion pass
      • Right now we use AlterOpLayout pass that automatically decides which layout based on the target hw back ends.

      • Given that we also want to offer the flexibility to pragmatically add pass pipelines, and there has been increasing need for converting between layouts(e.g. NHWC to NCHW), we might want to also introduce a Layout conversion pass that a user can specify. This would provide additional optional flexibility that some of our current frontends need Example usage:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章