lobanov-m commented on a change in pull request #13226: [MXNet-1211] Factor and 
"Like" modes in BilinearResize2D operator
URL: https://github.com/apache/incubator-mxnet/pull/13226#discussion_r236167407
 
 

 ##########
 File path: src/operator/contrib/bilinear_resize-inl.h
 ##########
 @@ -44,17 +44,39 @@
 #include "../mxnet_op.h"
 #include "../mshadow_op.h"
 
+namespace bilinear_resize {
+enum BilinearResizeOpMode{size, scale, odd_scale, like, to_even};
+}  // namespace bilinear_resize
+
+
 namespace mxnet {
 namespace op {
 
 struct BilinearSampleParam : public dmlc::Parameter<BilinearSampleParam> {
-  int height;
-  int width;
+  float height;
+  float width;
+  int mode;
   DMLC_DECLARE_PARAMETER(BilinearSampleParam) {
-    DMLC_DECLARE_FIELD(height).set_range(1, 10000)
-    .describe("output height (required)");
-    DMLC_DECLARE_FIELD(width).set_range(1, 10000)
-    .describe("output width (required)");
+    DMLC_DECLARE_FIELD(height).set_range(0, 10000)
+    .set_default(-1)
+    .describe(R"(output height if mode is "size" or scale on which input 
height should be multiplied if mode is
+                 "scale" or "odd_scale")");
+    DMLC_DECLARE_FIELD(width).set_range(0, 10000)
+    .set_default(-1)
+    .describe(R"(output width if mode is "size" or scale on which input width 
should be multiplied if mode is
+                 "scale" or "odd_scale")");
+    DMLC_DECLARE_FIELD(mode)
+    .add_enum("size", bilinear_resize::size)
+    .add_enum("scale", bilinear_resize::scale)
+    .add_enum("odd_scale", bilinear_resize::odd_scale)
+    .add_enum("like", bilinear_resize::like)
+    .add_enum("to_even", bilinear_resize::to_even)
+    .set_default(bilinear_resize::size)
+    .describe(R"(resizing mode. "size" - resize to distinct size; "scale" - 
original height and width are multiplied
 
 Review comment:
   I think any. If we have original tensor with shape (1, 3, 10000, 10000) and 
resize it with height=0.001 and width=0.001 in "scale" mode we will get tensor 
with shape (1, 3, 10, 10). And back we can resize the result tensor in scale 
mode with height=100 and width=100 and get tensor of original size. I'll try to 
clarify this in description.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to