You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/02/05 16:56:45 UTC

[GitHub] ChaiBapchya commented on a change in pull request #14042: [MXNET-891] Support tuple of scales in upsample operator

ChaiBapchya commented on a change in pull request #14042: [MXNET-891] Support tuple of scales in upsample operator
URL: https://github.com/apache/incubator-mxnet/pull/14042#discussion_r253953672
 
 

 ##########
 File path: src/operator/nn/upsampling-inl.h
 ##########
 @@ -82,6 +84,57 @@ struct UpSamplingParam : public dmlc::Parameter<UpSamplingParam> {
   }
 };  // struct UpSamplingParam
 
+template<typename xpu, typename DTyp, typename AccReal>
+void SpatialUpSamplingNearestUpdateOutput(mshadow::Stream<cpu> *s,
+                                           const std::vector<TBlob> &in_data,
+                                           std::vector<TBlob> *out_data) {
+  Tensor<xpu, 4, DTyp> itensor = in_data[0].get<xpu, 4, DTyp>(s);
+  Tensor<xpu, 4, DTyp> otensor = (*out_data)[0].get<xpu, 4, DTyp>(s);
+
+  int outputHeight = otensor.size(2);
+  int outputWidth = otensor.size(3);
+  int inputHeight = itensor.size(2);
+  int inputWidth = itensor.size(3);
+
+  int dW = outputWidth / inputWidth;
+  int dH = outputHeight / inputHeight;
+  int idim = itensor.shape_.kDimension;
+
+  // dims
+  int osz0 = otensor.size(0);
+  int osz1 = otensor.size(1);
+  int osz2 = otensor.size(2);
+  int osz3 = 1;
+  if (idim > 3) {
+    osz3 = otensor.size(3);
+  }
+
+  // perform the upsampling
+  int i0, i1, i2, i3;
 
 Review comment:
   how about using index_t as datatype for all of them
   Since for large operator support it was found to be useful -https://github.com/apache/incubator-mxnet/pull/13418

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services