masahi edited a comment on pull request #8669:
URL: https://github.com/apache/tvm/pull/8669#issuecomment-896481604


   @yzhliu @comaniac See the updated change. The confusion I had was: I was 
thinking that layout transform on `inputs[0]` should be inserted **before** the 
callback and `relay.nn.contrib_dense_pack` is called. So 
`relay.nn.contrib_dense_pack` is called, all layout transform on inputs have 
been completed. But that was wrong: `relay.nn.contrib_dense_pack` must accept 
whatever input when it is called the first time in the callback, and necessary 
layout transform would be inserted after the fact in `LayoutRewriter` to fix up 
inputs layout.
   
   So I made the following changes, which is also how alter layout for conv2d 
works:
   * Add `weight_layout` to `dense` op attribute
   * Add `DenseInferCorrectLayout` and `DensePackInferCorrectLayout`
   * Remove ` weight_transform = relay.layout_transform(inputs[1], "NK", 
weight_layout)` from the callback
   
   Now both layout transform are inserted in `LayoutRewriter` and not in the 
callback.


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