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 2018/11/27 21:26:38 UTC

[incubator-mxnet] branch master updated: Adding Java to ubuntu setup install page and minor fixes to docs (#13420)

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 e6fffe9  Adding Java to ubuntu setup install page and minor fixes to docs (#13420)
e6fffe9 is described below

commit e6fffe901fb0a07508d2d755957c84f84a11f7b8
Author: Andrew Ayres <an...@gmail.com>
AuthorDate: Tue Nov 27 13:26:23 2018 -0800

    Adding Java to ubuntu setup install page and minor fixes to docs (#13420)
    
    * Adding Java to ubuntu setup install page and minor fixes to other java api docs
    
    * Improving javadoc for java-api predictor class
    
    Mostly documentation changes
---
 docs/install/java_setup.md                         | 39 +++++++++++++---------
 docs/install/ubuntu_setup.md                       | 13 +++++++-
 docs/tutorials/index.md                            |  2 +-
 .../org/apache/mxnet/infer/javaapi/Predictor.scala | 12 ++++++-
 4 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/docs/install/java_setup.md b/docs/install/java_setup.md
index 5e1ddc9..fe55d07 100644
--- a/docs/install/java_setup.md
+++ b/docs/install/java_setup.md
@@ -41,41 +41,48 @@ Go to the [MXNet-Java demo project's README](https://github.com/apache/incubator
 
 #### Maven Repository
 
-Package information can be found in this [Maven Repository](https://repository.apache.org/#nexus-search;gav~org.apache.mxnet~~1.3.1-SNAPSHOT~~)
+MXNet-Java can be easily included in your Maven managed project. The Java packages are currently available as nightly builds on Maven. Add the following Maven repository to your `pom.xml` to fetch the Java packages :
+
+```html
+<repositories>
+    <repository>
+      <id>Apache Snapshot</id>
+      <url>https://repository.apache.org/content/groups/snapshots</url>
+    </repository>
+</repositories>
+```
+
+Also, add the dependency which corresponds to your platform to the `dependencies` tag :
 
 **Linux CPU**
 ```html
-<!-- https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-linux-x86_64-cpu -->
 <dependency>
-    <groupId>org.apache.mxnet</groupId>
-    <artifactId>mxnet-full_2.11-linux-x86_64-cpu</artifactId>
-    <scope>system</scope>
-    <systemPath>/system/path/to/jar/mxnet-full_2.11-linux-x86_64-cpu-1.3.1-SNAPSHOT.jar</systemPath>
+  <groupId>org.apache.mxnet</groupId>
+  <artifactId>mxnet-full_2.11-linux-x86_64-cpu</artifactId>
+  <version>1.3.1-SNAPSHOT</version>
 </dependency>
 ```
 
 **Linux GPU**
 ```html
-<!-- https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-linux-x86_64-gpu -->
 <dependency>
-    <groupId>org.apache.mxnet</groupId>
-    <artifactId>mxnet-full_2.11-linux-x86_64-gpu</artifactId>
-    <scope>system</scope>
-    <systemPath>/system/path/to/jar/mxnet-full_2.11-linux-x86_64-gpu-1.3.1-SNAPSHOT.jar</systemPath>
+  <groupId>org.apache.mxnet</groupId>
+  <artifactId>mxnet-full_2.11-linux-x86_64-gpu</artifactId>
+  <version>1.3.1-SNAPSHOT</version>
 </dependency>
 ```
 
 **macOS CPU**
 ```html
-<!-- https://mvnrepository.com/artifact/org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu -->
 <dependency>
-    <groupId>org.apache.mxnet</groupId>
-    <artifactId>mxnet-full_2.11-osx-x86_64-cpu</artifactId>
-    <scope>system</scope>
-    <systemPath>/system/path/to/jar/mxnet-full_2.11-osx-x86_64-cpu-1.3.1-SNAPSHOT.jar</systemPath>
+  <groupId>org.apache.mxnet</groupId>
+  <artifactId>mxnet-full_2.11-osx-x86_64-cpu</artifactId>
+  <version>1.3.1-SNAPSHOT</version>
 </dependency>
 ```
 
+
+The official Java Packages will be released with the release of MXNet 1.4 and will be available on  [MXNet Maven package repository](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.mxnet%22).
 <hr>
 
 ## Source
diff --git a/docs/install/ubuntu_setup.md b/docs/install/ubuntu_setup.md
index 8aac143..538d38d 100644
--- a/docs/install/ubuntu_setup.md
+++ b/docs/install/ubuntu_setup.md
@@ -14,6 +14,7 @@ The following installation instructions are for installing MXNet on computers ru
     * [R](#install-the-mxnet-package-for-r)
     * [Julia](#install-the-mxnet-package-for-julia)
     * [Scala](#install-the-mxnet-package-for-scala)
+    * [Java](#install-the-mxnet-package-for-java)    
     * [Perl](#install-the-mxnet-package-for-perl)
   * [Contributions](#contributions)
   * [Next Steps](#next-steps)
@@ -100,7 +101,7 @@ To install an older version of MXNet with one of the packages in the previous ta
 
 ## Build MXNet from Source
 
-You can build MXNet from source, and then you have the option of installing language-specific bindings, such as Scala, Julia, R or Perl. This is a two-step process:
+You can build MXNet from source, and then you have the option of installing language-specific bindings, such as Scala, Java, Julia, R or Perl. This is a two-step process:
 
 1. Build the shared library from the MXNet C++ source code.
 2. (optional) Install the supported language-specific packages for MXNet. Be sure to check that section first, as some scripts may be available to handle all of the dependencies, MXNet build, and language bindings for you. Here they are again for quick access:
@@ -108,6 +109,7 @@ You can build MXNet from source, and then you have the option of installing lang
 * [R](#install-the-mxnet-package-for-r)
 * [Julia](#install-the-mxnet-package-for-julia)
 * [Scala](#install-the-mxnet-package-for-scala)
+* [Java](#install-the-mxnet-package-for-java)
 * [Perl](#install-the-mxnet-package-for-perl)
 
 **Note:** To change the compilation options for your build, edit the ```make/config.mk``` file prior to building MXNet. More information on this is mentioned in the different language package instructions.
@@ -207,6 +209,7 @@ After you have installed the MXNet core library. You may install MXNet interface
 - [Perl](#install-the-mxnet-package-for-perl)
 - [R](#install-the-mxnet-package-for-r)
 - [Scala](#install-the-mxnet-package-for-scala)
+- [Java](#install-the-mxnet-package-for-java)
 
 <hr>
 
@@ -397,6 +400,14 @@ Further information is in the [MXNet-Scala Setup Instructions](scala_setup.html)
 If you use IntelliJ or a similar IDE, you may want to follow the [MXNet-Scala on IntelliJ tutorial](../tutorials/scala/mxnet_scala_on_intellij.html) instead.
 <hr>
 
+### Install the MXNet Package for Java
+
+To use the MXNet-Java package, you can acquire the Maven package as a dependency.
+
+Further information is in the [MXNet-Java Setup Instructions](java.html).
+
+If you use IntelliJ or a similar IDE, you may want to follow the [MXNet-Java on IntelliJ tutorial](../tutorials/java/mxnet_java_on_intellij.html) instead.
+<hr>
 
 ## Contributions
 
diff --git a/docs/tutorials/index.md b/docs/tutorials/index.md
index 23cf675..52e2be8 100644
--- a/docs/tutorials/index.md
+++ b/docs/tutorials/index.md
@@ -160,7 +160,7 @@ Select API:&nbsp;
 * Getting Started
     * [Developer Environment Setup on IntelliJ IDE](/tutorials/java/mxnet_java_on_intellij.html)
 * [Multi Object Detection using pre-trained Single Shot Detector (SSD) Model](/tutorials/java/ssd_inference.html)
-* [MXNet-Java  Examples](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/java/org/apache/mxnetexamples)
+* [MXNet-Java  Examples](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/java/org/apache/mxnetexamples/javaapi/infer)
 <hr>
 
 ## C++ Tutorials
diff --git a/scala-package/infer/src/main/scala/org/apache/mxnet/infer/javaapi/Predictor.scala b/scala-package/infer/src/main/scala/org/apache/mxnet/infer/javaapi/Predictor.scala
index a5428e1..c867168 100644
--- a/scala-package/infer/src/main/scala/org/apache/mxnet/infer/javaapi/Predictor.scala
+++ b/scala-package/infer/src/main/scala/org/apache/mxnet/infer/javaapi/Predictor.scala
@@ -51,7 +51,17 @@ class Predictor private[mxnet] (val predictor: org.apache.mxnet.infer.Predictor)
 
   /**
     * Takes input as Array of one dimensional arrays and creates the NDArray needed for inference
-    * The array will be reshaped based on the input descriptors.
+    * The array will be reshaped based on the input descriptors. Example of calling in Java:
+    *
+    * <pre>
+    * {@code
+    * float tmp[][] = new float[1][224];
+    * for (int x = 0; x < 1; x++)
+    *   for (int y = 0; y < 224; y++)
+    *     tmp[x][y] = (int)(Math.random()*10);
+    * predictor.predict(tmp);
+    * }
+    * </pre>
     *
     * @param input:            An Array of a one-dimensional array.
                               An extra Array is needed for when the model has more than one input.