Skip to content

Commit

Permalink
[MXNET-1178] updating scala docs (apache#14070)
Browse files Browse the repository at this point in the history
* updating scala docs

* Addressed PR feedback
  • Loading branch information
piyushghai authored and vdantu committed Mar 31, 2019
1 parent 66d1c3c commit 7f5dad5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
17 changes: 9 additions & 8 deletions scala-package/core/src/main/scala/org/apache/mxnet/Context.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 = {
Expand Down
36 changes: 20 additions & 16 deletions scala-package/core/src/main/scala/org/apache/mxnet/NDArray.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7f5dad5

Please sign in to comment.