nswamy commented on a change in pull request #12536: [MXNET-913][WIP] Java API 
--- Scala NDArray Improvement
URL: https://github.com/apache/incubator-mxnet/pull/12536#discussion_r218540567
 
 

 ##########
 File path: scala-package/core/src/main/scala/org/apache/mxnet/NDArray.scala
 ##########
 @@ -563,6 +568,61 @@ class NDArray private[mxnet](private[mxnet] val handle: 
NDArrayHandle,
     NDArrayCollector.collect(this)
   }
 
+  /**
+    * Java Flavor creating new NDArray
+    * @param arr
+    * @param shape
+    * @param ctx
+    * @return
+    */
+  def this(arr : Array[Float], shape : Shape, ctx : Context) = {
+    this(NDArray.newAllocHandle(shape, ctx, delayAlloc = false, 
Base.MX_REAL_TYPE))
+    this.set(arr)
+  }
+
+  override def toString: String = {
+    buildStringHelper(this, this.shape.length) + "\n"
 
 Review comment:
   print NDArray's metadata instead
   (x.shape, x.size, x.dtype, x.context, x.handle(%x)->hex value of native mem 
ref)

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