You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by la...@apache.org on 2019/02/07 00:14:06 UTC

[incubator-mxnet] branch master updated: [MXNET-1178] updating scala docs (#14070)

This is an automated email from the ASF dual-hosted git repository.

lanking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 8191585  [MXNET-1178] updating scala docs (#14070)
8191585 is described below

commit 819158559e15287b910647e22387486e04817fa6
Author: Piyush Ghai <gh...@osu.edu>
AuthorDate: Wed Feb 6 16:13:46 2019 -0800

    [MXNET-1178] updating scala docs (#14070)
    
    * updating scala docs
    
    * Addressed PR feedback
---
 .../src/main/scala/org/apache/mxnet/Context.scala  | 17 +++++-----
 .../src/main/scala/org/apache/mxnet/NDArray.scala  | 36 ++++++++++++----------
 .../org/apache/mxnet/infer/ObjectDetector.scala    |  3 +-
 3 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/scala-package/core/src/main/scala/org/apache/mxnet/Context.scala b/scala-package/core/src/main/scala/org/apache/mxnet/Context.scala
index ab44f43..b04cd31 100644
--- a/scala-package/core/src/main/scala/org/apache/mxnet/Context.scala
+++ b/scala-package/core/src/main/scala/org/apache/mxnet/Context.scala
@@ -38,11 +38,12 @@ object Context {
 }
 
 /**
- * Constructing a context.
-
- * @param deviceTypeName {'cpu', 'gpu'} String representing the device type
- * @param deviceId (default=0) The device id of the device, needed for GPU
- */
+  * Constructing a context which is used to specify the device and device type that will
+  * be utilized by the engine.
+  *
+  * @param deviceTypeName {'cpu', 'gpu'} String representing the device type
+  * @param deviceId (default=0) The device id of the device, needed for GPU
+  */
 class Context(deviceTypeName: String, val deviceId: Int = 0) extends Serializable {
   val deviceTypeid: Int = Context.devstr2type(deviceTypeName)
 
@@ -61,9 +62,9 @@ class Context(deviceTypeName: String, val deviceId: Int = 0) extends Serializabl
   }
 
   /**
-   * Return device type of current context.
-   * @return device_type
-   */
+    * Return device type of current context.
+    * @return device_type
+    */
   def deviceType: String = Context.devtype2str(deviceTypeid)
 
   override def toString: String = {
diff --git a/scala-package/core/src/main/scala/org/apache/mxnet/NDArray.scala b/scala-package/core/src/main/scala/org/apache/mxnet/NDArray.scala
index 4324b3d..ca2e986 100644
--- a/scala-package/core/src/main/scala/org/apache/mxnet/NDArray.scala
+++ b/scala-package/core/src/main/scala/org/apache/mxnet/NDArray.scala
@@ -728,12 +728,15 @@ object NDArray extends NDArrayBase {
 }
 
 /**
- * NDArray object in mxnet.
- * NDArray is basic ndarray/Tensor like data structure in mxnet. <br />
- * <b>
- * WARNING: it is your responsibility to clear this object through dispose().
- * </b>
- */
+  * NDArray object in mxnet.
+  * NDArray is basic ndarray/Tensor like data structure in mxnet. <br />
+  * <b>
+  * NOTE: NDArray is stored in native memory. Use NDArray in a try-with-resources() construct
+  * or a [[org.apache.mxnet.ResourceScope]] in a try-with-resource to have them
+  * automatically disposed. You can explicitly control the lifetime of NDArray
+  * by calling dispose manually. Failure to do this will result in leaking native memory.
+  * </b>
+  */
 class NDArray private[mxnet](private[mxnet] val handle: NDArrayHandle,
                              val writable: Boolean = true,
                              addToCollector: Boolean = true) extends NativeResource {
@@ -775,21 +778,22 @@ class NDArray private[mxnet](private[mxnet] val handle: NDArrayHandle,
   }
 
   /**
-   * Dispose all NDArrays who help to construct this array. <br />
-   * e.g. (a * b + c).disposeDeps() will dispose a, b, c (including their deps) and a * b
-   * @return this array
-   */
+    * Dispose all NDArrays who help to construct this array. <br />
+    * e.g. (a * b + c).disposeDeps() will dispose a, b, c (including their deps) and a * b
+    * @return this NDArray
+    */
   def disposeDeps(): NDArray = {
     disposeDepsExcept()
   }
 
   /**
-   * Dispose all NDArrays who help to construct this array, excepts those in the arguments. <br />
-   * e.g. (a * b + c).disposeDepsExcept(a, b)
-   * will dispose c and a * b.
-   * Note that a, b's dependencies will not be disposed either.
-   * @return this array
-   */
+    * Dispose all NDArrays who help to construct this array, excepts those in the arguments. <br />
+    * e.g. (a * b + c).disposeDepsExcept(a, b)
+    * will dispose c and a * b.
+    * Note that a, b's dependencies will not be disposed either.
+    * @param arrs array of NDArrays
+    * @return this array
+    */
   def disposeDepsExcept(arrs: NDArray*): NDArray = {
     if (dependencies != null) {
       val excepts = mutable.HashSet.empty[Long]
diff --git a/scala-package/infer/src/main/scala/org/apache/mxnet/infer/ObjectDetector.scala b/scala-package/infer/src/main/scala/org/apache/mxnet/infer/ObjectDetector.scala
index 78b237a..7146156 100644
--- a/scala-package/infer/src/main/scala/org/apache/mxnet/infer/ObjectDetector.scala
+++ b/scala-package/infer/src/main/scala/org/apache/mxnet/infer/ObjectDetector.scala
@@ -28,7 +28,8 @@ import org.apache.mxnet.Context
 import scala.collection.mutable.ListBuffer
 
 /**
-  * A class for object detection tasks
+  * The ObjectDetector class helps to run ObjectDetection tasks where the goal
+  * is to find bounding boxes and corresponding labels for objects in a image.
   *
   * @param modelPathPrefix    Path prefix from where to load the model artifacts.
   *                           These include the symbol, parameters, and synset.txt.