masahi edited a comment on issue #4771: [Relay] Added Merge Composite pass
URL: https://github.com/apache/incubator-tvm/pull/4771#issuecomment-578057856
 
 
   ok I already have a working test case for detecting conv + bias + relu (Note 
the "Composite" attribute). Now I really want to hook this up with "Compiler" 
and "ExternalSymbol" attributes to enable codegen.
   
   ```
   def @main(%data: Tensor[(1, 3, 224, 224), float32]) -> Tensor[(1, 16, 224, 
224), float32] {
     %2 = fn (%data1: Tensor[(1, 3, 224, 224), float32], %weight: Tensor[(16, 
3, 3, 3), float32], %bias: Tensor[(16, 1, 1), float32], Primitive=1, 
Composite="dnnl.conv_bias_relu") -> Tensor[(1, 16, 224, 224), float32] {
       %0 = nn.conv2d(%data1, %weight, padding=[1, 1], channels=16, 
kernel_size=[3, 3]) /* ty=Tensor[(1, 16, 224, 224), float32] */;
       %1 = add(%0, %bias) /* ty=Tensor[(1, 16, 224, 224), float32] */;
       nn.relu(%1) /* ty=Tensor[(1, 16, 224, 224), float32] */
     };
     %3 = %2(%data, meta[relay.Constant][0] /* ty=Tensor[(16, 3, 3, 3), 
float32] */ /* ty=Tensor[(16, 3, 3, 3), float32] */, meta[relay.Constant][1] /* 
ty=Tensor[(16, 1, 1), float32] */ /* ty=Tensor[(16, 1, 1), float32] */) /* 
ty=Tensor[(1, 16, 224, 224), float32] */;
     %6 = fn (%data2: Tensor[(1, 16, 224, 224), float32], %weight1: Tensor[(16, 
16, 3, 3), float32], %bias1: Tensor[(16, 1, 1), float32], Primitive=1, 
Composite="dnnl.conv_bias_relu") -> Tensor[(1, 16, 224, 224), float32] {
       %4 = nn.conv2d(%data2, %weight1, padding=[1, 1], channels=16, 
kernel_size=[3, 3]) /* ty=Tensor[(1, 16, 224, 224), float32] */;
       %5 = add(%4, %bias1) /* ty=Tensor[(1, 16, 224, 224), float32] */;
       nn.relu(%5) /* ty=Tensor[(1, 16, 224, 224), float32] */
     };
     %6(%3, meta[relay.Constant][2] /* ty=Tensor[(16, 16, 3, 3), float32] */ /* 
ty=Tensor[(16, 16, 3, 3), float32] */, meta[relay.Constant][3] /* 
ty=Tensor[(16, 1, 1), float32] */ /* ty=Tensor[(16, 1, 1), float32] */) /* 
ty=Tensor[(1, 16, 224, 224), float32] */
   }
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to