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

 ##########
 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;
+  }
 
 Review comment:
   Alignment:
   ```c++
     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;
     }
   ```

----------------------------------------------------------------
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