Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Sep 22, 2015
1 parent bae4324 commit f9d5272
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 21 deletions.
8 changes: 2 additions & 6 deletions doc/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ To install the package package, checkout [Build and Installation Instruction](..
There are three types of documents you can find about mxnet.

* [Tutorials](#tutorials) are self contained materials that introduces a certain usecases of mxnet.
* [Code Examples](#code-examples) contains links to codes.
* [Code Examples](../../example) contains example codes.
* [Python API Documents](#python-api-documents) contains documents about specific module, as well as reference of all API functions.

Tutorials
---------
* [Python Overview Tutorial](tutorial.md)

Code Examples
-------------
* [CIFAR 10 Example](../../example/cifar10)

Python API Documents
--------------------
* [High Level Model Training Related API](model.md)
* [NDArray API](ndarray.md)
* [Symbolic API](symbol.md)
* [KVStore API](kvstore.md)
* [Data Loading API](io.md)
* [Data Loading API](io.md)
10 changes: 9 additions & 1 deletion doc/python/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,16 @@ model = mx.model.FeedForward.create(
num_round=num_round,
learning_rate=0.01)
```

You can also use scikit-learn style construct and fit function to create a model.
```python
# create a model using sklearn-style two step way
model = mx.model.FeedForward.create(
softmax,
num_round=num_round,
learning_rate=0.01)

mode.fit(X=data_set)
```
For more information, you can refer to [Model API Reference](#model-api-reference).

Save the Model
Expand Down
17 changes: 17 additions & 0 deletions doc/python/ndarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,20 @@ NDArray API Reference
.. automodule:: mxnet.ndarray
:members:
```

NDArray Random API Reference
----------------------------

```eval_rst
.. automodule:: mxnet.random
:members:
```


Context API Reference
---------------------

```eval_rst
.. automodule:: mxnet.context
:members:
```
1 change: 0 additions & 1 deletion doc/python/symbol.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,3 @@ Execution API Reference
.. automodule:: mxnet.executor
:members:
```

3 changes: 1 addition & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ Python Howto
[Python Howto](python-howto) is a folder containing short snippet of code
introducing a certain feature of mxnet.

***List of Examples***
* [Configuring Net to get Multiple Ouputs](python-howto/multiple_outputs.py)

4 changes: 4 additions & 0 deletions example/cifar10/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
CIFAR 10 Example
================
* [cifar10.py](cifar10.py) provides an example to train a network-in-network style model on CIFAR-10


Machine: Dual Xeon E5-1650 3.5GHz, 4 GTX 980, Cuda 6.5

Expand Down
11 changes: 11 additions & 0 deletions example/cifar10/cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,19 @@ def SimpleFactory(data, ch_1x1, ch_3x3):
logging.basicConfig(level=logging.DEBUG)

gpus = [mx.gpu(i) for i in range(num_gpus)]
# Use create functional style to train a model
model = mx.model.FeedForward.create(
symbol=softmax, ctx=gpus,
X=train_dataiter, eval_data=test_dataiter,
num_round=num_round,
learning_rate=0.05, momentum=0.9, wd=0.00001)

# Alternatively, you can use sklearn-style two-step API, as follows
"""
model = mx.model.FeedForward(
symbol=softmax, ctx=gpus,
num_round=num_round,
learning_rate=0.05, momentum=0.9, wd=0.00001)
model.fit(X=train_dataiter, eval_data=test_dataiter)
"""
4 changes: 4 additions & 0 deletions example/python-howto/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Python Howto Examples
=====================
* [Configuring Net to get Multiple Ouputs](python-howto/multiple_outputs.py)
* [Configuring Image Record Iterator](python-howto/data_iter.py)
1 change: 0 additions & 1 deletion example/python-howto/multiple_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
# executor.forward()
# executor.output[0] will be value of fc1
# executor.output[1] will be value of softmax

8 changes: 4 additions & 4 deletions include/mxnet/ndarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ class NDArray {
if (static_data || delay_alloc) {
Engine::Get()->DeleteVariable([](RunContext s) {}, shandle.ctx, var);
} else {
Storage::Handle h = this->shandle;
Engine::Get()->DeleteVariable([h](RunContext s) {
Storage::Get()->Free(h);
}, shandle.ctx, var);
Storage::Handle h = this->shandle;
Engine::Get()->DeleteVariable([h](RunContext s) {
Storage::Get()->Free(h);
}, shandle.ctx, var);
}
}
};
Expand Down
13 changes: 7 additions & 6 deletions src/engine/threaded_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <condition_variable>
#include <atomic>
#include <mutex>
#include <string>
#include "./engine_impl.h"
#include "../common/object_pool.h"

Expand Down Expand Up @@ -256,13 +257,13 @@ class ThreadedEngine : public Engine {
ThreadedEngine::OnCompleteStatic, threaded_opr);
if (!shutdown_phase_) {
try {
threaded_opr->fn(run_ctx, callback);
threaded_opr->fn(run_ctx, callback);
} catch(dmlc::Error &e) {
std::string what = e.what();
if (what.find("driver shutting down") == std::string::npos &&
!shutdown_phase_) {
LOG(FATAL) << e.what();
}
std::string what = e.what();
if (what.find("driver shutting down") == std::string::npos &&
!shutdown_phase_) {
LOG(FATAL) << e.what();
}
}
} else {
callback();
Expand Down

0 comments on commit f9d5272

Please sign in to comment.