Skip to content

Commit 671df77

Browse files
nswamyyzhliu
authored andcommitted
Reverting namespace change since this needs a major version change and breaks backward compatibility. (apache#9579)
Revert "Refactor scala code/tests/examples/docs to use org.apache.mxnet (apache#9324)" This reverts commit deb25bc.
1 parent 7fb8154 commit 671df77

File tree

182 files changed

+710
-707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+710
-707
lines changed

docs/api/scala/index.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MXNet - Scala API
22

3-
See the [MXNet Scala API Documentation](http://mxnet.incubator.apache.org/api/scala/docs/index.html).
3+
See the [MXNet Scala API Documentation](http://mxnet.io/api/scala/docs/index.html).
44

55
MXNet supports the Scala programming language. The MXNet Scala package brings flexible and efficient GPU
66
computing and state-of-art deep learning to Scala. It enables you to write seamless tensor/matrix computation with multiple GPUs in Scala. It also lets you construct and customize the state-of-art deep learning models in Scala,
@@ -9,20 +9,20 @@ computing and state-of-art deep learning to Scala. It enables you to write seaml
99
You can perform tensor or matrix computation in pure Scala:
1010

1111
```scala
12-
scala> import org.apache.mxnet._
13-
import org.apache.mxnet._
12+
scala> import ml.dmlc.mxnet._
13+
import ml.dmlc.mxnet._
1414

1515
scala> val arr = NDArray.ones(2, 3)
16-
arr: org.apache.mxnet.NDArray = org.apache.mxnet.NDArray@f5e74790
16+
arr: ml.dmlc.mxnet.NDArray = ml.dmlc.mxnet.NDArray@f5e74790
1717

1818
scala> arr.shape
19-
res0: org.apache.mxnet.Shape = (2,3)
19+
res0: ml.dmlc.mxnet.Shape = (2,3)
2020

2121
scala> (arr * 2).toArray
2222
res2: Array[Float] = Array(2.0, 2.0, 2.0, 2.0, 2.0, 2.0)
2323

2424
scala> (arr * 2).shape
25-
res3: org.apache.mxnet.Shape = (2,3)
25+
res3: ml.dmlc.mxnet.Shape = (2,3)
2626
```
2727

2828
## Scala API Reference
@@ -36,7 +36,7 @@ You can perform tensor or matrix computation in pure Scala:
3636

3737
## Resources
3838

39-
* [MXNet Scala API Documentation](http://mxnet.incubator.apache.org/api/scala/docs/index.html)
40-
* [Handwritten Digit Classification in Scala](http://mxnet.incubator.apache.org/tutorials/scala/mnist.html)
41-
* [Neural Style in Scala on MXNet](https://github.com/apache/incubator-mxnet/blob/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples/neuralstyle/NeuralStyle.scala)
42-
* [More Scala Examples](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples)
39+
* [MXNet Scala API Documentation](http://mxnet.io/api/scala/docs/index.html)
40+
* [Handwritten Digit Classification in Scala](http://mxnet.io/tutorials/scala/mnist.html)
41+
* [Neural Style in Scala on MXNet](https://github.com/dmlc/mxnet/blob/master/scala-package/examples/src/main/scala/ml/dmlc/mxnetexamples/neuralstyle/NeuralStyle.scala)
42+
* [More Scala Examples](https://github.com/dmlc/mxnet/tree/master/scala-package/examples/src/main/scala/ml/dmlc/mxnetexamples)

docs/api/scala/io.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Topics:
88
* [Data Iterator Parameters](#parameters-for-data-iterator) clarifies the different usages for dataiter parameters.
99
* [Create a Data Iterator](#create-a-data-iterator) introduces how to create a data iterator in MXNet for Scala.
1010
* [How to Get Data](#how-to-get-data) introduces the data resource and data preparation tools.
11-
* [IO API Reference](http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.IO$) explains the IO API.
11+
* [IO API Reference](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.IO$) explains the IO API.
1212

1313

1414
## Data Iterator Parameters
@@ -83,7 +83,7 @@ First, explicitly specify the kind of data (MNIST, ImageRecord, etc.) to fetch.
8383
## How to Get Data
8484

8585

86-
We provide [scripts](https://github.com/apache/incubator-mxnet/tree/master/scala-package/core/scripts) to download MNIST data and CIFAR10 ImageRecord data. If you want to create your own dataset, we recommend using the Image RecordIO data format.
86+
We provide [scripts](https://github.com/dmlc/mxnet/tree/master/scala-package/core/scripts) to download MNIST data and CIFAR10 ImageRecord data. If you want to create your own dataset, we recommend using the Image RecordIO data format.
8787

8888
## Create a Dataset Using RecordIO
8989

@@ -93,7 +93,7 @@ RecordIO implements a file format for a sequence of records. We recommend storin
9393
* Packing data together allows continuous reading on the disk.
9494
* RecordIO has a simple way to partition, simplifying distributed setting. We provide an example later.
9595

96-
We provide the [im2rec tool](https://github.com/apache/incubator-mxnet/blob/master/tools/im2rec.cc) so you can create an Image RecordIO dataset by yourself. The following walkthrough shows you how.
96+
We provide the [im2rec tool](https://github.com/dmlc/mxnet/blob/master/tools/im2rec.cc) so you can create an Image RecordIO dataset by yourself. The following walkthrough shows you how.
9797

9898
### Prerequisites
9999
Download the data. You don't need to resize the images manually. You can use `im2rec` to resize them automatically. For details, see "Extension: Using Multiple Labels for a Single Image," later in this topic.

docs/api/scala/kvstore.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Topics:
44
* [Basic Push and Pull](#basic-push-and-pull)
55
* [List Key-Value Pairs](#list-key-value-pairs)
6-
* [API Reference](http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.KVStore)
6+
* [API Reference](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.KVStore)
77

88

99
## Basic Push and Pull
@@ -103,3 +103,6 @@ the interface for generating a list of key-value pairs. For a single device, use
103103
scala> b(1).toArray
104104
Array[Float] = Array(3.0, 3.0, 3.0, 3.0, 3.0, 3.0)
105105
```
106+
107+
## Next Steps
108+
* [Scala Tutorials](http://mxnet.io/tutorials/index.html#Python-Tutorials)

docs/api/scala/model.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Topics:
1010
* [Save the Model](#save-the-model)
1111
* [Periodic Checkpoint](#periodic-checkpointing)
1212
* [Multiple Devices](#use-multiple-devices)
13-
* [Model API Reference](#http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.Model)
13+
* [Model API Reference](#http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.Model)
1414

1515
## Train the Model
1616

@@ -48,7 +48,7 @@ You can also use the `scikit-learn-style` construct and `fit` function to create
4848

4949
model.fit(trainData = train)
5050
```
51-
For more information, see [API Reference](http://mxnet.incubator.apache.org/api/scala/docs/index.html).
51+
For more information, see [API Reference](http://mxnet.io/api/scala/docs/index.html).
5252

5353
## Save the Model
5454

docs/api/scala/module.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ A subclass of modules might have extra interface functions. This topic provides
77
To construct a module, refer to the constructors for the module class. For example, the `Module` class accepts a `Symbol` as input:
88

99
```scala
10-
import org.apache.mxnet._
11-
import org.apache.mxnet.module.{FitParams, Module}
10+
import ml.dmlc.mxnet._
11+
import ml.dmlc.mxnet.module.{FitParams, Module}
1212

1313
// construct a simple MLP
1414
val data = Symbol.Variable("data")
@@ -40,21 +40,21 @@ Now you can compute with the module using functions like `forward()`, `backward(
4040
Modules provide high-level APIs for training, predicting, and evaluating. To fit a module, call the `fit()` function with some `DataIter`s:
4141

4242
```scala
43-
import org.apache.mxnet.optimizer.SGD
43+
import ml.dmlc.mxnet.optimizer.SGD
4444
val mod = new Module(softmax)
4545

4646
mod.fit(train_dataiter, evalData = scala.Option(eval_dataiter), \
4747
numEpoch = n_epoch, fitParams = new FitParams()\
4848
.setOptimizer(new SGD(learningRate = 0.1f, momentum = 0.9f, wd = 0.0001f)))
4949
```
5050

51-
The interface is very similar to the old `FeedForward` class. You can pass in batch-end callbacks using `setBatchEndCallback` and epoch-end callbacks using `setEpochEndCallback`. You can also set parameters using methods like `setOptimizer` and `setEvalMetric`. To learn more about the `FitParams()`, see the [API page](http://mxnet.io/api/scala/docs/index.html#org.apache.mxnet.module.FitParams). To predict with a module, call `predict()` with a `DataIter`:
51+
The interface is very similar to the old `FeedForward` class. You can pass in batch-end callbacks using `setBatchEndCallback` and epoch-end callbacks using `setEpochEndCallback`. You can also set parameters using methods like `setOptimizer` and `setEvalMetric`. To learn more about the `FitParams()`, see the [API page](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.module.FitParams). To predict with a module, call `predict()` with a `DataIter`:
5252

5353
```scala
5454
mod.predict(val_dataiter)
5555
```
5656

57-
The module collects and returns all of the prediction results. For more details about the format of the return values, see the documentation for the [`predict()` function](http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.module.BaseModule).
57+
The module collects and returns all of the prediction results. For more details about the format of the return values, see the documentation for the [`predict()` function](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.module.BaseModule).
5858

5959
When prediction results might be too large to fit in memory, use the `predictEveryBatch` API:
6060

docs/api/scala/ndarray.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ Topics:
77

88
* [Create NDArray](#create-ndarray)
99
* [NDArray Operations](#ndarray-operations)
10-
* [NDArray API Reference](http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.NDArray)
10+
* [NDArray API Reference](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.NDArray)
1111

1212
## Create NDArray
1313

1414
Create `mxnet.ndarray` as follows:
1515

1616
```scala
17-
scala> import org.apache.mxnet._
17+
scala> import ml.dmlc.mxnet._
1818
scala> // all-zero array of dimension 100x50
1919
scala> val a = NDArray.zeros(100, 50)
2020
scala> // all-one array of dimension 256x32x128x1
@@ -30,10 +30,10 @@ We provide some basic ndarray operations, like arithmetic and slice operations.
3030
### Arithmetic Operations
3131

3232
```scala
33-
scala> import org.apache.mxnet._
33+
scala> import ml.dmlc.mxnet._
3434
scala> val a = NDArray.zeros(100, 50)
3535
scala> a.shape
36-
org.apache.mxnet.Shape = (100,50)
36+
ml.dmlc.mxnet.Shape = (100,50)
3737
scala> val b = NDArray.ones(100, 50)
3838
scala> // c and d will be calculated in parallel here!
3939
scala> val c = a + b
@@ -45,7 +45,7 @@ We provide some basic ndarray operations, like arithmetic and slice operations.
4545
### Multiplication/Division Operations
4646

4747
```scala
48-
scala> import org.apache.mxnet._
48+
scala> import ml.dmlc.mxnet._
4949
//Multiplication
5050
scala> val ndones = NDArray.ones(2, 1)
5151
scala> val ndtwos = ndones * 2
@@ -79,7 +79,7 @@ We provide some basic ndarray operations, like arithmetic and slice operations.
7979
### Slice Operations
8080

8181
```scala
82-
scala> import org.apache.mxnet._
82+
scala> import ml.dmlc.mxnet._
8383
scala> val a = NDArray.array(Array(1f, 2f, 3f, 4f, 5f, 6f), shape = Shape(3, 2))
8484
scala> val a1 = a.slice(1)
8585
scala> assert(a1.shape === Shape(1, 2))
@@ -93,12 +93,12 @@ We provide some basic ndarray operations, like arithmetic and slice operations.
9393
### Dot Product
9494

9595
```scala
96-
scala> import org.apache.mxnet._
96+
scala> import ml.dmlc.mxnet._
9797
scala> val arr1 = NDArray.array(Array(1f, 2f), shape = Shape(1, 2))
9898
scala> val arr2 = NDArray.array(Array(3f, 4f), shape = Shape(2, 1))
9999
scala> val res = NDArray.dot(arr1, arr2)
100100
scala> res.shape
101-
org.apache.mxnet.Shape = (1,1)
101+
ml.dmlc.mxnet.Shape = (1,1)
102102
scala> res.toArray
103103
Array[Float] = Array(11.0)
104104
```
@@ -108,7 +108,7 @@ We provide some basic ndarray operations, like arithmetic and slice operations.
108108
You can use MXNet functions to save and load a list or dictionary of NDArrays from file systems, as follows:
109109

110110
```scala
111-
scala> import org.apache.mxnet._
111+
scala> import ml.dmlc.mxnet._
112112
scala> val a = NDArray.zeros(100, 200)
113113
scala> val b = NDArray.zeros(100, 200)
114114
scala> // save list of NDArrays
@@ -128,20 +128,20 @@ The good thing about using the `save` and `load` interface is that you can use t
128128
Device information is stored in the `mxnet.Context` structure. When creating NDArray in MXNet, you can use the context argument (the default is the CPU context) to create arrays on specific devices as follows:
129129

130130
```scala
131-
scala> import org.apache.mxnet._
131+
scala> import ml.dmlc.mxnet._
132132
scala> val cpu_a = NDArray.zeros(100, 200)
133133
scala> cpu_a.context
134-
org.apache.mxnet.Context = cpu(0)
134+
ml.dmlc.mxnet.Context = cpu(0)
135135
scala> val ctx = Context.gpu(0)
136136
scala> val gpu_b = NDArray.zeros(Shape(100, 200), ctx)
137137
scala> gpu_b.context
138-
org.apache.mxnet.Context = gpu(0)
138+
ml.dmlc.mxnet.Context = gpu(0)
139139
```
140140

141141
Currently, we *do not* allow operations among arrays from different contexts. To manually enable this, use the `copyto` member function to copy the content to different devices, and continue computation:
142142

143143
```scala
144-
scala> import org.apache.mxnet._
144+
scala> import ml.dmlc.mxnet._
145145
scala> val x = NDArray.zeros(100, 200)
146146
scala> val ctx = Context.gpu(0)
147147
scala> val y = NDArray.zeros(Shape(100, 200), ctx)

docs/api/scala/symbol.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Topics:
66
* [Symbol Attributes](#symbol-attributes) describes how to attach attributes to symbols.
77
* [Serialization](#serialization) explains how to save and load symbols.
88
* [Executing Symbols](#executing-symbols) explains how to evaluate the symbols with data.
9-
* [Execution API Reference](http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.Executor) documents the execution APIs.
9+
* [Execution API Reference](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.Executor) documents the execution APIs.
1010
* [Multiple Outputs](#multiple-outputs) explains how to configure multiple outputs.
11-
* [Symbol Creation API Reference](http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.Symbol) documents functions.
11+
* [Symbol Creation API Reference](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.Symbol) documents functions.
1212

1313
We also highly encourage you to read [Symbolic Configuration and Execution in Pictures](symbol_in_pictures.md).
1414

@@ -20,14 +20,14 @@ You can configure the graphs either at the level of neural network layer operati
2020
The following example configures a two-layer neural network.
2121

2222
```scala
23-
scala> import org.apache.mxnet._
23+
scala> import ml.dmlc.mxnet._
2424
scala> val data = Symbol.Variable("data")
2525
scala> val fc1 = Symbol.FullyConnected(name = "fc1")()(Map("data" -> data, "num_hidden" -> 128))
2626
scala> val act1 = Symbol.Activation(name = "relu1")()(Map("data" -> fc1, "act_type" -> "relu"))
2727
scala> val fc2 = Symbol.FullyConnected(name = "fc2")()(Map("data" -> act1, "num_hidden" -> 64))
2828
scala> val net = Symbol.SoftmaxOutput(name = "out")()(Map("data" -> fc2))
2929
scala> :type net
30-
org.apache.mxnet.Symbol
30+
ml.dmlc.mxnet.Symbol
3131
```
3232

3333
The basic arithmetic operators (plus, minus, div, multiplication) are overloaded for
@@ -36,7 +36,7 @@ The basic arithmetic operators (plus, minus, div, multiplication) are overloaded
3636
The following example creates a computation graph that adds two inputs together.
3737

3838
```scala
39-
scala> import org.apache.mxnet._
39+
scala> import ml.dmlc.mxnet._
4040
scala> val a = Symbol.Variable("a")
4141
scala> val b = Symbol.Variable("b")
4242
scala> val c = a + b
@@ -79,12 +79,12 @@ To attach attributes, you can use ```AttrScope```. ```AttrScope``` automatically
7979
There are two ways to save and load the symbols. You can use the `mxnet.Symbol.save` and `mxnet.Symbol.load` functions to serialize the ```Symbol``` objects.
8080
The advantage of using `save` and `load` functions is that it is language agnostic and cloud friendly.
8181
The symbol is saved in JSON format. You can also get a JSON string directly using `mxnet.Symbol.toJson`.
82-
Refer to [API documentation](http://mxnet.incubator.apache.org/api/scala/docs/index.html#org.apache.mxnet.Symbol) for more details.
82+
Refer to [API documentation](http://mxnet.io/api/scala/docs/index.html#ml.dmlc.mxnet.Symbol) for more details.
8383

8484
The following example shows how to save a symbol to an S3 bucket, load it back, and compare two symbols using a JSON string.
8585

8686
```scala
87-
scala> import org.apache.mxnet._
87+
scala> import ml.dmlc.mxnet._
8888
scala> val a = Symbol.Variable("a")
8989
scala> val b = Symbol.Variable("b")
9090
scala> val c = a + b
@@ -112,7 +112,7 @@ which is typically constructed by calling the [`simpleBind(<parameters>)`] metho
112112
To group the symbols together, use the [mxnet.symbol.Group](#mxnet.symbol.Group) function.
113113

114114
```scala
115-
scala> import org.apache.mxnet._
115+
scala> import ml.dmlc.mxnet._
116116
scala> val data = Symbol.Variable("data")
117117
scala> val fc1 = Symbol.FullyConnected(name = "fc1")()(Map("data" -> data, "num_hidden" -> 128))
118118
scala> val act1 = Symbol.Activation(name = "relu1")()(Map("data" -> fc1, "act_type" -> "relu"))

docs/mxdoc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ def build_r_docs(app):
8080

8181
def build_scala_docs(app):
8282
"""build scala doc and then move the outdir"""
83-
scala_path = app.builder.srcdir + '/../scala-package/core/src/main/scala/org/apache/mxnet'
83+
scala_path = app.builder.srcdir + '/../scala-package/core/src/main/scala/ml/dmlc/mxnet'
8484
# scaldoc fails on some apis, so exit 0 to pass the check
8585
_run_cmd('cd ' + scala_path + '; scaladoc `find . | grep .*scala`; exit 0')
8686
dest_path = app.builder.outdir + '/api/scala/docs'
8787
_run_cmd('rm -rf ' + dest_path)
8888
_run_cmd('mkdir -p ' + dest_path)
89-
scaladocs = ['index', 'index.html', 'org', 'lib', 'index.js', 'package.html']
89+
scaladocs = ['index', 'index.html', 'ml', 'lib', 'index.js', 'package.html']
9090
for doc_file in scaladocs:
9191
_run_cmd('cd ' + scala_path + ' && mv -f ' + doc_file + ' ' + dest_path)
9292

0 commit comments

Comments
 (0)