srkreddy1238 commented on code in PR #17599:
URL: https://github.com/apache/tvm/pull/17599#discussion_r1929677377
##########
src/relax/op/tensor/binary.cc:
##########
@@ -157,15 +157,21 @@ InferLayoutOutput InferLayoutBinaryEwise(const Call& call,
Optional<ShapeExpr> shape1 =
GetRef<ShapeExpr>(x1_sinfo->shape.as<ShapeExprNode>());
Optional<ShapeExpr> shape2 =
GetRef<ShapeExpr>(x2_sinfo->shape.as<ShapeExprNode>());
+
// Lets handle sub indexing as long as primal dims are matching
- if (layout1->layout.ndim_primal() == layout2->layout.ndim_primal()) {
- if ((layout1->layout.ndim() >= layout2->layout.ndim()) &&
shape2.defined()) {
- if (CanProveLayoutTransform(layout2->layout, layout1->layout,
shape2.value()->values)) {
- return InferLayoutOutput({layout1, layout1}, {layout1},
Attrs(call->attrs));
- }
- } else if (shape1.defined()) {
- if (CanProveLayoutTransform(layout1->layout, layout2->layout,
shape1.value()->values)) {
- return InferLayoutOutput({layout2, layout2}, {layout2},
Attrs(call->attrs));
+ if ((layout1->layout.ndim() != layout1->layout.ndim_primal()) ||
Review Comment:
This is where we have any one input come with sub indexed layout (Ex. one
being NCHW & other being NCHW4c). All we are trying is to prove the NCHW input
be transformed to NCHW4c. If yes, we let both inputs in NCHW4c or choose NCHW.
Let me add couple of tests here.
--
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]