reminisce commented on a change in pull request #16720: [Numpy] Implement numpy 
operator 'average'
URL: https://github.com/apache/incubator-mxnet/pull/16720#discussion_r346593188
 
 

 ##########
 File path: include/mxnet/tensor_blob.h
 ##########
 @@ -148,6 +148,43 @@ class TBlob {
   TBlob(const mshadow::Tensor<Device, dim, DType> &src) {  // NOLINT(*)
     *this = src;
   }
+
+  /*!
+   * \brief constructor from contiguous memory
+   * \param dptr data pointer
+   * \param shape data shape
+   * \param stream device stream
+   * \tparam Device which device the tensor is on
+   * \tparam dim tensor dimension
+   * \tparam DType the type of elements in the tensor
+   */
+  template<typename Device, int dim, typename DType>
+  TBlob(DType *dptr, const mshadow::Shape<dim> &shape,
+        mshadow::Stream<Device> *stream) {
+    auto tensor = mshadow::Tensor<Device, dim, DType>(dptr, shape, stream);
+    *this = tensor;
+  }
+
+  /*!
+   * \brief constructor from contiguous memory
+   * \param dptr data pointer
+   * \param shape mxnet TShape
+   * \param stream device stream
+   * \tparam Device which device the tensor is on
+   * \tparam DType the type of elements in the tensor
+   */
+  template<typename Device, typename DType>
+  TBlob(DType *dptr, const TShape &shape,
+        mshadow::Stream<Device> *stream) {
+    mshadow::Shape<6> tensor_shape;
 
 Review comment:
   Same here. This should not be needed and we cannot assume `shape.ndim() < 6`.

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


With regards,
Apache Git Services

Reply via email to