This is an automated email from the ASF dual-hosted git repository.
wangwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-singa.git
The following commit(s) were added to refs/heads/master by this push:
new 7c109b7 SINGA-433 Update download page and fix some errors in
documentation
7c109b7 is described below
commit 7c109b74f019f09288e206238bff8a00764c4935
Author: Wang Wei <[email protected]>
AuthorDate: Sun Apr 21 20:50:20 2019 +0800
SINGA-433 Update download page and fix some errors in documentation
---
doc/en/docs/installation.md | 16 ++++----------
doc/en/downloads.md | 18 +++++++++++++--
doc/en/index.rst | 1 +
python/singa/metric.py | 54 ++++++++++++++++++++++-----------------------
4 files changed, 48 insertions(+), 41 deletions(-)
diff --git a/doc/en/docs/installation.md b/doc/en/docs/installation.md
index 40bf83c..70da2f8 100644
--- a/doc/en/docs/installation.md
+++ b/doc/en/docs/installation.md
@@ -36,11 +36,7 @@ SINGA.
conda install -c nusdbsystem singa-gpu
- It is equivalent to
-
- conda install -c nusdbsystem singa=1.1.1=py36_cuda9.0_cudnn7.1.2
-
- CUDA 9.0 must be installed before executing the above command. Singa
+ CUDA driver (for CUDA >=9.0) must be installed before executing the
above command. Singa
packages for other CUDA versions are also available. The following
instruction
lists all the available Singa packages.
@@ -73,18 +69,15 @@ To install conda-build (after installing miniconda)
To build the CPU version of SINGA
- export BUILD_STR=cpu
- conda build tool/conda/singa/ --python 3.6 (or --python 2.7)
-
+ conda build tool/conda/singa/ --python 3.6
The above commands have been tested on Ubuntu 16.04 and Mac OSX.
Refer to the [Travis-CI page](https://travis-ci.org/apache/incubator-singa)
for more information.
To build the GPU version of SINGA
- export BUILD_STR=cudax.y-cudnna.b.c (e.g. cuda9.0-cudnn7.1.2)
- export CUDNN_PATH=<path to cudnn folder>
- conda build tool/conda/singa/ --python 3.6 (or --python 2.7)
+ export CUDA=x.y (e.g. 9.0)
+ conda build tool/conda/singa/ --python 3.6
The commands for building on GPU platforms have been tested on Ubuntu 16.04
(cuDNN>=7 and CUDA>=9).
[Nvidia's Docker image](https://hub.docker.com/r/nvidia/cuda/) provides the
building
@@ -115,7 +108,6 @@ for the instructions of installing them on Ubuntu 16.04.
* `USE_MODULES=ON`, used if protobuf and blas are not installed a prior
* `USE_CUDA=ON`, used if CUDA and cuDNN is available
- * `USE_PYTHON=ON`, used for compiling PySINGA
* `USE_PYTHON3=ON`, used for compiling with Python 3 support. (The default
is Python 2)
* `USE_OPENCL=ON`, used for compiling with OpenCL support
* `USE_MKLDNN=ON`, used for compiling with Intel MKL-dnn support
diff --git a/doc/en/downloads.md b/doc/en/downloads.md
index f65222e..7a45a31 100644
--- a/doc/en/downloads.md
+++ b/doc/en/downloads.md
@@ -26,9 +26,23 @@
You can also check the SHA512 or MD5 values to see if the download is
completed.
+* v2.0.0 (20 April 2019):
+ * [Apache SINGA
2.0.0](http://www.apache.org/dyn/closer.cgi/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz)
+
[\[SHA512\]](https://www.apache.org/dist/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz.sha512)
+ [\[KEYS\]](https://www.apache.org/dist/incubator/singa/2.0.0/KEYS)
+
[\[ASC\]](https://www.apache.org/dist/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz.asc)
+ * [Release Notes 2.0.0](releases/RELEASE_NOTES_2.0.0.html)
+ * New features and major updates,
+ * Enhance autograd (for Convolution networks and recurrent networks)
+ * Support ONNX
+ * Improve the CPP operations via Intel MKL DNN lib
+ * Implement tensor broadcasting
+ * Move Docker images under Apache user name
+ * Update depdent lib versions in conda-build config
+
* v1.2.0 (6 June 2018):
- * [Apache SINGA
1.2.0](http://www.apache.org/dyn/closer.cgi/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz)
+ * [Apache SINGA
1.2.0](https://archive.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz)
[\[SHA512\]](https://www.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz.sha512)
[\[KEYS\]](https://www.apache.org/dist/incubator/singa/1.2.0/KEYS)
[\[ASC\]](https://www.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz.asc)
@@ -48,7 +62,7 @@
* v1.1.0 (12 February 2017):
- * [Apache SINGA
1.1.0](http://www.apache.org/dyn/closer.cgi/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz)
+ * [Apache SINGA
1.1.0](https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz)
[\[MD5\]](https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz.md5)
[\[KEYS\]](https://archive.apache.org/dist/incubator/singa/1.1.0/KEYS)
[\[ASC\]](https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz.asc)
diff --git a/doc/en/index.rst b/doc/en/index.rst
index b92a618..5509f09 100644
--- a/doc/en/index.rst
+++ b/doc/en/index.rst
@@ -20,6 +20,7 @@ Welcome to Apache SINGA
Recent News
-----------
+* **Version 2.0.0** is now available, 20 April, 2019. `Download SINGA v2.0.0
<downloads.html>`_
* SINGA was presented at `DISI, University of Trento, Italy
<https://www.disi.unitn.it/>`_ on 14 December 2018.
diff --git a/python/singa/metric.py b/python/singa/metric.py
index 92f115c..9874d17 100644
--- a/python/singa/metric.py
+++ b/python/singa/metric.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
# =============================================================================
-'''This module includes a set of metric classes for evaluating the model's
+"""This module includes a set of metric classes for evaluating the model's
performance. The specific metric classes could be converted from C++
implmentation or implemented directly using Python.
@@ -24,16 +24,17 @@ Example usage::
from singa import tensor
from singa import metric
+ import numpy as np
x = tensor.Tensor((3, 5))
x.uniform(0, 1) # randomly genearte the prediction activation
- x = tensor.SoftMax(x) # normalize the prediction into probabilities
+ x = tensor.Softmax(x) # normalize the prediction into probabilities
y = tensor.from_numpy(np.array([0, 1, 3], dtype=np.int)) # set the truth
f = metric.Accuracy()
acc = f.evaluate(x, y) # averaged accuracy over all 3 samples in x
-'''
+"""
from __future__ import division
from __future__ import absolute_import
@@ -46,19 +47,19 @@ import numpy as np
class Metric(object):
- '''Base metric class.
+ """Base metric class.
Subclasses that wrap the C++ loss classes can use the inherited foward,
and evaluate functions of this base class. Other subclasses need
to override these functions. Users need to feed in the **predictions** and
ground truth to get the metric values.
- '''
+ """
def __init__(self):
self.swig_metric = None
def forward(self, x, y):
- '''Compute the metric for each sample.
+ """Compute the metric for each sample.
Args:
x (Tensor): predictions, one row per sample
@@ -66,43 +67,42 @@ class Metric(object):
Returns:
a tensor of floats, one per sample
- '''
- return tensor.from_raw_tensor(
- self.swig_metric.Forward(x.data, y.data))
+ """
+ return tensor.from_raw_tensor(self.swig_metric.Forward(x.data, y.data))
def evaluate(self, x, y):
- '''Compute the averaged metric over all samples.
+ """Compute the averaged metric over all samples.
Args:
x (Tensor): predictions, one row per sample
y (Tensor): ground truth values, one row per sample
Returns:
a float value for the averaged metric
- '''
+ """
return self.swig_metric.Evaluate(x.data, y.data)
class Accuracy(Metric):
- '''Compute the top one accuracy for single label prediction tasks.
+ """Compute the top one accuracy for single label prediction tasks.
It calls the C++ functions to do the calculation.
- '''
+ """
def __init__(self):
self.swig_metric = singa.Accuracy()
class Precision(Metric):
- '''Make the top-k labels of max probability as the prediction
+ """Make the top-k labels of max probability as the prediction
Compute the precision against the groundtruth labels
- '''
+ """
def __init__(self, top_k):
self.top_k = top_k
def forward(self, x, y):
- '''Compute the precision for each sample.
+ """Compute the precision for each sample.
Convert tensor to numpy for computation
@@ -112,7 +112,7 @@ class Precision(Metric):
Returns:
a tensor of floats, one per sample
- '''
+ """
dev = x.device
x.to_host()
@@ -122,7 +122,7 @@ class Precision(Metric):
y_np = tensor.to_numpy(y)
# Sort in descending order
- pred_np = np.argsort(-x_np)[:, 0:self.top_k]
+ pred_np = np.argsort(-x_np)[:, 0 : self.top_k]
prcs_np = np.zeros(pred_np.shape[0], dtype=np.float32)
@@ -143,29 +143,29 @@ class Precision(Metric):
return precision
def evaluate(self, x, y):
- '''Compute the averaged precision over all samples.
+ """Compute the averaged precision over all samples.
Args:
x (Tensor): predictions, one row per sample
y (Tensor): ground truth values, one row per sample
Returns:
a float value for the averaged metric
- '''
+ """
return tensor.average(self.forward(x, y))
class Recall(Metric):
- '''Make the top-k labels of max probability as the prediction
+ """Make the top-k labels of max probability as the prediction
Compute the recall against the groundtruth labels
- '''
+ """
def __init__(self, top_k):
self.top_k = top_k
def forward(self, x, y):
- '''Compute the recall for each sample.
+ """Compute the recall for each sample.
Convert tensor to numpy for computation
@@ -175,7 +175,7 @@ class Recall(Metric):
Returns:
a tensor of floats, one per sample
- '''
+ """
dev = x.device
x.to_host()
@@ -185,7 +185,7 @@ class Recall(Metric):
y_np = tensor.to_numpy(y)
# Sort in descending order
- pred_np = np.argsort(-x_np)[:, 0:self.top_k]
+ pred_np = np.argsort(-x_np)[:, 0 : self.top_k]
recall_np = np.zeros(pred_np.shape[0], dtype=np.float32)
@@ -206,13 +206,13 @@ class Recall(Metric):
return recall
def evaluate(self, x, y):
- '''Compute the averaged precision over all samples.
+ """Compute the averaged precision over all samples.
Args:
x (Tensor): predictions, one row per sample
y (Tensor): ground truth values, one row per sample
Returns:
a float value for the averaged metric
- '''
+ """
return tensor.average(self.forward(x, y))