We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a037cd7 commit 09ef275Copy full SHA for 09ef275
paddle/phi/infermeta/binary.cc
@@ -1740,7 +1740,15 @@ void ElementwiseRawInferMeta(const MetaTensor& x,
1740
promote_result = x.dtype();
1741
}
1742
out->set_dtype(promote_result);
1743
- out->set_layout(x.layout());
+
1744
+ // layout need change when meet input layout contain kNHWC
1745
+ auto layout = [&]() {
1746
+ if (x.layout() == DataLayout::kNHWC || y.layout() == DataLayout::kNHWC)
1747
+ return DataLayout::kNHWC;
1748
+ return x.layout();
1749
+ }();
1750
1751
+ out->set_layout(layout);
1752
out->share_lod(x);
1753
1754
0 commit comments