soiferj commented on issue #4879: [Relay][Pass] Fix bug in re-processing call 
node in MergeComposite pass
URL: https://github.com/apache/incubator-tvm/pull/4879#issuecomment-586412142
 
 
   @mbarrett97 @comaniac I just pushed a test where "result" creates an 
incorrect graph, and "expected" is correct. Even those these two graphs are 
different, and "result" generated an incorrect function, they are 
computationally equivalent. This means that the test actually passes 
`alpha_equal` both with and without the bug. Here are the Relay outputs. The 
pattern I am trying to match is `add -> add -> add`.
   
   Result:
   ```
   v0.0.4
   fn (%a: Tensor[(10, 10), float32], %b: Tensor[(10, 10), float32]) -> 
Tensor[(10, 10), float32] {
     %0 = subtract(%a, %b) /* ty=Tensor[(10, 10), float32] */;
     %4 = fn (%x: Tensor[(10, 10), float32], %y: Tensor[(10, 10), float32], 
Primitive=1, Composite="add_add_add") -> Tensor[(10, 10), float32] {
       %1 = add(%x, %y) /* ty=Tensor[(10, 10), float32] */;
       %2 = add(%x, %1) /* ty=Tensor[(10, 10), float32] */;
       %3 = add(%x, %y) /* ty=Tensor[(10, 10), float32] */;
       add(%2, %3) /* ty=Tensor[(10, 10), float32] */
     };
     %4(%0, %b) /* ty=Tensor[(10, 10), float32] */
   }
   ```
   
   Expected:
   ```
   v0.0.4
   fn (%a: Tensor[(10, 10), float32], %b: Tensor[(10, 10), float32]) -> 
Tensor[(10, 10), float32] {
     %0 = subtract(%a, %b) /* ty=Tensor[(10, 10), float32] */;
     %3 = fn (%in_1: Tensor[(10, 10), float32], %in_2: Tensor[(10, 10), 
float32]) -> Tensor[(10, 10), float32] {
       %1 = add(%in_1, %in_2) /* ty=Tensor[(10, 10), float32] */;
       %2 = add(%in_1, %1) /* ty=Tensor[(10, 10), float32] */;
       add(%2, %1) /* ty=Tensor[(10, 10), float32] */
     };
     %3(%0, %b) /* ty=Tensor[(10, 10), 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