You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/10/22 04:48:43 UTC
[GitHub] [incubator-tvm] Beya2019 commented on a change in pull request #6516: [RELAY][OP] roi_pool operator alter layout
Beya2019 commented on a change in pull request #6516:
URL: https://github.com/apache/incubator-tvm/pull/6516#discussion_r495514565
##########
File path: src/relay/op/vision/rcnn_op.cc
##########
@@ -119,14 +119,34 @@ bool ROIPoolRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
CHECK(roi_pool_attrs);
CHECK_EQ(dshape.size(), 4) << "Input data should be 4-D.";
CHECK_EQ(rshape.size(), 2) << "Input rois should be 2-D.";
- CHECK_EQ(roi_pool_attrs->layout, "NCHW") << "ROI Pool only supports NCHW layout";
// assign output type
- std::vector<IndexExpr> oshape(
- {rshape[0], dshape[1], roi_pool_attrs->pooled_size[0], roi_pool_attrs->pooled_size[1]});
+ std::vector<IndexExpr> oshape;
+ if (roi_pool_attrs->layout == "NCHW") {
+ oshape = {rshape[0], dshape[1], roi_pool_attrs->pooled_size[0], roi_pool_attrs->pooled_size[1]};
+ } else {
+ CHECK_EQ(roi_pool_attrs->layout, "NHWC") << "Unexpected ROI Pool layout";
Review comment:
Hi @tkonolige :
Do you mean this?
```
if (roi_pool_attrs->layout == "NCHW") {
oshape = {rshape[0], dshape[1], roi_pool_attrs->pooled_size[0], roi_pool_attrs->pooled_size[1]};
} else if (roi_pool_attrs->layout == "NHWC") {
oshape = {rshape[0], roi_pool_attrs->pooled_size[0], roi_pool_attrs->pooled_size[1], dshape[3]};
} else {
LOG(FATAL) << "vision.roi_pool does not support " << roi_pool_attrs->layout << " layout";
}
```
----------------------------------------------------------------
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:
users@infra.apache.org