You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by zh...@apache.org on 2021/09/07 07:22:30 UTC
[singa-site] branch master updated: 21-9-6 chinese doc site
This is an automated email from the ASF dual-hosted git repository.
zhaojing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/singa-site.git
The following commit(s) were added to refs/heads/master by this push:
new 6fd0deb 21-9-6 chinese doc site
new 8d1d222 Merge pull request #23 from lzjpaul/21-9-6-chinese
6fd0deb is described below
commit 6fd0deb6828fb992ba1e87cf19070f90be3c8afc
Author: zhaojing <zh...@comp.nus.edu.sg>
AuthorDate: Tue Sep 7 01:17:07 2021 +0800
21-9-6 chinese doc site
---
content/docs/2.0.0/dist-train.html | 2 +-
content/docs/2.0.0/dist-train/index.html | 2 +-
content/docs/2.0.0/examples.html | 2 +-
content/docs/2.0.0/examples/index.html | 2 +-
content/docs/2.0.0/git-workflow.html | 2 +-
content/docs/2.0.0/git-workflow/index.html | 2 +-
content/docs/2.0.0/graph.html | 2 +-
content/docs/2.0.0/graph/index.html | 2 +-
content/docs/2.0.0/half-precision.html | 109 ++++
content/docs/2.0.0/half-precision/index.html | 109 ++++
content/docs/2.0.0/time-profiling.html | 2 +-
content/docs/2.0.0/time-profiling/index.html | 2 +-
content/docs/2.0.0/wheel-cpu-dev.html | 2 +-
content/docs/2.0.0/wheel-cpu-dev/index.html | 2 +-
content/docs/2.0.0/wheel-cpu.html | 2 +-
content/docs/2.0.0/wheel-cpu/index.html | 2 +-
content/docs/2.0.0/wheel-gpu-dev.html | 2 +-
content/docs/2.0.0/wheel-gpu-dev/index.html | 2 +-
content/docs/2.0.0/wheel-gpu.html | 2 +-
content/docs/2.0.0/wheel-gpu/index.html | 2 +-
content/docs/3.0.0.rc1/half-precision.html | 109 ++++
content/docs/3.0.0.rc1/half-precision/index.html | 109 ++++
content/docs/3.0.0.rc1/time-profiling.html | 2 +-
content/docs/3.0.0.rc1/time-profiling/index.html | 2 +-
content/docs/3.0.0.rc1/wheel-cpu-dev.html | 2 +-
content/docs/3.0.0.rc1/wheel-cpu-dev/index.html | 2 +-
content/docs/3.0.0.rc1/wheel-cpu.html | 2 +-
content/docs/3.0.0.rc1/wheel-cpu/index.html | 2 +-
content/docs/3.0.0.rc1/wheel-gpu-dev.html | 2 +-
content/docs/3.0.0.rc1/wheel-gpu-dev/index.html | 2 +-
content/docs/3.0.0.rc1/wheel-gpu.html | 2 +-
content/docs/3.0.0.rc1/wheel-gpu/index.html | 2 +-
content/docs/3.0.0/half-precision.html | 109 ++++
content/docs/3.0.0/half-precision/index.html | 109 ++++
content/docs/3.0.0/time-profiling.html | 2 +-
content/docs/3.0.0/time-profiling/index.html | 2 +-
content/docs/3.0.0/wheel-cpu-dev.html | 2 +-
content/docs/3.0.0/wheel-cpu-dev/index.html | 2 +-
content/docs/3.0.0/wheel-cpu.html | 2 +-
content/docs/3.0.0/wheel-cpu/index.html | 2 +-
content/docs/3.0.0/wheel-gpu-dev.html | 2 +-
content/docs/3.0.0/wheel-gpu-dev/index.html | 2 +-
content/docs/3.0.0/wheel-gpu.html | 2 +-
content/docs/3.0.0/wheel-gpu/index.html | 2 +-
content/docs/3.1.0/half-precision.html | 109 ++++
content/docs/3.1.0/half-precision/index.html | 109 ++++
content/docs/3.2.0.rc1/half-precision.html | 2 +-
content/docs/3.2.0.rc1/half-precision/index.html | 2 +-
content/docs/3.2.0.rc1/installation.html | 2 +-
content/docs/3.2.0.rc1/installation/index.html | 2 +-
content/docs/3.2.0.rc1/onnx.html | 2 +-
content/docs/3.2.0.rc1/onnx/index.html | 2 +-
.../3.2.0.rc1/releases/RELEASE_NOTES_3.1.0.html | 2 +-
.../releases/RELEASE_NOTES_3.1.0/index.html | 2 +-
.../releases/RELEASE_NOTES_3.2.0.rc1.html | 2 +-
.../releases/RELEASE_NOTES_3.2.0.rc1/index.html | 2 +-
content/docs/3.2.0.rc1/team-list.html | 2 +-
content/docs/3.2.0.rc1/team-list/index.html | 2 +-
content/docs/3.2.0.rc1/wheel-cpu.html | 2 +-
content/docs/3.2.0.rc1/wheel-cpu/index.html | 2 +-
content/docs/3.2.0.rc1/wheel-gpu.html | 2 +-
content/docs/3.2.0.rc1/wheel-gpu/index.html | 2 +-
content/docs/3.2.0_Chinese/autograd.html | 268 ++++++++
content/docs/3.2.0_Chinese/autograd/index.html | 268 ++++++++
.../benchmark-train.html} | 41 +-
.../benchmark-train}/index.html | 41 +-
content/docs/3.2.0_Chinese/build.html | 351 +++++++++++
content/docs/3.2.0_Chinese/build/index.html | 351 +++++++++++
content/docs/3.2.0_Chinese/contribute-code.html | 166 +++++
.../docs/3.2.0_Chinese/contribute-code/index.html | 166 +++++
content/docs/3.2.0_Chinese/contribute-docs.html | 144 +++++
.../docs/3.2.0_Chinese/contribute-docs/index.html | 144 +++++
content/docs/3.2.0_Chinese/device.html | 105 ++++
content/docs/3.2.0_Chinese/device/index.html | 105 ++++
.../docs/{2.0.0 => 3.2.0_Chinese}/dist-train.html | 62 +-
.../{2.0.0 => 3.2.0_Chinese}/dist-train/index.html | 62 +-
content/docs/3.2.0_Chinese/downloads.html | 252 ++++++++
content/docs/3.2.0_Chinese/downloads/index.html | 252 ++++++++
content/docs/3.2.0_Chinese/examples.html | 165 +++++
content/docs/3.2.0_Chinese/examples/index.html | 165 +++++
content/docs/3.2.0_Chinese/git-workflow.html | 146 +++++
content/docs/3.2.0_Chinese/git-workflow/index.html | 146 +++++
content/docs/{2.0.0 => 3.2.0_Chinese}/graph.html | 62 +-
.../docs/{2.0.0 => 3.2.0_Chinese}/graph/index.html | 62 +-
content/docs/3.2.0_Chinese/half-precision.html | 165 +++++
.../docs/3.2.0_Chinese/half-precision/index.html | 165 +++++
content/docs/3.2.0_Chinese/history-singa.html | 115 ++++
.../docs/3.2.0_Chinese/history-singa/index.html | 115 ++++
content/docs/3.2.0_Chinese/how-to-release.html | 241 ++++++++
.../docs/3.2.0_Chinese/how-to-release/index.html | 241 ++++++++
content/docs/3.2.0_Chinese/install-win.html | 330 ++++++++++
content/docs/3.2.0_Chinese/install-win/index.html | 330 ++++++++++
content/docs/3.2.0_Chinese/installation.html | 201 ++++++
content/docs/3.2.0_Chinese/installation/index.html | 201 ++++++
content/docs/3.2.0_Chinese/issue-tracking.html | 91 +++
.../docs/3.2.0_Chinese/issue-tracking/index.html | 91 +++
content/docs/3.2.0_Chinese/mail-lists.html | 100 +++
content/docs/3.2.0_Chinese/mail-lists/index.html | 100 +++
content/docs/3.2.0_Chinese/onnx.html | 686 +++++++++++++++++++++
content/docs/3.2.0_Chinese/onnx/index.html | 686 +++++++++++++++++++++
content/docs/3.2.0_Chinese/optimizer.html | 188 ++++++
content/docs/3.2.0_Chinese/optimizer/index.html | 188 ++++++
content/docs/3.2.0_Chinese/security.html | 90 +++
content/docs/3.2.0_Chinese/security/index.html | 90 +++
content/docs/3.2.0_Chinese/software-stack.html | 138 +++++
.../docs/3.2.0_Chinese/software-stack/index.html | 138 +++++
content/docs/3.2.0_Chinese/source-repository.html | 102 +++
.../3.2.0_Chinese/source-repository/index.html | 102 +++
content/docs/{ => 3.2.0_Chinese}/team-list.html | 23 +-
.../docs/{ => 3.2.0_Chinese}/team-list/index.html | 23 +-
content/docs/3.2.0_Chinese/tensor.html | 263 ++++++++
content/docs/3.2.0_Chinese/tensor/index.html | 263 ++++++++
.../time-profiling.html | 62 +-
.../time-profiling/index.html | 62 +-
content/docs/3.2.0_Chinese/wheel-cpu-dev.html | 95 +++
.../docs/3.2.0_Chinese/wheel-cpu-dev/index.html | 95 +++
content/docs/3.2.0_Chinese/wheel-cpu.html | 101 +++
content/docs/3.2.0_Chinese/wheel-cpu/index.html | 101 +++
content/docs/3.2.0_Chinese/wheel-gpu-dev.html | 95 +++
.../docs/3.2.0_Chinese/wheel-gpu-dev/index.html | 95 +++
content/docs/3.2.0_Chinese/wheel-gpu.html | 104 ++++
content/docs/3.2.0_Chinese/wheel-gpu/index.html | 104 ++++
content/docs/half-precision.html | 2 +-
content/docs/half-precision/index.html | 2 +-
content/docs/installation.html | 2 +-
content/docs/installation/index.html | 2 +-
content/docs/next/installation.html | 2 +-
content/docs/next/installation/index.html | 2 +-
.../docs/next/releases/RELEASE_NOTES_3.2.0.html | 2 +-
.../next/releases/RELEASE_NOTES_3.2.0.rc1.html | 2 +-
.../releases/RELEASE_NOTES_3.2.0.rc1/index.html | 2 +-
.../next/releases/RELEASE_NOTES_3.2.0/index.html | 2 +-
content/docs/next/wheel-cpu.html | 2 +-
content/docs/next/wheel-cpu/index.html | 2 +-
content/docs/next/wheel-gpu.html | 2 +-
content/docs/next/wheel-gpu/index.html | 2 +-
content/docs/onnx.html | 2 +-
content/docs/onnx/index.html | 2 +-
content/docs/releases/RELEASE_NOTES_3.1.0.html | 2 +-
.../docs/releases/RELEASE_NOTES_3.1.0/index.html | 2 +-
content/docs/releases/RELEASE_NOTES_3.2.0.html | 2 +-
content/docs/releases/RELEASE_NOTES_3.2.0.rc1.html | 2 +-
.../releases/RELEASE_NOTES_3.2.0.rc1/index.html | 2 +-
.../docs/releases/RELEASE_NOTES_3.2.0/index.html | 2 +-
content/docs/team-list.html | 2 +-
content/docs/team-list/index.html | 2 +-
content/docs/wheel-cpu.html | 2 +-
content/docs/wheel-cpu/index.html | 2 +-
content/docs/wheel-gpu.html | 2 +-
content/docs/wheel-gpu/index.html | 2 +-
content/en/versions.html | 2 +-
content/en/versions/index.html | 2 +-
content/sitemap.xml | 2 +-
content/versions.html | 2 +-
content/versions/index.html | 2 +-
155 files changed, 10749 insertions(+), 201 deletions(-)
diff --git a/content/docs/2.0.0/dist-train.html b/content/docs/2.0.0/dist-train.html
index ef822c5..3600274 100644
--- a/content/docs/2.0.0/dist-train.html
+++ b/content/docs/2.0.0/dist-train.html
@@ -292,7 +292,7 @@ Evaluation accuracy = <span class="hljs-number">0.988682</span>
<h3><a class="anchor" aria-hidden="true" id="distopt的python接口"></a><a href="#distopt的python接口" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
<p>然后,python接口提供了一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">DistOpt</a>类来封装一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">optimizer</a>对象,以执行基于MPI或Multiprocess的分布式训练。在初始化过程中,它创建了一个NCCL communicator对象(来自于上面小节提到的C接口),然后,<code>DistOpt</code>中的每一次all-reduce操作都会用到这个communicator对象。</p>
<p>在MPI或Multiprocess中,每个进程都有一个独立的rank,它给出了各个进程使用的GPU的信息。训练数据是被拆分的,因此每个进程可以根据一部分训练数据来评估子梯度。一旦每个进程的子梯度被计算出来,就可以将所有进程计算出的子梯度做all-reduce,得到总体随机梯度。</p>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/9/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul></li><li><a href="#针对分布式训练的优化">针对分布式训练的优化</a><ul class="toc-headings"><li><a href="#不采取优化手段">不采取优化手段</a></li><li><a href="#半精度梯度(half-precision-gradients)">半精度梯度(Half-precision Gradie [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul></li><li><a href="#针对分布式训练的优化">针对分布式训练的优化</a><ul class="toc-headings"><li><a href="#不采取优化手段">不采取优化手段</a></li><li><a href="#半精度梯度(half-precision-gradients)">半精度梯度(Half-precision Gradients)</a></li><li><a href="#部分同步(partial-synchronization)">部分同步(Part [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/dist-train/index.html b/content/docs/2.0.0/dist-train/index.html
index ef822c5..3600274 100644
--- a/content/docs/2.0.0/dist-train/index.html
+++ b/content/docs/2.0.0/dist-train/index.html
@@ -292,7 +292,7 @@ Evaluation accuracy = <span class="hljs-number">0.988682</span>
<h3><a class="anchor" aria-hidden="true" id="distopt的python接口"></a><a href="#distopt的python接口" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
<p>然后,python接口提供了一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">DistOpt</a>类来封装一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">optimizer</a>对象,以执行基于MPI或Multiprocess的分布式训练。在初始化过程中,它创建了一个NCCL communicator对象(来自于上面小节提到的C接口),然后,<code>DistOpt</code>中的每一次all-reduce操作都会用到这个communicator对象。</p>
<p>在MPI或Multiprocess中,每个进程都有一个独立的rank,它给出了各个进程使用的GPU的信息。训练数据是被拆分的,因此每个进程可以根据一部分训练数据来评估子梯度。一旦每个进程的子梯度被计算出来,就可以将所有进程计算出的子梯度做all-reduce,得到总体随机梯度。</p>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/9/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul></li><li><a href="#针对分布式训练的优化">针对分布式训练的优化</a><ul class="toc-headings"><li><a href="#不采取优化手段">不采取优化手段</a></li><li><a href="#半精度梯度(half-precision-gradients)">半精度梯度(Half-precision Gradie [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul></li><li><a href="#针对分布式训练的优化">针对分布式训练的优化</a><ul class="toc-headings"><li><a href="#不采取优化手段">不采取优化手段</a></li><li><a href="#半精度梯度(half-precision-gradients)">半精度梯度(Half-precision Gradients)</a></li><li><a href="#部分同步(partial-synchronization)">部分同步(Part [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/examples.html b/content/docs/2.0.0/examples.html
index 23a91a0..f4cc1eb 100644
--- a/content/docs/2.0.0/examples.html
+++ b/content/docs/2.0.0/examples.html
@@ -81,7 +81,7 @@
<li>MNIST数据集的有限玻尔兹曼机, <a href="">source</a>,
<a href="https://colab.research.google.com/drive/19996noGu9JyHHkVmp4edBGu7PJSRQKsd">Colab</a>.</li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/18/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#图像分类">图像分类</a></li><li><a href="#目标检测">目标检测</a></li><li><a href="#面部及表情识别">面部及表情识别</a></li><li><a href="#图像生成">图像生成</a></li><li><a href="#机器理解">机器理解</a></li><li><a href="#文字识别">文字识别</a></li><li><a href="#文本排序">文本排序</a></li><li><a href="#其他">其他</a></li></ul></nav></div><footer class="nav-f [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#图像分类">图像分类</a></li><li><a href="#目标检测">目标检测</a></li><li><a href="#面部及表情识别">面部及表情识别</a></li><li><a href="#图像生成">图像生成</a></li><li><a href="#机器理解">机器理解</a></li><li><a href="#文字识别">文字识别</a></li><li><a href="#文本排序">文本排序</a></li><li><a href="#其他">其他</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav- [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/examples/index.html b/content/docs/2.0.0/examples/index.html
index 23a91a0..f4cc1eb 100644
--- a/content/docs/2.0.0/examples/index.html
+++ b/content/docs/2.0.0/examples/index.html
@@ -81,7 +81,7 @@
<li>MNIST数据集的有限玻尔兹曼机, <a href="">source</a>,
<a href="https://colab.research.google.com/drive/19996noGu9JyHHkVmp4edBGu7PJSRQKsd">Colab</a>.</li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/18/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#图像分类">图像分类</a></li><li><a href="#目标检测">目标检测</a></li><li><a href="#面部及表情识别">面部及表情识别</a></li><li><a href="#图像生成">图像生成</a></li><li><a href="#机器理解">机器理解</a></li><li><a href="#文字识别">文字识别</a></li><li><a href="#文本排序">文本排序</a></li><li><a href="#其他">其他</a></li></ul></nav></div><footer class="nav-f [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#图像分类">图像分类</a></li><li><a href="#目标检测">目标检测</a></li><li><a href="#面部及表情识别">面部及表情识别</a></li><li><a href="#图像生成">图像生成</a></li><li><a href="#机器理解">机器理解</a></li><li><a href="#文字识别">文字识别</a></li><li><a href="#文本排序">文本排序</a></li><li><a href="#其他">其他</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav- [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/git-workflow.html b/content/docs/2.0.0/git-workflow.html
index 97c8102..67119c6 100644
--- a/content/docs/2.0.0/git-workflow.html
+++ b/content/docs/2.0.0/git-workflow.html
@@ -62,7 +62,7 @@ git push asf dev:dev
</code></pre>
<p>不要使用rebase来合并PR,并禁用fast forward。</p></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/9/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#对于开发者">对于开发者</a></li><li><a href="#对于committers">对于Committers</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a hre [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#对于开发者">对于开发者</a></li><li><a href="#对于committers">对于Committers</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Gu [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/git-workflow/index.html b/content/docs/2.0.0/git-workflow/index.html
index 97c8102..67119c6 100644
--- a/content/docs/2.0.0/git-workflow/index.html
+++ b/content/docs/2.0.0/git-workflow/index.html
@@ -62,7 +62,7 @@ git push asf dev:dev
</code></pre>
<p>不要使用rebase来合并PR,并禁用fast forward。</p></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/9/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#对于开发者">对于开发者</a></li><li><a href="#对于committers">对于Committers</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a hre [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#对于开发者">对于开发者</a></li><li><a href="#对于committers">对于Committers</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Gu [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/graph.html b/content/docs/2.0.0/graph.html
index 92da4be..c62d744 100644
--- a/content/docs/2.0.0/graph.html
+++ b/content/docs/2.0.0/graph.html
@@ -434,7 +434,7 @@ C->device()->Exec(
<li>在启用计算图的情况下进行训练,可以显著减少内存占用。</li>
<li>目前,在速度上有一点改进。在效率方面还可以做更多的优化。</li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/4/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优化</a></li></ul></li><li><a href="#新的操作符">新的操作符</a></li><li><a href="#benchmark">Benchmark</a><ul class="toc-headings"><li><a href="#单节点">单节点</a></li><li><a href="#多线程">多线程</ [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优化</a></li></ul></li><li><a href="#新的操作符">新的操作符</a></li><li><a href="#benchmark">Benchmark</a><ul class="toc-headings"><li><a href="#单节点">单节点</a></li><li><a href="#多线程">多线程</a></li><li><a href="#结论">结论</a></li></ul></li></ul></nav></div><foo [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/graph/index.html b/content/docs/2.0.0/graph/index.html
index 92da4be..c62d744 100644
--- a/content/docs/2.0.0/graph/index.html
+++ b/content/docs/2.0.0/graph/index.html
@@ -434,7 +434,7 @@ C->device()->Exec(
<li>在启用计算图的情况下进行训练,可以显著减少内存占用。</li>
<li>目前,在速度上有一点改进。在效率方面还可以做更多的优化。</li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/4/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优化</a></li></ul></li><li><a href="#新的操作符">新的操作符</a></li><li><a href="#benchmark">Benchmark</a><ul class="toc-headings"><li><a href="#单节点">单节点</a></li><li><a href="#多线程">多线程</ [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优化</a></li></ul></li><li><a href="#新的操作符">新的操作符</a></li><li><a href="#benchmark">Benchmark</a><ul class="toc-headings"><li><a href="#单节点">单节点</a></li><li><a href="#多线程">多线程</a></li><li><a href="#结论">结论</a></li></ul></li></ul></nav></div><foo [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/half-precision.html b/content/docs/2.0.0/half-precision.html
new file mode 100644
index 0000000..a246c51
--- /dev/null
+++ b/content/docs/2.0.0/half-precision.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>2.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/2.0.0/half-precision/index.html b/content/docs/2.0.0/half-precision/index.html
new file mode 100644
index 0000000..a246c51
--- /dev/null
+++ b/content/docs/2.0.0/half-precision/index.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>2.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/2.0.0/time-profiling.html b/content/docs/2.0.0/time-profiling.html
index ac208e2..076ecd6 100644
--- a/content/docs/2.0.0/time-profiling.html
+++ b/content/docs/2.0.0/time-profiling.html
@@ -139,7 +139,7 @@ Backward Propagation <span class="hljs-built_in">Time</span> <span class="hljs-s
<span class="hljs-string">.</span>
<span class="hljs-string">.</span>
</code></pre>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/27/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/> [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/time-profiling/index.html b/content/docs/2.0.0/time-profiling/index.html
index ac208e2..076ecd6 100644
--- a/content/docs/2.0.0/time-profiling/index.html
+++ b/content/docs/2.0.0/time-profiling/index.html
@@ -139,7 +139,7 @@ Backward Propagation <span class="hljs-built_in">Time</span> <span class="hljs-s
<span class="hljs-string">.</span>
<span class="hljs-string">.</span>
</code></pre>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/27/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/> [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-cpu-dev.html b/content/docs/2.0.0/wheel-cpu-dev.html
index 44f8722..d29ee75 100644
--- a/content/docs/2.0.0/wheel-cpu-dev.html
+++ b/content/docs/2.0.0/wheel-cpu-dev.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-cpu-dev/index.html b/content/docs/2.0.0/wheel-cpu-dev/index.html
index 44f8722..d29ee75 100644
--- a/content/docs/2.0.0/wheel-cpu-dev/index.html
+++ b/content/docs/2.0.0/wheel-cpu-dev/index.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-cpu.html b/content/docs/2.0.0/wheel-cpu.html
index 97e7da8..1e67432 100644
--- a/content/docs/2.0.0/wheel-cpu.html
+++ b/content/docs/2.0.0/wheel-cpu.html
@@ -17,7 +17,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-cpu/index.html b/content/docs/2.0.0/wheel-cpu/index.html
index 97e7da8..1e67432 100644
--- a/content/docs/2.0.0/wheel-cpu/index.html
+++ b/content/docs/2.0.0/wheel-cpu/index.html
@@ -17,7 +17,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-gpu-dev.html b/content/docs/2.0.0/wheel-gpu-dev.html
index eb5652b..79e9d8d 100644
--- a/content/docs/2.0.0/wheel-gpu-dev.html
+++ b/content/docs/2.0.0/wheel-gpu-dev.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-gpu-dev/index.html b/content/docs/2.0.0/wheel-gpu-dev/index.html
index eb5652b..79e9d8d 100644
--- a/content/docs/2.0.0/wheel-gpu-dev/index.html
+++ b/content/docs/2.0.0/wheel-gpu-dev/index.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-gpu.html b/content/docs/2.0.0/wheel-gpu.html
index 40f3f3d..c162673 100644
--- a/content/docs/2.0.0/wheel-gpu.html
+++ b/content/docs/2.0.0/wheel-gpu.html
@@ -20,7 +20,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/wheel-gpu/index.html b/content/docs/2.0.0/wheel-gpu/index.html
index 40f3f3d..c162673 100644
--- a/content/docs/2.0.0/wheel-gpu/index.html
+++ b/content/docs/2.0.0/wheel-gpu/index.html
@@ -20,7 +20,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/half-precision.html b/content/docs/3.0.0.rc1/half-precision.html
new file mode 100644
index 0000000..15ca20f
--- /dev/null
+++ b/content/docs/3.0.0.rc1/half-precision.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.0.0.rc1</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-in [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.0.0.rc1/half-precision/index.html b/content/docs/3.0.0.rc1/half-precision/index.html
new file mode 100644
index 0000000..15ca20f
--- /dev/null
+++ b/content/docs/3.0.0.rc1/half-precision/index.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.0.0.rc1</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-in [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.0.0.rc1/time-profiling.html b/content/docs/3.0.0.rc1/time-profiling.html
index a74929f..f8f82aa 100644
--- a/content/docs/3.0.0.rc1/time-profiling.html
+++ b/content/docs/3.0.0.rc1/time-profiling.html
@@ -139,7 +139,7 @@ Backward Propagation <span class="hljs-built_in">Time</span> <span class="hljs-s
<span class="hljs-string">.</span>
<span class="hljs-string">.</span>
</code></pre>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/27/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/> [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/time-profiling/index.html b/content/docs/3.0.0.rc1/time-profiling/index.html
index a74929f..f8f82aa 100644
--- a/content/docs/3.0.0.rc1/time-profiling/index.html
+++ b/content/docs/3.0.0.rc1/time-profiling/index.html
@@ -139,7 +139,7 @@ Backward Propagation <span class="hljs-built_in">Time</span> <span class="hljs-s
<span class="hljs-string">.</span>
<span class="hljs-string">.</span>
</code></pre>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/27/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/> [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-cpu-dev.html b/content/docs/3.0.0.rc1/wheel-cpu-dev.html
index 5eefa29..79e16dd 100644
--- a/content/docs/3.0.0.rc1/wheel-cpu-dev.html
+++ b/content/docs/3.0.0.rc1/wheel-cpu-dev.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-cpu-dev/index.html b/content/docs/3.0.0.rc1/wheel-cpu-dev/index.html
index 5eefa29..79e16dd 100644
--- a/content/docs/3.0.0.rc1/wheel-cpu-dev/index.html
+++ b/content/docs/3.0.0.rc1/wheel-cpu-dev/index.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-cpu.html b/content/docs/3.0.0.rc1/wheel-cpu.html
index 2a00a7c..426eaf5 100644
--- a/content/docs/3.0.0.rc1/wheel-cpu.html
+++ b/content/docs/3.0.0.rc1/wheel-cpu.html
@@ -17,7 +17,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-cpu/index.html b/content/docs/3.0.0.rc1/wheel-cpu/index.html
index 2a00a7c..426eaf5 100644
--- a/content/docs/3.0.0.rc1/wheel-cpu/index.html
+++ b/content/docs/3.0.0.rc1/wheel-cpu/index.html
@@ -17,7 +17,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-gpu-dev.html b/content/docs/3.0.0.rc1/wheel-gpu-dev.html
index febb7b6..9459af7 100644
--- a/content/docs/3.0.0.rc1/wheel-gpu-dev.html
+++ b/content/docs/3.0.0.rc1/wheel-gpu-dev.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-gpu-dev/index.html b/content/docs/3.0.0.rc1/wheel-gpu-dev/index.html
index febb7b6..9459af7 100644
--- a/content/docs/3.0.0.rc1/wheel-gpu-dev/index.html
+++ b/content/docs/3.0.0.rc1/wheel-gpu-dev/index.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-gpu.html b/content/docs/3.0.0.rc1/wheel-gpu.html
index 57c28c9..1a2c4ba 100644
--- a/content/docs/3.0.0.rc1/wheel-gpu.html
+++ b/content/docs/3.0.0.rc1/wheel-gpu.html
@@ -20,7 +20,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0.rc1/wheel-gpu/index.html b/content/docs/3.0.0.rc1/wheel-gpu/index.html
index 57c28c9..1a2c4ba 100644
--- a/content/docs/3.0.0.rc1/wheel-gpu/index.html
+++ b/content/docs/3.0.0.rc1/wheel-gpu/index.html
@@ -20,7 +20,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/half-precision.html b/content/docs/3.0.0/half-precision.html
new file mode 100644
index 0000000..1dbec6a
--- /dev/null
+++ b/content/docs/3.0.0/half-precision.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.0.0/half-precision/index.html b/content/docs/3.0.0/half-precision/index.html
new file mode 100644
index 0000000..1dbec6a
--- /dev/null
+++ b/content/docs/3.0.0/half-precision/index.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.0.0/time-profiling.html b/content/docs/3.0.0/time-profiling.html
index 61b8903..5d8e9ae 100644
--- a/content/docs/3.0.0/time-profiling.html
+++ b/content/docs/3.0.0/time-profiling.html
@@ -139,7 +139,7 @@ Backward Propagation <span class="hljs-built_in">Time</span> <span class="hljs-s
<span class="hljs-string">.</span>
<span class="hljs-string">.</span>
</code></pre>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/27/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/> [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/time-profiling/index.html b/content/docs/3.0.0/time-profiling/index.html
index 61b8903..5d8e9ae 100644
--- a/content/docs/3.0.0/time-profiling/index.html
+++ b/content/docs/3.0.0/time-profiling/index.html
@@ -139,7 +139,7 @@ Backward Propagation <span class="hljs-built_in">Time</span> <span class="hljs-s
<span class="hljs-string">.</span>
<span class="hljs-string">.</span>
</code></pre>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 9/27/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/> [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#设置时间分析verbosity">设置时间分析Verbosity</a></li><li><a href="#不同verbosity的输出示例">不同Verbosity的输出示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-cpu-dev.html b/content/docs/3.0.0/wheel-cpu-dev.html
index f1ec577..fd447d1 100644
--- a/content/docs/3.0.0/wheel-cpu-dev.html
+++ b/content/docs/3.0.0/wheel-cpu-dev.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-cpu-dev/index.html b/content/docs/3.0.0/wheel-cpu-dev/index.html
index f1ec577..fd447d1 100644
--- a/content/docs/3.0.0/wheel-cpu-dev/index.html
+++ b/content/docs/3.0.0/wheel-cpu-dev/index.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-cpu.html b/content/docs/3.0.0/wheel-cpu.html
index 1e98959..e1c60fc 100644
--- a/content/docs/3.0.0/wheel-cpu.html
+++ b/content/docs/3.0.0/wheel-cpu.html
@@ -17,7 +17,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-cpu/index.html b/content/docs/3.0.0/wheel-cpu/index.html
index 1e98959..e1c60fc 100644
--- a/content/docs/3.0.0/wheel-cpu/index.html
+++ b/content/docs/3.0.0/wheel-cpu/index.html
@@ -17,7 +17,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-gpu-dev.html b/content/docs/3.0.0/wheel-gpu-dev.html
index 40db38d..07c550f 100644
--- a/content/docs/3.0.0/wheel-gpu-dev.html
+++ b/content/docs/3.0.0/wheel-gpu-dev.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-gpu-dev/index.html b/content/docs/3.0.0/wheel-gpu-dev/index.html
index 40db38d..07c550f 100644
--- a/content/docs/3.0.0/wheel-gpu-dev/index.html
+++ b/content/docs/3.0.0/wheel-gpu-dev/index.html
@@ -11,7 +11,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0.dev200720%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 4/2/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting St [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#300dev200720">3.0.0.dev200720</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-gpu.html b/content/docs/3.0.0/wheel-gpu.html
index 925918b..69c59fa 100644
--- a/content/docs/3.0.0/wheel-gpu.html
+++ b/content/docs/3.0.0/wheel-gpu.html
@@ -20,7 +20,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.0.0/wheel-gpu/index.html b/content/docs/3.0.0/wheel-gpu/index.html
index 925918b..69c59fa 100644
--- a/content/docs/3.0.0/wheel-gpu/index.html
+++ b/content/docs/3.0.0/wheel-gpu/index.html
@@ -20,7 +20,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installa [...]
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/ [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.1.0/half-precision.html b/content/docs/3.1.0/half-precision.html
new file mode 100644
index 0000000..0e0ef5f
--- /dev/null
+++ b/content/docs/3.1.0/half-precision.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.1.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.1.0/half-precision/index.html b/content/docs/3.1.0/half-precision/index.html
new file mode 100644
index 0000000..0e0ef5f
--- /dev/null
+++ b/content/docs/3.1.0/half-precision/index.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.1.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义">Half data type 定义</a></li><li><a href="#half-data-type-运算">Half data type 运算</a></li></ul></li><li><a href="#training-in-half">Training in Half</a><ul class="toc-headings"><li><a href="#training-in-half-三个步骤">Training in Half 三个步骤</a></li><li><a href="#示例">示例</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0.rc1/half-precision.html b/content/docs/3.2.0.rc1/half-precision.html
index 62b5422..3f7ee99 100644
--- a/content/docs/3.2.0.rc1/half-precision.html
+++ b/content/docs/3.2.0.rc1/half-precision.html
@@ -144,7 +144,7 @@ operation template with half type and implementation the low level computation.<
<span class="hljs-comment">// ...</span>
}
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/time-profiling"><span class="arrow-prev">← </span><span>Time Profiling</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/downloads"><span>Download SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-definition" [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/16/2020</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/time-profiling"><span class="arrow-prev">← </span><span>Time Profiling</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/downloads"><span>Download SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/half-precision/index.html b/content/docs/3.2.0.rc1/half-precision/index.html
index 62b5422..3f7ee99 100644
--- a/content/docs/3.2.0.rc1/half-precision/index.html
+++ b/content/docs/3.2.0.rc1/half-precision/index.html
@@ -144,7 +144,7 @@ operation template with half type and implementation the low level computation.<
<span class="hljs-comment">// ...</span>
}
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/time-profiling"><span class="arrow-prev">← </span><span>Time Profiling</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/downloads"><span>Download SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-definition" [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/16/2020</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/time-profiling"><span class="arrow-prev">← </span><span>Time Profiling</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/downloads"><span>Download SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type< [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/installation.html b/content/docs/3.2.0.rc1/installation.html
index 760ea78..943b61f 100644
--- a/content/docs/3.2.0.rc1/installation.html
+++ b/content/docs/3.2.0.rc1/installation.html
@@ -205,7 +205,7 @@ check your interpreter by <code>which python</code> and check the Python linked
via <code>otool -L <path to _singa_wrap.so></code>. This problem should be resolved if
SINGA is installed via conda.</p></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-next button" href="/docs/3.2.0.rc1/software-stack"><span>Software Stack</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#using-conda">Using Conda</a></li><li><a href="#using-pip">Using Pip</a></li><li><a href="#using-docker">Using Docker</a></li><li><a href="#from-source">From source</a></li><li><a href="#faq">FAQ</a></li></ul></nav></div><foot [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 1/16/2021</em></div><div class="docs-prevnext"><a class="docs-next button" href="/docs/3.2.0.rc1/software-stack"><span>Software Stack</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#using-conda">Using Conda</a></li><li><a href="#using-pip">Using Pip</a></li><li><a href="#using-docker">Using Docker</a></li><li><a href="#from-source">From s [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/installation/index.html b/content/docs/3.2.0.rc1/installation/index.html
index 760ea78..943b61f 100644
--- a/content/docs/3.2.0.rc1/installation/index.html
+++ b/content/docs/3.2.0.rc1/installation/index.html
@@ -205,7 +205,7 @@ check your interpreter by <code>which python</code> and check the Python linked
via <code>otool -L <path to _singa_wrap.so></code>. This problem should be resolved if
SINGA is installed via conda.</p></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-next button" href="/docs/3.2.0.rc1/software-stack"><span>Software Stack</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#using-conda">Using Conda</a></li><li><a href="#using-pip">Using Pip</a></li><li><a href="#using-docker">Using Docker</a></li><li><a href="#from-source">From source</a></li><li><a href="#faq">FAQ</a></li></ul></nav></div><foot [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 1/16/2021</em></div><div class="docs-prevnext"><a class="docs-next button" href="/docs/3.2.0.rc1/software-stack"><span>Software Stack</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#using-conda">Using Conda</a></li><li><a href="#using-pip">Using Pip</a></li><li><a href="#using-docker">Using Docker</a></li><li><a href="#from-source">From s [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/onnx.html b/content/docs/3.2.0.rc1/onnx.html
index 2bcd033..72b328f 100644
--- a/content/docs/3.2.0.rc1/onnx.html
+++ b/content/docs/3.2.0.rc1/onnx.html
@@ -423,7 +423,7 @@ layers.</p>
<h3><a class="anchor" aria-hidden="true" id="sonnxmodel"></a><a href="#sonnxmodel" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
<p><code>SONNXModel</code> inherits from <code>sonnx.SONNXModel</code> and implements the method
<code>forward</code> to provide a unified API with other SINGA models.</p>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/graph"><span class="arrow-prev">← </span><span>Model</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/dist-train"><span>Distributed Training</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#general-usage">General usage</a><ul class="toc-headings"><li><a href="#loading-an-onnx-model-into-singa">Loadi [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 1/11/2021</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/graph"><span class="arrow-prev">← </span><span>Model</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/dist-train"><span>Distributed Training</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#general-usage">General usage</a><ul class=" [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/onnx/index.html b/content/docs/3.2.0.rc1/onnx/index.html
index 2bcd033..72b328f 100644
--- a/content/docs/3.2.0.rc1/onnx/index.html
+++ b/content/docs/3.2.0.rc1/onnx/index.html
@@ -423,7 +423,7 @@ layers.</p>
<h3><a class="anchor" aria-hidden="true" id="sonnxmodel"></a><a href="#sonnxmodel" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
<p><code>SONNXModel</code> inherits from <code>sonnx.SONNXModel</code> and implements the method
<code>forward</code> to provide a unified API with other SINGA models.</p>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/graph"><span class="arrow-prev">← </span><span>Model</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/dist-train"><span>Distributed Training</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#general-usage">General usage</a><ul class="toc-headings"><li><a href="#loading-an-onnx-model-into-singa">Loadi [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 1/11/2021</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/graph"><span class="arrow-prev">← </span><span>Model</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/dist-train"><span>Distributed Training</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#general-usage">General usage</a><ul class=" [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0.html b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0.html
index 02b2dd1..ae96d64 100644
--- a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0.html
+++ b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0.html
@@ -43,7 +43,7 @@ management.</p></li>
gradient by param python object id for testing purpose.</li>
</ul></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readthedocs.io/en/latest/">API Reference</a><a href="/docs/examples">Exa [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/30/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.read [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0/index.html b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0/index.html
index 02b2dd1..ae96d64 100644
--- a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0/index.html
+++ b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.1.0/index.html
@@ -43,7 +43,7 @@ management.</p></li>
gradient by param python object id for testing purpose.</li>
</ul></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readthedocs.io/en/latest/">API Reference</a><a href="/docs/examples">Exa [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/30/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.read [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1.html b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1.html
index cbd946c..8c63bc0 100644
--- a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1.html
+++ b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1.html
@@ -38,7 +38,7 @@ training.</li>
<li>Solve the warnings of deprecated functions in the distributed optimizer module.</li>
</ul></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readthedocs.io/en/latest/">API Reference</a><a href="/docs/examples">Exa [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 8/16/2021</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readt [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1/index.html b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1/index.html
index cbd946c..8c63bc0 100644
--- a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1/index.html
+++ b/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1/index.html
@@ -38,7 +38,7 @@ training.</li>
<li>Solve the warnings of deprecated functions in the distributed optimizer module.</li>
</ul></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readthedocs.io/en/latest/">API Reference</a><a href="/docs/examples">Exa [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 8/16/2021</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readt [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/team-list.html b/content/docs/3.2.0.rc1/team-list.html
index 5106b81..710da7d 100644
--- a/content/docs/3.2.0.rc1/team-list.html
+++ b/content/docs/3.2.0.rc1/team-list.html
@@ -121,7 +121,7 @@ Zhejiang University, NetEase, Osaka University, yzBigData, etc.</p>
<tr><td>Chang Yao</td><td><a href="mailto:yaochang2009@gmail.com">yaochang2009@gmail.com</a></td><td>Hangzhou MZH Technologies</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/security"><span class="arrow-prev">← </span><span>Security</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/history-singa"><span>History of SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#pmc">PMC</a></li><li><a href="#committers">Committers</a></li><li><a href="#contributors">Contributors</a [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 3/7/2021</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/security"><span class="arrow-prev">← </span><span>Security</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/history-singa"><span>History of SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#pmc">PMC</a></li><li><a href="#committe [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/team-list/index.html b/content/docs/3.2.0.rc1/team-list/index.html
index 5106b81..710da7d 100644
--- a/content/docs/3.2.0.rc1/team-list/index.html
+++ b/content/docs/3.2.0.rc1/team-list/index.html
@@ -121,7 +121,7 @@ Zhejiang University, NetEase, Osaka University, yzBigData, etc.</p>
<tr><td>Chang Yao</td><td><a href="mailto:yaochang2009@gmail.com">yaochang2009@gmail.com</a></td><td>Hangzhou MZH Technologies</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/security"><span class="arrow-prev">← </span><span>Security</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/history-singa"><span>History of SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#pmc">PMC</a></li><li><a href="#committers">Committers</a></li><li><a href="#contributors">Contributors</a [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 3/7/2021</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0.rc1/security"><span class="arrow-prev">← </span><span>Security</span></a><a class="docs-next button" href="/docs/3.2.0.rc1/history-singa"><span>History of SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#pmc">PMC</a></li><li><a href="#committe [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/wheel-cpu.html b/content/docs/3.2.0.rc1/wheel-cpu.html
index 6284f87..8c5970d 100644
--- a/content/docs/3.2.0.rc1/wheel-cpu.html
+++ b/content/docs/3.2.0.rc1/wheel-cpu.html
@@ -23,7 +23,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/ [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5 [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/wheel-cpu/index.html b/content/docs/3.2.0.rc1/wheel-cpu/index.html
index 6284f87..8c5970d 100644
--- a/content/docs/3.2.0.rc1/wheel-cpu/index.html
+++ b/content/docs/3.2.0.rc1/wheel-cpu/index.html
@@ -23,7 +23,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp37-cp37m-manylinux2014_x86_64.whl">Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0-cp38-cp38-manylinux2014_x86_64.whl">Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/ [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5 [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/wheel-gpu.html b/content/docs/3.2.0.rc1/wheel-gpu.html
index 1e2ea79..5d2d25f 100644
--- a/content/docs/3.2.0.rc1/wheel-gpu.html
+++ b/content/docs/3.2.0.rc1/wheel-gpu.html
@@ -23,7 +23,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/ [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5 [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0.rc1/wheel-gpu/index.html b/content/docs/3.2.0.rc1/wheel-gpu/index.html
index 1e2ea79..5d2d25f 100644
--- a/content/docs/3.2.0.rc1/wheel-gpu/index.html
+++ b/content/docs/3.2.0.rc1/wheel-gpu/index.html
@@ -23,7 +23,7 @@
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp37-cp37m-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.7</a></li>
<li><a href="https://singa-wheel.s3-ap-southeast-1.amazonaws.com/singa-3.0.0%2Bcuda10.2-cp38-cp38-manylinux2014_x86_64.whl">CUDA10.2, cuDNN 7.6.5, Python 3.8</a></li>
</ul>
-</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/ [...]
+</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/21/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#320">3.2.0</a></li><li><a href="#310">3.1.0</a></li><li><a href="#300">3.0.0</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5 [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0_Chinese/autograd.html b/content/docs/3.2.0_Chinese/autograd.html
new file mode 100644
index 0000000..ab18ded
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/autograd.html
@@ -0,0 +1,268 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Autograd · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owners [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/autograd.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Autograd</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license [...]
+<p>实现autograd有两种典型的方式,一种是通过如<a href="http://deeplearning.net/software/theano/index.html">Theano</a>的符号微分(symbolic differentiation)或通过如<a href="https://pytorch.org/docs/stable/notes/autograd.html">Pytorch</a>的反向微分(reverse differentialtion)。SINGA遵循Pytorch方式,即通过记录计算图,并在正向传播后自动应用反向传播。自动传播算法的详细解释请参阅<a href="https://pytorch.org/docs/stable/notes/autograd.html">这里</a>。我们接下来对SINGA中的相关模块进行解释,并举例说明其使用方法。</p>
+<h2><a class="anchor" aria-hidden="true" id="相关模块"></a><a href="#相关模块" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>在autograd中涉及三个类,分别是<code>singa.tensor.Tensor</code>,<code>singa.autograd.Operation</code>和<code>singa.autograd.Layer</code>。在本篇的后续部分中,我们使用Tensor、Operation和Layer来指代这三个类。</p>
+<h3><a class="anchor" aria-hidden="true" id="tensor"></a><a href="#tensor" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>Tensor的三个属性被autograd使用:</p>
+<ul>
+<li><code>.creator</code>是一个<code>Operation</code>实例。它记录了产生Tensor实例的这个操作。</li>
+<li><code>.request_grad</code>是一个布尔变量。它用于指示autograd算法是否需要计算张量的梯度。例如,在反向传播的过程中,线性层的权重矩阵和卷积层(非底层)的特征图的张量梯度应该被计算。</li>
+<li><code>.store_grad</code>是一个布尔变量。它用于指示张量的梯度是否应该被存储并由后向函数输出。例如,特征图的梯度是在反向传播过程中计算出来的,但不包括在反向函数的输出中。</li>
+</ul>
+<p>开发者可以改变Tensor实例的<code>requires_grad</code>和<code>stores_grad</code>。例如,如果将后者设置为True,那么相应的梯度就会被包含在后向函数的输出。需要注意的是,如果<code>stores_grad</code>是True,那么 <code>requires_grad</code>一定是真,反之亦然。</p>
+<h3><a class="anchor" aria-hidden="true" id="operation"></a><a href="#operation" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
+<p>它将一个或多个<code>Tensor</code>实例作为输入,然后输出一个或多个<code>Tensor</code>实例。例如,ReLU可以作为一个具体的Operation子类来实现。当一个<code>Operation</code>实例被调用时(实例化后),会执行以下两个步骤。</p>
+<p>1.记录源操作,即输入张量的<code>创建者</code>。
+2.通过调用成员函数<code>.forward()</code>进行计算。</p>
+<p>有两个成员函数用于前向和反向传播,即<code>.forward()</code>和<code>.backward()</code>。它们以<code>Tensor.data</code>作为输入(类型为<code>CTensor</code>),并输出<code>Ctensor</code>s。要添加一个特定的操作,子类<code>Operation</code>应该实现自己的<code>.forward()</code>和<code>.backward()</code>函数。在后向传播过程中,autograd的<code>backward()</code>函数会自动调用<code>backward()</code>函数来计算输入的梯度(根据<code>require_grad</code>字段的参数和约束)。</p>
+<h3><a class="anchor" aria-hidden="true" id="layer"></a><a href="#layer" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>对于那些需要参数的Operation,我们把它们封装成一个新的类,<code>Layer</code>。例如,卷积操作被封装到卷积层(Convolution layer)中。<code>层</code>管理(存储)参数,并调用相应的<code>Operation</code>来实现变换。</p>
+<h2><a class="anchor" aria-hidden="true" id="样例"></a><a href="#样例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>在<a href="https://github.com/apache/singa/tree/master/examples/autograd">example folder</a>中提供了很多样例。在这里我我们分析两个最具代表性的例子。</p>
+<h3><a class="anchor" aria-hidden="true" id="只使用operation"></a><a href="#只使用operation" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>下一段代码展示了一个只使用<code>Operation</code>的多层感知机(MLP)模型:</p>
+<h4><a class="anchor" aria-hidden="true" id="调用依赖包"></a><a href="#调用依赖包" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> singa.tensor <span class="hljs-keyword">import</span> Tensor
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> autograd
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="创建权重矩阵和偏置向量"></a><a href="#创建权重矩阵和偏置向量" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>在将<code>requires_grad</code>和<code>stores_grad</code>都设置为<code>True</code>的情况下,创建参数张量。</p>
+<pre><code class="hljs css language-python">w0 = Tensor(shape=(<span class="hljs-number">2</span>, <span class="hljs-number">3</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+w0.gaussian(<span class="hljs-number">0.0</span>, <span class="hljs-number">0.1</span>)
+b0 = Tensor(shape=(<span class="hljs-number">1</span>, <span class="hljs-number">3</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+b0.set_value(<span class="hljs-number">0.0</span>)
+
+w1 = Tensor(shape=(<span class="hljs-number">3</span>, <span class="hljs-number">2</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+w1.gaussian(<span class="hljs-number">0.0</span>, <span class="hljs-number">0.1</span>)
+b1 = Tensor(shape=(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+b1.set_value(<span class="hljs-number">0.0</span>)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="训练"></a><a href="#训练" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<pre><code class="hljs css language-python">inputs = Tensor(data=data) <span class="hljs-comment"># data matrix</span>
+target = Tensor(data=label) <span class="hljs-comment"># label vector</span>
+autograd.training = <span class="hljs-literal">True</span> <span class="hljs-comment"># for training</span>
+sgd = opt.SGD(<span class="hljs-number">0.05</span>) <span class="hljs-comment"># optimizer</span>
+
+<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>):
+ x = autograd.matmul(inputs, w0) <span class="hljs-comment"># matrix multiplication</span>
+ x = autograd.add_bias(x, b0) <span class="hljs-comment"># add the bias vector</span>
+ x = autograd.relu(x) <span class="hljs-comment"># ReLU activation operation</span>
+
+ x = autograd.matmul(x, w1)
+ x = autograd.add_bias(x, b1)
+
+ loss = autograd.softmax_cross_entropy(x, target)
+
+ <span class="hljs-keyword">for</span> p, g <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, g)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="使用operation和layer"></a><a href="#使用operation和layer" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>下面的<a href="https://github.com/apache/singa/blob/master/examples/autograd/mnist_cnn.py">例子</a>使用autograd模块提供的层实现了一个CNN模型。</p>
+<h4><a class="anchor" aria-hidden="true" id="创建层"></a><a href="#创建层" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<pre><code class="hljs css language-python">conv1 = autograd.Conv2d(<span class="hljs-number">1</span>, <span class="hljs-number">32</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-number">1</span>, bias=<span class="hljs-literal">False</span>)
+bn1 = autograd.BatchNorm2d(<span class="hljs-number">32</span>)
+pooling1 = autograd.MaxPool2d(<span class="hljs-number">3</span>, <span class="hljs-number">1</span>, padding=<span class="hljs-number">1</span>)
+conv21 = autograd.Conv2d(<span class="hljs-number">32</span>, <span class="hljs-number">16</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-number">1</span>)
+conv22 = autograd.Conv2d(<span class="hljs-number">32</span>, <span class="hljs-number">16</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-number">1</span>)
+bn2 = autograd.BatchNorm2d(<span class="hljs-number">32</span>)
+linear = autograd.Linear(<span class="hljs-number">32</span> * <span class="hljs-number">28</span> * <span class="hljs-number">28</span>, <span class="hljs-number">10</span>)
+pooling2 = autograd.AvgPool2d(<span class="hljs-number">3</span>, <span class="hljs-number">1</span>, padding=<span class="hljs-number">1</span>)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="定义正向传播函数"></a><a href="#定义正向传播函数" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>在正向传播中的operations会被自动记录,用于反向传播。</p>
+<pre><code class="hljs css language-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(x, t)</span>:</span>
+ <span class="hljs-comment"># x is the input data (a batch of images)</span>
+ <span class="hljs-comment"># t is the label vector (a batch of integers)</span>
+ y = conv1(x) <span class="hljs-comment"># Conv layer</span>
+ y = autograd.relu(y) <span class="hljs-comment"># ReLU operation</span>
+ y = bn1(y) <span class="hljs-comment"># BN layer</span>
+ y = pooling1(y) <span class="hljs-comment"># Pooling Layer</span>
+
+ <span class="hljs-comment"># two parallel convolution layers</span>
+ y1 = conv21(y)
+ y2 = conv22(y)
+ y = autograd.cat((y1, y2), <span class="hljs-number">1</span>) <span class="hljs-comment"># cat operation</span>
+ y = autograd.relu(y) <span class="hljs-comment"># ReLU operation</span>
+ y = bn2(y)
+ y = pooling2(y)
+
+ y = autograd.flatten(y) <span class="hljs-comment"># flatten operation</span>
+ y = linear(y) <span class="hljs-comment"># Linear layer</span>
+ loss = autograd.softmax_cross_entropy(y, t) <span class="hljs-comment"># operation</span>
+ <span class="hljs-keyword">return</span> loss, y
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="训练-1"></a><a href="#训练-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python">autograd.training = <span class="hljs-literal">True</span>
+<span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(batch_number):
+ inputs = tensor.Tensor(device=dev, data=x_train[
+ i * batch_sz:(<span class="hljs-number">1</span> + i) * batch_sz], stores_grad=<span class="hljs-literal">False</span>)
+ targets = tensor.Tensor(device=dev, data=y_train[
+ i * batch_sz:(<span class="hljs-number">1</span> + i) * batch_sz], requires_grad=<span class="hljs-literal">False</span>, stores_grad=<span class="hljs-literal">False</span>)
+
+ loss, y = forward(inputs, targets) <span class="hljs-comment"># forward the net</span>
+
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss): <span class="hljs-comment"># auto backward</span>
+ sgd.update(p, gp)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="using-the-model-api"></a><a href="#using-the-model-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.2 [...]
+<p>下面的<a href="https://github.com/apache/singa/blob/master/examples/cnn/model/cnn.py">样例</a>使用<a href="./graph">Model API</a>实现了一个CNN模型。.</p>
+<h4><a class="anchor" aria-hidden="true" id="定义model的子类"></a><a href="#定义model的子类" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>定义模型类,它应该是Model的子类。只有这样,在训练阶段使用的所有操作才会形成一个计算图以便进行分析。图中的操作将被按时序规划并有效执行,模型类中也可以包含层。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MLP</span><span class="hljs-params">(model.Model)</span>:</span> <span class="hljs-comment"># the model is a subclass of Model</span>
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, data_size=<span class="hljs-number">10</span>, perceptron_size=<span class="hljs-number">100</span>, num_classes=<span class="hljs-number">10</span>)</span>:</span>
+ super(MLP, self).__init__()
+
+ <span class="hljs-comment"># init the operators, layers and other objects</span>
+ self.relu = layer.ReLU()
+ self.linear1 = layer.Linear(perceptron_size)
+ self.linear2 = layer.Linear(num_classes)
+ self.softmax_cross_entropy = layer.SoftMaxCrossEntropy()
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, inputs)</span>:</span> <span class="hljs-comment"># define the forward function</span>
+ y = self.linear1(inputs)
+ y = self.relu(y)
+ y = self.linear2(y)
+ <span class="hljs-keyword">return</span> y
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">train_one_batch</span><span class="hljs-params">(self, x, y)</span>:</span>
+ out = self.forward(x)
+ loss = self.softmax_cross_entropy(out, y)
+ self.optimizer(loss)
+ <span class="hljs-keyword">return</span> out, loss
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">set_optimizer</span><span class="hljs-params">(self, optimizer)</span>:</span> <span class="hljs-comment"># attach an optimizer</span>
+ self.optimizer = optimizer
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="训练-2"></a><a href="#训练-2" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-comment"># create a model instance</span>
+model = MLP()
+<span class="hljs-comment"># initialize optimizer and attach it to the model</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.005</span>, momentum=<span class="hljs-number">0.9</span>, weight_decay=<span class="hljs-number">1e-5</span>)
+model.set_optimizer(sgd)
+<span class="hljs-comment"># input and target placeholders for the model</span>
+tx = tensor.Tensor((batch_size, <span class="hljs-number">1</span>, IMG_SIZE, IMG_SIZE), dev, tensor.float32)
+ty = tensor.Tensor((batch_size, num_classes), dev, tensor.int32)
+<span class="hljs-comment"># compile the model before training</span>
+model.compile([tx], is_train=<span class="hljs-literal">True</span>, use_graph=<span class="hljs-literal">True</span>, sequential=<span class="hljs-literal">False</span>)
+
+<span class="hljs-comment"># train the model iteratively</span>
+<span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(num_train_batch):
+ <span class="hljs-comment"># generate the next mini-batch</span>
+ x, y = ...
+
+ <span class="hljs-comment"># Copy the data into input tensors</span>
+ tx.copy_from_numpy(x)
+ ty.copy_from_numpy(y)
+
+ <span class="hljs-comment"># Training with one batch</span>
+ out, loss = model(tx, ty)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="保存模型checkpoint"></a><a href="#保存模型checkpoint" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define the path to save the checkpoint</span>
+checkpointpath=<span class="hljs-string">"checkpoint.zip"</span>
+
+<span class="hljs-comment"># save a checkpoint</span>
+model.save_states(fpath=checkpointpath)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="加载模型checkpoint"></a><a href="#加载模型checkpoint" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define the path to load the checkpoint</span>
+checkpointpath=<span class="hljs-string">"checkpoint.zip"</span>
+
+<span class="hljs-comment"># load a checkpoint</span>
+<span class="hljs-keyword">import</span> os
+<span class="hljs-keyword">if</span> os.path.exists(checkpointpath):
+ model.load_states(fpath=checkpointpath)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="python-api"></a><a href="#python-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>关于Python API的更多细节,请参考<a href="https://singa.readthedocs.io/en/latest/autograd.html#module-singa.autograd">这里</a>。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/tensor"><span class="arrow-prev">← </span><span>Tensor</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/optimizer"><span>Optimizer</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#相关模块">相关模块</a><ul class="toc-headings"><li><a href="#tensor">Tensor</a></li><li><a href="#operation">Operation</ [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/autograd/index.html b/content/docs/3.2.0_Chinese/autograd/index.html
new file mode 100644
index 0000000..ab18ded
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/autograd/index.html
@@ -0,0 +1,268 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Autograd · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owners [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/autograd.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Autograd</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license [...]
+<p>实现autograd有两种典型的方式,一种是通过如<a href="http://deeplearning.net/software/theano/index.html">Theano</a>的符号微分(symbolic differentiation)或通过如<a href="https://pytorch.org/docs/stable/notes/autograd.html">Pytorch</a>的反向微分(reverse differentialtion)。SINGA遵循Pytorch方式,即通过记录计算图,并在正向传播后自动应用反向传播。自动传播算法的详细解释请参阅<a href="https://pytorch.org/docs/stable/notes/autograd.html">这里</a>。我们接下来对SINGA中的相关模块进行解释,并举例说明其使用方法。</p>
+<h2><a class="anchor" aria-hidden="true" id="相关模块"></a><a href="#相关模块" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>在autograd中涉及三个类,分别是<code>singa.tensor.Tensor</code>,<code>singa.autograd.Operation</code>和<code>singa.autograd.Layer</code>。在本篇的后续部分中,我们使用Tensor、Operation和Layer来指代这三个类。</p>
+<h3><a class="anchor" aria-hidden="true" id="tensor"></a><a href="#tensor" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>Tensor的三个属性被autograd使用:</p>
+<ul>
+<li><code>.creator</code>是一个<code>Operation</code>实例。它记录了产生Tensor实例的这个操作。</li>
+<li><code>.request_grad</code>是一个布尔变量。它用于指示autograd算法是否需要计算张量的梯度。例如,在反向传播的过程中,线性层的权重矩阵和卷积层(非底层)的特征图的张量梯度应该被计算。</li>
+<li><code>.store_grad</code>是一个布尔变量。它用于指示张量的梯度是否应该被存储并由后向函数输出。例如,特征图的梯度是在反向传播过程中计算出来的,但不包括在反向函数的输出中。</li>
+</ul>
+<p>开发者可以改变Tensor实例的<code>requires_grad</code>和<code>stores_grad</code>。例如,如果将后者设置为True,那么相应的梯度就会被包含在后向函数的输出。需要注意的是,如果<code>stores_grad</code>是True,那么 <code>requires_grad</code>一定是真,反之亦然。</p>
+<h3><a class="anchor" aria-hidden="true" id="operation"></a><a href="#operation" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
+<p>它将一个或多个<code>Tensor</code>实例作为输入,然后输出一个或多个<code>Tensor</code>实例。例如,ReLU可以作为一个具体的Operation子类来实现。当一个<code>Operation</code>实例被调用时(实例化后),会执行以下两个步骤。</p>
+<p>1.记录源操作,即输入张量的<code>创建者</code>。
+2.通过调用成员函数<code>.forward()</code>进行计算。</p>
+<p>有两个成员函数用于前向和反向传播,即<code>.forward()</code>和<code>.backward()</code>。它们以<code>Tensor.data</code>作为输入(类型为<code>CTensor</code>),并输出<code>Ctensor</code>s。要添加一个特定的操作,子类<code>Operation</code>应该实现自己的<code>.forward()</code>和<code>.backward()</code>函数。在后向传播过程中,autograd的<code>backward()</code>函数会自动调用<code>backward()</code>函数来计算输入的梯度(根据<code>require_grad</code>字段的参数和约束)。</p>
+<h3><a class="anchor" aria-hidden="true" id="layer"></a><a href="#layer" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>对于那些需要参数的Operation,我们把它们封装成一个新的类,<code>Layer</code>。例如,卷积操作被封装到卷积层(Convolution layer)中。<code>层</code>管理(存储)参数,并调用相应的<code>Operation</code>来实现变换。</p>
+<h2><a class="anchor" aria-hidden="true" id="样例"></a><a href="#样例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>在<a href="https://github.com/apache/singa/tree/master/examples/autograd">example folder</a>中提供了很多样例。在这里我我们分析两个最具代表性的例子。</p>
+<h3><a class="anchor" aria-hidden="true" id="只使用operation"></a><a href="#只使用operation" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>下一段代码展示了一个只使用<code>Operation</code>的多层感知机(MLP)模型:</p>
+<h4><a class="anchor" aria-hidden="true" id="调用依赖包"></a><a href="#调用依赖包" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> singa.tensor <span class="hljs-keyword">import</span> Tensor
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> autograd
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="创建权重矩阵和偏置向量"></a><a href="#创建权重矩阵和偏置向量" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>在将<code>requires_grad</code>和<code>stores_grad</code>都设置为<code>True</code>的情况下,创建参数张量。</p>
+<pre><code class="hljs css language-python">w0 = Tensor(shape=(<span class="hljs-number">2</span>, <span class="hljs-number">3</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+w0.gaussian(<span class="hljs-number">0.0</span>, <span class="hljs-number">0.1</span>)
+b0 = Tensor(shape=(<span class="hljs-number">1</span>, <span class="hljs-number">3</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+b0.set_value(<span class="hljs-number">0.0</span>)
+
+w1 = Tensor(shape=(<span class="hljs-number">3</span>, <span class="hljs-number">2</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+w1.gaussian(<span class="hljs-number">0.0</span>, <span class="hljs-number">0.1</span>)
+b1 = Tensor(shape=(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>), requires_grad=<span class="hljs-literal">True</span>, stores_grad=<span class="hljs-literal">True</span>)
+b1.set_value(<span class="hljs-number">0.0</span>)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="训练"></a><a href="#训练" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<pre><code class="hljs css language-python">inputs = Tensor(data=data) <span class="hljs-comment"># data matrix</span>
+target = Tensor(data=label) <span class="hljs-comment"># label vector</span>
+autograd.training = <span class="hljs-literal">True</span> <span class="hljs-comment"># for training</span>
+sgd = opt.SGD(<span class="hljs-number">0.05</span>) <span class="hljs-comment"># optimizer</span>
+
+<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">10</span>):
+ x = autograd.matmul(inputs, w0) <span class="hljs-comment"># matrix multiplication</span>
+ x = autograd.add_bias(x, b0) <span class="hljs-comment"># add the bias vector</span>
+ x = autograd.relu(x) <span class="hljs-comment"># ReLU activation operation</span>
+
+ x = autograd.matmul(x, w1)
+ x = autograd.add_bias(x, b1)
+
+ loss = autograd.softmax_cross_entropy(x, target)
+
+ <span class="hljs-keyword">for</span> p, g <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, g)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="使用operation和layer"></a><a href="#使用operation和layer" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>下面的<a href="https://github.com/apache/singa/blob/master/examples/autograd/mnist_cnn.py">例子</a>使用autograd模块提供的层实现了一个CNN模型。</p>
+<h4><a class="anchor" aria-hidden="true" id="创建层"></a><a href="#创建层" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<pre><code class="hljs css language-python">conv1 = autograd.Conv2d(<span class="hljs-number">1</span>, <span class="hljs-number">32</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-number">1</span>, bias=<span class="hljs-literal">False</span>)
+bn1 = autograd.BatchNorm2d(<span class="hljs-number">32</span>)
+pooling1 = autograd.MaxPool2d(<span class="hljs-number">3</span>, <span class="hljs-number">1</span>, padding=<span class="hljs-number">1</span>)
+conv21 = autograd.Conv2d(<span class="hljs-number">32</span>, <span class="hljs-number">16</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-number">1</span>)
+conv22 = autograd.Conv2d(<span class="hljs-number">32</span>, <span class="hljs-number">16</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-number">1</span>)
+bn2 = autograd.BatchNorm2d(<span class="hljs-number">32</span>)
+linear = autograd.Linear(<span class="hljs-number">32</span> * <span class="hljs-number">28</span> * <span class="hljs-number">28</span>, <span class="hljs-number">10</span>)
+pooling2 = autograd.AvgPool2d(<span class="hljs-number">3</span>, <span class="hljs-number">1</span>, padding=<span class="hljs-number">1</span>)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="定义正向传播函数"></a><a href="#定义正向传播函数" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>在正向传播中的operations会被自动记录,用于反向传播。</p>
+<pre><code class="hljs css language-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(x, t)</span>:</span>
+ <span class="hljs-comment"># x is the input data (a batch of images)</span>
+ <span class="hljs-comment"># t is the label vector (a batch of integers)</span>
+ y = conv1(x) <span class="hljs-comment"># Conv layer</span>
+ y = autograd.relu(y) <span class="hljs-comment"># ReLU operation</span>
+ y = bn1(y) <span class="hljs-comment"># BN layer</span>
+ y = pooling1(y) <span class="hljs-comment"># Pooling Layer</span>
+
+ <span class="hljs-comment"># two parallel convolution layers</span>
+ y1 = conv21(y)
+ y2 = conv22(y)
+ y = autograd.cat((y1, y2), <span class="hljs-number">1</span>) <span class="hljs-comment"># cat operation</span>
+ y = autograd.relu(y) <span class="hljs-comment"># ReLU operation</span>
+ y = bn2(y)
+ y = pooling2(y)
+
+ y = autograd.flatten(y) <span class="hljs-comment"># flatten operation</span>
+ y = linear(y) <span class="hljs-comment"># Linear layer</span>
+ loss = autograd.softmax_cross_entropy(y, t) <span class="hljs-comment"># operation</span>
+ <span class="hljs-keyword">return</span> loss, y
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="训练-1"></a><a href="#训练-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python">autograd.training = <span class="hljs-literal">True</span>
+<span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(batch_number):
+ inputs = tensor.Tensor(device=dev, data=x_train[
+ i * batch_sz:(<span class="hljs-number">1</span> + i) * batch_sz], stores_grad=<span class="hljs-literal">False</span>)
+ targets = tensor.Tensor(device=dev, data=y_train[
+ i * batch_sz:(<span class="hljs-number">1</span> + i) * batch_sz], requires_grad=<span class="hljs-literal">False</span>, stores_grad=<span class="hljs-literal">False</span>)
+
+ loss, y = forward(inputs, targets) <span class="hljs-comment"># forward the net</span>
+
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss): <span class="hljs-comment"># auto backward</span>
+ sgd.update(p, gp)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="using-the-model-api"></a><a href="#using-the-model-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.2 [...]
+<p>下面的<a href="https://github.com/apache/singa/blob/master/examples/cnn/model/cnn.py">样例</a>使用<a href="./graph">Model API</a>实现了一个CNN模型。.</p>
+<h4><a class="anchor" aria-hidden="true" id="定义model的子类"></a><a href="#定义model的子类" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>定义模型类,它应该是Model的子类。只有这样,在训练阶段使用的所有操作才会形成一个计算图以便进行分析。图中的操作将被按时序规划并有效执行,模型类中也可以包含层。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MLP</span><span class="hljs-params">(model.Model)</span>:</span> <span class="hljs-comment"># the model is a subclass of Model</span>
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, data_size=<span class="hljs-number">10</span>, perceptron_size=<span class="hljs-number">100</span>, num_classes=<span class="hljs-number">10</span>)</span>:</span>
+ super(MLP, self).__init__()
+
+ <span class="hljs-comment"># init the operators, layers and other objects</span>
+ self.relu = layer.ReLU()
+ self.linear1 = layer.Linear(perceptron_size)
+ self.linear2 = layer.Linear(num_classes)
+ self.softmax_cross_entropy = layer.SoftMaxCrossEntropy()
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, inputs)</span>:</span> <span class="hljs-comment"># define the forward function</span>
+ y = self.linear1(inputs)
+ y = self.relu(y)
+ y = self.linear2(y)
+ <span class="hljs-keyword">return</span> y
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">train_one_batch</span><span class="hljs-params">(self, x, y)</span>:</span>
+ out = self.forward(x)
+ loss = self.softmax_cross_entropy(out, y)
+ self.optimizer(loss)
+ <span class="hljs-keyword">return</span> out, loss
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">set_optimizer</span><span class="hljs-params">(self, optimizer)</span>:</span> <span class="hljs-comment"># attach an optimizer</span>
+ self.optimizer = optimizer
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="训练-2"></a><a href="#训练-2" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-comment"># create a model instance</span>
+model = MLP()
+<span class="hljs-comment"># initialize optimizer and attach it to the model</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.005</span>, momentum=<span class="hljs-number">0.9</span>, weight_decay=<span class="hljs-number">1e-5</span>)
+model.set_optimizer(sgd)
+<span class="hljs-comment"># input and target placeholders for the model</span>
+tx = tensor.Tensor((batch_size, <span class="hljs-number">1</span>, IMG_SIZE, IMG_SIZE), dev, tensor.float32)
+ty = tensor.Tensor((batch_size, num_classes), dev, tensor.int32)
+<span class="hljs-comment"># compile the model before training</span>
+model.compile([tx], is_train=<span class="hljs-literal">True</span>, use_graph=<span class="hljs-literal">True</span>, sequential=<span class="hljs-literal">False</span>)
+
+<span class="hljs-comment"># train the model iteratively</span>
+<span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(num_train_batch):
+ <span class="hljs-comment"># generate the next mini-batch</span>
+ x, y = ...
+
+ <span class="hljs-comment"># Copy the data into input tensors</span>
+ tx.copy_from_numpy(x)
+ ty.copy_from_numpy(y)
+
+ <span class="hljs-comment"># Training with one batch</span>
+ out, loss = model(tx, ty)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="保存模型checkpoint"></a><a href="#保存模型checkpoint" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define the path to save the checkpoint</span>
+checkpointpath=<span class="hljs-string">"checkpoint.zip"</span>
+
+<span class="hljs-comment"># save a checkpoint</span>
+model.save_states(fpath=checkpointpath)
+</code></pre>
+<h4><a class="anchor" aria-hidden="true" id="加载模型checkpoint"></a><a href="#加载模型checkpoint" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define the path to load the checkpoint</span>
+checkpointpath=<span class="hljs-string">"checkpoint.zip"</span>
+
+<span class="hljs-comment"># load a checkpoint</span>
+<span class="hljs-keyword">import</span> os
+<span class="hljs-keyword">if</span> os.path.exists(checkpointpath):
+ model.load_states(fpath=checkpointpath)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="python-api"></a><a href="#python-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>关于Python API的更多细节,请参考<a href="https://singa.readthedocs.io/en/latest/autograd.html#module-singa.autograd">这里</a>。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/tensor"><span class="arrow-prev">← </span><span>Tensor</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/optimizer"><span>Optimizer</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#相关模块">相关模块</a><ul class="toc-headings"><li><a href="#tensor">Tensor</a></li><li><a href="#operation">Operation</ [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1.html b/content/docs/3.2.0_Chinese/benchmark-train.html
similarity index 55%
copy from content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1.html
copy to content/docs/3.2.0_Chinese/benchmark-train.html
index cbd946c..6a21e69 100644
--- a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1.html
+++ b/content/docs/3.2.0_Chinese/benchmark-train.html
@@ -1,43 +1,14 @@
-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Apache SINGA-3.2.0.rc1 Release Notes · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional informatio [...]
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Benchmark for Distributed Training · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information [...]
document.addEventListener('DOMContentLoaded', function() {
addBackToTop(
{"zIndex":100}
)
});
- </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0.rc1</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-in [...]
-<p>SINGA is a distributed deep learning library.</p>
-<p>This release includes following changes:</p>
-<ul>
-<li><p>New examples</p>
-<ul>
-<li>Add one cifar-10 distributed CNN example for benchmarking the performance of the distributed
-training.</li>
-<li>Add one large CNN example for training with a dataset from the filesysetm.</li>
-</ul></li>
-<li><p>Enhance distributed training</p>
-<ul>
-<li>Improve the data augmentation module for faster distributed training.</li>
-<li>Add device synchronization for more accurate time measurements during the distributed training.</li>
-</ul></li>
-<li><p>Add Support for half-precision floating-point format (fp16) in deep learning models and
-computational kernels.</p></li>
-<li><p>Update new onnx APIs and fix onnx examples accordingly, namely, DenseNet121, ShuffleNetv1,
-ShuffleNetv2, SqueezeNet, VGG19.</p></li>
-<li><p>Add a new method to resize images by given width and height.</p></li>
-<li><p>Use docusaurus versioning to simplify the process of generating the project homepage.</p></li>
-<li><p>Promote code quality</p>
-<ul>
-<li>Unify the formats of docstrings that describe the contents and usage of the module.</li>
-<li>Unify the parameters of command-line arguments.</li>
-</ul></li>
-<li><p>Fix bugs</p>
-<ul>
-<li>Fix the CI build error by downloading the tbb binaries.</li>
-<li>Add disabling graph option for accessing parameter or gradient tensors during distributed<br>
-training.</li>
-<li>Solve the warnings of deprecated functions in the distributed optimizer module.</li>
-</ul></li>
-</ul>
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+<p>项目:我们使用深度卷积神经网络<a href="https://github.com/apache/singa/blob/master/examples/cnn/model/resnet.py">ResNet-50</a>。它有50个卷积层,用于图像分类。它需要3.8个GFLOPs来通过网络处理一张图像(尺寸为224x224)。输入的图像大小为224x224。</p>
+<p>硬件方面:我们使用的是AWS的p2.8xlarge实例,每个实例有8个Nvidia Tesla K80 GPU,共96GB GPU内存,32个vCPU,488GB主内存,10Gbps网络带宽。</p>
+<p>衡量标准:我们衡量不同数量worker的每次迭代时间,以评估SINGA的可扩展性。Batch-size固定为每个GPU32个。采用同步训练方案。因此,有效的batch-size是<code>32N</code>,其中N是GPU的数量。我们与一个流行的开源系统进行比较,该系统采用参数服务器拓扑结构。选择第一个GPU作为服务器。</p>
+<p><img src="/docs/assets/benchmark.png" alt="Benchmark Experiments"> <br/> <strong>可扩展性测试。条形为吞吐量,折线形为通信成本。</strong></p>
</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readthedocs.io/en/latest/">API Reference</a><a href="/docs/examples">Exa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
diff --git a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1/index.html b/content/docs/3.2.0_Chinese/benchmark-train/index.html
similarity index 55%
copy from content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1/index.html
copy to content/docs/3.2.0_Chinese/benchmark-train/index.html
index cbd946c..6a21e69 100644
--- a/content/docs/3.2.0.rc1/releases/RELEASE_NOTES_3.2.0.rc1/index.html
+++ b/content/docs/3.2.0_Chinese/benchmark-train/index.html
@@ -1,43 +1,14 @@
-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Apache SINGA-3.2.0.rc1 Release Notes · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional informatio [...]
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Benchmark for Distributed Training · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information [...]
document.addEventListener('DOMContentLoaded', function() {
addBackToTop(
{"zIndex":100}
)
});
- </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0.rc1</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-in [...]
-<p>SINGA is a distributed deep learning library.</p>
-<p>This release includes following changes:</p>
-<ul>
-<li><p>New examples</p>
-<ul>
-<li>Add one cifar-10 distributed CNN example for benchmarking the performance of the distributed
-training.</li>
-<li>Add one large CNN example for training with a dataset from the filesysetm.</li>
-</ul></li>
-<li><p>Enhance distributed training</p>
-<ul>
-<li>Improve the data augmentation module for faster distributed training.</li>
-<li>Add device synchronization for more accurate time measurements during the distributed training.</li>
-</ul></li>
-<li><p>Add Support for half-precision floating-point format (fp16) in deep learning models and
-computational kernels.</p></li>
-<li><p>Update new onnx APIs and fix onnx examples accordingly, namely, DenseNet121, ShuffleNetv1,
-ShuffleNetv2, SqueezeNet, VGG19.</p></li>
-<li><p>Add a new method to resize images by given width and height.</p></li>
-<li><p>Use docusaurus versioning to simplify the process of generating the project homepage.</p></li>
-<li><p>Promote code quality</p>
-<ul>
-<li>Unify the formats of docstrings that describe the contents and usage of the module.</li>
-<li>Unify the parameters of command-line arguments.</li>
-</ul></li>
-<li><p>Fix bugs</p>
-<ul>
-<li>Fix the CI build error by downloading the tbb binaries.</li>
-<li>Add disabling graph option for accessing parameter or gradient tensors during distributed<br>
-training.</li>
-<li>Solve the warnings of deprecated functions in the distributed optimizer module.</li>
-</ul></li>
-</ul>
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+<p>项目:我们使用深度卷积神经网络<a href="https://github.com/apache/singa/blob/master/examples/cnn/model/resnet.py">ResNet-50</a>。它有50个卷积层,用于图像分类。它需要3.8个GFLOPs来通过网络处理一张图像(尺寸为224x224)。输入的图像大小为224x224。</p>
+<p>硬件方面:我们使用的是AWS的p2.8xlarge实例,每个实例有8个Nvidia Tesla K80 GPU,共96GB GPU内存,32个vCPU,488GB主内存,10Gbps网络带宽。</p>
+<p>衡量标准:我们衡量不同数量worker的每次迭代时间,以评估SINGA的可扩展性。Batch-size固定为每个GPU32个。采用同步训练方案。因此,有效的batch-size是<code>32N</code>,其中N是GPU的数量。我们与一个流行的开源系统进行比较,该系统采用参数服务器拓扑结构。选择第一个GPU作为服务器。</p>
+<p><img src="/docs/assets/benchmark.png" alt="Benchmark Experiments"> <br/> <strong>可扩展性测试。条形为吞吐量,折线形为通信成本。</strong></p>
</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-square.png" alt="Apache SINGA" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/installation">Getting Started</a><a href="/docs/device">Guides</a><a href="/en/https://apache-singa.readthedocs.io/en/latest/">API Reference</a><a href="/docs/examples">Exa [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
diff --git a/content/docs/3.2.0_Chinese/build.html b/content/docs/3.2.0_Chinese/build.html
new file mode 100644
index 0000000..1ad5994
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/build.html
@@ -0,0 +1,351 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Build SINGA from Source · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding c [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/build.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Build SINGA from Source</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contribu [...]
+<p>源文件可以通过<a href="https://dist.apache.org/repos/dist/dev/singa/">tar.gz文件</a>或git repo的形式下载:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/singa.git</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> singa/</span>
+</code></pre>
+<p>如果您想为SINGA贡献代码,请参考<a href="/docs/3.2.0_Chinese/contribute-code">贡献代码</a>页面的步骤和要求。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用conda构筑singa"></a><a href="#使用conda构筑singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>Conda-build 是一个构建工具,它从anaconda cloud安装依赖的库并执行构建脚本。</p>
+<p>安装conda-build(需要先安装conda):</p>
+<pre><code class="hljs css language-shell">conda install conda-build
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="构建cpu版本"></a><a href="#构建cpu版本" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>构建SINGA的CPU版本:</p>
+<pre><code class="hljs css language-shell">conda build tool/conda/singa/
+</code></pre>
+<p>以上命令已经在Ubuntu(14.04,16.04和18.04)和macOS 10.11上测试过。更多信息请参考<a href="https://travis-ci.org/apache/singa">Travis-CI page</a>页面。</p>
+<h3><a class="anchor" aria-hidden="true" id="构建gpu版本"></a><a href="#构建gpu版本" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>要构建GPU版的SINGA,计算机必须装备有Nvida GPU,而且需要安装CUDA driver(>=384.81)、CUDA toolkit(>=9)和cuDNN(>=7)。以下两个Docker镜像提供了构建环境:</p>
+<ol>
+<li>apache/singa:conda-cuda9.0</li>
+<li>apache/singa:conda-cuda10.0</li>
+</ol>
+<p>构建环境准备好后,需要先导出CUDA版本,然后运行conda命令构建SINGA:</p>
+<pre><code class="hljs css language-shell">export CUDA=x.y (e.g. 9.0)
+conda build tool/conda/singa/
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="后处理"></a><a href="#后处理" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<p>生成的包文件的位置(<code>.tar.gz</code>)将打印在终端上,生成的包可以直接安装:</p>
+<pre><code class="hljs css language-shell">conda install -c conda-forge --use-local <path to the package file>
+</code></pre>
+<p>若要上传到anaconda云端供他人下载安装,需要在 anaconda 上注册一个账号,才能<a href="https://docs.anaconda.com/anaconda-cloud/user-guide/getting-started/">上传包</a>:</p>
+<pre><code class="hljs css language-shell">conda install anaconda-client
+anaconda login
+anaconda upload -l main <path to the package file>
+</code></pre>
+<p>将包上传到云端后,您可以在<a href="https://anaconda.org/">Anaconda Cloud</a>上看到,也可以通过以下命令查看:</p>
+<pre><code class="hljs css language-shell">conda search -c <anaconda username> singa
+</code></pre>
+<p>每个特定的SINGA软件包都由版本和构建字符串来标识。要安装一个特定的SINGA包,需要提供所有信息,例如:</p>
+<pre><code class="hljs css language-shell">conda install -c <anaconda username> -c conda-forge singa=2.1.0.dev=cpu_py36
+</code></pre>
+<p>为了使安装命令简单化,您可以创建以下附加包,这些包依赖于最新的CPU和GPU SINGA包:</p>
+<pre><code class="hljs css language-console"><span class="hljs-meta">#</span><span class="bash"> <span class="hljs-keyword">for</span> singa-cpu</span>
+conda build tool/conda/cpu/ --python=3.6
+conda build tool/conda/cpu/ --python=3.7
+<span class="hljs-meta">#</span><span class="bash"> <span class="hljs-keyword">for</span> singa-gpu</span>
+conda build tool/conda/gpu/ --python=3.6
+conda build tool/conda/gpu/ --python=3.7
+</code></pre>
+<p>因此,当您运行:</p>
+<pre><code class="hljs css language-shell">conda install -c <anaconda username> -c conda-forge singa-xpu
+</code></pre>
+<p>时(<code>xpu</code>表示'cpu' or 'gpu'), 相应的真正的SINGA包将作为依赖库被安装。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用本地工具在ubuntu上构建singa"></a><a href="#使用本地工具在ubuntu上构建singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>请参阅 SINGA <a href="https://github.com/apache/singa/blob/master/tool/docker/devel/ubuntu/cuda9/Dockerfile#L30">Dockerfiles</a>,了解在 Ubuntu 16.04 上安装依赖库的说明。您也可以使用 devel 映像创建一个 Docker 容器,并在容器中构建 SINGA。要使用GPU、DNNL、Python和单元测试来构建SINGA,请运行以下命令:</p>
+<pre><code class="hljs css language-shell">mkdir build # at the root of singa folder
+cd build
+cmake -DENABLE_TEST=ON -DUSE_CUDA=ON -DUSE_DNNL=ON -DUSE_PYTHON3=ON ..
+make
+cd python
+pip install .
+</code></pre>
+<p>CMake选项的详细内容在本页最后一节解释,上面最后一条命令是安装Python包。你也可以运行<code>pip install -e .</code>,它可以创建符号链接,而不是将 Python 文件复制到 site-package 文件夹中。</p>
+<p>如果SINGA在ENABLE_TEST=ON的情况下编译,您可以通过以下方式运行单元测试:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./bin/test_singa</span>
+</code></pre>
+<p>您可以看到所有的测试案例与测试结果。如果SINGA通过了所有测试,那么您就成功安装了SINGA。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用本地工具在centos7上构建singa"></a><a href="#使用本地工具在centos7上构建singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<p>由于Centos7的软件包名称不同,因此从源码开始构建会有所不同。</p>
+<h3><a class="anchor" aria-hidden="true" id="安装依赖项"></a><a href="#安装依赖项" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>基础包和库文件:</p>
+<pre><code class="hljs css language-shell">sudo yum install freetype-devel libXft-devel ncurses-devel openblas-devel blas-devel lapack devel atlas-devel kernel-headers unzip wget pkgconfig zip zlib-devel libcurl-devel cmake curl unzip dh-autoreconf git python-devel glog-devel protobuf-devel
+</code></pre>
+<p>构建必需的包:</p>
+<pre><code class="hljs css language-shell">sudo yum group install "Development Tools"
+</code></pre>
+<p>若要安装swig:</p>
+<pre><code class="hljs css language-shell">sudo yum install pcre-devel
+wget http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz
+tar xvzf swig-3.0.10.tar.gz
+cd swig-3.0.10.tar.gz
+./configure --prefix=${RUN}
+make
+make install
+</code></pre>
+<p>安装gfortran:</p>
+<pre><code class="hljs css language-shell">sudo yum install centos-release-scl-rh
+sudo yum --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc-gfortran
+</code></pre>
+<p>安装pip和其他包:</p>
+<pre><code class="hljs css language-shell">sudo yum install epel-release
+sudo yum install python-pip
+pip install matplotlib numpy pandas scikit-learn pydot
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="安装singa"></a><a href="#安装singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>按照《使用本地工具在Ubuntu上构建SINGA》的步骤1-5进行操作</p>
+<h3><a class="anchor" aria-hidden="true" id="测试"></a><a href="#测试" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>您可以通过如下方式进行</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./bin/test_singa</span>
+</code></pre>
+<p>您可以看到所有的测试案例与测试结果。如果SINGA通过了所有测试,即表示安装成功。</p>
+<h2><a class="anchor" aria-hidden="true" id="在windows中编译singa"></a><a href="#在windows中编译singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在Windows上使用Python支持构建SINGA的说明可以在<a href="/docs/3.2.0_Chinese/install-win">install-win页面</a>找到。</p>
+<h2><a class="anchor" aria-hidden="true" id="关于编译选项的更多细节"></a><a href="#关于编译选项的更多细节" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="use_modules-已过期废弃"></a><a href="#use_modules-已过期废弃" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>如果没有安装protobuf和openblas,你可以用它们一起编译SINGA</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> In SINGA ROOT folder</span>
+<span class="hljs-meta">$</span><span class="bash"> mkdir build</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> build</span>
+<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_MODULES=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<p>cmake 会下载 OpenBlas 和 Protobuf (2.6.1) 并与 SINGA 一起编译。</p>
+<p>您可以使用<code>ccmake ..</code>来配置编译选项。如果一些依赖的库不在系统默认路径中,则您需要手动导出以下环境变量:</p>
+<pre><code class="hljs css language-shell">export CMAKE_INCLUDE_PATH=<path to the header file folder>
+export CMAKE_LIBRARY_PATH=<path to the lib file folder>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_python"></a><a href="#use_python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>编译SINGA的Python封装器选项:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_PYTHON=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> python</span>
+<span class="hljs-meta">$</span><span class="bash"> pip install .</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_cuda"></a><a href="#use_cuda" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>我们推荐用户安装CUDA和<a href="https://developer.nvidia.com/cudnn">cuDNN</a>,以便在GPU上运行SINGA,以获得更好的性能。</p>
+<p>SINGA已经在CUDA 9/10和cuDNN 7上进行了测试。如果cuDNN安装在非系统文件夹中,例如 /home/bob/local/cudnn/,则需要执行以下命令来让cmake在编译时能够找到它们:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_INCLUDE_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/include:<span class="hljs-variable">$CMAKE_INCLUDE_PATH</span></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_LIBRARY_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/lib64:<span class="hljs-variable">$CMAKE_LIBRARY_PATH</span></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LD_LIBRARY_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span></span>
+</code></pre>
+<p>CUDA和cuDNN的cmake选项应该设置成“ON”:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> Dependent libs are install already</span>
+<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_CUDA=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_dnnl"></a><a href="#use_dnnl" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>用户可以启用DNNL来提高CPU的计算性能,DNNL的安装指南可以在<a href="https://github.com/intel/mkl-dnn#installation">这里</a>找到:</p>
+<p>SINGA在DNNL v1.1环境下已经进行过测试并通过,</p>
+<p>若要启用DNNL支持来编译SINGA:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> Dependent libs are installed already</span>
+<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_DNNL=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_opencl"></a><a href="#use_opencl" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>SINGA使用opencl-headers和viennacl(版本1.7.1及以上)来支持OpenCL,它们可以通过如下方式安装:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> On Ubuntu 16.04</span>
+<span class="hljs-meta">$</span><span class="bash"> sudo apt-get install opencl-headers, libviennacl-dev</span>
+<span class="hljs-meta">#</span><span class="bash"> On Fedora</span>
+<span class="hljs-meta">$</span><span class="bash"> sudo yum install opencl-headers, viennacl</span>
+</code></pre>
+<p>此外,你需要在你想运行OpenCL的平台安装OpenCL Installable Client Driver(ICD)。</p>
+<ul>
+<li>对于AMD和Nvidia的GPU,驱动包也应该安装与之匹配的OpenCL ICD。</li>
+<li>对于Intel的CPU和/或GPU,请从<a href="https://software.intel.com/en-us/articles/opencl-drivers">Intel官方网站</a>上获取驱动程序。请注意,该网站上提供的驱动程序只支持最新的CPU和Iris GPU。</li>
+<li>对于旧的Intel CPU,你可以使用beignet-opencl-icd包。</li>
+</ul>
+<p>请注意,目前不建议在CPU上运行OpenCL,因为运行速度会很慢。内存传输是以整数秒为单位的(直观来说,CPU上是1000毫秒,而GPU上是1毫秒)。</p>
+<p>更多关于建立OpenCL工作环境的信息可以在<a href="https://wiki.tiker.net/OpenCLHowTo">这里</a>找到。</p>
+<p>如果ViennaCL的软件包版本不是至少1.7.1,则需要从源码构建它:</p>
+<p>从<a href="https://github.com/viennacl/viennacl-dev">这个git repo</a>clone版本库,切换(checkout)到release-1.7.1分支,然后构建它,并把项目路径添加到PATH,再把构建的库文件添加到LD_LIBRARY_PATH。</p>
+<p>构建支持OpenCL的SINGA(在SINGA 1.1上测试):</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_OPENCL=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="package"></a><a href="#package" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>这个设置是用来构建 Debian 软件包的。设置PACKAGE=ON,然后用make命令来编译软件包,如下所示:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DPACKAGE=ON</span>
+<span class="hljs-meta">$</span><span class="bash"> make package</span>
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="faq"></a><a href="#faq" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<ul>
+<li><p>Q: 'import singa'阶段报错</p>
+<p>A: 请检查<code>python -c "from singa import _singa_wrap</code>中的详细错误。有时是由依赖库引起的,比如protobuf有多个版本,cudnn缺失,numpy版本不匹配等问题。下面展示了不同情况下的解决方案</p>
+<ol>
+<li><p>检查cudnn和cuda。如果cudnn缺失或与wheel包的版本不一致,你可以下载正确的cudnn版本到~/local/cudnn/,然后:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"export LD_LIBRARY_PATH=/home/<yourname>/local/cudnn/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span>"</span> >> ~/.bashrc</span>
+</code></pre></li>
+<li><p>如果是protobuf的问题。你可以将protobuf (3.6.1)从源码安装到本地文件夹,比如 ~/local/,解压tar文件,然后:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./configure --prefix=/home/<yourname><span class="hljs-built_in">local</span></span>
+<span class="hljs-meta">$</span><span class="bash"> make && make install</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"export LD_LIBRARY_PATH=/home/<yourname>/local/lib:<span class="hljs-variable">$LD_LIBRARY_PATH</span>"</span> >> ~/.bashrc</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">source</span> ~/.bashrc</span>
+</code></pre></li>
+<li><p>如果找不到包括python在内的其他类库,则使用<code>pip</code>或<code>conda</code>创建虚拟环境.</p></li>
+<li><p>如果不是上述原因造成的,请到<code>_singa_wrap.so</code>文件夹中查看:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> python</span>
+<span class="hljs-meta">></span><span class="bash">> import importlib</span>
+<span class="hljs-meta">></span><span class="bash">> importlib.import_module(<span class="hljs-string">'_singa_wrap'</span>)</span>
+</code></pre>
+<p>来检查错误信息。例如,如果是numpy的版本不匹配,错误信息会是:</p>
+<pre><code class="hljs css language-shell">RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
+</code></pre>
+<p>那么你就需要更新numpy到更高版本。</p></li>
+</ol></li>
+</ul>
+<ul>
+<li><p>Q: 运行<code>cmake ...</code>时出错,找不到依赖库。</p>
+<p>A: 如果你还没有安装这些依赖库,请先安装它们。如果你在系统文件夹之外的文件夹中安装了库,例如/usr/local,那您需要手动导出以下变量:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_INCLUDE_PATH=<path to your header file folder></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_LIBRARY_PATH=<path to your lib file folder></span>
+</code></pre></li>
+</ul>
+<ul>
+<li><p>Q: 来自<code>make</code>的错误,例如linking阶段的错误.</p>
+<p>A: 如果您的库文件在系统默认路径以外的其他文件夹中,则需要手动导出以下变量。</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LIBRARY_PATH=<path to your lib file folder></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LD_LIBRARY_PATH=<path to your lib file folder></span>
+</code></pre></li>
+</ul>
+<ul>
+<li><p>Q: 来自头文件的错误,例如'cblas.h文件不存在'</p>
+<p>A: 您需要手动将cblas.h的文件夹包含在CPLUS_INCLUDE_PATH中,例如:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include:<span class="hljs-variable">$CPLUS_INCLUDE_PATH</span></span>
+</code></pre></li>
+<li><p>Q: 在编译SINGA时,我收到错误信息<code>SSE2 instruction set not enabled</code></p>
+<p>A:您可以尝试如下指令:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> make CFLAGS=<span class="hljs-string">'-msse2'</span> CXXFLAGS=<span class="hljs-string">'-msse2'</span></span>
+</code></pre></li>
+<li><p>Q:当试图导入.py文件时,从google.protobuf.internal收到<code>ImportError: cannot import name enum_type_wrapper</code>。</p>
+<p>A: 您需要安装protobuf的Python绑定包,它可以通过如下方式安装:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> sudo apt-get install protobuf</span>
+</code></pre>
+<p>或从源文件编译:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> /PROTOBUF/SOURCE/FOLDER</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> python</span>
+<span class="hljs-meta">$</span><span class="bash"> python setup.py build</span>
+<span class="hljs-meta">$</span><span class="bash"> python setup.py install</span>
+</code></pre></li>
+<li><p>Q: 当我从源码构建OpenBLAS时,被告知需要一个Fortran编译器。</p>
+<p>A: 您可以通过如下方式编译OpenBLAS:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> make ONLY_CBLAS=1</span>
+</code></pre>
+<p>或者通过如下方式安装:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> sudo apt-get install libopenblas-dev</span>
+</code></pre></li>
+<li><p>Q: 当我构建协议缓冲区时,它报告说在<code>/usr/lib64/libstdc++.so.6</code>中没有找到<code>GLIBC++_3.4.20</code>?</p>
+<p>A: 这意味着链接器找到了libstdc++.so.6,但该库属于旧的GCC(用于编译和链接程序的GCC)版本。此程序依赖于新的libstdc++中定义的代码,而该代码属于较新版本的GCC,所以必须告诉链接器如何找到较新的libstdc++共享库。最简单的解决方法是找到正确的libstdc++,并将其导出到LD_LIBRARY_PATH。例如,如果下面命令的输出中列出了GLIBC++_3.4.20:</p>
+<pre><code class="hljs"> $ strings /usr/local/lib64/libstdc++.so.6|grep GLIBC++
+</code></pre>
+<p>那么接下来需要设置环境变量为:</p>
+<pre><code class="hljs"> $ export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
+</code></pre></li>
+<li><p>Q: 当构建glog时,报告说 "src/logging_unittest.cc:83:20: error: 'gflags' is not a namespace-name"。</p>
+<p>A: 可能是由于安装的gflags用了不同的命名空间,比如 "google",所以glog找不到'gflags'的命名空间。实际上建立glog并不需要gflags,所以你可以修改configure.ac文件来忽略gflags。</p>
+<pre><code class="hljs"> 1. cd to glog src directory
+ 2. change line 125 of configure.ac to "AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=0, ac_cv_have_libgflags=0)"
+ 3. autoreconf
+</code></pre>
+<p>执行上述命令后,就可以重新构建glog了。</p></li>
+<li><p>Q: 在使用虚拟环境时,每次运行pip install,都会重新安装numpy。但是,当运行<code>import numpy</code>时,numpy并没有被调用。</p>
+<p>A: 可能是由于<code>PYTHONPATH</code>造成的,在使用虚拟环境时,应将<code>PYTHONPATH</code>设置为空,以避免与虚拟环境本身的路径冲突。</p></li>
+<li><p>Q: 当从源代码编译PySINGA时,由于缺少<numpy/objectarray.h>,出现的编译错误。</p>
+<p>A: 请安装numpy并导出numpy头文件的路径为</p>
+<pre><code class="hljs"> $ export CPLUS_INCLUDE_PATH=`python -c "import numpy; print numpy.get_include()"`:$CPLUS_INCLUDE_PATH
+</code></pre></li>
+<li><p>Q: 当我在Mac OS X中运行SINGA时,报错 "Fatal Python error:
+PyThreadState_Get: no current thread Abort trap: 6"</p>
+<p>A: 这个错误通常发生在系统上有多个版本的Python,并且是通过pip安装的SINGA (通过conda安装时不会出现这个问题),例如,操作系统自带的版本和Homebrew安装的版本。PySINGA所链接的Python必须与Python解释器(interpreter)相同。 您可以通过 <code>which python</code> 检查您的解释器路径并通过<code>otool -L <path to _singa_wrap.so></code>检查PySINGA链接的Python路径。要解决这个问题,请用正确的 Python 版本编译 SINGA。需要注意的是,如果您从源码编译 PySINGA,您需要在调用<a href="http://stackoverflow.com/questions/15291500/i-have-2-versions-of-python-installed-but-cmake-is-using-older-version-how-do">cmake</a>时指定路径:</p></li>
+</ul>
+<pre><code class="hljs"> $ cmake -DPYTHON_LIBRARY=`python-config --prefix`/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=`python-config --prefix`/include/python2.7/ ..
+</code></pre>
+<p>如果从二进制包中安装PySINGA,例如debian或wheel,那么你需要改变python解释器的路径,例如,重新设置$PATH,并把Python的正确路径放在前面的位置。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/downloads"><span class="arrow-prev">← </span><span>Download SINGA</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/contribute-code"><span>How to Contribute Code</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用conda构筑singa">使用Conda构筑SINGA</a><ul class="toc-headings"><li><a href="#构建cpu版本"> [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/build/index.html b/content/docs/3.2.0_Chinese/build/index.html
new file mode 100644
index 0000000..1ad5994
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/build/index.html
@@ -0,0 +1,351 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Build SINGA from Source · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding c [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/build.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Build SINGA from Source</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contribu [...]
+<p>源文件可以通过<a href="https://dist.apache.org/repos/dist/dev/singa/">tar.gz文件</a>或git repo的形式下载:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/singa.git</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> singa/</span>
+</code></pre>
+<p>如果您想为SINGA贡献代码,请参考<a href="/docs/3.2.0_Chinese/contribute-code">贡献代码</a>页面的步骤和要求。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用conda构筑singa"></a><a href="#使用conda构筑singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>Conda-build 是一个构建工具,它从anaconda cloud安装依赖的库并执行构建脚本。</p>
+<p>安装conda-build(需要先安装conda):</p>
+<pre><code class="hljs css language-shell">conda install conda-build
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="构建cpu版本"></a><a href="#构建cpu版本" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>构建SINGA的CPU版本:</p>
+<pre><code class="hljs css language-shell">conda build tool/conda/singa/
+</code></pre>
+<p>以上命令已经在Ubuntu(14.04,16.04和18.04)和macOS 10.11上测试过。更多信息请参考<a href="https://travis-ci.org/apache/singa">Travis-CI page</a>页面。</p>
+<h3><a class="anchor" aria-hidden="true" id="构建gpu版本"></a><a href="#构建gpu版本" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>要构建GPU版的SINGA,计算机必须装备有Nvida GPU,而且需要安装CUDA driver(>=384.81)、CUDA toolkit(>=9)和cuDNN(>=7)。以下两个Docker镜像提供了构建环境:</p>
+<ol>
+<li>apache/singa:conda-cuda9.0</li>
+<li>apache/singa:conda-cuda10.0</li>
+</ol>
+<p>构建环境准备好后,需要先导出CUDA版本,然后运行conda命令构建SINGA:</p>
+<pre><code class="hljs css language-shell">export CUDA=x.y (e.g. 9.0)
+conda build tool/conda/singa/
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="后处理"></a><a href="#后处理" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<p>生成的包文件的位置(<code>.tar.gz</code>)将打印在终端上,生成的包可以直接安装:</p>
+<pre><code class="hljs css language-shell">conda install -c conda-forge --use-local <path to the package file>
+</code></pre>
+<p>若要上传到anaconda云端供他人下载安装,需要在 anaconda 上注册一个账号,才能<a href="https://docs.anaconda.com/anaconda-cloud/user-guide/getting-started/">上传包</a>:</p>
+<pre><code class="hljs css language-shell">conda install anaconda-client
+anaconda login
+anaconda upload -l main <path to the package file>
+</code></pre>
+<p>将包上传到云端后,您可以在<a href="https://anaconda.org/">Anaconda Cloud</a>上看到,也可以通过以下命令查看:</p>
+<pre><code class="hljs css language-shell">conda search -c <anaconda username> singa
+</code></pre>
+<p>每个特定的SINGA软件包都由版本和构建字符串来标识。要安装一个特定的SINGA包,需要提供所有信息,例如:</p>
+<pre><code class="hljs css language-shell">conda install -c <anaconda username> -c conda-forge singa=2.1.0.dev=cpu_py36
+</code></pre>
+<p>为了使安装命令简单化,您可以创建以下附加包,这些包依赖于最新的CPU和GPU SINGA包:</p>
+<pre><code class="hljs css language-console"><span class="hljs-meta">#</span><span class="bash"> <span class="hljs-keyword">for</span> singa-cpu</span>
+conda build tool/conda/cpu/ --python=3.6
+conda build tool/conda/cpu/ --python=3.7
+<span class="hljs-meta">#</span><span class="bash"> <span class="hljs-keyword">for</span> singa-gpu</span>
+conda build tool/conda/gpu/ --python=3.6
+conda build tool/conda/gpu/ --python=3.7
+</code></pre>
+<p>因此,当您运行:</p>
+<pre><code class="hljs css language-shell">conda install -c <anaconda username> -c conda-forge singa-xpu
+</code></pre>
+<p>时(<code>xpu</code>表示'cpu' or 'gpu'), 相应的真正的SINGA包将作为依赖库被安装。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用本地工具在ubuntu上构建singa"></a><a href="#使用本地工具在ubuntu上构建singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>请参阅 SINGA <a href="https://github.com/apache/singa/blob/master/tool/docker/devel/ubuntu/cuda9/Dockerfile#L30">Dockerfiles</a>,了解在 Ubuntu 16.04 上安装依赖库的说明。您也可以使用 devel 映像创建一个 Docker 容器,并在容器中构建 SINGA。要使用GPU、DNNL、Python和单元测试来构建SINGA,请运行以下命令:</p>
+<pre><code class="hljs css language-shell">mkdir build # at the root of singa folder
+cd build
+cmake -DENABLE_TEST=ON -DUSE_CUDA=ON -DUSE_DNNL=ON -DUSE_PYTHON3=ON ..
+make
+cd python
+pip install .
+</code></pre>
+<p>CMake选项的详细内容在本页最后一节解释,上面最后一条命令是安装Python包。你也可以运行<code>pip install -e .</code>,它可以创建符号链接,而不是将 Python 文件复制到 site-package 文件夹中。</p>
+<p>如果SINGA在ENABLE_TEST=ON的情况下编译,您可以通过以下方式运行单元测试:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./bin/test_singa</span>
+</code></pre>
+<p>您可以看到所有的测试案例与测试结果。如果SINGA通过了所有测试,那么您就成功安装了SINGA。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用本地工具在centos7上构建singa"></a><a href="#使用本地工具在centos7上构建singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<p>由于Centos7的软件包名称不同,因此从源码开始构建会有所不同。</p>
+<h3><a class="anchor" aria-hidden="true" id="安装依赖项"></a><a href="#安装依赖项" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>基础包和库文件:</p>
+<pre><code class="hljs css language-shell">sudo yum install freetype-devel libXft-devel ncurses-devel openblas-devel blas-devel lapack devel atlas-devel kernel-headers unzip wget pkgconfig zip zlib-devel libcurl-devel cmake curl unzip dh-autoreconf git python-devel glog-devel protobuf-devel
+</code></pre>
+<p>构建必需的包:</p>
+<pre><code class="hljs css language-shell">sudo yum group install "Development Tools"
+</code></pre>
+<p>若要安装swig:</p>
+<pre><code class="hljs css language-shell">sudo yum install pcre-devel
+wget http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz
+tar xvzf swig-3.0.10.tar.gz
+cd swig-3.0.10.tar.gz
+./configure --prefix=${RUN}
+make
+make install
+</code></pre>
+<p>安装gfortran:</p>
+<pre><code class="hljs css language-shell">sudo yum install centos-release-scl-rh
+sudo yum --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc-gfortran
+</code></pre>
+<p>安装pip和其他包:</p>
+<pre><code class="hljs css language-shell">sudo yum install epel-release
+sudo yum install python-pip
+pip install matplotlib numpy pandas scikit-learn pydot
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="安装singa"></a><a href="#安装singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>按照《使用本地工具在Ubuntu上构建SINGA》的步骤1-5进行操作</p>
+<h3><a class="anchor" aria-hidden="true" id="测试"></a><a href="#测试" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>您可以通过如下方式进行</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./bin/test_singa</span>
+</code></pre>
+<p>您可以看到所有的测试案例与测试结果。如果SINGA通过了所有测试,即表示安装成功。</p>
+<h2><a class="anchor" aria-hidden="true" id="在windows中编译singa"></a><a href="#在windows中编译singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在Windows上使用Python支持构建SINGA的说明可以在<a href="/docs/3.2.0_Chinese/install-win">install-win页面</a>找到。</p>
+<h2><a class="anchor" aria-hidden="true" id="关于编译选项的更多细节"></a><a href="#关于编译选项的更多细节" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="use_modules-已过期废弃"></a><a href="#use_modules-已过期废弃" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>如果没有安装protobuf和openblas,你可以用它们一起编译SINGA</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> In SINGA ROOT folder</span>
+<span class="hljs-meta">$</span><span class="bash"> mkdir build</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> build</span>
+<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_MODULES=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<p>cmake 会下载 OpenBlas 和 Protobuf (2.6.1) 并与 SINGA 一起编译。</p>
+<p>您可以使用<code>ccmake ..</code>来配置编译选项。如果一些依赖的库不在系统默认路径中,则您需要手动导出以下环境变量:</p>
+<pre><code class="hljs css language-shell">export CMAKE_INCLUDE_PATH=<path to the header file folder>
+export CMAKE_LIBRARY_PATH=<path to the lib file folder>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_python"></a><a href="#use_python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>编译SINGA的Python封装器选项:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_PYTHON=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> python</span>
+<span class="hljs-meta">$</span><span class="bash"> pip install .</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_cuda"></a><a href="#use_cuda" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>我们推荐用户安装CUDA和<a href="https://developer.nvidia.com/cudnn">cuDNN</a>,以便在GPU上运行SINGA,以获得更好的性能。</p>
+<p>SINGA已经在CUDA 9/10和cuDNN 7上进行了测试。如果cuDNN安装在非系统文件夹中,例如 /home/bob/local/cudnn/,则需要执行以下命令来让cmake在编译时能够找到它们:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_INCLUDE_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/include:<span class="hljs-variable">$CMAKE_INCLUDE_PATH</span></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_LIBRARY_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/lib64:<span class="hljs-variable">$CMAKE_LIBRARY_PATH</span></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LD_LIBRARY_PATH=/home/bob/<span class="hljs-built_in">local</span>/cudnn/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span></span>
+</code></pre>
+<p>CUDA和cuDNN的cmake选项应该设置成“ON”:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> Dependent libs are install already</span>
+<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_CUDA=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_dnnl"></a><a href="#use_dnnl" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>用户可以启用DNNL来提高CPU的计算性能,DNNL的安装指南可以在<a href="https://github.com/intel/mkl-dnn#installation">这里</a>找到:</p>
+<p>SINGA在DNNL v1.1环境下已经进行过测试并通过,</p>
+<p>若要启用DNNL支持来编译SINGA:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> Dependent libs are installed already</span>
+<span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_DNNL=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="use_opencl"></a><a href="#use_opencl" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>SINGA使用opencl-headers和viennacl(版本1.7.1及以上)来支持OpenCL,它们可以通过如下方式安装:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">#</span><span class="bash"> On Ubuntu 16.04</span>
+<span class="hljs-meta">$</span><span class="bash"> sudo apt-get install opencl-headers, libviennacl-dev</span>
+<span class="hljs-meta">#</span><span class="bash"> On Fedora</span>
+<span class="hljs-meta">$</span><span class="bash"> sudo yum install opencl-headers, viennacl</span>
+</code></pre>
+<p>此外,你需要在你想运行OpenCL的平台安装OpenCL Installable Client Driver(ICD)。</p>
+<ul>
+<li>对于AMD和Nvidia的GPU,驱动包也应该安装与之匹配的OpenCL ICD。</li>
+<li>对于Intel的CPU和/或GPU,请从<a href="https://software.intel.com/en-us/articles/opencl-drivers">Intel官方网站</a>上获取驱动程序。请注意,该网站上提供的驱动程序只支持最新的CPU和Iris GPU。</li>
+<li>对于旧的Intel CPU,你可以使用beignet-opencl-icd包。</li>
+</ul>
+<p>请注意,目前不建议在CPU上运行OpenCL,因为运行速度会很慢。内存传输是以整数秒为单位的(直观来说,CPU上是1000毫秒,而GPU上是1毫秒)。</p>
+<p>更多关于建立OpenCL工作环境的信息可以在<a href="https://wiki.tiker.net/OpenCLHowTo">这里</a>找到。</p>
+<p>如果ViennaCL的软件包版本不是至少1.7.1,则需要从源码构建它:</p>
+<p>从<a href="https://github.com/viennacl/viennacl-dev">这个git repo</a>clone版本库,切换(checkout)到release-1.7.1分支,然后构建它,并把项目路径添加到PATH,再把构建的库文件添加到LD_LIBRARY_PATH。</p>
+<p>构建支持OpenCL的SINGA(在SINGA 1.1上测试):</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DUSE_OPENCL=ON ..</span>
+<span class="hljs-meta">$</span><span class="bash"> make</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="package"></a><a href="#package" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>这个设置是用来构建 Debian 软件包的。设置PACKAGE=ON,然后用make命令来编译软件包,如下所示:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> cmake -DPACKAGE=ON</span>
+<span class="hljs-meta">$</span><span class="bash"> make package</span>
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="faq"></a><a href="#faq" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<ul>
+<li><p>Q: 'import singa'阶段报错</p>
+<p>A: 请检查<code>python -c "from singa import _singa_wrap</code>中的详细错误。有时是由依赖库引起的,比如protobuf有多个版本,cudnn缺失,numpy版本不匹配等问题。下面展示了不同情况下的解决方案</p>
+<ol>
+<li><p>检查cudnn和cuda。如果cudnn缺失或与wheel包的版本不一致,你可以下载正确的cudnn版本到~/local/cudnn/,然后:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"export LD_LIBRARY_PATH=/home/<yourname>/local/cudnn/lib64:<span class="hljs-variable">$LD_LIBRARY_PATH</span>"</span> >> ~/.bashrc</span>
+</code></pre></li>
+<li><p>如果是protobuf的问题。你可以将protobuf (3.6.1)从源码安装到本地文件夹,比如 ~/local/,解压tar文件,然后:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> ./configure --prefix=/home/<yourname><span class="hljs-built_in">local</span></span>
+<span class="hljs-meta">$</span><span class="bash"> make && make install</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">echo</span> <span class="hljs-string">"export LD_LIBRARY_PATH=/home/<yourname>/local/lib:<span class="hljs-variable">$LD_LIBRARY_PATH</span>"</span> >> ~/.bashrc</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">source</span> ~/.bashrc</span>
+</code></pre></li>
+<li><p>如果找不到包括python在内的其他类库,则使用<code>pip</code>或<code>conda</code>创建虚拟环境.</p></li>
+<li><p>如果不是上述原因造成的,请到<code>_singa_wrap.so</code>文件夹中查看:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> python</span>
+<span class="hljs-meta">></span><span class="bash">> import importlib</span>
+<span class="hljs-meta">></span><span class="bash">> importlib.import_module(<span class="hljs-string">'_singa_wrap'</span>)</span>
+</code></pre>
+<p>来检查错误信息。例如,如果是numpy的版本不匹配,错误信息会是:</p>
+<pre><code class="hljs css language-shell">RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
+</code></pre>
+<p>那么你就需要更新numpy到更高版本。</p></li>
+</ol></li>
+</ul>
+<ul>
+<li><p>Q: 运行<code>cmake ...</code>时出错,找不到依赖库。</p>
+<p>A: 如果你还没有安装这些依赖库,请先安装它们。如果你在系统文件夹之外的文件夹中安装了库,例如/usr/local,那您需要手动导出以下变量:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_INCLUDE_PATH=<path to your header file folder></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CMAKE_LIBRARY_PATH=<path to your lib file folder></span>
+</code></pre></li>
+</ul>
+<ul>
+<li><p>Q: 来自<code>make</code>的错误,例如linking阶段的错误.</p>
+<p>A: 如果您的库文件在系统默认路径以外的其他文件夹中,则需要手动导出以下变量。</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LIBRARY_PATH=<path to your lib file folder></span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> LD_LIBRARY_PATH=<path to your lib file folder></span>
+</code></pre></li>
+</ul>
+<ul>
+<li><p>Q: 来自头文件的错误,例如'cblas.h文件不存在'</p>
+<p>A: 您需要手动将cblas.h的文件夹包含在CPLUS_INCLUDE_PATH中,例如:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">export</span> CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include:<span class="hljs-variable">$CPLUS_INCLUDE_PATH</span></span>
+</code></pre></li>
+<li><p>Q: 在编译SINGA时,我收到错误信息<code>SSE2 instruction set not enabled</code></p>
+<p>A:您可以尝试如下指令:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> make CFLAGS=<span class="hljs-string">'-msse2'</span> CXXFLAGS=<span class="hljs-string">'-msse2'</span></span>
+</code></pre></li>
+<li><p>Q:当试图导入.py文件时,从google.protobuf.internal收到<code>ImportError: cannot import name enum_type_wrapper</code>。</p>
+<p>A: 您需要安装protobuf的Python绑定包,它可以通过如下方式安装:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> sudo apt-get install protobuf</span>
+</code></pre>
+<p>或从源文件编译:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> /PROTOBUF/SOURCE/FOLDER</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> python</span>
+<span class="hljs-meta">$</span><span class="bash"> python setup.py build</span>
+<span class="hljs-meta">$</span><span class="bash"> python setup.py install</span>
+</code></pre></li>
+<li><p>Q: 当我从源码构建OpenBLAS时,被告知需要一个Fortran编译器。</p>
+<p>A: 您可以通过如下方式编译OpenBLAS:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> make ONLY_CBLAS=1</span>
+</code></pre>
+<p>或者通过如下方式安装:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> sudo apt-get install libopenblas-dev</span>
+</code></pre></li>
+<li><p>Q: 当我构建协议缓冲区时,它报告说在<code>/usr/lib64/libstdc++.so.6</code>中没有找到<code>GLIBC++_3.4.20</code>?</p>
+<p>A: 这意味着链接器找到了libstdc++.so.6,但该库属于旧的GCC(用于编译和链接程序的GCC)版本。此程序依赖于新的libstdc++中定义的代码,而该代码属于较新版本的GCC,所以必须告诉链接器如何找到较新的libstdc++共享库。最简单的解决方法是找到正确的libstdc++,并将其导出到LD_LIBRARY_PATH。例如,如果下面命令的输出中列出了GLIBC++_3.4.20:</p>
+<pre><code class="hljs"> $ strings /usr/local/lib64/libstdc++.so.6|grep GLIBC++
+</code></pre>
+<p>那么接下来需要设置环境变量为:</p>
+<pre><code class="hljs"> $ export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
+</code></pre></li>
+<li><p>Q: 当构建glog时,报告说 "src/logging_unittest.cc:83:20: error: 'gflags' is not a namespace-name"。</p>
+<p>A: 可能是由于安装的gflags用了不同的命名空间,比如 "google",所以glog找不到'gflags'的命名空间。实际上建立glog并不需要gflags,所以你可以修改configure.ac文件来忽略gflags。</p>
+<pre><code class="hljs"> 1. cd to glog src directory
+ 2. change line 125 of configure.ac to "AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=0, ac_cv_have_libgflags=0)"
+ 3. autoreconf
+</code></pre>
+<p>执行上述命令后,就可以重新构建glog了。</p></li>
+<li><p>Q: 在使用虚拟环境时,每次运行pip install,都会重新安装numpy。但是,当运行<code>import numpy</code>时,numpy并没有被调用。</p>
+<p>A: 可能是由于<code>PYTHONPATH</code>造成的,在使用虚拟环境时,应将<code>PYTHONPATH</code>设置为空,以避免与虚拟环境本身的路径冲突。</p></li>
+<li><p>Q: 当从源代码编译PySINGA时,由于缺少<numpy/objectarray.h>,出现的编译错误。</p>
+<p>A: 请安装numpy并导出numpy头文件的路径为</p>
+<pre><code class="hljs"> $ export CPLUS_INCLUDE_PATH=`python -c "import numpy; print numpy.get_include()"`:$CPLUS_INCLUDE_PATH
+</code></pre></li>
+<li><p>Q: 当我在Mac OS X中运行SINGA时,报错 "Fatal Python error:
+PyThreadState_Get: no current thread Abort trap: 6"</p>
+<p>A: 这个错误通常发生在系统上有多个版本的Python,并且是通过pip安装的SINGA (通过conda安装时不会出现这个问题),例如,操作系统自带的版本和Homebrew安装的版本。PySINGA所链接的Python必须与Python解释器(interpreter)相同。 您可以通过 <code>which python</code> 检查您的解释器路径并通过<code>otool -L <path to _singa_wrap.so></code>检查PySINGA链接的Python路径。要解决这个问题,请用正确的 Python 版本编译 SINGA。需要注意的是,如果您从源码编译 PySINGA,您需要在调用<a href="http://stackoverflow.com/questions/15291500/i-have-2-versions-of-python-installed-but-cmake-is-using-older-version-how-do">cmake</a>时指定路径:</p></li>
+</ul>
+<pre><code class="hljs"> $ cmake -DPYTHON_LIBRARY=`python-config --prefix`/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=`python-config --prefix`/include/python2.7/ ..
+</code></pre>
+<p>如果从二进制包中安装PySINGA,例如debian或wheel,那么你需要改变python解释器的路径,例如,重新设置$PATH,并把Python的正确路径放在前面的位置。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/downloads"><span class="arrow-prev">← </span><span>Download SINGA</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/contribute-code"><span>How to Contribute Code</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用conda构筑singa">使用Conda构筑SINGA</a><ul class="toc-headings"><li><a href="#构建cpu版本"> [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/contribute-code.html b/content/docs/3.2.0_Chinese/contribute-code.html
new file mode 100644
index 0000000..3b379f7
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/contribute-code.html
@@ -0,0 +1,166 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>How to Contribute Code · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding cop [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/contribute-code.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">How to Contribute Code</h1></header><article><div><span><!-- Licensed to the Apache Software Foundation (ASF) under one or more [...]
+<h2><a class="anchor" aria-hidden="true" id="代码风格"></a><a href="#代码风格" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>SINGA代码库在<a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">CPP</a>和<a href="http://google.github.io/styleguide/pyguide.html">Python</a>代码中都遵循Google风格。</p>
+<p>强制执行Google编码风格的一个简单方法是使用Visual Studio Code编辑器中的linting和格式化工具:</p>
+<ul>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools">C/C++扩展</a></li>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python">Python扩展</a></li>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=mine.cpplint">cpplint扩展</a></li>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=xaver.clang-format">Clang-Format</a></li>
+</ul>
+<p>安装扩展后,编辑<code>settings.json</code>文件:</p>
+<pre><code class="hljs css language-json">{
+ <span class="hljs-attr">"[cpp]"</span>: {
+ <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"xaver.clang-format"</span>
+ },
+ <span class="hljs-attr">"cpplint.cpplintPath"</span>: <span class="hljs-string">"path/to/cpplint"</span>,
+
+ <span class="hljs-attr">"editor.formatOnSave"</span>: <span class="hljs-literal">true</span>,
+ <span class="hljs-attr">"python.formatting.provider"</span>: <span class="hljs-string">"yapf"</span>,
+ <span class="hljs-attr">"python.linting.enabled"</span>: <span class="hljs-literal">true</span>,
+ <span class="hljs-attr">"python.linting.lintOnSave"</span>: <span class="hljs-literal">true</span>,
+ <span class="hljs-attr">"clang-format.language.cpp.style"</span>: <span class="hljs-string">"google"</span>,
+ <span class="hljs-attr">"python.formatting.yapfArgs"</span>: [<span class="hljs-string">"--style"</span>, <span class="hljs-string">"{based_on_style: google}"</span>]
+}
+</code></pre>
+<p>根据您的操作系统,用户设置文件位于以下位置:</p>
+<ol>
+<li>Windows %APPDATA%\Code\User\settings.json</li>
+<li>macOS "$HOME/Library/Application Support/Code/User/settings.json"</li>
+<li>Linux "$HOME/.config/Code/User/settings.json"</li>
+</ol>
+<p>配置是在相应的配置文件中指定的。而这些工具会自动查找项目根目录下的配置文件,比如<code>.pylintrc</code>。</p>
+<h4><a class="anchor" aria-hidden="true" id="安装必要工具"></a><a href="#安装必要工具" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>最理想的情况是所有贡献者都使用相同版本的代码格式化工具(clang-format 9.0.0和yapf 0.29.0),这样在不同PR中的代码格式化就会完全相同,从而摆脱github pull request冲突。</p>
+<p>首先,安装LLVM 9.0,它提供了clang-format 9.0.0版本,LLVM的下载页面如下:</p>
+<ul>
+<li><p><a href="http://releases.llvm.org/download.html#9.0.0">LLVM</a></p>
+<ul>
+<li><p>Ubuntu系统:</p>
+<pre><code class="hljs css language-sh">sudo apt-get install clang-format-9
+</code></pre></li>
+<li><p>Windows系统,下载预编译包并安装。</p></li>
+</ul></li>
+</ul>
+<p>然后,安装cpplint, pylint和yapf</p>
+<ul>
+<li><p>Ubuntu或OSX:</p>
+<pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> sudo pip install cpplint</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">which</span> cpplint</span>
+/path/to/cpplint
+<span class="hljs-meta">
+$</span><span class="bash"> pip install yapf==0.29.0</span>
+<span class="hljs-meta">$</span><span class="bash"> pip install pylint</span>
+</code></pre></li>
+<li><p>Windows: 安装Anaconda进行包管理</p>
+<pre><code class="hljs">$ pip <span class="hljs-keyword">install</span> cpplint
+$ <span class="hljs-keyword">where</span> cpplint
+C:/<span class="hljs-keyword">path</span>/<span class="hljs-keyword">to</span>/cpplint.exe
+
+$ pip <span class="hljs-keyword">install</span> yapf==<span class="hljs-number">0.29</span><span class="hljs-number">.0</span>
+$ pip <span class="hljs-keyword">install</span> pylint
+</code></pre></li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="使用"></a><a href="#使用" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<ul>
+<li>配置后,在编辑源代码文件时,linting会自动启用。错误和警告会在Visual Studio Code <code>PROBLEMS</code>面板中列出。</li>
+<li>代码格式化可以通过调出Command Palette(Windows中为<code>Shift+Ctrl+P</code>,OS X中为<code>Shift+Command+P</code>)并输入<code>Format Document</code>来完成。</li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="提交"></a><a href="#提交" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>修正格式错误以后就可以提交pull request了。</p>
+<h2><a class="anchor" aria-hidden="true" id="开发环境"></a><a href="#开发环境" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>推荐使用Visual Studio Code作为编辑器。可以安装Python、C/C++、代码拼写检查器、autoDocstring、vim、远程开发等扩展。这些扩展的参考配置(即<code>settings.json</code>)可以在<a href="https://gist.github.com/nudles/3d23cfb6ffb30ca7636c45fe60278c55">这里</a>查看。</p>
+<p>如果更新CPP代码,需要从<a href="/docs/3.2.0_Chinese/build">源文件</a>重新编译SINGA。建议使用<code>*-devel Docker</code>镜像中的原生构建工具或使用<code>conda build</code>。</p>
+<p>如果要只更新Python代码,您可以安装一次SINGA,然后复制更新后的Python文件来替换Python安装文件夹中的文件。</p>
+<pre><code class="hljs css language-shell">cp python/singa/xx.py <path to conda>/lib/python3.7/site-packages/singa/
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="工作流程"></a><a href="#工作流程" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>请参阅<a href="/docs/3.2.0_Chinese/git-workflow">git工作流程页面</a>.</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/build"><span class="arrow-prev">← </span><span>Build SINGA from Source</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/contribute-docs"><span>How to Contribute to Documentation</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#代码风格">代码风格</a></li><li><a href="#开发环境">开发环境</a></li><li><a href=" [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/contribute-code/index.html b/content/docs/3.2.0_Chinese/contribute-code/index.html
new file mode 100644
index 0000000..3b379f7
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/contribute-code/index.html
@@ -0,0 +1,166 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>How to Contribute Code · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding cop [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/contribute-code.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">How to Contribute Code</h1></header><article><div><span><!-- Licensed to the Apache Software Foundation (ASF) under one or more [...]
+<h2><a class="anchor" aria-hidden="true" id="代码风格"></a><a href="#代码风格" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>SINGA代码库在<a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">CPP</a>和<a href="http://google.github.io/styleguide/pyguide.html">Python</a>代码中都遵循Google风格。</p>
+<p>强制执行Google编码风格的一个简单方法是使用Visual Studio Code编辑器中的linting和格式化工具:</p>
+<ul>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools">C/C++扩展</a></li>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python">Python扩展</a></li>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=mine.cpplint">cpplint扩展</a></li>
+<li><a href="https://marketplace.visualstudio.com/items?itemName=xaver.clang-format">Clang-Format</a></li>
+</ul>
+<p>安装扩展后,编辑<code>settings.json</code>文件:</p>
+<pre><code class="hljs css language-json">{
+ <span class="hljs-attr">"[cpp]"</span>: {
+ <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"xaver.clang-format"</span>
+ },
+ <span class="hljs-attr">"cpplint.cpplintPath"</span>: <span class="hljs-string">"path/to/cpplint"</span>,
+
+ <span class="hljs-attr">"editor.formatOnSave"</span>: <span class="hljs-literal">true</span>,
+ <span class="hljs-attr">"python.formatting.provider"</span>: <span class="hljs-string">"yapf"</span>,
+ <span class="hljs-attr">"python.linting.enabled"</span>: <span class="hljs-literal">true</span>,
+ <span class="hljs-attr">"python.linting.lintOnSave"</span>: <span class="hljs-literal">true</span>,
+ <span class="hljs-attr">"clang-format.language.cpp.style"</span>: <span class="hljs-string">"google"</span>,
+ <span class="hljs-attr">"python.formatting.yapfArgs"</span>: [<span class="hljs-string">"--style"</span>, <span class="hljs-string">"{based_on_style: google}"</span>]
+}
+</code></pre>
+<p>根据您的操作系统,用户设置文件位于以下位置:</p>
+<ol>
+<li>Windows %APPDATA%\Code\User\settings.json</li>
+<li>macOS "$HOME/Library/Application Support/Code/User/settings.json"</li>
+<li>Linux "$HOME/.config/Code/User/settings.json"</li>
+</ol>
+<p>配置是在相应的配置文件中指定的。而这些工具会自动查找项目根目录下的配置文件,比如<code>.pylintrc</code>。</p>
+<h4><a class="anchor" aria-hidden="true" id="安装必要工具"></a><a href="#安装必要工具" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>最理想的情况是所有贡献者都使用相同版本的代码格式化工具(clang-format 9.0.0和yapf 0.29.0),这样在不同PR中的代码格式化就会完全相同,从而摆脱github pull request冲突。</p>
+<p>首先,安装LLVM 9.0,它提供了clang-format 9.0.0版本,LLVM的下载页面如下:</p>
+<ul>
+<li><p><a href="http://releases.llvm.org/download.html#9.0.0">LLVM</a></p>
+<ul>
+<li><p>Ubuntu系统:</p>
+<pre><code class="hljs css language-sh">sudo apt-get install clang-format-9
+</code></pre></li>
+<li><p>Windows系统,下载预编译包并安装。</p></li>
+</ul></li>
+</ul>
+<p>然后,安装cpplint, pylint和yapf</p>
+<ul>
+<li><p>Ubuntu或OSX:</p>
+<pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> sudo pip install cpplint</span>
+<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">which</span> cpplint</span>
+/path/to/cpplint
+<span class="hljs-meta">
+$</span><span class="bash"> pip install yapf==0.29.0</span>
+<span class="hljs-meta">$</span><span class="bash"> pip install pylint</span>
+</code></pre></li>
+<li><p>Windows: 安装Anaconda进行包管理</p>
+<pre><code class="hljs">$ pip <span class="hljs-keyword">install</span> cpplint
+$ <span class="hljs-keyword">where</span> cpplint
+C:/<span class="hljs-keyword">path</span>/<span class="hljs-keyword">to</span>/cpplint.exe
+
+$ pip <span class="hljs-keyword">install</span> yapf==<span class="hljs-number">0.29</span><span class="hljs-number">.0</span>
+$ pip <span class="hljs-keyword">install</span> pylint
+</code></pre></li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="使用"></a><a href="#使用" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<ul>
+<li>配置后,在编辑源代码文件时,linting会自动启用。错误和警告会在Visual Studio Code <code>PROBLEMS</code>面板中列出。</li>
+<li>代码格式化可以通过调出Command Palette(Windows中为<code>Shift+Ctrl+P</code>,OS X中为<code>Shift+Command+P</code>)并输入<code>Format Document</code>来完成。</li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="提交"></a><a href="#提交" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>修正格式错误以后就可以提交pull request了。</p>
+<h2><a class="anchor" aria-hidden="true" id="开发环境"></a><a href="#开发环境" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>推荐使用Visual Studio Code作为编辑器。可以安装Python、C/C++、代码拼写检查器、autoDocstring、vim、远程开发等扩展。这些扩展的参考配置(即<code>settings.json</code>)可以在<a href="https://gist.github.com/nudles/3d23cfb6ffb30ca7636c45fe60278c55">这里</a>查看。</p>
+<p>如果更新CPP代码,需要从<a href="/docs/3.2.0_Chinese/build">源文件</a>重新编译SINGA。建议使用<code>*-devel Docker</code>镜像中的原生构建工具或使用<code>conda build</code>。</p>
+<p>如果要只更新Python代码,您可以安装一次SINGA,然后复制更新后的Python文件来替换Python安装文件夹中的文件。</p>
+<pre><code class="hljs css language-shell">cp python/singa/xx.py <path to conda>/lib/python3.7/site-packages/singa/
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="工作流程"></a><a href="#工作流程" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>请参阅<a href="/docs/3.2.0_Chinese/git-workflow">git工作流程页面</a>.</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/build"><span class="arrow-prev">← </span><span>Build SINGA from Source</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/contribute-docs"><span>How to Contribute to Documentation</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#代码风格">代码风格</a></li><li><a href="#开发环境">开发环境</a></li><li><a href=" [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/contribute-docs.html b/content/docs/3.2.0_Chinese/contribute-docs.html
new file mode 100644
index 0000000..d670190
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/contribute-docs.html
@@ -0,0 +1,144 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>How to Contribute to Documentation · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information r [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/contribute-docs.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">How to Contribute to Documentation</h1></header><article><div><span><!-- Licensed to the Apache Software Foundation (ASF) under [...]
+<p>文档有两种类型,即markdown文件和API使用参考。本指南介绍了一些工具,并指导如何准备md文件和API注释。</p>
+<p>md文件将通过<a href="https://docusaurus.io/">Docusaurus</a>构建成HTML页面;API注释(来自源代码)将用于使用Sphinx(对应Python)和Doxygen(对应CPP)生成API参考页面。</p>
+<h2><a class="anchor" aria-hidden="true" id="markdown文件"></a><a href="#markdown文件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>请尽量遵循<a href="https://developers.google.com/style">Google Documentation style</a>。例如:</p>
+<ol>
+<li>删除指令中的"please"。如:'Please click...' VS 'Click...'。</li>
+<li>遵循标准的<a href="https://owl.purdue.edu/owl/general_writing/mechanics/help_with_capitals.html">大小写规则</a>。</li>
+<li>在说明中用"you"代替"we"。</li>
+<li>使用现在时态,避免使用<code>will</code>。</li>
+<li>尽量使用主动语态而不是被动。</li>
+</ol>
+<p>此外,为了使文件一致:</p>
+<ol>
+<li>句子不宜过长, e.g., 长度<=80</li>
+<li>尽量使用相对路径,假设我们在repo的根目录下,例如,<code>doc-site/docs</code>指的是<code>singa-doc/docs-site/docs</code>。</li>
+<li>使用背标将命令、路径、类函数和变量亮出来,例如,<code>Tensor</code>, <code>singa-doc/docs-site/docs</code>。</li>
+<li>为了突出其他术语/概念,使用 <em>斜体</em> or <strong>加粗</strong></li>
+</ol>
+<p>本项目使用的<a href="https://prettier.io/">prettier tool</a>会在我们进行git提交时,根据<a href="https://github.com/apache/singa-doc/blob/master/docs-site/.prettierrc">配置</a>自动格式化代码。例如,它会将markdown文件中的文本最多折叠成80个字符(注释行除外)。</p>
+<p>在介绍一个概念(如<code>Tensor</code>类)时,要提供概述(目的和与其他概念的关系)、API和例子,还可以用Google colab来演示其用法。</p>
+<p>详细的编辑md文件和建立网站的方法请参考<a href="https://github.com/apache/singa-doc/tree/master/docs-site">本页面</a>。</p>
+<h2><a class="anchor" aria-hidden="true" id="api-references"></a><a href="#api-references" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="cpp-api"></a><a href="#cpp-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>请遵循<a href="https://google.github.io/styleguide/cppguide.html#Comments">Google CPP注释风格</a>.</p>
+<p>要生成文档,请从doc文件夹中运行 "doxygen"(推荐使用Doxygen >= 1.8)。</p>
+<h3><a class="anchor" aria-hidden="true" id="python-api"></a><a href="#python-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>请遵循<a href="http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings">Google Python DocString风格</a>.</p>
+<h2><a class="anchor" aria-hidden="true" id="visual-studio-code-vscode"></a><a href="#visual-studio-code-vscode" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c [...]
+<p>如果你使用vscode作为编辑器,我们推荐使用以下插件。</p>
+<h3><a class="anchor" aria-hidden="true" id="docstring-snippet"></a><a href="#docstring-snippet" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p><a href="https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring">autoDocstring</a>生成函数、类等的docstring,要注意选择使用<code>google</code>的docString格式。</p>
+<h3><a class="anchor" aria-hidden="true" id="spell-check"></a><a href="#spell-check" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p><a href="https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker">Code Spell Checker</a>可以用来检查代码的注释,或<code>.md</code>和<code>.rst</code>文件。</p>
+<p>要只对Python代码的注释进行拼写检查,可以在<code>File - Preferences - User Snippets - python.json</code>中添加以下代码段:</p>
+<pre><code class="hljs">"cspell check" : {
+"prefix": "cspell",
+"body": [
+ "# Directives for doing spell check only for python and c/cpp comments",
+ "# cSpell:includeRegExp #.* ",
+ "# cSpell:includeRegExp (\"\"\"|''')[^\1]*\1",
+ "# cSpell: CStyleComment",
+],
+"description": "# spell check only for python comments"
+}
+</code></pre>
+<p>如果要只对Cpp代码的注释进行拼写检查,可以在<code>File - Preferences - User Snippets - cpp.json</code>中添加以下代码段:</p>
+<pre><code class="hljs">"cspell check" : {
+"prefix": "cspell",
+"body": [
+ "// Directive for doing spell check only for cpp comments",
+ "// cSpell:includeRegExp CStyleComment",
+],
+"description": "# spell check only for cpp comments"
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/contribute-code"><span class="arrow-prev">← </span><span>How to Contribute Code</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/how-to-release"><span>How to Prepare a Release</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#markdown文件">Markdown文件</a></li><li><a href="#api-references">API Re [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/contribute-docs/index.html b/content/docs/3.2.0_Chinese/contribute-docs/index.html
new file mode 100644
index 0000000..d670190
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/contribute-docs/index.html
@@ -0,0 +1,144 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>How to Contribute to Documentation · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information r [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/contribute-docs.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">How to Contribute to Documentation</h1></header><article><div><span><!-- Licensed to the Apache Software Foundation (ASF) under [...]
+<p>文档有两种类型,即markdown文件和API使用参考。本指南介绍了一些工具,并指导如何准备md文件和API注释。</p>
+<p>md文件将通过<a href="https://docusaurus.io/">Docusaurus</a>构建成HTML页面;API注释(来自源代码)将用于使用Sphinx(对应Python)和Doxygen(对应CPP)生成API参考页面。</p>
+<h2><a class="anchor" aria-hidden="true" id="markdown文件"></a><a href="#markdown文件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>请尽量遵循<a href="https://developers.google.com/style">Google Documentation style</a>。例如:</p>
+<ol>
+<li>删除指令中的"please"。如:'Please click...' VS 'Click...'。</li>
+<li>遵循标准的<a href="https://owl.purdue.edu/owl/general_writing/mechanics/help_with_capitals.html">大小写规则</a>。</li>
+<li>在说明中用"you"代替"we"。</li>
+<li>使用现在时态,避免使用<code>will</code>。</li>
+<li>尽量使用主动语态而不是被动。</li>
+</ol>
+<p>此外,为了使文件一致:</p>
+<ol>
+<li>句子不宜过长, e.g., 长度<=80</li>
+<li>尽量使用相对路径,假设我们在repo的根目录下,例如,<code>doc-site/docs</code>指的是<code>singa-doc/docs-site/docs</code>。</li>
+<li>使用背标将命令、路径、类函数和变量亮出来,例如,<code>Tensor</code>, <code>singa-doc/docs-site/docs</code>。</li>
+<li>为了突出其他术语/概念,使用 <em>斜体</em> or <strong>加粗</strong></li>
+</ol>
+<p>本项目使用的<a href="https://prettier.io/">prettier tool</a>会在我们进行git提交时,根据<a href="https://github.com/apache/singa-doc/blob/master/docs-site/.prettierrc">配置</a>自动格式化代码。例如,它会将markdown文件中的文本最多折叠成80个字符(注释行除外)。</p>
+<p>在介绍一个概念(如<code>Tensor</code>类)时,要提供概述(目的和与其他概念的关系)、API和例子,还可以用Google colab来演示其用法。</p>
+<p>详细的编辑md文件和建立网站的方法请参考<a href="https://github.com/apache/singa-doc/tree/master/docs-site">本页面</a>。</p>
+<h2><a class="anchor" aria-hidden="true" id="api-references"></a><a href="#api-references" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="cpp-api"></a><a href="#cpp-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>请遵循<a href="https://google.github.io/styleguide/cppguide.html#Comments">Google CPP注释风格</a>.</p>
+<p>要生成文档,请从doc文件夹中运行 "doxygen"(推荐使用Doxygen >= 1.8)。</p>
+<h3><a class="anchor" aria-hidden="true" id="python-api"></a><a href="#python-api" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<p>请遵循<a href="http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings">Google Python DocString风格</a>.</p>
+<h2><a class="anchor" aria-hidden="true" id="visual-studio-code-vscode"></a><a href="#visual-studio-code-vscode" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c [...]
+<p>如果你使用vscode作为编辑器,我们推荐使用以下插件。</p>
+<h3><a class="anchor" aria-hidden="true" id="docstring-snippet"></a><a href="#docstring-snippet" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p><a href="https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring">autoDocstring</a>生成函数、类等的docstring,要注意选择使用<code>google</code>的docString格式。</p>
+<h3><a class="anchor" aria-hidden="true" id="spell-check"></a><a href="#spell-check" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p><a href="https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker">Code Spell Checker</a>可以用来检查代码的注释,或<code>.md</code>和<code>.rst</code>文件。</p>
+<p>要只对Python代码的注释进行拼写检查,可以在<code>File - Preferences - User Snippets - python.json</code>中添加以下代码段:</p>
+<pre><code class="hljs">"cspell check" : {
+"prefix": "cspell",
+"body": [
+ "# Directives for doing spell check only for python and c/cpp comments",
+ "# cSpell:includeRegExp #.* ",
+ "# cSpell:includeRegExp (\"\"\"|''')[^\1]*\1",
+ "# cSpell: CStyleComment",
+],
+"description": "# spell check only for python comments"
+}
+</code></pre>
+<p>如果要只对Cpp代码的注释进行拼写检查,可以在<code>File - Preferences - User Snippets - cpp.json</code>中添加以下代码段:</p>
+<pre><code class="hljs">"cspell check" : {
+"prefix": "cspell",
+"body": [
+ "// Directive for doing spell check only for cpp comments",
+ "// cSpell:includeRegExp CStyleComment",
+],
+"description": "# spell check only for cpp comments"
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/contribute-code"><span class="arrow-prev">← </span><span>How to Contribute Code</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/how-to-release"><span>How to Prepare a Release</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#markdown文件">Markdown文件</a></li><li><a href="#api-references">API Re [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/device.html b/content/docs/3.2.0_Chinese/device.html
new file mode 100644
index 0000000..4f522d2
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/device.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Device · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownershi [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/device.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Device</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agre [...]
+<p>Device代表一个有内存和计算单元的硬件设备。所有的<a href="./tensor">Tensor操作</a>都由常驻设备安排执行的,Tensor内存也由设备的内存管理器管理。因此,需要在Device类中实现内存和执行的优化。</p>
+<h2><a class="anchor" aria-hidden="true" id="特定设备"></a><a href="#特定设备" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>目前,SINGA支持三种设备:</p>
+<ol>
+<li>CudaGPU:用于运行Cuda代码的Nvidia GPU。</li>
+<li>CppCPU:用于运行Cpp代码的CPU。</li>
+<li>OpenclGPU:用于运行OpenCL代码的GPU卡。</li>
+</ol>
+<h2><a class="anchor" aria-hidden="true" id="用法示例"></a><a href="#用法示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>下面的代码提供了创建设备的例子:</p>
+<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> device
+cuda = device.create_cuda_gpu_on(<span class="hljs-number">0</span>) <span class="hljs-comment"># use GPU card of ID 0</span>
+host = device.get_default_device() <span class="hljs-comment"># get the default host device (a CppCPU)</span>
+ary1 = device.create_cuda_gpus(<span class="hljs-number">2</span>) <span class="hljs-comment"># create 2 devices, starting from ID 0</span>
+ary2 = device.create_cuda_gpus([<span class="hljs-number">0</span>,<span class="hljs-number">2</span>]) <span class="hljs-comment"># create 2 devices on ID 0 and 2</span>
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/examples"><span class="arrow-prev">← </span><span>Examples</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/tensor"><span>Tensor</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#特定设备">特定设备</a></li><li><a href="#用法示例">用法示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><secti [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/device/index.html b/content/docs/3.2.0_Chinese/device/index.html
new file mode 100644
index 0000000..4f522d2
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/device/index.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Device · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownershi [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/device.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Device</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agre [...]
+<p>Device代表一个有内存和计算单元的硬件设备。所有的<a href="./tensor">Tensor操作</a>都由常驻设备安排执行的,Tensor内存也由设备的内存管理器管理。因此,需要在Device类中实现内存和执行的优化。</p>
+<h2><a class="anchor" aria-hidden="true" id="特定设备"></a><a href="#特定设备" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>目前,SINGA支持三种设备:</p>
+<ol>
+<li>CudaGPU:用于运行Cuda代码的Nvidia GPU。</li>
+<li>CppCPU:用于运行Cpp代码的CPU。</li>
+<li>OpenclGPU:用于运行OpenCL代码的GPU卡。</li>
+</ol>
+<h2><a class="anchor" aria-hidden="true" id="用法示例"></a><a href="#用法示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>下面的代码提供了创建设备的例子:</p>
+<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> device
+cuda = device.create_cuda_gpu_on(<span class="hljs-number">0</span>) <span class="hljs-comment"># use GPU card of ID 0</span>
+host = device.get_default_device() <span class="hljs-comment"># get the default host device (a CppCPU)</span>
+ary1 = device.create_cuda_gpus(<span class="hljs-number">2</span>) <span class="hljs-comment"># create 2 devices, starting from ID 0</span>
+ary2 = device.create_cuda_gpus([<span class="hljs-number">0</span>,<span class="hljs-number">2</span>]) <span class="hljs-comment"># create 2 devices on ID 0 and 2</span>
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/examples"><span class="arrow-prev">← </span><span>Examples</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/tensor"><span>Tensor</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#特定设备">特定设备</a></li><li><a href="#用法示例">用法示例</a></li></ul></nav></div><footer class="nav-footer" id="footer"><secti [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/2.0.0/dist-train.html b/content/docs/3.2.0_Chinese/dist-train.html
similarity index 73%
copy from content/docs/2.0.0/dist-train.html
copy to content/docs/3.2.0_Chinese/dist-train.html
index ef822c5..15a957d 100644
--- a/content/docs/2.0.0/dist-train.html
+++ b/content/docs/3.2.0_Chinese/dist-train.html
@@ -1,10 +1,66 @@
-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Distributed Training · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copy [...]
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Distributed Training · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copy [...]
document.addEventListener('DOMContentLoaded', function() {
addBackToTop(
{"zIndex":100}
)
});
- </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>2.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/dist-train.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Distributed Training</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contri [...]
<p>SINGA支持跨多个GPU的数据并行训练(在单个节点上或跨不同节点)。下图说明了数据并行训练的情况:</p>
<p><img src="/docs/assets/MPI.png" alt="MPI.png"></p>
<p>在分布式训练中,每个进程(称为worker)在单个GPU上运行一个训练脚本,每个进程都有一个单独的通信等级,训练数据被分发给各个worker,模型在每个worker上被复制。在每次迭代中,worker从其分区中读取数据的一个mini-batch(例如,256张图像),并运行BackPropagation算法来计算权重的梯度,通过all-reduce(由<a href="https://developer.nvidia.com/nccl">NCCL</a>提供)进行平均,按照随机梯度下降算法(SGD)进行权重更新。</p>
@@ -292,7 +348,7 @@ Evaluation accuracy = <span class="hljs-number">0.988682</span>
<h3><a class="anchor" aria-hidden="true" id="distopt的python接口"></a><a href="#distopt的python接口" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
<p>然后,python接口提供了一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">DistOpt</a>类来封装一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">optimizer</a>对象,以执行基于MPI或Multiprocess的分布式训练。在初始化过程中,它创建了一个NCCL communicator对象(来自于上面小节提到的C接口),然后,<code>DistOpt</code>中的每一次all-reduce操作都会用到这个communicator对象。</p>
<p>在MPI或Multiprocess中,每个进程都有一个独立的rank,它给出了各个进程使用的GPU的信息。训练数据是被拆分的,因此每个进程可以根据一部分训练数据来评估子梯度。一旦每个进程的子梯度被计算出来,就可以将所有进程计算出的子梯度做all-reduce,得到总体随机梯度。</p>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/9/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul></li><li><a href="#针对分布式训练的优化">针对分布式训练的优化</a><ul class="toc-headings"><li><a href="#不采取优化手段">不采取优化手段</a></li><li><a href="#半精度梯度(half-precision-gradients)">半精度梯度(Half-precision Gradie [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/onnx"><span class="arrow-prev">← </span><span>ONNX</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/time-profiling"><span>Time Profiling</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul> [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/dist-train/index.html b/content/docs/3.2.0_Chinese/dist-train/index.html
similarity index 73%
copy from content/docs/2.0.0/dist-train/index.html
copy to content/docs/3.2.0_Chinese/dist-train/index.html
index ef822c5..15a957d 100644
--- a/content/docs/2.0.0/dist-train/index.html
+++ b/content/docs/3.2.0_Chinese/dist-train/index.html
@@ -1,10 +1,66 @@
-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Distributed Training · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copy [...]
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Distributed Training · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copy [...]
document.addEventListener('DOMContentLoaded', function() {
addBackToTop(
{"zIndex":100}
)
});
- </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>2.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/dist-train.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Distributed Training</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contri [...]
<p>SINGA支持跨多个GPU的数据并行训练(在单个节点上或跨不同节点)。下图说明了数据并行训练的情况:</p>
<p><img src="/docs/assets/MPI.png" alt="MPI.png"></p>
<p>在分布式训练中,每个进程(称为worker)在单个GPU上运行一个训练脚本,每个进程都有一个单独的通信等级,训练数据被分发给各个worker,模型在每个worker上被复制。在每次迭代中,worker从其分区中读取数据的一个mini-batch(例如,256张图像),并运行BackPropagation算法来计算权重的梯度,通过all-reduce(由<a href="https://developer.nvidia.com/nccl">NCCL</a>提供)进行平均,按照随机梯度下降算法(SGD)进行权重更新。</p>
@@ -292,7 +348,7 @@ Evaluation accuracy = <span class="hljs-number">0.988682</span>
<h3><a class="anchor" aria-hidden="true" id="distopt的python接口"></a><a href="#distopt的python接口" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
<p>然后,python接口提供了一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">DistOpt</a>类来封装一个<a href="https://github.com/apache/singa/blob/master/python/singa/opt.py">optimizer</a>对象,以执行基于MPI或Multiprocess的分布式训练。在初始化过程中,它创建了一个NCCL communicator对象(来自于上面小节提到的C接口),然后,<code>DistOpt</code>中的每一次all-reduce操作都会用到这个communicator对象。</p>
<p>在MPI或Multiprocess中,每个进程都有一个独立的rank,它给出了各个进程使用的GPU的信息。训练数据是被拆分的,因此每个进程可以根据一部分训练数据来评估子梯度。一旦每个进程的子梯度被计算出来,就可以将所有进程计算出的子梯度做all-reduce,得到总体随机梯度。</p>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/9/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul></li><li><a href="#针对分布式训练的优化">针对分布式训练的优化</a><ul class="toc-headings"><li><a href="#不采取优化手段">不采取优化手段</a></li><li><a href="#半精度梯度(half-precision-gradients)">半精度梯度(Half-precision Gradie [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/onnx"><span class="arrow-prev">← </span><span>ONNX</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/time-profiling"><span>Time Profiling</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用">使用</a><ul class="toc-headings"><li><a href="#代码示例">代码示例</a></li><li><a href="#执行命令">执行命令</a></li></ul> [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0_Chinese/downloads.html b/content/docs/3.2.0_Chinese/downloads.html
new file mode 100644
index 0000000..895850f
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/downloads.html
@@ -0,0 +1,252 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Download SINGA · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/download.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Download SINGA</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor li [...]
+<h2><a class="anchor" aria-hidden="true" id="verify"></a><a href="#verify" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>要验证下载的tar.gz文件,下载<a href="https://www.apache.org/dist/singa/KEYS">KEYS</a>和ASC文件,然后执行以下命令:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">%</span><span class="bash"> gpg --import KEYS</span>
+<span class="hljs-meta">%</span><span class="bash"> gpg --verify downloaded_file.asc downloaded_file</span>
+</code></pre>
+<p>你也可以检查SHA512或MD5值判断下载是否完成。</p>
+<h2><a class="anchor" aria-hidden="true" id="v300-18-april-2020"></a><a href="#v300-18-april-2020" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
+<ul>
+<li><a href="http://www.apache.org/dyn/closer.cgi/singa/3.0.0/apache-singa-3.0.0.tar.gz">Apache SINGA 3.0.0</a>
+<a href="https://www.apache.org/dist/singa/3.0.0/apache-singa-3.0.0.tar.gz.sha512">[SHA512]</a>
+<a href="https://www.apache.org/dist/singa/3.0.0/apache-singa-3.0.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_3.0.0">Release Notes 3.0.0</a></li>
+<li>新特性及重要更新:
+<ul>
+<li>增强了ONNX。在SINGA中测试了多种ONNX模型。</li>
+<li>使用 MPI 和 NCCL Communication进行分布式训练,通过梯度稀疏化和压缩以及分块传输进行了优化。</li>
+<li>计算图的构建,利用图优化了速度和内存。</li>
+<li>新的文档网站(singa.apache.org)和API参考网站(apache-singa.rtfd.io)。</li>
+<li>使用CI实现代码质量检查。</li>
+<li>将MKLDNN替换为DNNL。</li>
+<li>更新Tensor API以支持广播操作。</li>
+<li>实现了支持ONNX模型的新的autograd操作符。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v200-20-april-2019"></a><a href="#孵化版本(incubating)-v200-20-april-2019" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2 [...]
+<ul>
+<li><a href="http://www.apache.org/dyn/closer.cgi/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz">Apache SINGA 2.0.0 (incubating)</a>
+<a href="https://www.apache.org/dist/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz.sha512">[SHA512]</a>
+<a href="https://www.apache.org/dist/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_2.0.0.html">Release Notes 2.0.0 (incubating)</a></li>
+<li>新特性及重要更新:
+<ul>
+<li>增强了autograd功能(适用于卷积网络和循环网络)。</li>
+<li>支持ONNX。</li>
+<li>通过英特尔MKL DNN lib改进CPP操作。</li>
+<li>实现tensor广播。</li>
+<li>在Apache用户名下移动Docker镜像。</li>
+<li>更新conda-build配置中依赖的lib版本。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v120-6-june-2018"></a><a href="#孵化版本(incubating)-v120-6-june-2018" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S1 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz">Apache SINGA 1.2.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz.sha512">[SHA512]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_1.2.0.html">Release Notes 1.2.0 (incubating)</a></li>
+<li>新特性及重要更新:
+<ul>
+<li>实现了autograd(目前支持MLP模式)。</li>
+<li>升级PySinga以支持Python 3</li>
+<li>改进Tensor类的stride范围。</li>
+<li>将cuDNN从V5升级到V7。</li>
+<li>增加VGG、Inception V4、ResNet和DenseNet进行ImageNet分类。</li>
+<li>为conda包创建别名</li>
+<li>完整的中文文档</li>
+<li>添加在Windows上运行Singa的说明</li>
+<li>更新编译,CI</li>
+<li>修复一些错误</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v110-12-february-2017"></a><a href="#孵化版本(incubating)-v110-12-february-2017" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1. [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz">Apache SINGA 1.1.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_1.1.0.html">Release Notes 1.1.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>创建Docker镜像(CPU和GPU版本)</li>
+<li>为SINGA创建Amazon AMI(CPU版)。</li>
+<li>集成Jenkins,自动生成Wheel和Debian包(用于安装),并更新网站。</li>
+<li>增强FeedFowardNet,例如,多输入和用于调试的verbose模式。</li>
+<li>添加Concat和Slice层。</li>
+<li>优化CrossEntropyLoss以接受带有多个标签的实例。</li>
+<li>添加包含图像增强方法的image_tool.py。</li>
+<li>支持通过快照API加载和保存模型。</li>
+<li>在Windows上编译SINGA源代码。</li>
+<li>将必要依赖库与SINGA代码一起编译。</li>
+<li>为SINGA启用Java binding(基本)。</li>
+<li>在checkpoint文件中添加版本ID。</li>
+<li>增加Rafiki工具包以提供RESTFul APIs。</li>
+<li>添加了从Caffe预训练的例子,包括GoogleNet。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v100-8-september-2016"></a><a href="#孵化版本(incubating)-v100-8-september-2016" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1. [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/1.0.0/apache-singa-incubating-1.0.0.tar.gz">Apache SINGA 1.0.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.0.0/apache-singa-incubating-1.0.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.0.0/apache-singa-incubating-1.0.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_1.0.0.html">Release Notes 1.0.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>创建Tensor概念,用于支持更多的机器学习模型。</li>
+<li>创建Device概念,用于运行在不同的硬件设备上,包括CPU,(Nvidia/AMD) GPU 和 FPGA (将在以后的版本中测试)。</li>
+<li>用 cmake 取代 GNU autotool 进行编译。</li>
+<li>支持 Mac OS。</li>
+<li>改进Python binding,包括安装和编程。</li>
+<li>更多的深度学习模型,包括VGG和ResNet。</li>
+<li>更多的IO类用于读取/写入文件和编码/解码数据。</li>
+<li>直接基于Socket的新网络通信组件。</li>
+<li>Cudnn V5,包含Dropout和RNN层。</li>
+<li>将网页构建工具从maven更换为Sphinx。</li>
+<li>整合Travis-CI。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v030-20-april-2016"></a><a href="#孵化版本(incubating)-v030-20-april-2016" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz">Apache SINGA 0.3.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_0.3.0.html">Release Notes 0.3.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>在GPU集群上进行训练,可以在GPU集群上进行深度学习模型的训练。</li>
+<li>改进Python wrapper简化配置工作,包括神经网络和SGD算法。</li>
+<li>新增SGD更新器,包括Adam、AdaDelta和AdaMax。</li>
+<li>安装时减少了单节点训练的依赖库。</li>
+<li>使用CPU和GPU进行异构训练。</li>
+<li>支持 cuDNN V4。</li>
+<li>数据预取。</li>
+<li>修复一些bug。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v020-14-january-2016"></a><a href="#孵化版本(incubating)-v020-14-january-2016" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz">Apache SINGA 0.2.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_0.2.0.html">Release Notes 0.2.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>在GPU上进行训练,可以在一个节点上用多个GPU卡训练复杂的模型。</li>
+<li>混合神经网分区支持数据和模型同时并行。</li>
+<li>Python wrapper简化配置,包括神经网络和SGD算法。</li>
+<li>实现了RNN模型和BPTT算法,支持基于RNN模型的应用,如GRU。</li>
+<li>云软件集成,包括Mesos、Docker和HDFS。</li>
+<li>可视化神经网结构和层信息,以便优化调试。</li>
+<li>针对Blobs和原始数据指针的线性代数函数和随机函数。</li>
+<li>添加新的层,包括SoftmaxLayer、ArgSortLayer、DummyLayer、RNN层和cuDNN层。</li>
+<li>更新Layer类以携带多个数据/梯度Blobs。</li>
+<li>通过加载之前训练的模型参数,提取特征并测试新数据的性能。</li>
+<li>为IO操作添加Store类。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="incubating-v010-8-october-2015"></a><a href="#incubating-v010-8-october-2015" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 1 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/apache-singa-incubating-0.1.0.tar.gz">Apache SINGA 0.1.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/apache-singa-incubating-0.1.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/apache-singa-incubating-0.1.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="https://console.aws.amazon.com/ec2/v2/home?region=ap-southeast-1#LaunchInstanceWizard:ami=ami-b41001e6">Amazon EC2 image</a></li>
+<li><a href="releases/RELEASE_NOTES_0.1.0.html">Release Notes 0.1.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>允许使用GNU构建工具进行安装。</li>
+<li>实现用zookeeper进行工作管理的脚本。</li>
+<li>实现基于NeuralNet和Layer的编程模型。</li>
+<li>实现基于Worker、Server和Stub的系统架构。</li>
+<li>训练模型来自三种不同的模型类别,即前馈模型、能量模型和RNN模型。</li>
+<li>使用CPU的同步和异步分布式训练框架。</li>
+<li>checkpoint文件生成和恢复。</li>
+<li>使用gtest进行单元测试。</li>
+</ul></li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/half-precision"><span class="arrow-prev">← </span><span>Half Precision</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/build"><span>Build SINGA from Source</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#verify">Verify</a></li><li><a href="#v300-18-april-2020">V3.0.0 (18 April 2020):</a></ [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/downloads/index.html b/content/docs/3.2.0_Chinese/downloads/index.html
new file mode 100644
index 0000000..895850f
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/downloads/index.html
@@ -0,0 +1,252 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Download SINGA · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/download.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Download SINGA</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor li [...]
+<h2><a class="anchor" aria-hidden="true" id="verify"></a><a href="#verify" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>要验证下载的tar.gz文件,下载<a href="https://www.apache.org/dist/singa/KEYS">KEYS</a>和ASC文件,然后执行以下命令:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">%</span><span class="bash"> gpg --import KEYS</span>
+<span class="hljs-meta">%</span><span class="bash"> gpg --verify downloaded_file.asc downloaded_file</span>
+</code></pre>
+<p>你也可以检查SHA512或MD5值判断下载是否完成。</p>
+<h2><a class="anchor" aria-hidden="true" id="v300-18-april-2020"></a><a href="#v300-18-april-2020" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
+<ul>
+<li><a href="http://www.apache.org/dyn/closer.cgi/singa/3.0.0/apache-singa-3.0.0.tar.gz">Apache SINGA 3.0.0</a>
+<a href="https://www.apache.org/dist/singa/3.0.0/apache-singa-3.0.0.tar.gz.sha512">[SHA512]</a>
+<a href="https://www.apache.org/dist/singa/3.0.0/apache-singa-3.0.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_3.0.0">Release Notes 3.0.0</a></li>
+<li>新特性及重要更新:
+<ul>
+<li>增强了ONNX。在SINGA中测试了多种ONNX模型。</li>
+<li>使用 MPI 和 NCCL Communication进行分布式训练,通过梯度稀疏化和压缩以及分块传输进行了优化。</li>
+<li>计算图的构建,利用图优化了速度和内存。</li>
+<li>新的文档网站(singa.apache.org)和API参考网站(apache-singa.rtfd.io)。</li>
+<li>使用CI实现代码质量检查。</li>
+<li>将MKLDNN替换为DNNL。</li>
+<li>更新Tensor API以支持广播操作。</li>
+<li>实现了支持ONNX模型的新的autograd操作符。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v200-20-april-2019"></a><a href="#孵化版本(incubating)-v200-20-april-2019" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2 [...]
+<ul>
+<li><a href="http://www.apache.org/dyn/closer.cgi/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz">Apache SINGA 2.0.0 (incubating)</a>
+<a href="https://www.apache.org/dist/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz.sha512">[SHA512]</a>
+<a href="https://www.apache.org/dist/incubator/singa/2.0.0/apache-singa-incubating-2.0.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_2.0.0.html">Release Notes 2.0.0 (incubating)</a></li>
+<li>新特性及重要更新:
+<ul>
+<li>增强了autograd功能(适用于卷积网络和循环网络)。</li>
+<li>支持ONNX。</li>
+<li>通过英特尔MKL DNN lib改进CPP操作。</li>
+<li>实现tensor广播。</li>
+<li>在Apache用户名下移动Docker镜像。</li>
+<li>更新conda-build配置中依赖的lib版本。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v120-6-june-2018"></a><a href="#孵化版本(incubating)-v120-6-june-2018" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S1 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz">Apache SINGA 1.2.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz.sha512">[SHA512]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.2.0/apache-singa-incubating-1.2.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_1.2.0.html">Release Notes 1.2.0 (incubating)</a></li>
+<li>新特性及重要更新:
+<ul>
+<li>实现了autograd(目前支持MLP模式)。</li>
+<li>升级PySinga以支持Python 3</li>
+<li>改进Tensor类的stride范围。</li>
+<li>将cuDNN从V5升级到V7。</li>
+<li>增加VGG、Inception V4、ResNet和DenseNet进行ImageNet分类。</li>
+<li>为conda包创建别名</li>
+<li>完整的中文文档</li>
+<li>添加在Windows上运行Singa的说明</li>
+<li>更新编译,CI</li>
+<li>修复一些错误</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v110-12-february-2017"></a><a href="#孵化版本(incubating)-v110-12-february-2017" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1. [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz">Apache SINGA 1.1.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.1.0/apache-singa-incubating-1.1.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_1.1.0.html">Release Notes 1.1.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>创建Docker镜像(CPU和GPU版本)</li>
+<li>为SINGA创建Amazon AMI(CPU版)。</li>
+<li>集成Jenkins,自动生成Wheel和Debian包(用于安装),并更新网站。</li>
+<li>增强FeedFowardNet,例如,多输入和用于调试的verbose模式。</li>
+<li>添加Concat和Slice层。</li>
+<li>优化CrossEntropyLoss以接受带有多个标签的实例。</li>
+<li>添加包含图像增强方法的image_tool.py。</li>
+<li>支持通过快照API加载和保存模型。</li>
+<li>在Windows上编译SINGA源代码。</li>
+<li>将必要依赖库与SINGA代码一起编译。</li>
+<li>为SINGA启用Java binding(基本)。</li>
+<li>在checkpoint文件中添加版本ID。</li>
+<li>增加Rafiki工具包以提供RESTFul APIs。</li>
+<li>添加了从Caffe预训练的例子,包括GoogleNet。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v100-8-september-2016"></a><a href="#孵化版本(incubating)-v100-8-september-2016" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1. [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/1.0.0/apache-singa-incubating-1.0.0.tar.gz">Apache SINGA 1.0.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.0.0/apache-singa-incubating-1.0.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/1.0.0/apache-singa-incubating-1.0.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_1.0.0.html">Release Notes 1.0.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>创建Tensor概念,用于支持更多的机器学习模型。</li>
+<li>创建Device概念,用于运行在不同的硬件设备上,包括CPU,(Nvidia/AMD) GPU 和 FPGA (将在以后的版本中测试)。</li>
+<li>用 cmake 取代 GNU autotool 进行编译。</li>
+<li>支持 Mac OS。</li>
+<li>改进Python binding,包括安装和编程。</li>
+<li>更多的深度学习模型,包括VGG和ResNet。</li>
+<li>更多的IO类用于读取/写入文件和编码/解码数据。</li>
+<li>直接基于Socket的新网络通信组件。</li>
+<li>Cudnn V5,包含Dropout和RNN层。</li>
+<li>将网页构建工具从maven更换为Sphinx。</li>
+<li>整合Travis-CI。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v030-20-april-2016"></a><a href="#孵化版本(incubating)-v030-20-april-2016" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz">Apache SINGA 0.3.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.3.0/apache-singa-incubating-0.3.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_0.3.0.html">Release Notes 0.3.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>在GPU集群上进行训练,可以在GPU集群上进行深度学习模型的训练。</li>
+<li>改进Python wrapper简化配置工作,包括神经网络和SGD算法。</li>
+<li>新增SGD更新器,包括Adam、AdaDelta和AdaMax。</li>
+<li>安装时减少了单节点训练的依赖库。</li>
+<li>使用CPU和GPU进行异构训练。</li>
+<li>支持 cuDNN V4。</li>
+<li>数据预取。</li>
+<li>修复一些bug。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="孵化版本(incubating)-v020-14-january-2016"></a><a href="#孵化版本(incubating)-v020-14-january-2016" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz">Apache SINGA 0.2.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/0.2.0/apache-singa-incubating-0.2.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="releases/RELEASE_NOTES_0.2.0.html">Release Notes 0.2.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>在GPU上进行训练,可以在一个节点上用多个GPU卡训练复杂的模型。</li>
+<li>混合神经网分区支持数据和模型同时并行。</li>
+<li>Python wrapper简化配置,包括神经网络和SGD算法。</li>
+<li>实现了RNN模型和BPTT算法,支持基于RNN模型的应用,如GRU。</li>
+<li>云软件集成,包括Mesos、Docker和HDFS。</li>
+<li>可视化神经网结构和层信息,以便优化调试。</li>
+<li>针对Blobs和原始数据指针的线性代数函数和随机函数。</li>
+<li>添加新的层,包括SoftmaxLayer、ArgSortLayer、DummyLayer、RNN层和cuDNN层。</li>
+<li>更新Layer类以携带多个数据/梯度Blobs。</li>
+<li>通过加载之前训练的模型参数,提取特征并测试新数据的性能。</li>
+<li>为IO操作添加Store类。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="incubating-v010-8-october-2015"></a><a href="#incubating-v010-8-october-2015" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 1 [...]
+<ul>
+<li><a href="https://archive.apache.org/dist/incubator/singa/apache-singa-incubating-0.1.0.tar.gz">Apache SINGA 0.1.0 (incubating)</a>
+<a href="https://archive.apache.org/dist/incubator/singa/apache-singa-incubating-0.1.0.tar.gz.md5">[MD5]</a>
+<a href="https://archive.apache.org/dist/incubator/singa/apache-singa-incubating-0.1.0.tar.gz.asc">[ASC]</a></li>
+<li><a href="https://console.aws.amazon.com/ec2/v2/home?region=ap-southeast-1#LaunchInstanceWizard:ami=ami-b41001e6">Amazon EC2 image</a></li>
+<li><a href="releases/RELEASE_NOTES_0.1.0.html">Release Notes 0.1.0 (incubating)</a></li>
+<li>新特性和重要更新:
+<ul>
+<li>允许使用GNU构建工具进行安装。</li>
+<li>实现用zookeeper进行工作管理的脚本。</li>
+<li>实现基于NeuralNet和Layer的编程模型。</li>
+<li>实现基于Worker、Server和Stub的系统架构。</li>
+<li>训练模型来自三种不同的模型类别,即前馈模型、能量模型和RNN模型。</li>
+<li>使用CPU的同步和异步分布式训练框架。</li>
+<li>checkpoint文件生成和恢复。</li>
+<li>使用gtest进行单元测试。</li>
+</ul></li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/half-precision"><span class="arrow-prev">← </span><span>Half Precision</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/build"><span>Build SINGA from Source</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#verify">Verify</a></li><li><a href="#v300-18-april-2020">V3.0.0 (18 April 2020):</a></ [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/examples.html b/content/docs/3.2.0_Chinese/examples.html
new file mode 100644
index 0000000..03a5117
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/examples.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Examples · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owners [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/examples.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Examples</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license [...]
+<p>本页列出了一些使用SINGA的深度学习任务示例。源代码维护在 <a href="https://github.com/apache/singa/tree/master/examples">Github</a> 上的 SINGA repo 内。对于使用SINGA Python API在CPU或单GPU上运行的例子,它们也可以在<a href="https://colab.research.google.com/">Google Colab</a>上获得。你可以直接在谷歌云上运行它们,而无需在本地设置环境。下面给出了每个例子的链接。</p>
+<h2><a class="anchor" aria-hidden="true" id="图像分类"></a><a href="#图像分类" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>网络模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Simple CNN</td><td>MNIST, CIFAR10, CIFAR100</td><td><a href="https://colab.research.google.com/drive/1fbGUs1AsoX6bU5F745RwQpohP4bHTktq">Colab</a></td></tr>
+<tr><td>AlexNet</td><td>ImageNet</td><td><a href="">Cpp</a></td></tr>
+<tr><td>VGG</td><td>ImageNet</td><td><a href="">Cpp</a>, <a href="">Python</a>, <a href="https://colab.research.google.com/drive/14kxgRKtbjPCKKsDJVNi3AvTev81Gp_Ds">Colab</a></td></tr>
+<tr><td>XceptionNet</td><td>MNIST, CIFAR10, CIFAR100</td><td><a href="">Python</a></td></tr>
+<tr><td>ResNet</td><td>MNIST, CIFAR10, CIFAR100, CIFAR10</td><td><a href="">Python</a>, <a href="https://colab.research.google.com/drive/1u1RYefSsVbiP4I-5wiBKHjsT9L0FxLm9">Colab</a></td></tr>
+<tr><td>MobileNet</td><td>ImageNet</td><td><a href="https://colab.research.google.com/drive/1HsixqJMIpKyEPhkbB8jy7NwNEFEAUWAf">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="目标检测"></a><a href="#目标检测" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>网络模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Tiny YOLOv2</td><td>Pascal VOC</td><td><a href="https://colab.research.google.com/drive/11V4I6cRjIJNUv5ZGsEGwqHuoQEie6b1T">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="面部及表情识别"></a><a href="#面部及表情识别" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>ArcFace</td><td>Refined MS-Celeb-1M</td><td><a href="https://colab.research.google.com/drive/1qanaqUKGIDtifdzEzJOHjEj4kYzA9uJC">Colab</a></td></tr>
+<tr><td>Emotion FerPlus</td><td><a href="https://www.kaggle.com/c/challenges-in-representation-learning-facial-expression-recognition-challenge/data">Facial Expression Recognition Challenge</a></td><td><a href="https://colab.research.google.com/drive/1XHtBQGRhe58PDi4LGYJzYueWBeWbO23r">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="图像生成"></a><a href="#图像生成" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>GAN</td><td>MNIST</td><td><a href="https://colab.research.google.com/drive/1f86MNDW47DJqHoIqWD1tOxcyx2MWys8L">Colab</a></td></tr>
+<tr><td>LSGAN</td><td>MNIST</td><td><a href="https://colab.research.google.com/drive/1C6jNRf28vnFOI9JVM4lpkJPqxsnhxdol">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="机器理解"></a><a href="#机器理解" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Bert-Squad</td><td><a href="https://rajpurkar.github.io/SQuAD-explorer/explore/1.1/dev/">SQuAD v1.1</a></td><td><a href="https://colab.research.google.com/drive/1kud-lUPjS_u-TkDAzihBTw0Vqr0FjCE-">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="文字识别"></a><a href="#文字识别" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Simple LSTM</td><td>IMDB</td><td><a href="">python</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="文本排序"></a><a href="#文本排序" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>BiLSTM</td><td>InsuranceQA</td><td><a href="">python</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="其他"></a><a href="#其他" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<ul>
+<li>MNIST数据集的有限玻尔兹曼机, <a href="">source</a>,
+<a href="https://colab.research.google.com/drive/19996noGu9JyHHkVmp4edBGu7PJSRQKsd">Colab</a>.</li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/software-stack"><span class="arrow-prev">← </span><span>Software Stack</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/device"><span>Device</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#图像分类">图像分类</a></li><li><a href="#目标检测">目标检测</a></li><li><a href="#面部及表情识别">面部及表情识别</a></li><li><a href [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/examples/index.html b/content/docs/3.2.0_Chinese/examples/index.html
new file mode 100644
index 0000000..03a5117
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/examples/index.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Examples · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owners [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/examples.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Examples</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license [...]
+<p>本页列出了一些使用SINGA的深度学习任务示例。源代码维护在 <a href="https://github.com/apache/singa/tree/master/examples">Github</a> 上的 SINGA repo 内。对于使用SINGA Python API在CPU或单GPU上运行的例子,它们也可以在<a href="https://colab.research.google.com/">Google Colab</a>上获得。你可以直接在谷歌云上运行它们,而无需在本地设置环境。下面给出了每个例子的链接。</p>
+<h2><a class="anchor" aria-hidden="true" id="图像分类"></a><a href="#图像分类" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>网络模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Simple CNN</td><td>MNIST, CIFAR10, CIFAR100</td><td><a href="https://colab.research.google.com/drive/1fbGUs1AsoX6bU5F745RwQpohP4bHTktq">Colab</a></td></tr>
+<tr><td>AlexNet</td><td>ImageNet</td><td><a href="">Cpp</a></td></tr>
+<tr><td>VGG</td><td>ImageNet</td><td><a href="">Cpp</a>, <a href="">Python</a>, <a href="https://colab.research.google.com/drive/14kxgRKtbjPCKKsDJVNi3AvTev81Gp_Ds">Colab</a></td></tr>
+<tr><td>XceptionNet</td><td>MNIST, CIFAR10, CIFAR100</td><td><a href="">Python</a></td></tr>
+<tr><td>ResNet</td><td>MNIST, CIFAR10, CIFAR100, CIFAR10</td><td><a href="">Python</a>, <a href="https://colab.research.google.com/drive/1u1RYefSsVbiP4I-5wiBKHjsT9L0FxLm9">Colab</a></td></tr>
+<tr><td>MobileNet</td><td>ImageNet</td><td><a href="https://colab.research.google.com/drive/1HsixqJMIpKyEPhkbB8jy7NwNEFEAUWAf">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="目标检测"></a><a href="#目标检测" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>网络模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Tiny YOLOv2</td><td>Pascal VOC</td><td><a href="https://colab.research.google.com/drive/11V4I6cRjIJNUv5ZGsEGwqHuoQEie6b1T">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="面部及表情识别"></a><a href="#面部及表情识别" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>ArcFace</td><td>Refined MS-Celeb-1M</td><td><a href="https://colab.research.google.com/drive/1qanaqUKGIDtifdzEzJOHjEj4kYzA9uJC">Colab</a></td></tr>
+<tr><td>Emotion FerPlus</td><td><a href="https://www.kaggle.com/c/challenges-in-representation-learning-facial-expression-recognition-challenge/data">Facial Expression Recognition Challenge</a></td><td><a href="https://colab.research.google.com/drive/1XHtBQGRhe58PDi4LGYJzYueWBeWbO23r">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="图像生成"></a><a href="#图像生成" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>GAN</td><td>MNIST</td><td><a href="https://colab.research.google.com/drive/1f86MNDW47DJqHoIqWD1tOxcyx2MWys8L">Colab</a></td></tr>
+<tr><td>LSGAN</td><td>MNIST</td><td><a href="https://colab.research.google.com/drive/1C6jNRf28vnFOI9JVM4lpkJPqxsnhxdol">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="机器理解"></a><a href="#机器理解" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Bert-Squad</td><td><a href="https://rajpurkar.github.io/SQuAD-explorer/explore/1.1/dev/">SQuAD v1.1</a></td><td><a href="https://colab.research.google.com/drive/1kud-lUPjS_u-TkDAzihBTw0Vqr0FjCE-">Colab</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="文字识别"></a><a href="#文字识别" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>Simple LSTM</td><td>IMDB</td><td><a href="">python</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="文本排序"></a><a href="#文本排序" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<table>
+<thead>
+<tr><th>模型</th><th>数据集</th><th>链接</th></tr>
+</thead>
+<tbody>
+<tr><td>BiLSTM</td><td>InsuranceQA</td><td><a href="">python</a></td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="其他"></a><a href="#其他" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<ul>
+<li>MNIST数据集的有限玻尔兹曼机, <a href="">source</a>,
+<a href="https://colab.research.google.com/drive/19996noGu9JyHHkVmp4edBGu7PJSRQKsd">Colab</a>.</li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/software-stack"><span class="arrow-prev">← </span><span>Software Stack</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/device"><span>Device</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#图像分类">图像分类</a></li><li><a href="#目标检测">目标检测</a></li><li><a href="#面部及表情识别">面部及表情识别</a></li><li><a href [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/git-workflow.html b/content/docs/3.2.0_Chinese/git-workflow.html
new file mode 100644
index 0000000..c478bde
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/git-workflow.html
@@ -0,0 +1,146 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Git Workflow · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ow [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/git-workflow.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Git Workflow</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor [...]
+<h2><a class="anchor" aria-hidden="true" id="对于开发者"></a><a href="#对于开发者" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<ol>
+<li><p>将<a href="https://github.com/apache/singa">SINGA Github repository</a> fork到你自己的Github账户。</p></li>
+<li><p>从你自己的git仓库中clone <strong>repo</strong> (short for repository):</p>
+<pre><code class="hljs css language-shell">git clone https://github.com/<Github account>/singa.git
+git remote add upstream https://github.com/apache/singa.git
+</code></pre></li>
+<li><p>创建一个新的分支(例如 <code>feature-foo</code> 或 <code>fixbug-foo</code>),在这个分支上工作并提交你的代码:</p>
+<pre><code class="hljs css language-shell">git checkout dev
+git checkout -b feature-foo
+<span class="hljs-meta">#</span><span class="bash"> write your code</span>
+git add <created/updated files>
+git commit
+</code></pre>
+<p>commit信息应包括:</p>
+<ul>
+<li>一个概括性的标题。</li>
+<li>详细的描述。如果提交是为了修复bug,描述中最好包括问题的简短复现;如果是新功能,可以描述新功能的动机/目的。</li>
+</ul>
+<p>如果您的分支有很多小的commit,您需要通过:</p>
+<pre><code class="hljs css language-shell">git rebase -i <commit id>
+</code></pre>
+<p>你可以<a href="https://help.github.com/en/articles/about-git-rebase">压制和重写</a>提交的内容。</p></li>
+<li><p>当你在写代码的时候,SINGA的<code>dev</code>分支可能已经被别人更新了;在这种情况下,你需要拉取最新的<code>dev</code>分支:</p>
+<pre><code class="hljs css language-shell">git checkout dev
+git pull upstream dev:dev
+</code></pre></li>
+<li><p>将<code>feature-foo</code> <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing">rebase</a>到<code>dev</code>分支上,并将提交的内容推送到自己的Github账户(你刚刚创建的新分支),rebase操作是为了清理提交历史。提交当前工作后,应执行以下 git 指令:</p>
+<pre><code class="hljs css language-shell">git checkout feature-foo
+git rebase dev
+git push origin feature-foo:feature-foo
+</code></pre>
+<p>Rebase命令的<a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing">操作步骤</a>如下: "这个操作的工作原理是进入到两个分支(你所在的分支和你要rebase的分支)的共同来源 -> 获取你所在分支的每次commit所引入的差异 -> 将这些差异保存到临时文件中 -> 将当前分支重置为与你要rebase的分支相同的commit -> 最后依次修改每个差异。"</p>
+<p>因此,执行后,你还是在特性分支上,但你自己的提交ID/hash被改变了,因为diffs是在rebase时提交的;而且你的分支现在有来自<code>dev</code>分支和你自己分支的最新代码。</p></li>
+<li><p>在 Github 网站上创建一个针对 apache/singa <code>dev</code>分支的pull request(PR)。如果你想通知其他在相同文件上工作过的贡献者,你可以在Github上找到文件,然后点击 "Blame",就可以看到最后修改代码的人的逐行注释。然后,你可以在PR描述中加上@username,就可以立即ping到他们。请说明该贡献是你的原创作品,并且你在项目的开源许可下将该作品授权给项目。你的新分支的进一步提交(例如,bug修复)将由Github自动添加到这个pull request中。</p></li>
+<li><p>接下来等待committer审核PR。在这段时间里,SINGA的<code>dev</code>可能已经被其他人更新了,这时你需要<a href="https://docs.fast.ai/dev/git.html#how-to-keep-your-feature-branch-up-to-date">合并</a>最新的<code>dev</code>来解决冲突。有些人将PR重新<a href="https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request">rebase到最新的dev</a>上,而不是合并。但是,如果其他开发者获取这个PR来添加新的功能,然后再发送PR,那么rebase操作会在未来的PR中引入<strong>重复的提交</strong>(不同的哈希)。关于何时避免使用rebase的细节,请参见<a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing">The Golden Rule [...]
+</ol>
+<h2><a class="anchor" aria-hidden="true" id="对于committers"></a><a href="#对于committers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>Committer可以将PR合并到上游 repo 的 dev 分支。在合并每一个PR之前,提交者应该做到:</p>
+<ul>
+<li>检查commit信息(内容和格式)</li>
+<li>检查对现有代码的修改,API的变化应该被记录下来</li>
+<li>检查Travis测试结果,检查代码/文档格式和单元测试。</li>
+</ul>
+<p>合并PR的方式有两种:</p>
+<ul>
+<li><p>在Github上,按照<a href="https://gitbox.apache.org/setup/">说明</a>将你的Apache账户与Github账户链接,之后你就可以直接在GitHub上合并PR了。</p></li>
+<li><p>通过命令行合并pull request到<a href="https://github.com/apache/singa/pull/xxx">https://github.com/apache/singa/pull/xxx</a>,应执行以下指令:</p>
+<pre><code class="hljs css language-shell">git clone https://github.com/apache/singa.git
+git remote add asf https://gitbox.apache.org/repos/asf/singa.git
+git fetch origin pull/xxx/head:prxxx
+git checkout dev
+git merge --no-ff prxxx
+git push asf dev:dev
+</code></pre>
+<p>不要使用rebase来合并PR,并禁用fast forward。</p></li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/how-to-release"><span class="arrow-prev">← </span><span>How to Prepare a Release</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#对于开发者">对于开发者</a></li><li><a href="#对于committers">对于Committers</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-squar [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/git-workflow/index.html b/content/docs/3.2.0_Chinese/git-workflow/index.html
new file mode 100644
index 0000000..c478bde
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/git-workflow/index.html
@@ -0,0 +1,146 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Git Workflow · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ow [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/git-workflow.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Git Workflow</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor [...]
+<h2><a class="anchor" aria-hidden="true" id="对于开发者"></a><a href="#对于开发者" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<ol>
+<li><p>将<a href="https://github.com/apache/singa">SINGA Github repository</a> fork到你自己的Github账户。</p></li>
+<li><p>从你自己的git仓库中clone <strong>repo</strong> (short for repository):</p>
+<pre><code class="hljs css language-shell">git clone https://github.com/<Github account>/singa.git
+git remote add upstream https://github.com/apache/singa.git
+</code></pre></li>
+<li><p>创建一个新的分支(例如 <code>feature-foo</code> 或 <code>fixbug-foo</code>),在这个分支上工作并提交你的代码:</p>
+<pre><code class="hljs css language-shell">git checkout dev
+git checkout -b feature-foo
+<span class="hljs-meta">#</span><span class="bash"> write your code</span>
+git add <created/updated files>
+git commit
+</code></pre>
+<p>commit信息应包括:</p>
+<ul>
+<li>一个概括性的标题。</li>
+<li>详细的描述。如果提交是为了修复bug,描述中最好包括问题的简短复现;如果是新功能,可以描述新功能的动机/目的。</li>
+</ul>
+<p>如果您的分支有很多小的commit,您需要通过:</p>
+<pre><code class="hljs css language-shell">git rebase -i <commit id>
+</code></pre>
+<p>你可以<a href="https://help.github.com/en/articles/about-git-rebase">压制和重写</a>提交的内容。</p></li>
+<li><p>当你在写代码的时候,SINGA的<code>dev</code>分支可能已经被别人更新了;在这种情况下,你需要拉取最新的<code>dev</code>分支:</p>
+<pre><code class="hljs css language-shell">git checkout dev
+git pull upstream dev:dev
+</code></pre></li>
+<li><p>将<code>feature-foo</code> <a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing">rebase</a>到<code>dev</code>分支上,并将提交的内容推送到自己的Github账户(你刚刚创建的新分支),rebase操作是为了清理提交历史。提交当前工作后,应执行以下 git 指令:</p>
+<pre><code class="hljs css language-shell">git checkout feature-foo
+git rebase dev
+git push origin feature-foo:feature-foo
+</code></pre>
+<p>Rebase命令的<a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing">操作步骤</a>如下: "这个操作的工作原理是进入到两个分支(你所在的分支和你要rebase的分支)的共同来源 -> 获取你所在分支的每次commit所引入的差异 -> 将这些差异保存到临时文件中 -> 将当前分支重置为与你要rebase的分支相同的commit -> 最后依次修改每个差异。"</p>
+<p>因此,执行后,你还是在特性分支上,但你自己的提交ID/hash被改变了,因为diffs是在rebase时提交的;而且你的分支现在有来自<code>dev</code>分支和你自己分支的最新代码。</p></li>
+<li><p>在 Github 网站上创建一个针对 apache/singa <code>dev</code>分支的pull request(PR)。如果你想通知其他在相同文件上工作过的贡献者,你可以在Github上找到文件,然后点击 "Blame",就可以看到最后修改代码的人的逐行注释。然后,你可以在PR描述中加上@username,就可以立即ping到他们。请说明该贡献是你的原创作品,并且你在项目的开源许可下将该作品授权给项目。你的新分支的进一步提交(例如,bug修复)将由Github自动添加到这个pull request中。</p></li>
+<li><p>接下来等待committer审核PR。在这段时间里,SINGA的<code>dev</code>可能已经被其他人更新了,这时你需要<a href="https://docs.fast.ai/dev/git.html#how-to-keep-your-feature-branch-up-to-date">合并</a>最新的<code>dev</code>来解决冲突。有些人将PR重新<a href="https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request">rebase到最新的dev</a>上,而不是合并。但是,如果其他开发者获取这个PR来添加新的功能,然后再发送PR,那么rebase操作会在未来的PR中引入<strong>重复的提交</strong>(不同的哈希)。关于何时避免使用rebase的细节,请参见<a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing">The Golden Rule [...]
+</ol>
+<h2><a class="anchor" aria-hidden="true" id="对于committers"></a><a href="#对于committers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>Committer可以将PR合并到上游 repo 的 dev 分支。在合并每一个PR之前,提交者应该做到:</p>
+<ul>
+<li>检查commit信息(内容和格式)</li>
+<li>检查对现有代码的修改,API的变化应该被记录下来</li>
+<li>检查Travis测试结果,检查代码/文档格式和单元测试。</li>
+</ul>
+<p>合并PR的方式有两种:</p>
+<ul>
+<li><p>在Github上,按照<a href="https://gitbox.apache.org/setup/">说明</a>将你的Apache账户与Github账户链接,之后你就可以直接在GitHub上合并PR了。</p></li>
+<li><p>通过命令行合并pull request到<a href="https://github.com/apache/singa/pull/xxx">https://github.com/apache/singa/pull/xxx</a>,应执行以下指令:</p>
+<pre><code class="hljs css language-shell">git clone https://github.com/apache/singa.git
+git remote add asf https://gitbox.apache.org/repos/asf/singa.git
+git fetch origin pull/xxx/head:prxxx
+git checkout dev
+git merge --no-ff prxxx
+git push asf dev:dev
+</code></pre>
+<p>不要使用rebase来合并PR,并禁用fast forward。</p></li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/how-to-release"><span class="arrow-prev">← </span><span>How to Prepare a Release</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#对于开发者">对于开发者</a></li><li><a href="#对于committers">对于Committers</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-squar [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/2.0.0/graph.html b/content/docs/3.2.0_Chinese/graph.html
similarity index 73%
copy from content/docs/2.0.0/graph.html
copy to content/docs/3.2.0_Chinese/graph.html
index 92da4be..aa8adfe 100644
--- a/content/docs/2.0.0/graph.html
+++ b/content/docs/3.2.0_Chinese/graph.html
@@ -1,10 +1,66 @@
-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Model · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. [...]
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Model · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. [...]
document.addEventListener('DOMContentLoaded', function() {
addBackToTop(
{"zIndex":100}
)
});
- </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>2.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/graph.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Model</h1></header><article><div><span><!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreeme [...]
<p>神经网络中的前向和反向传播可以用一组操作来表示,比如卷积和池化。每个操作都需要一些输入的<a href="./tensor">tensors</a>,并应用一个<a href="./autograd">operator</a>来生成输出的张量。通过将每个运算符表示为一个节点,将每个张量表示为一条边,所有的运算就形成了一个计算图。有了计算图,可以通过调度运算的执行和内存的智能分配/释放来进行速度和内存优化。在SINGA中,用户只需要使用<a href="https://github.com/apache/singa/blob/master/python/singa/model.py">Model</a> API定义神经网络模型,计算图则会在C++后台自动构建和优化。</p>
<p>这样,一方面,用户使用<a href="./graph">Model</a> API按照PyTorch那样的命令式编程风格实现网络。而与PyTorch在每次迭代中重新创建操作不同的是,SINGA在第一次迭代后就会缓冲操作,隐式地创建计算图(当该功能被启用时)。因此,另一方面,SINGA的计算图与使用声明式编程的库(如TensorFlow)创建的计算图类似,因而它可以享受在图上进行的优化。</p>
<h2><a class="anchor" aria-hidden="true" id="样例"></a><a href="#样例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
@@ -434,7 +490,7 @@ C->device()->Exec(
<li>在启用计算图的情况下进行训练,可以显著减少内存占用。</li>
<li>目前,在速度上有一点改进。在效率方面还可以做更多的优化。</li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/4/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优化</a></li></ul></li><li><a href="#新的操作符">新的操作符</a></li><li><a href="#benchmark">Benchmark</a><ul class="toc-headings"><li><a href="#单节点">单节点</a></li><li><a href="#多线程">多线程</ [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/optimizer"><span class="arrow-prev">← </span><span>Optimizer</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/onnx"><span>ONNX</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优 [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/2.0.0/graph/index.html b/content/docs/3.2.0_Chinese/graph/index.html
similarity index 73%
copy from content/docs/2.0.0/graph/index.html
copy to content/docs/3.2.0_Chinese/graph/index.html
index 92da4be..aa8adfe 100644
--- a/content/docs/2.0.0/graph/index.html
+++ b/content/docs/3.2.0_Chinese/graph/index.html
@@ -1,10 +1,66 @@
-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Model · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. [...]
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Model · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. [...]
document.addEventListener('DOMContentLoaded', function() {
addBackToTop(
{"zIndex":100}
)
});
- </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>2.0.0</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-intern [...]
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/graph.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Model</h1></header><article><div><span><!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreeme [...]
<p>神经网络中的前向和反向传播可以用一组操作来表示,比如卷积和池化。每个操作都需要一些输入的<a href="./tensor">tensors</a>,并应用一个<a href="./autograd">operator</a>来生成输出的张量。通过将每个运算符表示为一个节点,将每个张量表示为一条边,所有的运算就形成了一个计算图。有了计算图,可以通过调度运算的执行和内存的智能分配/释放来进行速度和内存优化。在SINGA中,用户只需要使用<a href="https://github.com/apache/singa/blob/master/python/singa/model.py">Model</a> API定义神经网络模型,计算图则会在C++后台自动构建和优化。</p>
<p>这样,一方面,用户使用<a href="./graph">Model</a> API按照PyTorch那样的命令式编程风格实现网络。而与PyTorch在每次迭代中重新创建操作不同的是,SINGA在第一次迭代后就会缓冲操作,隐式地创建计算图(当该功能被启用时)。因此,另一方面,SINGA的计算图与使用声明式编程的库(如TensorFlow)创建的计算图类似,因而它可以享受在图上进行的优化。</p>
<h2><a class="anchor" aria-hidden="true" id="样例"></a><a href="#样例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
@@ -434,7 +490,7 @@ C->device()->Exec(
<li>在启用计算图的情况下进行训练,可以显著减少内存占用。</li>
<li>目前,在速度上有一点改进。在效率方面还可以做更多的优化。</li>
</ul>
-</span></div></article></div><div class="docLastUpdate"><em>Last updated on 10/4/2020</em></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优化</a></li></ul></li><li><a href="#新的操作符">新的操作符</a></li><li><a href="#benchmark">Benchmark</a><ul class="toc-headings"><li><a href="#单节点">单节点</a></li><li><a href="#多线程">多线程</ [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/optimizer"><span class="arrow-prev">← </span><span>Optimizer</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/onnx"><span>ONNX</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#样例">样例</a></li><li><a href="#实现">实现</a><ul class="toc-headings"><li><a href="#图的构建">图的构建</a></li><li><a href="#优化">优 [...]
The Apache Software Foundation. All rights reserved.
Apache SINGA, Apache, the Apache feather logo, and
the Apache SINGA project logos are trademarks of The
diff --git a/content/docs/3.2.0_Chinese/half-precision.html b/content/docs/3.2.0_Chinese/half-precision.html
new file mode 100644
index 0000000..bf15b93
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/half-precision.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/half-precision.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Half Precision</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contribu [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/time-profiling"><span class="arrow-prev">← </span><span>Time Profiling</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/downloads"><span>Download SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义" [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/half-precision/index.html b/content/docs/3.2.0_Chinese/half-precision/index.html
new file mode 100644
index 0000000..bf15b93
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/half-precision/index.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Half Precision · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/half-precision.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Half Precision</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contribu [...]
+<p>Half precision training 优点:</p>
+<ul>
+<li>CPU内存使用低, 网络支持大。</li>
+<li>训练速度快。</li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="half-data-type"></a><a href="#half-data-type" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-定义"></a><a href="#half-data-type-定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>在 IEEE 754 标准中明确binary16有如下格式:
+<a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">format</a>:
+Sign bit: 1 bit
+Exponent width: 5 bits
+Significand precision: 11 bits (10 explicitly stored)</p>
+<h3><a class="anchor" aria-hidden="true" id="half-data-type-运算"></a><a href="#half-data-type-运算" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>以fp32形式加载数据,快速转换成fp16。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor, device
+<span class="hljs-meta">>>> </span>dev = device.create_cuda_gpu()
+<span class="hljs-meta">>>> </span>x = tensor.random((<span class="hljs-number">2</span>,<span class="hljs-number">3</span>),dev)
+<span class="hljs-meta">>>> </span>x
+[[<span class="hljs-number">0.7703407</span> <span class="hljs-number">0.42764223</span> <span class="hljs-number">0.5872884</span> ]
+ [<span class="hljs-number">0.78362167</span> <span class="hljs-number">0.70469785</span> <span class="hljs-number">0.64975065</span>]], float32
+<span class="hljs-meta">>>> </span>y = x.as_type(tensor.float16)
+<span class="hljs-meta">>>> </span>y
+[[<span class="hljs-number">0.7705</span> <span class="hljs-number">0.4277</span> <span class="hljs-number">0.5874</span>]
+ [<span class="hljs-number">0.7837</span> <span class="hljs-number">0.7046</span> <span class="hljs-number">0.65</span> ]], float16
+</code></pre>
+<p>初级运算支持fp16格式。</p>
+<pre><code class="hljs css language-python"><span class="hljs-meta">>>> </span>y+y
+[[<span class="hljs-number">1.541</span> <span class="hljs-number">0.8555</span> <span class="hljs-number">1.175</span> ]
+ [<span class="hljs-number">1.567</span> <span class="hljs-number">1.409</span> <span class="hljs-number">1.3</span> ]], float16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="training-in-half"></a><a href="#training-in-half" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h3><a class="anchor" aria-hidden="true" id="training-in-half-三个步骤"></a><a href="#training-in-half-三个步骤" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>半精度训练只需要如下三个步骤:</p>
+<ol>
+<li>加载数据并且转换成半精度数据</li>
+<li>设置数据优化类型</li>
+<li>启动训练模型</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># cast input data to fp16</span>
+x = load_data()
+x = x.astype(np.float16)
+tx = tensor.from_numpy(x)
+
+<span class="hljs-comment"># load model</span>
+model = build_model()
+<span class="hljs-comment"># set optimizer dtype to fp16</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.1</span>, dtype=tensor.float16)
+
+<span class="hljs-comment"># train as usual</span>
+out, loss = model(tx, ty)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>提供示例脚本<code>train_cnn.py</code>,可执行下面的命令语句开始半精度模型训练。</p>
+<pre><code class="hljs css language-python">python examples/cnn/train_cnn.py cnn mnist -pfloat16
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="half-type-依赖性"></a><a href="#half-type-依赖性" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>该半精度实现方式就像一半半精度模型支持的一样,是被整合在C++后端来实现的。</p>
+<p>在GPU上跑的时候,<code>__half</code>可用在uda math API中,为了支持<code>__half</code>数学运算,需要编译Nvidia compute arch > 6.0(Pascal)</p>
+<h3><a class="anchor" aria-hidden="true" id="nvidia-hardware-acceleration-tensor-core"></a><a href="#nvidia-hardware-acceleration-tensor-core" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 [...]
+<p>Nvidia发布Tensor Core后进一步加速了半精度和倍数吞吐量的运算,如GEMM(CuBlas) and convolution(CuDNN)。要启用Tensor core的运算,在GEMM方面有一些要求,比如:卷积通道大小,Cuda版本和GPU版本(图灵或更高版本)等等。</p>
+<h3><a class="anchor" aria-hidden="true" id="implement-operations"></a><a href="#implement-operations" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1 [...]
+<p>半精度运算起初被整合在<code>tensor_math_cuda.h</code>中,专门提供半精度类型运算模版和实现方式,用来实现低数据量的计算。</p>
+<p>示例, GEMM 运算实现如下:</p>
+<pre><code class="hljs css language-c++"><span class="hljs-keyword">template</span> <>
+<span class="hljs-keyword">void</span> GEMM<half_float::half, lang::Cuda>(<span class="hljs-keyword">const</span> half_float::half alpha,
+ <span class="hljs-keyword">const</span> Tensor& A, <span class="hljs-keyword">const</span> Tensor& B,
+ <span class="hljs-keyword">const</span> half_float::half beta, Tensor* C,
+ Context* ctx) {
+ <span class="hljs-comment">// ...</span>
+ CUBLAS_CHECK(cublasGemmEx(handle, transb, transa, ncolB, nrowA, ncolA,
+ alphaPtr, BPtr, Btype, ldb, APtr, Atype, lda,
+ betaPtr, CPtr, Ctype, ldc, computeType, algo));
+ <span class="hljs-comment">// ...</span>
+}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/time-profiling"><span class="arrow-prev">← </span><span>Time Profiling</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/downloads"><span>Download SINGA</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#half-data-type">Half data type</a><ul class="toc-headings"><li><a href="#half-data-type-定义" [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/history-singa.html b/content/docs/3.2.0_Chinese/history-singa.html
new file mode 100644
index 0000000..b01422c
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/history-singa.html
@@ -0,0 +1,115 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>History of SINGA · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyrigh [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/history-singa.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">History of SINGA</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contrib [...]
+<h2><a class="anchor" aria-hidden="true" id="历史"></a><a href="#历史" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>SINGA由新加坡国立大学DB System Group于2014年发起,与浙江大学数据库组合作。如果您在研究中使用SINGA,请引用以下两篇论文。</p>
+<ul>
+<li><p>B.C. Ooi, K.-L. Tan, S. Wang, W. Wang, Q. Cai, G. Chen, J. Gao, Z. Luo, A. K.
+H. Tung, Y. Wang, Z. Xie, M. Zhang, and K. Zheng.
+<a href="http://www.comp.nus.edu.sg/~ooibc/singaopen-mm15.pdf">SINGA: A distributed deep learning platform</a>.
+ACM Multimedia (Open Source Software Competition) 2015</p></li>
+<li><p>W. Wang, G. Chen, T. T. A. Dinh, B. C. Ooi, K.-L.Tan, J. Gao, and S. Wang.
+<a href="http://www.comp.nus.edu.sg/~ooibc/singa-mm15.pdf">SINGA: putting deep learning in the hands of multimedia users</a>.
+ACM Multimedia 2015.</p></li>
+</ul>
+<p>Rafiki是SINGA的一个子模块,如果您在研究中使用Rafiki,请引用以下论文。</p>
+<ul>
+<li>Wei Wang, Jinyang Gao, Meihui Zhang, Sheng Wang, Gang Chen, Teck Khim Ng, Beng
+Chin Ooi, Jie Shao, Moaz Reyad.
+<a href="http://www.vldb.org/pvldb/vol12/p128-wang.pdf">Rafiki: Machine Learning as an Analytics Service System</a>.
+<a href="http://vldb.org/2019/">VLDB 2019</a>
+(<a href="https://dblp.org/rec/bib2/journals/pvldb/WangWGZCNOS18.bib">BibTex</a>).</li>
+</ul>
+<p><a href="http://tech.163.com/17/0602/17/CLUL016I00098GJ5.html">NetEase</a>,
+<a href="http://www.yzbigdata.com/en/index.html">yzBigData</a>,
+<a href="https://shentilium.com/">Shentilium</a>, <a href="http://www.foodlg.com/">Foodlg</a> 以及
+<a href="https://medilot.com/technologies">Medilot</a> 等公司在他们的工作和应用中使用了SINGA。</p>
+<h2><a class="anchor" aria-hidden="true" id="license"></a><a href="#license" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>SINGA以<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License Version 2.0</a>
+版本发布。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/team-list"><span class="arrow-prev">← </span><span>The SINGA Team</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/wheel-cpu"><span>CPU only</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#历史">历史</a></li><li><a href="#license">License</a></li></ul></nav></div><footer class="nav-footer" id=" [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/history-singa/index.html b/content/docs/3.2.0_Chinese/history-singa/index.html
new file mode 100644
index 0000000..b01422c
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/history-singa/index.html
@@ -0,0 +1,115 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>History of SINGA · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyrigh [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/history-singa.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">History of SINGA</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contrib [...]
+<h2><a class="anchor" aria-hidden="true" id="历史"></a><a href="#历史" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>SINGA由新加坡国立大学DB System Group于2014年发起,与浙江大学数据库组合作。如果您在研究中使用SINGA,请引用以下两篇论文。</p>
+<ul>
+<li><p>B.C. Ooi, K.-L. Tan, S. Wang, W. Wang, Q. Cai, G. Chen, J. Gao, Z. Luo, A. K.
+H. Tung, Y. Wang, Z. Xie, M. Zhang, and K. Zheng.
+<a href="http://www.comp.nus.edu.sg/~ooibc/singaopen-mm15.pdf">SINGA: A distributed deep learning platform</a>.
+ACM Multimedia (Open Source Software Competition) 2015</p></li>
+<li><p>W. Wang, G. Chen, T. T. A. Dinh, B. C. Ooi, K.-L.Tan, J. Gao, and S. Wang.
+<a href="http://www.comp.nus.edu.sg/~ooibc/singa-mm15.pdf">SINGA: putting deep learning in the hands of multimedia users</a>.
+ACM Multimedia 2015.</p></li>
+</ul>
+<p>Rafiki是SINGA的一个子模块,如果您在研究中使用Rafiki,请引用以下论文。</p>
+<ul>
+<li>Wei Wang, Jinyang Gao, Meihui Zhang, Sheng Wang, Gang Chen, Teck Khim Ng, Beng
+Chin Ooi, Jie Shao, Moaz Reyad.
+<a href="http://www.vldb.org/pvldb/vol12/p128-wang.pdf">Rafiki: Machine Learning as an Analytics Service System</a>.
+<a href="http://vldb.org/2019/">VLDB 2019</a>
+(<a href="https://dblp.org/rec/bib2/journals/pvldb/WangWGZCNOS18.bib">BibTex</a>).</li>
+</ul>
+<p><a href="http://tech.163.com/17/0602/17/CLUL016I00098GJ5.html">NetEase</a>,
+<a href="http://www.yzbigdata.com/en/index.html">yzBigData</a>,
+<a href="https://shentilium.com/">Shentilium</a>, <a href="http://www.foodlg.com/">Foodlg</a> 以及
+<a href="https://medilot.com/technologies">Medilot</a> 等公司在他们的工作和应用中使用了SINGA。</p>
+<h2><a class="anchor" aria-hidden="true" id="license"></a><a href="#license" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>SINGA以<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License Version 2.0</a>
+版本发布。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/team-list"><span class="arrow-prev">← </span><span>The SINGA Team</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/wheel-cpu"><span>CPU only</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#历史">历史</a></li><li><a href="#license">License</a></li></ul></nav></div><footer class="nav-footer" id=" [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/how-to-release.html b/content/docs/3.2.0_Chinese/how-to-release.html
new file mode 100644
index 0000000..37289c9
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/how-to-release.html
@@ -0,0 +1,241 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>How to Prepare a Release · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/how-to-release.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">How to Prepare a Release</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or mor [...]
+<p>这是SINGA的<a href="http://www.apache.org/dev/release-publishing.html">发布准备流程</a>指南。</p>
+<ol>
+<li><p>选择一个发布管理者。发布管理者(RM)是发布过程的协调者,他的签名文件(.asc)将会与发布一起上传。RM 生成 KEY (RSA 4096 位)并将其上传到公钥服务器,首先需要得到其他Apache用户对他的密钥的认可(签名),才能连接到信任网,RM需要先求助其他项目管理者帮忙认证他的密钥。<a href="http://www.apache.org/dev/release-signing.html">如何生成密钥?</a></p></li>
+<li><p>检查license。 <a href="https://www.apache.org/legal/src-headers.html#faq-docs">FAQ</a>;
+<a href="https://issues.apache.org/jira/projects/SINGA/issues/SINGA-447">SINGA Issue</a></p>
+<ul>
+<li>代码库不能包含与APL不兼容的第三方代码。</li>
+<li>依赖项与APL兼容,GNU类license不兼容。</li>
+<li>我们编写的所有源文件都必须包含Apache license头:<a href="http://www.apache.org/legal/src-headers.html">http://www.apache.org/legal/src-headers.html</a>.
+链接中有一个脚本可以帮助将这个头同步到所有文件。</li>
+<li>更新LICENSE文件。如果我们在发行包中包含了任何非APL的第三方代码,必须要在NOTICE文件的最后注明。</li>
+</ul></li>
+<li><p>复查版本。检查代码和文档。</p>
+<ul>
+<li>编译过程无错误。</li>
+<li>(尽可能地)包含进单元测试。</li>
+<li>Conda包运行无误。</li>
+<li>Apache网站上的在线文档是最新的。</li>
+</ul></li>
+<li><p>准备好RELEASE_NOTES文件。包括以下项目,介绍,特性,错误(链接到JIRA或Github PR),变更,依赖列表,不兼容问题,可以按照这个<a href="(http://commons.apache.org/proper/commons-digester/commons-digester-3.0/RELEASE-NOTES.txt)">例子</a>来写。</p></li>
+<li><p>打包候选版本。该版本应该打包成:apache-singa-VERSION.tar.gz。这个版本不应该包含任何二进制文件,包括git文件。但是CMake的编译依赖于git标签来获取版本号;要删除这个依赖,你需要手动更新CMakeLists.txt文件来设置版本号:</p>
+<pre><code class="hljs"># remove the following lines
+include(GetGitRevisionDescription)
+git_describe(VERSION --tags --dirty=-d)
+<span class="hljs-type">string</span>(REGEX REPLACE <span class="hljs-string">"^([0-9]+)<span class="hljs-subst">\\</span>..*"</span> <span class="hljs-string">"<span class="hljs-subst">\\</span>1"</span> VERSION_MAJOR <span class="hljs-string">"${VERSION}"</span>)
+<span class="hljs-type">string</span>(REGEX REPLACE <span class="hljs-string">"^[0-9]+<span class="hljs-subst">\\</span>.([0-9]+).*"</span> <span class="hljs-string">"<span class="hljs-subst">\\</span>1"</span> VERSION_MINOR <span class="hljs-string">"${VERSION}"</span>)
+<span class="hljs-type">string</span>(REGEX REPLACE <span class="hljs-string">"^[0-9]+<span class="hljs-subst">\\</span>.[0-9]+<span class="hljs-subst">\\</span>.([0-9]+).*"</span> <span class="hljs-string">"<span class="hljs-subst">\\</span>1"</span> VERSION_PATCH <span class="hljs-string">"${VERSION}"</span>)
+
+# set the numbers manually
+SET(PACKAGE_VERSION <span class="hljs-number">3.0</span><span class="hljs-number">.0</span>)
+SET(VERSION <span class="hljs-number">3.0</span><span class="hljs-number">.0</span>)
+SET(SINGA_MAJOR_VERSION <span class="hljs-number">3</span>) # <span class="hljs-number">0</span> -
+SET(SINGA_MINOR_VERSION <span class="hljs-number">0</span>) # <span class="hljs-number">0</span> - <span class="hljs-number">9</span>
+SET(SINGA_PATCH_VERSION <span class="hljs-number">0</span>) # <span class="hljs-number">0</span> - <span class="hljs-number">99</span>
+</code></pre>
+<p>将软件包上传到<a href="https://dist.apache.org/repos/dist/dev/singa/">stage repo</a>。应包括tar文件、签名、KEY和SHA256校验和文件。MD5不再使用,详细规则在<a href="https://dist.apache.org/repos/dist/dev/singa/">这里</a>。阶段文件夹应该包括:</p>
+<ul>
+<li>apache-singa-VERSION.tar.gz</li>
+<li>apache-singa-VERSION.acs</li>
+<li>apache-singa-VERSION.SHA256</li>
+</ul>
+<p>创建这些文件并上传到stage svn repo的命令如下:</p>
+<pre><code class="hljs css language-sh"><span class="hljs-comment"># in singa repo</span>
+rm -rf .git
+rm -rf rafiki/*
+<span class="hljs-built_in">cd</span> ..
+tar -czvf apache-singa-VERSION.tar.gz singa/
+
+mkdir stage
+<span class="hljs-built_in">cd</span> stage
+svn co https://dist.apache.org/repos/dist/dev/singa/
+<span class="hljs-built_in">cd</span> singa
+<span class="hljs-comment"># copy the KEYS file from singa repo to this folder if it is not here</span>
+cp ../../singa/KEYS .
+mkdir VERSION
+<span class="hljs-comment"># copy the tar.gz file</span>
+mv ../../apache-singa-VERSION.tar.gz VERSION/
+<span class="hljs-built_in">cd</span> VERSION
+sha512sum apache-singa-VERSION.tar.gz > apache-singa-VERSION.tar.gz.sha512
+gpg --armor --output apache-singa-VERSION.tar.gz.asc --detach-sig apache-singa-VERSION.tar.gz
+<span class="hljs-built_in">cd</span> ..
+svn add VERSION
+svn commit
+</code></pre></li>
+</ol>
+<ol start="6">
+<li>通过发送电子邮件的方式进行投票。现举例如下:</li>
+</ol>
+<pre><code class="hljs"> To: dev@singa.apache.org
+ Subject: [VOTE] <span class="hljs-keyword">Release</span> apache-singa-X.Y.Z (<span class="hljs-keyword">release</span> candidate N)
+
+ Hi <span class="hljs-keyword">all</span>,
+
+ I have created a <span class="hljs-keyword">build</span> <span class="hljs-keyword">for</span> Apache SINGA <span class="hljs-number">3.1</span><span class="hljs-number">.0</span>, <span class="hljs-keyword">release</span> candidate <span class="hljs-number">2.</span>
+
+ The <span class="hljs-keyword">release</span> note <span class="hljs-keyword">is</span> <span class="hljs-keyword">at</span>
+ https://github.com/apache/singa/<span class="hljs-built_in">blob</span>/<span class="hljs-keyword">master</span>/RELEASE_NOTES.
+
+ The artifacts <span class="hljs-keyword">to</span> be voted <span class="hljs-keyword">on</span> <span class="hljs-keyword">are</span> located here:
+ https://dist.apache.org/repos/dist/dev/singa/<span class="hljs-number">3.1</span><span class="hljs-number">.0</span>.rc2/apache-singa<span class="hljs-number">-3.1</span><span class="hljs-number">.0</span>.rc2.tar.gz
+
+ The hashes <span class="hljs-keyword">of</span> the artifacts <span class="hljs-keyword">are</span> <span class="hljs-keyword">as</span> <span class="hljs-keyword">follows</span>:
+ SHA512: <span class="hljs-number">84545499</span>ad36da108c6a599edd1d853f82d331bc03273b5278515554866f0c698e881f956b2eabcb6b29c07fa9fa4ff1add5a777b58db8a6a2362cf383b5c04d
+
+ <span class="hljs-keyword">Release</span> artifacts <span class="hljs-keyword">are</span> signed <span class="hljs-keyword">with</span> the followingkey:
+ https://dist.apache.org/repos/dist/dev/singa/<span class="hljs-keyword">KEYS</span>
+
+ The signature <span class="hljs-keyword">file</span> <span class="hljs-keyword">is</span>:
+ https://dist.apache.org/repos/dist/dev/singa/<span class="hljs-number">3.1</span><span class="hljs-number">.0</span>.rc2/apache-singa<span class="hljs-number">-3.1</span><span class="hljs-number">.0</span>.rc2.tar.gz.asc
+
+ The Github tag <span class="hljs-keyword">is</span> <span class="hljs-keyword">at</span>:
+ https://github.com/apache/singa/releases/tag/<span class="hljs-number">3.1</span><span class="hljs-number">.0</span>.rc2
+
+ The documentation website <span class="hljs-keyword">is</span> <span class="hljs-keyword">at</span>
+ <span class="hljs-keyword">http</span>://singa.apache.org/docs/<span class="hljs-keyword">next</span>/installation/
+
+ <span class="hljs-keyword">Some</span> examples <span class="hljs-keyword">are</span> available <span class="hljs-keyword">for</span> testing:
+ https://github.com/apache/singa/tree/<span class="hljs-keyword">master</span>/examples
+
+
+
+ Please vote <span class="hljs-keyword">on</span> releasing this package. The vote <span class="hljs-keyword">is</span> <span class="hljs-keyword">open</span> <span class="hljs-keyword">for</span> <span class="hljs-keyword">at</span> <span class="hljs-keyword">least</span> <span class="hljs-number">72</span> <span class="hljs-keyword">hours</span> <span class="hljs-keyword">and</span> passes <span class="hljs-keyword">if</span> a majority <span class="hljs-keyword">of</span> <span clas [...]
+
+ [ ] +<span class="hljs-number">1</span> <span class="hljs-keyword">Release</span> this <span class="hljs-keyword">package</span> <span class="hljs-keyword">as</span> Apache SINGA X.Y.Z
+
+ [ ] <span class="hljs-number">0</span> I don<span class="hljs-string">'t feel strongly about it, but I'</span>m okay <span class="hljs-keyword">with</span> the <span class="hljs-keyword">release</span>
+
+ [ ] <span class="hljs-number">-1</span> <span class="hljs-keyword">Do</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">release</span> this <span class="hljs-keyword">package</span> because...
+
+ Here <span class="hljs-keyword">is</span> my vote: +<span class="hljs-number">1</span>
+
+</code></pre>
+<ol start="7">
+<li>等待至少48小时的测试回复。任何PMC、提交者或贡献者都可以测试发布的功能,以及反馈。大家在投票+1之前应该检查这些。如果投票通过,则发送如下的结果邮件,否则,从头开始重复刚刚的步骤。</li>
+</ol>
+<pre><code class="hljs">
+<span class="hljs-keyword">To</span>: dev@singa.apache.org Subject: [RESULT][vote] Release apache-singa-X.Y.Z
+(release candidate N)
+
+Thanks <span class="hljs-keyword">to</span> everyone who has voted <span class="hljs-keyword">and</span> given their comments. The tally is as
+follows.
+
+N binding +1s: <names>
+
+N non-binding +1s: <names>
+
+<span class="hljs-literal">No</span> 0s <span class="hljs-keyword">or</span> -1s.
+
+I am delighted <span class="hljs-keyword">to</span> announce that the<span class="hljs-built_in"> proposal </span><span class="hljs-keyword">to</span> release Apache SINGA X.Y.Z has
+passed.
+
+</code></pre>
+<ol start="8">
+<li><p>将软件包上传至 <a href="https://dist.apache.org/repos/dist/release/singa/">https://dist.apache.org/repos/dist/release/singa/</a>,以便<a href="http://www.apache.org/dev/release-publishing.html#distribution">distribution</a>。</p></li>
+<li><p>更新SINGA网站的下载页面。tar.gz 文件必须从镜像下载,使用 closer.cgi 脚本;其他工件必须从 Apache 主站点下载。更多细节请看<a href="http://www.apache.org/dev/release-download-pages.html">这里</a>。我们在之前的版本中得到的一些反馈。“下载页面必须只链接到正式发布的版本,所以不能包含到GitHub的链接”,“链接到KEYS, sig和Hash的链接不能使用dist.apache.org而应该使用 <a href="https://www.apache.org/dist/singa/">https://www.apache.org/dist/singa/</a>...”“而且你只需要一个KEYS链接,而且应该描述如何使用KEYS+sig或Hash来验证下载。”</p></li>
+<li><p>删除RC标签并编译conda包。</p></li>
+<li><p>发布release信息:</p></li>
+</ol>
+<pre><code class="hljs"><span class="hljs-attribute">To</span>: announce<span class="hljs-variable">@apache</span>.org, dev<span class="hljs-variable">@singa</span>.apache.org
+<span class="hljs-attribute">Subject</span>: [ANNOUNCE] Apache SINGA X.Y.Z released
+
+We are pleased to announce that SINGA X.Y.Z is released.
+
+SINGA is a general distributed deep learning platform
+for training big deep learning models over large datasets.
+The release is available <span class="hljs-attribute">at</span>: <span class="hljs-attribute">http</span>:<span class="hljs-comment">//singa.apache.org/downloads.html</span>
+The main features of this release include XXX
+We look forward to hearing your feedback, suggestions,
+and contributions to the project.
+
+On behalf of the SINGA team, {SINGA Team Member Name}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/contribute-docs"><span class="arrow-prev">← </span><span>How to Contribute to Documentation</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/git-workflow"><span>Git Workflow</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><im [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/how-to-release/index.html b/content/docs/3.2.0_Chinese/how-to-release/index.html
new file mode 100644
index 0000000..37289c9
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/how-to-release/index.html
@@ -0,0 +1,241 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>How to Prepare a Release · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/how-to-release.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">How to Prepare a Release</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or mor [...]
+<p>这是SINGA的<a href="http://www.apache.org/dev/release-publishing.html">发布准备流程</a>指南。</p>
+<ol>
+<li><p>选择一个发布管理者。发布管理者(RM)是发布过程的协调者,他的签名文件(.asc)将会与发布一起上传。RM 生成 KEY (RSA 4096 位)并将其上传到公钥服务器,首先需要得到其他Apache用户对他的密钥的认可(签名),才能连接到信任网,RM需要先求助其他项目管理者帮忙认证他的密钥。<a href="http://www.apache.org/dev/release-signing.html">如何生成密钥?</a></p></li>
+<li><p>检查license。 <a href="https://www.apache.org/legal/src-headers.html#faq-docs">FAQ</a>;
+<a href="https://issues.apache.org/jira/projects/SINGA/issues/SINGA-447">SINGA Issue</a></p>
+<ul>
+<li>代码库不能包含与APL不兼容的第三方代码。</li>
+<li>依赖项与APL兼容,GNU类license不兼容。</li>
+<li>我们编写的所有源文件都必须包含Apache license头:<a href="http://www.apache.org/legal/src-headers.html">http://www.apache.org/legal/src-headers.html</a>.
+链接中有一个脚本可以帮助将这个头同步到所有文件。</li>
+<li>更新LICENSE文件。如果我们在发行包中包含了任何非APL的第三方代码,必须要在NOTICE文件的最后注明。</li>
+</ul></li>
+<li><p>复查版本。检查代码和文档。</p>
+<ul>
+<li>编译过程无错误。</li>
+<li>(尽可能地)包含进单元测试。</li>
+<li>Conda包运行无误。</li>
+<li>Apache网站上的在线文档是最新的。</li>
+</ul></li>
+<li><p>准备好RELEASE_NOTES文件。包括以下项目,介绍,特性,错误(链接到JIRA或Github PR),变更,依赖列表,不兼容问题,可以按照这个<a href="(http://commons.apache.org/proper/commons-digester/commons-digester-3.0/RELEASE-NOTES.txt)">例子</a>来写。</p></li>
+<li><p>打包候选版本。该版本应该打包成:apache-singa-VERSION.tar.gz。这个版本不应该包含任何二进制文件,包括git文件。但是CMake的编译依赖于git标签来获取版本号;要删除这个依赖,你需要手动更新CMakeLists.txt文件来设置版本号:</p>
+<pre><code class="hljs"># remove the following lines
+include(GetGitRevisionDescription)
+git_describe(VERSION --tags --dirty=-d)
+<span class="hljs-type">string</span>(REGEX REPLACE <span class="hljs-string">"^([0-9]+)<span class="hljs-subst">\\</span>..*"</span> <span class="hljs-string">"<span class="hljs-subst">\\</span>1"</span> VERSION_MAJOR <span class="hljs-string">"${VERSION}"</span>)
+<span class="hljs-type">string</span>(REGEX REPLACE <span class="hljs-string">"^[0-9]+<span class="hljs-subst">\\</span>.([0-9]+).*"</span> <span class="hljs-string">"<span class="hljs-subst">\\</span>1"</span> VERSION_MINOR <span class="hljs-string">"${VERSION}"</span>)
+<span class="hljs-type">string</span>(REGEX REPLACE <span class="hljs-string">"^[0-9]+<span class="hljs-subst">\\</span>.[0-9]+<span class="hljs-subst">\\</span>.([0-9]+).*"</span> <span class="hljs-string">"<span class="hljs-subst">\\</span>1"</span> VERSION_PATCH <span class="hljs-string">"${VERSION}"</span>)
+
+# set the numbers manually
+SET(PACKAGE_VERSION <span class="hljs-number">3.0</span><span class="hljs-number">.0</span>)
+SET(VERSION <span class="hljs-number">3.0</span><span class="hljs-number">.0</span>)
+SET(SINGA_MAJOR_VERSION <span class="hljs-number">3</span>) # <span class="hljs-number">0</span> -
+SET(SINGA_MINOR_VERSION <span class="hljs-number">0</span>) # <span class="hljs-number">0</span> - <span class="hljs-number">9</span>
+SET(SINGA_PATCH_VERSION <span class="hljs-number">0</span>) # <span class="hljs-number">0</span> - <span class="hljs-number">99</span>
+</code></pre>
+<p>将软件包上传到<a href="https://dist.apache.org/repos/dist/dev/singa/">stage repo</a>。应包括tar文件、签名、KEY和SHA256校验和文件。MD5不再使用,详细规则在<a href="https://dist.apache.org/repos/dist/dev/singa/">这里</a>。阶段文件夹应该包括:</p>
+<ul>
+<li>apache-singa-VERSION.tar.gz</li>
+<li>apache-singa-VERSION.acs</li>
+<li>apache-singa-VERSION.SHA256</li>
+</ul>
+<p>创建这些文件并上传到stage svn repo的命令如下:</p>
+<pre><code class="hljs css language-sh"><span class="hljs-comment"># in singa repo</span>
+rm -rf .git
+rm -rf rafiki/*
+<span class="hljs-built_in">cd</span> ..
+tar -czvf apache-singa-VERSION.tar.gz singa/
+
+mkdir stage
+<span class="hljs-built_in">cd</span> stage
+svn co https://dist.apache.org/repos/dist/dev/singa/
+<span class="hljs-built_in">cd</span> singa
+<span class="hljs-comment"># copy the KEYS file from singa repo to this folder if it is not here</span>
+cp ../../singa/KEYS .
+mkdir VERSION
+<span class="hljs-comment"># copy the tar.gz file</span>
+mv ../../apache-singa-VERSION.tar.gz VERSION/
+<span class="hljs-built_in">cd</span> VERSION
+sha512sum apache-singa-VERSION.tar.gz > apache-singa-VERSION.tar.gz.sha512
+gpg --armor --output apache-singa-VERSION.tar.gz.asc --detach-sig apache-singa-VERSION.tar.gz
+<span class="hljs-built_in">cd</span> ..
+svn add VERSION
+svn commit
+</code></pre></li>
+</ol>
+<ol start="6">
+<li>通过发送电子邮件的方式进行投票。现举例如下:</li>
+</ol>
+<pre><code class="hljs"> To: dev@singa.apache.org
+ Subject: [VOTE] <span class="hljs-keyword">Release</span> apache-singa-X.Y.Z (<span class="hljs-keyword">release</span> candidate N)
+
+ Hi <span class="hljs-keyword">all</span>,
+
+ I have created a <span class="hljs-keyword">build</span> <span class="hljs-keyword">for</span> Apache SINGA <span class="hljs-number">3.1</span><span class="hljs-number">.0</span>, <span class="hljs-keyword">release</span> candidate <span class="hljs-number">2.</span>
+
+ The <span class="hljs-keyword">release</span> note <span class="hljs-keyword">is</span> <span class="hljs-keyword">at</span>
+ https://github.com/apache/singa/<span class="hljs-built_in">blob</span>/<span class="hljs-keyword">master</span>/RELEASE_NOTES.
+
+ The artifacts <span class="hljs-keyword">to</span> be voted <span class="hljs-keyword">on</span> <span class="hljs-keyword">are</span> located here:
+ https://dist.apache.org/repos/dist/dev/singa/<span class="hljs-number">3.1</span><span class="hljs-number">.0</span>.rc2/apache-singa<span class="hljs-number">-3.1</span><span class="hljs-number">.0</span>.rc2.tar.gz
+
+ The hashes <span class="hljs-keyword">of</span> the artifacts <span class="hljs-keyword">are</span> <span class="hljs-keyword">as</span> <span class="hljs-keyword">follows</span>:
+ SHA512: <span class="hljs-number">84545499</span>ad36da108c6a599edd1d853f82d331bc03273b5278515554866f0c698e881f956b2eabcb6b29c07fa9fa4ff1add5a777b58db8a6a2362cf383b5c04d
+
+ <span class="hljs-keyword">Release</span> artifacts <span class="hljs-keyword">are</span> signed <span class="hljs-keyword">with</span> the followingkey:
+ https://dist.apache.org/repos/dist/dev/singa/<span class="hljs-keyword">KEYS</span>
+
+ The signature <span class="hljs-keyword">file</span> <span class="hljs-keyword">is</span>:
+ https://dist.apache.org/repos/dist/dev/singa/<span class="hljs-number">3.1</span><span class="hljs-number">.0</span>.rc2/apache-singa<span class="hljs-number">-3.1</span><span class="hljs-number">.0</span>.rc2.tar.gz.asc
+
+ The Github tag <span class="hljs-keyword">is</span> <span class="hljs-keyword">at</span>:
+ https://github.com/apache/singa/releases/tag/<span class="hljs-number">3.1</span><span class="hljs-number">.0</span>.rc2
+
+ The documentation website <span class="hljs-keyword">is</span> <span class="hljs-keyword">at</span>
+ <span class="hljs-keyword">http</span>://singa.apache.org/docs/<span class="hljs-keyword">next</span>/installation/
+
+ <span class="hljs-keyword">Some</span> examples <span class="hljs-keyword">are</span> available <span class="hljs-keyword">for</span> testing:
+ https://github.com/apache/singa/tree/<span class="hljs-keyword">master</span>/examples
+
+
+
+ Please vote <span class="hljs-keyword">on</span> releasing this package. The vote <span class="hljs-keyword">is</span> <span class="hljs-keyword">open</span> <span class="hljs-keyword">for</span> <span class="hljs-keyword">at</span> <span class="hljs-keyword">least</span> <span class="hljs-number">72</span> <span class="hljs-keyword">hours</span> <span class="hljs-keyword">and</span> passes <span class="hljs-keyword">if</span> a majority <span class="hljs-keyword">of</span> <span clas [...]
+
+ [ ] +<span class="hljs-number">1</span> <span class="hljs-keyword">Release</span> this <span class="hljs-keyword">package</span> <span class="hljs-keyword">as</span> Apache SINGA X.Y.Z
+
+ [ ] <span class="hljs-number">0</span> I don<span class="hljs-string">'t feel strongly about it, but I'</span>m okay <span class="hljs-keyword">with</span> the <span class="hljs-keyword">release</span>
+
+ [ ] <span class="hljs-number">-1</span> <span class="hljs-keyword">Do</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">release</span> this <span class="hljs-keyword">package</span> because...
+
+ Here <span class="hljs-keyword">is</span> my vote: +<span class="hljs-number">1</span>
+
+</code></pre>
+<ol start="7">
+<li>等待至少48小时的测试回复。任何PMC、提交者或贡献者都可以测试发布的功能,以及反馈。大家在投票+1之前应该检查这些。如果投票通过,则发送如下的结果邮件,否则,从头开始重复刚刚的步骤。</li>
+</ol>
+<pre><code class="hljs">
+<span class="hljs-keyword">To</span>: dev@singa.apache.org Subject: [RESULT][vote] Release apache-singa-X.Y.Z
+(release candidate N)
+
+Thanks <span class="hljs-keyword">to</span> everyone who has voted <span class="hljs-keyword">and</span> given their comments. The tally is as
+follows.
+
+N binding +1s: <names>
+
+N non-binding +1s: <names>
+
+<span class="hljs-literal">No</span> 0s <span class="hljs-keyword">or</span> -1s.
+
+I am delighted <span class="hljs-keyword">to</span> announce that the<span class="hljs-built_in"> proposal </span><span class="hljs-keyword">to</span> release Apache SINGA X.Y.Z has
+passed.
+
+</code></pre>
+<ol start="8">
+<li><p>将软件包上传至 <a href="https://dist.apache.org/repos/dist/release/singa/">https://dist.apache.org/repos/dist/release/singa/</a>,以便<a href="http://www.apache.org/dev/release-publishing.html#distribution">distribution</a>。</p></li>
+<li><p>更新SINGA网站的下载页面。tar.gz 文件必须从镜像下载,使用 closer.cgi 脚本;其他工件必须从 Apache 主站点下载。更多细节请看<a href="http://www.apache.org/dev/release-download-pages.html">这里</a>。我们在之前的版本中得到的一些反馈。“下载页面必须只链接到正式发布的版本,所以不能包含到GitHub的链接”,“链接到KEYS, sig和Hash的链接不能使用dist.apache.org而应该使用 <a href="https://www.apache.org/dist/singa/">https://www.apache.org/dist/singa/</a>...”“而且你只需要一个KEYS链接,而且应该描述如何使用KEYS+sig或Hash来验证下载。”</p></li>
+<li><p>删除RC标签并编译conda包。</p></li>
+<li><p>发布release信息:</p></li>
+</ol>
+<pre><code class="hljs"><span class="hljs-attribute">To</span>: announce<span class="hljs-variable">@apache</span>.org, dev<span class="hljs-variable">@singa</span>.apache.org
+<span class="hljs-attribute">Subject</span>: [ANNOUNCE] Apache SINGA X.Y.Z released
+
+We are pleased to announce that SINGA X.Y.Z is released.
+
+SINGA is a general distributed deep learning platform
+for training big deep learning models over large datasets.
+The release is available <span class="hljs-attribute">at</span>: <span class="hljs-attribute">http</span>:<span class="hljs-comment">//singa.apache.org/downloads.html</span>
+The main features of this release include XXX
+We look forward to hearing your feedback, suggestions,
+and contributions to the project.
+
+On behalf of the SINGA team, {SINGA Team Member Name}
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/contribute-docs"><span class="arrow-prev">← </span><span>How to Contribute to Documentation</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/git-workflow"><span>Git Workflow</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><im [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/install-win.html b/content/docs/3.2.0_Chinese/install-win.html
new file mode 100644
index 0000000..9da033f
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/install-win.html
@@ -0,0 +1,330 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Build SINGA on Windows · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding co [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+<p>在Microsoft Windows上从源码构建SINGA的过程有四个部分:安装依赖关系、构建SINGA源码、(可选择)安装python模块和(可选择)运行单元测试。</p>
+<h2><a class="anchor" aria-hidden="true" id="安装依赖项"></a><a href="#安装依赖项" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>你可以创建一个文件夹来构建依赖关系。</p>
+<p>使用到的依赖项有:</p>
+<ul>
+<li><p>编译器和IDE:</p>
+<ul>
+<li>Visual Studio,社区版是免费的,可以用来构建SINGA。
+<a href="https://www.visualstudio.com/">https://www.visualstudio.com/</a></li>
+</ul></li>
+<li><p>CMake</p>
+<ul>
+<li>可以从 <a href="http://cmake.org/">http://cmake.org/</a> 下载</li>
+<li>确保 cmake 可执行文件的路径在系统路径中,或者在调用 cmake 时使用完整路径。</li>
+</ul></li>
+<li><p>SWIG</p>
+<ul>
+<li>可以从 <a href="http://swig.org/">http://swig.org/</a> 下载</li>
+<li>确保swig可执行文件的路径在系统路径中,或者在调用swig时使用完整路径。请使用最新的版本,如3.0.12。</li>
+</ul></li>
+<li><p>Protocol Buffers</p>
+<ul>
+<li>下载一个合适的版本,如2.6.1:
+<a href="https://github.com/google/protobuf/releases/tag/v2.6.1">https://github.com/google/protobuf/releases/tag/v2.6.1</a> 。</li>
+<li>下载 protobuf-2.6.1.zip 和 protoc-2.6.1-win32.zip。</li>
+<li>将这两个文件解压到dependencies文件夹中,将protoc可执行文件的路径添加到系统路径中,或者在调用它时使用完整路径。</li>
+<li>打开Visual Studio solution,它可以在vsproject文件夹中找到。</li>
+<li>将build settings改为Release和x64。</li>
+<li>构建libprotobuf项目。</li>
+</ul></li>
+<li><p>Openblas</p>
+<ul>
+<li>从 <a href="http://www.openblas.net">http://www.openblas.net</a> 下载合适的源码,如0.2.20。</li>
+<li>将源码解压到dependencies文件夹中。</li>
+<li>如果你没有安装Perl,请下载一个perl环境,如Strawberry Perl (<a href="http://strawberryperl.com/">http://strawberryperl.com/</a>)。</li>
+<li>在源文件夹中运行此命令来构建Visual Studio解决方案:</li>
+</ul>
+<pre><code class="hljs css language-bash">cmake -G <span class="hljs-string">"Visual Studio 15 2017 Win64"</span>
+</code></pre>
+<ul>
+<li>打开Visual Studio解决方案并将build settings更改为Release和x64。</li>
+<li>构建libopenblas项目。</li>
+</ul></li>
+<li><p>Google glog</p>
+<ul>
+<li>下载一个合适的版本,如0.3.5:
+<a href="https://github.com/google/glog/releases">https://github.com/google/glog/releases</a></li>
+<li>将源码解压到dependencies文件夹中。</li>
+<li>打开Visual Studio solution.</li>
+<li>将build settings改为Release and x64.</li>
+<li>构建libglog项目。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="构建singa源代码"></a><a href="#构建singa源代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<ul>
+<li><p>下载SINGA源代码</p></li>
+<li><p>编译protobuf文件:</p>
+<ul>
+<li>在src/proto目录中:</li>
+</ul>
+<pre><code class="hljs css language-shell">mkdir python_out
+protoc.exe *.proto --python_out python_out
+</code></pre></li>
+<li><p>为C++和Python生成swig接口:在src/api目录中:</p>
+<pre><code class="hljs css language-shell">swig -python -c++ singa.i
+</code></pre></li>
+<li><p>生成SINGA的Visual Studio解决方案:在SINGA源码根目录中:</p>
+<pre><code class="hljs css language-shell">mkdir build
+cd build
+</code></pre></li>
+<li><p>调用 cmake 并添加系统路径,类似于下面的例子:</p>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64" ^
+ -DGLOG_INCLUDE_DIR="D:/WinSinga/dependencies/glog-0.3.5/src/windows" ^
+ -DGLOG_LIBRARIES="D:/WinSinga/dependencies/glog-0.3.5/x64/Release" ^
+ -DCBLAS_INCLUDE_DIR="D:/WinSinga/dependencies/openblas-0.2.20/lapack-netlib/CBLAS/include" ^
+ -DCBLAS_LIBRARIES="D:/WinSinga/dependencies/openblas-0.2.20/lib/RELEASE" ^
+ -DProtobuf_INCLUDE_DIR="D:/WinSinga/dependencies/protobuf-2.6.1/src" ^
+ -DProtobuf_LIBRARIES="D:/WinSinga/dependencies/protobuf-2.6.1/vsprojects/x64/Release" ^
+ -DProtobuf_PROTOC_EXECUTABLE="D:/WinSinga/dependencies/protoc-2.6.1-win32/protoc.exe" ^
+ ..
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案。</p></li>
+<li><p>将构建设置改为Release和x64。</p></li>
+<li><p>将src/api中的singa_wrap.cxx文件添加到singa_objects项目中。</p></li>
+<li><p>在 singa_objects 项目中,打开 Additional Include Directories。</p></li>
+<li><p>添加Python的include路径。</p></li>
+<li><p>添加numpy的include路径。</p></li>
+<li><p>添加protobuf的include路径。</p></li>
+<li><p>在 singa_objects 项目的预处理程序定义中, 添加 USE_GLOG。</p></li>
+<li><p>构建singa_objects项目。</p></li>
+<li><p>在singa项目中:</p>
+<ul>
+<li>将singa_wrap.obj添加到对象库。</li>
+<li>将目标名称改为"_singa_wrap"。</li>
+<li>将目标扩展名为.pyd。</li>
+<li>将配置类型改为动态库(.dll)。</li>
+<li>进入Additional Library Directories,添加路径到python、openblas、protobuf和glog库。</li>
+<li>在Additional Dependencies中添加libopenblas.lib、libglog.lib和libprotobuf.lib。</li>
+</ul></li>
+<li><p>构建singa项目</p></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="安装python模块"></a><a href="#安装python模块" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<ul>
+<li><p>将build/python/setup.py中的<code>_singa_wrap.so</code>改为<code>_singa_wrap.pyd</code>。</p></li>
+<li><p>将<code>src/proto/python_out</code>中的文件复制到<code>build/python/singa/proto</code>中。</p></li>
+<li><p>(可选)创建并激活一个虚拟环境:</p>
+<pre><code class="hljs css language-shell">mkdir SingaEnv
+virtualenv SingaEnv
+SingaEnv\Scripts\activate
+</code></pre></li>
+<li><p>进入build/python文件夹,运行:</p>
+<pre><code class="hljs css language-shell">python setup.py install
+</code></pre></li>
+<li><p>将 _singa_wrap.pyd、libglog.dll 和 libopenblas.dll 添加到路径中,或者将它们复制到 python site-packages 中的 singa package 文件夹中。</p></li>
+</ul>
+<ul>
+<li><p>通过运行如下命令,来验证SINGA是否安装成功:</p>
+<pre><code class="hljs css language-shell">python -c "from singa import tensor"
+</code></pre></li>
+</ul>
+<p>构建过程的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=cteER7WeiGk"><img src="https://img.youtube.com/vi/cteER7WeiGk/0.jpg" alt="youtube video"></a></p>
+<h2><a class="anchor" aria-hidden="true" id="运行单元测试"></a><a href="#运行单元测试" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<ul>
+<li><p>在测试文件夹中,生成Visual Studio解决方案:</p>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64"
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案。</p></li>
+<li><p>更改build settings为Release和x64。</p></li>
+<li><p>构建glog项目。</p></li>
+<li><p>在test_singa项目中:</p>
+<ul>
+<li>将 USE_GLOG 添加到Preprocessor Definitions中。</li>
+<li>在 Additional Include Directories 中, 添加上面第 2 步中使用的 GLOG_INCLUDE_DIR、 CBLAS_INCLUDE_DIR 和 Protobuf_INCLUDE_DIR 的路径。同时添加build和build/include文件夹。</li>
+<li>转到Additional Library Directories,添加openblas、protobuf和glog库的路径。同时添加 build/src/singa_objects.dir/Release。</li>
+<li>转到 Additional Dependencies 并添加 libopenblas.lib、libglog.lib 和 libprotobuf.lib。修改两个库的名字:gtest.lib和singa_objects.lib。</li>
+</ul></li>
+<li><p>构建test_singa项目。</p></li>
+<li><p>将libglog.dll和libopenblas.dll添加到路径中,或者将它们复制到test/release文件夹中,使其可用。</p></li>
+<li><p>单元测试可以通过如下方式执行:</p>
+<ul>
+<li>从命令行:</li>
+</ul>
+<pre><code class="hljs css language-shell">test_singa.exe
+</code></pre>
+<ul>
+<li>从Visual Studio:
+<ul>
+<li>右键点击test_singa项目,选择 "Set as StartUp Project"。</li>
+<li>在Debug菜单中,选择'Start Without Debugging'。</li>
+</ul></li>
+</ul></li>
+</ul>
+<p>单元测试的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=393gPtzMN1k"><img src="https://img.youtube.com/vi/393gPtzMN1k/0.jpg" alt="youtube video"></a></p>
+<h2><a class="anchor" aria-hidden="true" id="构建包含cuda的gpu支持"></a><a href="#构建包含cuda的gpu支持" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>在本节中,我们将扩展前面的步骤来启用GPU。</p>
+<h3><a class="anchor" aria-hidden="true" id="安装依赖项-1"></a><a href="#安装依赖项-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>除了上面第1节的依赖关系外,我们还需要以下内容:</p>
+<ul>
+<li><p>CUDA</p>
+<p>从 <a href="https://developer.nvidia.com/cuda-downloads">https://developer.nvidia.com/cuda-downloads</a> 下载一个合适的版本,如9.1。确保已经安装了Visual Studio集成模块。</p></li>
+</ul>
+<ul>
+<li><p>cuDNN</p>
+<p>从 <a href="https://developer.nvidia.com/cudnn">https://developer.nvidia.com/cudnn</a> 下载一个合适的版本,如7.1。</p></li>
+<li><p>cnmem:</p>
+<ul>
+<li>从 <a href="https://github.com/NVIDIA/cnmem">https://github.com/NVIDIA/cnmem</a> 下载最新版本。</li>
+<li>构建Visual Studio解决方案:</li>
+</ul>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64"
+</code></pre>
+<ul>
+<li>在Visual Studio中打开生成的解决方案。</li>
+<li>将build settings改为Release和x64。</li>
+<li>构建cnmem项目。</li>
+</ul></li>
+</ul>
+<h3><a class="anchor" aria-hidden="true" id="构建singa源代码-1"></a><a href="#构建singa源代码-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<ul>
+<li>调用 cmake 并添加系统路径,类似于下面的例子:
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64" ^
+ -DGLOG_INCLUDE_DIR="D:/WinSinga/dependencies/glog-0.3.5/src/windows" ^
+ -DGLOG_LIBRARIES="D:/WinSinga/dependencies/glog-0.3.5/x64/Release" ^
+ -DCBLAS_INCLUDE_DIR="D:/WinSinga/dependencies/openblas-0.2.20/lapack-netlib/CBLAS/include" ^
+ -DCBLAS_LIBRARIES="D:/WinSinga/dependencies/openblas-0.2.20/lib/RELEASE" ^
+ -DProtobuf_INCLUDE_DIR="D:/WinSinga/dependencies/protobuf-2.6.1/src" ^
+ -DProtobuf_LIBRARIES="D:\WinSinga/dependencies/protobuf-2.6.1/vsprojects/x64/Release" ^
+ -DProtobuf_PROTOC_EXECUTABLE="D:/WinSinga/dependencies/protoc-2.6.1-win32/protoc.exe" ^
+ -DCUDNN_INCLUDE_DIR=D:\WinSinga\dependencies\cudnn-9.1-windows10-x64-v7.1\cuda\include ^
+ -DCUDNN_LIBRARIES=D:\WinSinga\dependencies\cudnn-9.1-windows10-x64-v7.1\cuda\lib\x64 ^
+ -DSWIG_DIR=D:\WinSinga\dependencies\swigwin-3.0.12 ^
+ -DSWIG_EXECUTABLE=D:\WinSinga\dependencies\swigwin-3.0.12\swig.exe ^
+ -DUSE_CUDA=YES ^
+ -DCUDNN_VERSION=7 ^
+ ..
+</code></pre></li>
+</ul>
+<ul>
+<li><p>为C++和Python生成swig接口。在src/api目录中:</p>
+<pre><code class="hljs css language-shell">swig -python -c++ singa.i
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案</p></li>
+<li><p>将build settings改为Release和x64</p></li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="构建singa_objects"></a><a href="#构建singa_objects" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<ul>
+<li>将src/api中的singa_wrap.cxx文件添加到singa_objects项目中。</li>
+<li>在 singa_objects 项目中,打开 Additional Include Directories。</li>
+<li>添加Python的include路径</li>
+<li>添加numpy include路径</li>
+<li>添加protobuf包括路径</li>
+<li>增加CUDA、cuDNN和cnmem的包含路径。</li>
+<li>在 singa_objects 项目的预处理程序定义中, 加入 USE_GLOG、 USE_CUDA 和 USE_CUDNN。删除 DISABLE_WARNINGS。</li>
+<li>建立 singa_objects 项目</li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="构建singa-kernel"></a><a href="#构建singa-kernel" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<ul>
+<li><p>创建一个新的Visual Studio项目,类型为 "CUDA 9.1 Runtime"。给它起个名字,比如singa-kernel。</p></li>
+<li><p>该项目自带一个名为kernel.cu的初始文件,从项目中删除这个文件。</p></li>
+<li><p>添加这个文件:src/core/tensor/math_kernel.cu。</p></li>
+<li><p>在项目设置中。</p>
+<ul>
+<li>将平台工具集设置为 "Visual Studio 2015 (v140)"</li>
+<li>将 "配置类型 "设置为 "静态库(.lib)"</li>
+<li>在include目录中,添加build/include。</li>
+</ul></li>
+<li><p>建立singa-kernel项目</p></li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="构建singa"></a><a href="#构建singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<ul>
+<li><p>在singa项目中:</p>
+<ul>
+<li>将singa_wrap.obj添加到对象库中。</li>
+<li>将目标名称改为"_singa_wrap"。</li>
+<li>将目标扩展名为.pyd。</li>
+<li>将配置类型改为动态库(.dll)。</li>
+<li>到Additional Library Directories中添加python、openblas的路径。protobuf和glog库。</li>
+<li>同时添加singa-kernel、cnmem、cuda和cudnn的library path。</li>
+<li>到Additional Dependencies,并添加libopenblas.lib、libglog.lib和 libprotobuf.lib。</li>
+<li>另外还要添加:singa-kernel.lib、cnmem.lib、cudnn.lib、cuda.lib、cublas.lib。curand.lib和cudart.lib。</li>
+</ul></li>
+<li><p>构建singa项目。</p></li>
+</ul>
+<h3><a class="anchor" aria-hidden="true" id="install-python-module"></a><a href="#install-python-module" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<ul>
+<li><p>将 build/python/setup.py 中的 _singa_wrap.so 改为 _singa_wrap.pyd。</p></li>
+<li><p>将 src/proto/python_out 中的文件复制到 build/python/singa/proto 中。</p></li>
+<li><p>(可选) 创建并激活虚拟环境:</p>
+<pre><code class="hljs css language-shell">mkdir SingaEnv
+virtualenv SingaEnv
+SingaEnv\Scripts\activate
+</code></pre></li>
+<li><p>进入build/python文件夹,运行:</p>
+<pre><code class="hljs css language-shell">python setup.py install
+</code></pre></li>
+<li><p>将 _singa_wrap.pyd, libglog.dll, libopenblas.dll, cnmem.dll, CUDA Runtime (例如 cudart64_91.dll) 和 cuDNN (例如 cudnn64_7.dll) 添加到路径中,或者将它们复制到 python site-packages 中的 singa package 文件夹中。</p></li>
+<li><p>通过运行如下命令来验证SINGA是否已经安装:</p>
+<pre><code class="hljs css language-shell">python -c "from singa import device; dev = device.create_cuda_gpu()"
+</code></pre></li>
+</ul>
+<p>这个部分的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=YasKVjRtuDs"><img src="https://img.youtube.com/vi/YasKVjRtuDs/0.jpg" alt="youtube video"></a></p>
+<h3><a class="anchor" aria-hidden="true" id="运行单元测试-1"></a><a href="#运行单元测试-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<ul>
+<li><p>在测试文件夹中,生成Visual Studio解决方案:</p>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64"
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案,或者将项目添加到步骤5.2中创建的singa解决方案中。</p></li>
+<li><p>将build settings改为Release和x64。</p></li>
+<li><p>构建 glog 项目。</p></li>
+<li><p>在test_singa项目中:</p>
+<ul>
+<li>将 USE_GLOG; USE_CUDA; USE_CUDNN 添加到Preprocessor Definitions中。</li>
+<li>在 Additional Include Directories 中, 添加上面 5.2 中使用的 GLOG_INCLUDE_DIR、 CBLAS_INCLUDE_DIR 和 Protobuf_INCLUDE_DIR 的路径。同时添加build、build/include、CUDA和cuDNN的include文件夹。</li>
+<li>转到Additional Library Directories,添加openblas、protobuf和glog库的路径。同时添加 build/src/singa_objects.dir/Release、singa-kernel、cnmem、CUDA 和 cuDNN 库的路径。</li>
+<li>在Additional Dependencies中添加libopenblas.lib; libglog.lib; libprotobuf.lib; cnmem.lib; cudnn.lib; cuda.lib; cublas.lib; curand.lib; cudart.lib; singa-kernel.lib。修正两个库的名字:gtest.lib和singa_objects.lib。</li>
+</ul></li>
+</ul>
+<ul>
+<li><p>构建.</p></li>
+<li><p>将libglog.dll、libopenblas.dll、cnmem.dll、cudart64_91.dll和cudnn64_7.dll添加到路径中,或将它们复制到test/release文件夹中,使其可用。</p></li>
+<li><p>单元测试可以通过如下方式执行:</p>
+<ul>
+<li><p>从命令行:</p>
+<pre><code class="hljs css language-shell">test_singa.exe
+</code></pre></li>
+<li><p>从 Visual Studio:</p>
+<ul>
+<li>右键点击test_singa项目,选择 'Set as StartUp Project'.</li>
+<li>从Debug菜单,选择 'Start Without Debugging'</li>
+</ul></li>
+</ul></li>
+</ul>
+<p>运行单元测试的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=YOjwtrvTPn4"><img src="https://img.youtube.com/vi/YOjwtrvTPn4/0.jpg" alt="youtube video"></a></p>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装依赖项">安装依赖项</a></li><li><a href="#构建singa源代码">构建SINGA源代码</a></li><li><a href="#安装python模块">安装python模块</a></li><li><a href="#运行单元测试">运行单元测试</a></li><li><a href="#构建包含cuda的gpu支持">构建包含cuda的GPU支持</a><ul class="toc-headings"><li><a href="#安装依赖项-1">安装依赖项</a></li><li><a href="#构建singa源代码-1">构建SINGA源代码</a></li><li><a href="#install-python-module">Install Python [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/install-win/index.html b/content/docs/3.2.0_Chinese/install-win/index.html
new file mode 100644
index 0000000..9da033f
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/install-win/index.html
@@ -0,0 +1,330 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Build SINGA on Windows · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding co [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+<p>在Microsoft Windows上从源码构建SINGA的过程有四个部分:安装依赖关系、构建SINGA源码、(可选择)安装python模块和(可选择)运行单元测试。</p>
+<h2><a class="anchor" aria-hidden="true" id="安装依赖项"></a><a href="#安装依赖项" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>你可以创建一个文件夹来构建依赖关系。</p>
+<p>使用到的依赖项有:</p>
+<ul>
+<li><p>编译器和IDE:</p>
+<ul>
+<li>Visual Studio,社区版是免费的,可以用来构建SINGA。
+<a href="https://www.visualstudio.com/">https://www.visualstudio.com/</a></li>
+</ul></li>
+<li><p>CMake</p>
+<ul>
+<li>可以从 <a href="http://cmake.org/">http://cmake.org/</a> 下载</li>
+<li>确保 cmake 可执行文件的路径在系统路径中,或者在调用 cmake 时使用完整路径。</li>
+</ul></li>
+<li><p>SWIG</p>
+<ul>
+<li>可以从 <a href="http://swig.org/">http://swig.org/</a> 下载</li>
+<li>确保swig可执行文件的路径在系统路径中,或者在调用swig时使用完整路径。请使用最新的版本,如3.0.12。</li>
+</ul></li>
+<li><p>Protocol Buffers</p>
+<ul>
+<li>下载一个合适的版本,如2.6.1:
+<a href="https://github.com/google/protobuf/releases/tag/v2.6.1">https://github.com/google/protobuf/releases/tag/v2.6.1</a> 。</li>
+<li>下载 protobuf-2.6.1.zip 和 protoc-2.6.1-win32.zip。</li>
+<li>将这两个文件解压到dependencies文件夹中,将protoc可执行文件的路径添加到系统路径中,或者在调用它时使用完整路径。</li>
+<li>打开Visual Studio solution,它可以在vsproject文件夹中找到。</li>
+<li>将build settings改为Release和x64。</li>
+<li>构建libprotobuf项目。</li>
+</ul></li>
+<li><p>Openblas</p>
+<ul>
+<li>从 <a href="http://www.openblas.net">http://www.openblas.net</a> 下载合适的源码,如0.2.20。</li>
+<li>将源码解压到dependencies文件夹中。</li>
+<li>如果你没有安装Perl,请下载一个perl环境,如Strawberry Perl (<a href="http://strawberryperl.com/">http://strawberryperl.com/</a>)。</li>
+<li>在源文件夹中运行此命令来构建Visual Studio解决方案:</li>
+</ul>
+<pre><code class="hljs css language-bash">cmake -G <span class="hljs-string">"Visual Studio 15 2017 Win64"</span>
+</code></pre>
+<ul>
+<li>打开Visual Studio解决方案并将build settings更改为Release和x64。</li>
+<li>构建libopenblas项目。</li>
+</ul></li>
+<li><p>Google glog</p>
+<ul>
+<li>下载一个合适的版本,如0.3.5:
+<a href="https://github.com/google/glog/releases">https://github.com/google/glog/releases</a></li>
+<li>将源码解压到dependencies文件夹中。</li>
+<li>打开Visual Studio solution.</li>
+<li>将build settings改为Release and x64.</li>
+<li>构建libglog项目。</li>
+</ul></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="构建singa源代码"></a><a href="#构建singa源代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<ul>
+<li><p>下载SINGA源代码</p></li>
+<li><p>编译protobuf文件:</p>
+<ul>
+<li>在src/proto目录中:</li>
+</ul>
+<pre><code class="hljs css language-shell">mkdir python_out
+protoc.exe *.proto --python_out python_out
+</code></pre></li>
+<li><p>为C++和Python生成swig接口:在src/api目录中:</p>
+<pre><code class="hljs css language-shell">swig -python -c++ singa.i
+</code></pre></li>
+<li><p>生成SINGA的Visual Studio解决方案:在SINGA源码根目录中:</p>
+<pre><code class="hljs css language-shell">mkdir build
+cd build
+</code></pre></li>
+<li><p>调用 cmake 并添加系统路径,类似于下面的例子:</p>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64" ^
+ -DGLOG_INCLUDE_DIR="D:/WinSinga/dependencies/glog-0.3.5/src/windows" ^
+ -DGLOG_LIBRARIES="D:/WinSinga/dependencies/glog-0.3.5/x64/Release" ^
+ -DCBLAS_INCLUDE_DIR="D:/WinSinga/dependencies/openblas-0.2.20/lapack-netlib/CBLAS/include" ^
+ -DCBLAS_LIBRARIES="D:/WinSinga/dependencies/openblas-0.2.20/lib/RELEASE" ^
+ -DProtobuf_INCLUDE_DIR="D:/WinSinga/dependencies/protobuf-2.6.1/src" ^
+ -DProtobuf_LIBRARIES="D:/WinSinga/dependencies/protobuf-2.6.1/vsprojects/x64/Release" ^
+ -DProtobuf_PROTOC_EXECUTABLE="D:/WinSinga/dependencies/protoc-2.6.1-win32/protoc.exe" ^
+ ..
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案。</p></li>
+<li><p>将构建设置改为Release和x64。</p></li>
+<li><p>将src/api中的singa_wrap.cxx文件添加到singa_objects项目中。</p></li>
+<li><p>在 singa_objects 项目中,打开 Additional Include Directories。</p></li>
+<li><p>添加Python的include路径。</p></li>
+<li><p>添加numpy的include路径。</p></li>
+<li><p>添加protobuf的include路径。</p></li>
+<li><p>在 singa_objects 项目的预处理程序定义中, 添加 USE_GLOG。</p></li>
+<li><p>构建singa_objects项目。</p></li>
+<li><p>在singa项目中:</p>
+<ul>
+<li>将singa_wrap.obj添加到对象库。</li>
+<li>将目标名称改为"_singa_wrap"。</li>
+<li>将目标扩展名为.pyd。</li>
+<li>将配置类型改为动态库(.dll)。</li>
+<li>进入Additional Library Directories,添加路径到python、openblas、protobuf和glog库。</li>
+<li>在Additional Dependencies中添加libopenblas.lib、libglog.lib和libprotobuf.lib。</li>
+</ul></li>
+<li><p>构建singa项目</p></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="安装python模块"></a><a href="#安装python模块" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 [...]
+<ul>
+<li><p>将build/python/setup.py中的<code>_singa_wrap.so</code>改为<code>_singa_wrap.pyd</code>。</p></li>
+<li><p>将<code>src/proto/python_out</code>中的文件复制到<code>build/python/singa/proto</code>中。</p></li>
+<li><p>(可选)创建并激活一个虚拟环境:</p>
+<pre><code class="hljs css language-shell">mkdir SingaEnv
+virtualenv SingaEnv
+SingaEnv\Scripts\activate
+</code></pre></li>
+<li><p>进入build/python文件夹,运行:</p>
+<pre><code class="hljs css language-shell">python setup.py install
+</code></pre></li>
+<li><p>将 _singa_wrap.pyd、libglog.dll 和 libopenblas.dll 添加到路径中,或者将它们复制到 python site-packages 中的 singa package 文件夹中。</p></li>
+</ul>
+<ul>
+<li><p>通过运行如下命令,来验证SINGA是否安装成功:</p>
+<pre><code class="hljs css language-shell">python -c "from singa import tensor"
+</code></pre></li>
+</ul>
+<p>构建过程的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=cteER7WeiGk"><img src="https://img.youtube.com/vi/cteER7WeiGk/0.jpg" alt="youtube video"></a></p>
+<h2><a class="anchor" aria-hidden="true" id="运行单元测试"></a><a href="#运行单元测试" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<ul>
+<li><p>在测试文件夹中,生成Visual Studio解决方案:</p>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64"
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案。</p></li>
+<li><p>更改build settings为Release和x64。</p></li>
+<li><p>构建glog项目。</p></li>
+<li><p>在test_singa项目中:</p>
+<ul>
+<li>将 USE_GLOG 添加到Preprocessor Definitions中。</li>
+<li>在 Additional Include Directories 中, 添加上面第 2 步中使用的 GLOG_INCLUDE_DIR、 CBLAS_INCLUDE_DIR 和 Protobuf_INCLUDE_DIR 的路径。同时添加build和build/include文件夹。</li>
+<li>转到Additional Library Directories,添加openblas、protobuf和glog库的路径。同时添加 build/src/singa_objects.dir/Release。</li>
+<li>转到 Additional Dependencies 并添加 libopenblas.lib、libglog.lib 和 libprotobuf.lib。修改两个库的名字:gtest.lib和singa_objects.lib。</li>
+</ul></li>
+<li><p>构建test_singa项目。</p></li>
+<li><p>将libglog.dll和libopenblas.dll添加到路径中,或者将它们复制到test/release文件夹中,使其可用。</p></li>
+<li><p>单元测试可以通过如下方式执行:</p>
+<ul>
+<li>从命令行:</li>
+</ul>
+<pre><code class="hljs css language-shell">test_singa.exe
+</code></pre>
+<ul>
+<li>从Visual Studio:
+<ul>
+<li>右键点击test_singa项目,选择 "Set as StartUp Project"。</li>
+<li>在Debug菜单中,选择'Start Without Debugging'。</li>
+</ul></li>
+</ul></li>
+</ul>
+<p>单元测试的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=393gPtzMN1k"><img src="https://img.youtube.com/vi/393gPtzMN1k/0.jpg" alt="youtube video"></a></p>
+<h2><a class="anchor" aria-hidden="true" id="构建包含cuda的gpu支持"></a><a href="#构建包含cuda的gpu支持" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>在本节中,我们将扩展前面的步骤来启用GPU。</p>
+<h3><a class="anchor" aria-hidden="true" id="安装依赖项-1"></a><a href="#安装依赖项-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>除了上面第1节的依赖关系外,我们还需要以下内容:</p>
+<ul>
+<li><p>CUDA</p>
+<p>从 <a href="https://developer.nvidia.com/cuda-downloads">https://developer.nvidia.com/cuda-downloads</a> 下载一个合适的版本,如9.1。确保已经安装了Visual Studio集成模块。</p></li>
+</ul>
+<ul>
+<li><p>cuDNN</p>
+<p>从 <a href="https://developer.nvidia.com/cudnn">https://developer.nvidia.com/cudnn</a> 下载一个合适的版本,如7.1。</p></li>
+<li><p>cnmem:</p>
+<ul>
+<li>从 <a href="https://github.com/NVIDIA/cnmem">https://github.com/NVIDIA/cnmem</a> 下载最新版本。</li>
+<li>构建Visual Studio解决方案:</li>
+</ul>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64"
+</code></pre>
+<ul>
+<li>在Visual Studio中打开生成的解决方案。</li>
+<li>将build settings改为Release和x64。</li>
+<li>构建cnmem项目。</li>
+</ul></li>
+</ul>
+<h3><a class="anchor" aria-hidden="true" id="构建singa源代码-1"></a><a href="#构建singa源代码-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<ul>
+<li>调用 cmake 并添加系统路径,类似于下面的例子:
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64" ^
+ -DGLOG_INCLUDE_DIR="D:/WinSinga/dependencies/glog-0.3.5/src/windows" ^
+ -DGLOG_LIBRARIES="D:/WinSinga/dependencies/glog-0.3.5/x64/Release" ^
+ -DCBLAS_INCLUDE_DIR="D:/WinSinga/dependencies/openblas-0.2.20/lapack-netlib/CBLAS/include" ^
+ -DCBLAS_LIBRARIES="D:/WinSinga/dependencies/openblas-0.2.20/lib/RELEASE" ^
+ -DProtobuf_INCLUDE_DIR="D:/WinSinga/dependencies/protobuf-2.6.1/src" ^
+ -DProtobuf_LIBRARIES="D:\WinSinga/dependencies/protobuf-2.6.1/vsprojects/x64/Release" ^
+ -DProtobuf_PROTOC_EXECUTABLE="D:/WinSinga/dependencies/protoc-2.6.1-win32/protoc.exe" ^
+ -DCUDNN_INCLUDE_DIR=D:\WinSinga\dependencies\cudnn-9.1-windows10-x64-v7.1\cuda\include ^
+ -DCUDNN_LIBRARIES=D:\WinSinga\dependencies\cudnn-9.1-windows10-x64-v7.1\cuda\lib\x64 ^
+ -DSWIG_DIR=D:\WinSinga\dependencies\swigwin-3.0.12 ^
+ -DSWIG_EXECUTABLE=D:\WinSinga\dependencies\swigwin-3.0.12\swig.exe ^
+ -DUSE_CUDA=YES ^
+ -DCUDNN_VERSION=7 ^
+ ..
+</code></pre></li>
+</ul>
+<ul>
+<li><p>为C++和Python生成swig接口。在src/api目录中:</p>
+<pre><code class="hljs css language-shell">swig -python -c++ singa.i
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案</p></li>
+<li><p>将build settings改为Release和x64</p></li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="构建singa_objects"></a><a href="#构建singa_objects" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<ul>
+<li>将src/api中的singa_wrap.cxx文件添加到singa_objects项目中。</li>
+<li>在 singa_objects 项目中,打开 Additional Include Directories。</li>
+<li>添加Python的include路径</li>
+<li>添加numpy include路径</li>
+<li>添加protobuf包括路径</li>
+<li>增加CUDA、cuDNN和cnmem的包含路径。</li>
+<li>在 singa_objects 项目的预处理程序定义中, 加入 USE_GLOG、 USE_CUDA 和 USE_CUDNN。删除 DISABLE_WARNINGS。</li>
+<li>建立 singa_objects 项目</li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="构建singa-kernel"></a><a href="#构建singa-kernel" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<ul>
+<li><p>创建一个新的Visual Studio项目,类型为 "CUDA 9.1 Runtime"。给它起个名字,比如singa-kernel。</p></li>
+<li><p>该项目自带一个名为kernel.cu的初始文件,从项目中删除这个文件。</p></li>
+<li><p>添加这个文件:src/core/tensor/math_kernel.cu。</p></li>
+<li><p>在项目设置中。</p>
+<ul>
+<li>将平台工具集设置为 "Visual Studio 2015 (v140)"</li>
+<li>将 "配置类型 "设置为 "静态库(.lib)"</li>
+<li>在include目录中,添加build/include。</li>
+</ul></li>
+<li><p>建立singa-kernel项目</p></li>
+</ul>
+<h4><a class="anchor" aria-hidden="true" id="构建singa"></a><a href="#构建singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<ul>
+<li><p>在singa项目中:</p>
+<ul>
+<li>将singa_wrap.obj添加到对象库中。</li>
+<li>将目标名称改为"_singa_wrap"。</li>
+<li>将目标扩展名为.pyd。</li>
+<li>将配置类型改为动态库(.dll)。</li>
+<li>到Additional Library Directories中添加python、openblas的路径。protobuf和glog库。</li>
+<li>同时添加singa-kernel、cnmem、cuda和cudnn的library path。</li>
+<li>到Additional Dependencies,并添加libopenblas.lib、libglog.lib和 libprotobuf.lib。</li>
+<li>另外还要添加:singa-kernel.lib、cnmem.lib、cudnn.lib、cuda.lib、cublas.lib。curand.lib和cudart.lib。</li>
+</ul></li>
+<li><p>构建singa项目。</p></li>
+</ul>
+<h3><a class="anchor" aria-hidden="true" id="install-python-module"></a><a href="#install-python-module" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<ul>
+<li><p>将 build/python/setup.py 中的 _singa_wrap.so 改为 _singa_wrap.pyd。</p></li>
+<li><p>将 src/proto/python_out 中的文件复制到 build/python/singa/proto 中。</p></li>
+<li><p>(可选) 创建并激活虚拟环境:</p>
+<pre><code class="hljs css language-shell">mkdir SingaEnv
+virtualenv SingaEnv
+SingaEnv\Scripts\activate
+</code></pre></li>
+<li><p>进入build/python文件夹,运行:</p>
+<pre><code class="hljs css language-shell">python setup.py install
+</code></pre></li>
+<li><p>将 _singa_wrap.pyd, libglog.dll, libopenblas.dll, cnmem.dll, CUDA Runtime (例如 cudart64_91.dll) 和 cuDNN (例如 cudnn64_7.dll) 添加到路径中,或者将它们复制到 python site-packages 中的 singa package 文件夹中。</p></li>
+<li><p>通过运行如下命令来验证SINGA是否已经安装:</p>
+<pre><code class="hljs css language-shell">python -c "from singa import device; dev = device.create_cuda_gpu()"
+</code></pre></li>
+</ul>
+<p>这个部分的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=YasKVjRtuDs"><img src="https://img.youtube.com/vi/YasKVjRtuDs/0.jpg" alt="youtube video"></a></p>
+<h3><a class="anchor" aria-hidden="true" id="运行单元测试-1"></a><a href="#运行单元测试-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<ul>
+<li><p>在测试文件夹中,生成Visual Studio解决方案:</p>
+<pre><code class="hljs css language-shell">cmake -G "Visual Studio 15 2017 Win64"
+</code></pre></li>
+<li><p>在Visual Studio中打开生成的解决方案,或者将项目添加到步骤5.2中创建的singa解决方案中。</p></li>
+<li><p>将build settings改为Release和x64。</p></li>
+<li><p>构建 glog 项目。</p></li>
+<li><p>在test_singa项目中:</p>
+<ul>
+<li>将 USE_GLOG; USE_CUDA; USE_CUDNN 添加到Preprocessor Definitions中。</li>
+<li>在 Additional Include Directories 中, 添加上面 5.2 中使用的 GLOG_INCLUDE_DIR、 CBLAS_INCLUDE_DIR 和 Protobuf_INCLUDE_DIR 的路径。同时添加build、build/include、CUDA和cuDNN的include文件夹。</li>
+<li>转到Additional Library Directories,添加openblas、protobuf和glog库的路径。同时添加 build/src/singa_objects.dir/Release、singa-kernel、cnmem、CUDA 和 cuDNN 库的路径。</li>
+<li>在Additional Dependencies中添加libopenblas.lib; libglog.lib; libprotobuf.lib; cnmem.lib; cudnn.lib; cuda.lib; cublas.lib; curand.lib; cudart.lib; singa-kernel.lib。修正两个库的名字:gtest.lib和singa_objects.lib。</li>
+</ul></li>
+</ul>
+<ul>
+<li><p>构建.</p></li>
+<li><p>将libglog.dll、libopenblas.dll、cnmem.dll、cudart64_91.dll和cudnn64_7.dll添加到路径中,或将它们复制到test/release文件夹中,使其可用。</p></li>
+<li><p>单元测试可以通过如下方式执行:</p>
+<ul>
+<li><p>从命令行:</p>
+<pre><code class="hljs css language-shell">test_singa.exe
+</code></pre></li>
+<li><p>从 Visual Studio:</p>
+<ul>
+<li>右键点击test_singa项目,选择 'Set as StartUp Project'.</li>
+<li>从Debug菜单,选择 'Start Without Debugging'</li>
+</ul></li>
+</ul></li>
+</ul>
+<p>运行单元测试的视频教程可以在这里找到:</p>
+<p><a href="https://www.youtube.com/watch?v=YOjwtrvTPn4"><img src="https://img.youtube.com/vi/YOjwtrvTPn4/0.jpg" alt="youtube video"></a></p>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装依赖项">安装依赖项</a></li><li><a href="#构建singa源代码">构建SINGA源代码</a></li><li><a href="#安装python模块">安装python模块</a></li><li><a href="#运行单元测试">运行单元测试</a></li><li><a href="#构建包含cuda的gpu支持">构建包含cuda的GPU支持</a><ul class="toc-headings"><li><a href="#安装依赖项-1">安装依赖项</a></li><li><a href="#构建singa源代码-1">构建SINGA源代码</a></li><li><a href="#install-python-module">Install Python [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/installation.html b/content/docs/3.2.0_Chinese/installation.html
new file mode 100644
index 0000000..28436b1
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/installation.html
@@ -0,0 +1,201 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Installation · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ow [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/installation.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Installation</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor [...]
+<h2><a class="anchor" aria-hidden="true" id="使用conda"></a><a href="#使用conda" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>Conda是一个Python、CPP等包的包管理器。</p>
+<p>目前,SINGA有Linux和MacOSX的conda包。推荐使用<a href="https://conda.io/miniconda.html">Miniconda3</a>来配合SINGA使用,安装miniconda后,执行以下命令之一安装SINGA。</p>
+<ol>
+<li>只使用CPU
+<a href="https://colab.research.google.com/drive/1Ntkhi-Z6XTR8WYPXiLwujHd2dOm0772V?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda install -c nusdbsystem -c conda-forge singa-cpu=3.1.0</span>
+</code></pre>
+<ol start="2">
+<li>使用带CUDA和cuDNN的GPU(需要CUDA驱动>=384.81)
+<a href="https://colab.research.google.com/drive/1do_TLJe18IthLOnBOsHCEe-FFPGk1sPJ?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda install -c nusdbsystem -c conda-forge singa-gpu=3.1.0</span>
+</code></pre>
+<ol start="3">
+<li>安装特定版本的SINGA,下面的命令列出了所有可用的SINGA软件包:</li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda search -c nusdbsystem singa</span>
+
+Loading channels: done
+<span class="hljs-meta">#</span><span class="bash"> Name Version Build Channel</span>
+singa 3.1.0.rc2 cpu_py36 nusdbsystem
+singa 3.1.0.rc2 cudnn7.6.5_cuda10.2_py36 nusdbsystem
+singa 3.1.0.rc2 cudnn7.6.5_cuda10.2_py37 nusdbsystem
+</code></pre>
+<!--- > Please note that using the nightly built images is not recommended except for SINGA development and testing. Using stable releases is recommended. -->
+<p>下面的命令将安装SINGA的特定版本:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda install -c nusdbsystem -c conda-forge singa=X.Y.Z=cpu_py36</span>
+</code></pre>
+<p>如果运行以下命令没有报错:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> python -c <span class="hljs-string">"from singa import tensor"</span></span>
+</code></pre>
+<p>那么SINGA就安装成功了。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用pip"></a><a href="#使用pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<ol>
+<li>只使用CPU
+<a href="https://colab.research.google.com/drive/17RA056Brwk0vBQTFaZ-l9EbqwADO0NA9?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-bash">pip install singa -f http://singa.apache.org/docs/next/wheel-cpu.html --trusted-host singa.apache.org
+</code></pre>
+<p>您可以通过<code>singa==<version></code>安装特定版本的SINGA,其中<code><version></code>字段应被替换,例如<code>3.1.0</code>。可用的SINGA版本在链接中列出。</p>
+<p>要安装最新的开发版本,请将链接替换为
+<a href="http://singa.apache.org/docs/next/wheel-cpu-dev.html">http://singa.apache.org/docs/next/wheel-cpu-dev.html</a></p>
+<ol start="2">
+<li>使用CUDA和cuDNN的GPU
+<a href="https://colab.research.google.com/drive/1W30IPCqj5fG8ADAQsFqclaCLyIclVcJL?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-bash">pip install singa -f http://singa.apache.org/docs/next/wheel-gpu.html --trusted-host singa.apache.org
+</code></pre>
+<p>您也可以配置SINGA版本和CUDA版本,比如<code>singa==3.1.0+cuda10.2</code>,SINGA版本和CUDA版本的可用组合在链接中列出。</p>
+<p>要安装最新的开发版本,请将链接替换为
+<a href="http://singa.apache.org/docs/next/wheel-gpu-dev.html">http://singa.apache.org/docs/next/wheel-gpu-dev.html</a></p>
+<p>注意:你本地Python环境的Python版本将被用来寻找相应的wheel包。例如,如果你本地的Python是3.6,那么就会通过pip选择在Python 3.6上编译的wheel包并安装。事实上,wheel文件的名称包括SINGA版本、CUDA版本和Python版本。因此,<code>pip</code>知道要下载和安装哪个wheel文件。</p>
+<p>参考setup.py文件顶部的注释,了解如何构建wheel包。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用docker"></a><a href="#使用docker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>按照<a href="https://docs.docker.com/install/">说明</a>在你的本地主机上安装Docker。将您的用户添加到<a href="https://docs.docker.com/install/linux/linux-postinstall/">docker组</a>中,以便在没有<code>sudo</code>的情况下运行docker命令。</p>
+<ol>
+<li>仅使用CPU</li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> docker run -it apache/singa:X.Y.Z-cpu-ubuntu16.04 /bin/bash</span>
+</code></pre>
+<ol start="2">
+<li>要使用GPU,在安装Docker后安装
+<a href="https://github.com/NVIDIA/nvidia-docker">Nvidia-Docker</a></li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> nvidia-docker run -it apache/singa:X.Y.Z-cuda9.0-cudnn7.4.2-ubuntu16.04 /bin/bash</span>
+</code></pre>
+<ol start="3">
+<li>关于SINGA Docker镜像(标签)的完整列表,请访问<a href="https://hub.docker.com/r/apache/singa/">docker hub site</a>。对于每个docker镜像,标签的命名为:</li>
+</ol>
+<pre><code class="hljs css language-shell">version-(cpu|gpu)[-devel]
+</code></pre>
+<table>
+<thead>
+<tr><th>Tag</th><th>Description</th><th>Example value</th></tr>
+</thead>
+<tbody>
+<tr><td><code>version</code></td><td>SINGA version</td><td>'2.0.0-rc0', '2.0.0', '1.2.0'</td></tr>
+<tr><td><code>cpu</code></td><td>the image cannot run on GPUs</td><td>'cpu'</td></tr>
+<tr><td><code>gpu</code></td><td>the image can run on Nvidia GPUs</td><td>'gpu', or 'cudax.x-cudnnx.x' e.g., 'cuda10.0-cudnn7.3'</td></tr>
+<tr><td><code>devel</code></td><td>indicator for development</td><td>if absent, SINGA Python package is installed for runtime only; if present, the building environment is also created, you can recompile SINGA from source at '/root/singa'</td></tr>
+<tr><td><code>OS</code></td><td>indicate OS version number</td><td>'ubuntu16.04', 'ubuntu18.04'</td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="从源码编译"></a><a href="#从源码编译" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>您可以使用本地构建工具或conda-build在本地主机操作系统上或在Docker容器中从源代码<a href="/docs/3.2.0_Chinese/build">构建和安装SINGA</a>。</p>
+<h2><a class="anchor" aria-hidden="true" id="faq"></a><a href="#faq" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<ul>
+<li><p>Q: <code>from singa import tensor</code>错误</p>
+<p>A: 执行下面的命令,检查详细的错误:</p>
+<pre><code class="hljs css language-shell">python -c "from singa import _singa_wrap"
+<span class="hljs-meta">#</span><span class="bash"> go to the folder of _singa_wrap.so</span>
+ldd path to _singa_wrap.so
+python
+<span class="hljs-meta">></span><span class="bash">> import importlib</span>
+<span class="hljs-meta">></span><span class="bash">> importlib.import_module(<span class="hljs-string">'_singa_wrap'</span>)</span>
+</code></pre>
+<p><code>_singa_wrap.so</code> 的文件夹是 <code>~/miniconda3/lib/python3.7/site-packages/singa</code>。通常情况下,这个错误是由于依赖的库不匹配或缺失造成的,例如 cuDNN 或 protobuf。解决方法是创建一个新的虚拟环境,并在该环境中安装SINGA,例如:</p></li>
+</ul>
+<pre><code class="hljs css language-shell">conda create -n singa
+conda activate singa
+conda install -c nusdbsystem -c conda-forge singa-cpu
+</code></pre>
+<ul>
+<li><p>Q: 使用虚拟环境时,每次安装SINGA时,都会重新安装numpy。但是,当我运行<code>import numpy</code>时,numpy没有被使用。</p>
+<p>A:
+这可能是由<code>PYTHONPATH</code>环境变量引起的,在使用虚拟环境时,应将其设置为空,以避免与虚拟环境的路径冲突。</p></li>
+<li><p>Q: 当我在Mac OS X中运行SINGA时,得到如下错误 "Fatal Python error:
+PyThreadState_Get: no current thread Abort trap: 6"</p>
+<p>A: 这个错误通常发生在系统中有多个 Python 版本的时候,例如,操作系统自带的版本和 Homebrew 安装的版本。SINGA链接的Python必须与Python解释器相同。您可以通过<code>which python</code>来检查解释器python版本并通过<code>otool -L <path to _singa_wrap.so></code> 检查 SINGA 链接的 Python,如果通过conda安装SINGA,这个问题应该可以解决。</p></li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-next button" href="/docs/3.2.0_Chinese/software-stack"><span>Software Stack</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用conda">使用Conda</a></li><li><a href="#使用pip">使用pip</a></li><li><a href="#使用docker">使用Docker</a></li><li><a href="#从源码编译">从源码编译</a></li><li><a href="#faq">FAQ</a></li></ul></nav></div><footer class="nav-footer" id="footer [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/installation/index.html b/content/docs/3.2.0_Chinese/installation/index.html
new file mode 100644
index 0000000..28436b1
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/installation/index.html
@@ -0,0 +1,201 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Installation · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ow [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/installation.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Installation</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor [...]
+<h2><a class="anchor" aria-hidden="true" id="使用conda"></a><a href="#使用conda" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>Conda是一个Python、CPP等包的包管理器。</p>
+<p>目前,SINGA有Linux和MacOSX的conda包。推荐使用<a href="https://conda.io/miniconda.html">Miniconda3</a>来配合SINGA使用,安装miniconda后,执行以下命令之一安装SINGA。</p>
+<ol>
+<li>只使用CPU
+<a href="https://colab.research.google.com/drive/1Ntkhi-Z6XTR8WYPXiLwujHd2dOm0772V?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda install -c nusdbsystem -c conda-forge singa-cpu=3.1.0</span>
+</code></pre>
+<ol start="2">
+<li>使用带CUDA和cuDNN的GPU(需要CUDA驱动>=384.81)
+<a href="https://colab.research.google.com/drive/1do_TLJe18IthLOnBOsHCEe-FFPGk1sPJ?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda install -c nusdbsystem -c conda-forge singa-gpu=3.1.0</span>
+</code></pre>
+<ol start="3">
+<li>安装特定版本的SINGA,下面的命令列出了所有可用的SINGA软件包:</li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda search -c nusdbsystem singa</span>
+
+Loading channels: done
+<span class="hljs-meta">#</span><span class="bash"> Name Version Build Channel</span>
+singa 3.1.0.rc2 cpu_py36 nusdbsystem
+singa 3.1.0.rc2 cudnn7.6.5_cuda10.2_py36 nusdbsystem
+singa 3.1.0.rc2 cudnn7.6.5_cuda10.2_py37 nusdbsystem
+</code></pre>
+<!--- > Please note that using the nightly built images is not recommended except for SINGA development and testing. Using stable releases is recommended. -->
+<p>下面的命令将安装SINGA的特定版本:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> conda install -c nusdbsystem -c conda-forge singa=X.Y.Z=cpu_py36</span>
+</code></pre>
+<p>如果运行以下命令没有报错:</p>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> python -c <span class="hljs-string">"from singa import tensor"</span></span>
+</code></pre>
+<p>那么SINGA就安装成功了。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用pip"></a><a href="#使用pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<ol>
+<li>只使用CPU
+<a href="https://colab.research.google.com/drive/17RA056Brwk0vBQTFaZ-l9EbqwADO0NA9?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-bash">pip install singa -f http://singa.apache.org/docs/next/wheel-cpu.html --trusted-host singa.apache.org
+</code></pre>
+<p>您可以通过<code>singa==<version></code>安装特定版本的SINGA,其中<code><version></code>字段应被替换,例如<code>3.1.0</code>。可用的SINGA版本在链接中列出。</p>
+<p>要安装最新的开发版本,请将链接替换为
+<a href="http://singa.apache.org/docs/next/wheel-cpu-dev.html">http://singa.apache.org/docs/next/wheel-cpu-dev.html</a></p>
+<ol start="2">
+<li>使用CUDA和cuDNN的GPU
+<a href="https://colab.research.google.com/drive/1W30IPCqj5fG8ADAQsFqclaCLyIclVcJL?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></li>
+</ol>
+<pre><code class="hljs css language-bash">pip install singa -f http://singa.apache.org/docs/next/wheel-gpu.html --trusted-host singa.apache.org
+</code></pre>
+<p>您也可以配置SINGA版本和CUDA版本,比如<code>singa==3.1.0+cuda10.2</code>,SINGA版本和CUDA版本的可用组合在链接中列出。</p>
+<p>要安装最新的开发版本,请将链接替换为
+<a href="http://singa.apache.org/docs/next/wheel-gpu-dev.html">http://singa.apache.org/docs/next/wheel-gpu-dev.html</a></p>
+<p>注意:你本地Python环境的Python版本将被用来寻找相应的wheel包。例如,如果你本地的Python是3.6,那么就会通过pip选择在Python 3.6上编译的wheel包并安装。事实上,wheel文件的名称包括SINGA版本、CUDA版本和Python版本。因此,<code>pip</code>知道要下载和安装哪个wheel文件。</p>
+<p>参考setup.py文件顶部的注释,了解如何构建wheel包。</p>
+<h2><a class="anchor" aria-hidden="true" id="使用docker"></a><a href="#使用docker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p>按照<a href="https://docs.docker.com/install/">说明</a>在你的本地主机上安装Docker。将您的用户添加到<a href="https://docs.docker.com/install/linux/linux-postinstall/">docker组</a>中,以便在没有<code>sudo</code>的情况下运行docker命令。</p>
+<ol>
+<li>仅使用CPU</li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> docker run -it apache/singa:X.Y.Z-cpu-ubuntu16.04 /bin/bash</span>
+</code></pre>
+<ol start="2">
+<li>要使用GPU,在安装Docker后安装
+<a href="https://github.com/NVIDIA/nvidia-docker">Nvidia-Docker</a></li>
+</ol>
+<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> nvidia-docker run -it apache/singa:X.Y.Z-cuda9.0-cudnn7.4.2-ubuntu16.04 /bin/bash</span>
+</code></pre>
+<ol start="3">
+<li>关于SINGA Docker镜像(标签)的完整列表,请访问<a href="https://hub.docker.com/r/apache/singa/">docker hub site</a>。对于每个docker镜像,标签的命名为:</li>
+</ol>
+<pre><code class="hljs css language-shell">version-(cpu|gpu)[-devel]
+</code></pre>
+<table>
+<thead>
+<tr><th>Tag</th><th>Description</th><th>Example value</th></tr>
+</thead>
+<tbody>
+<tr><td><code>version</code></td><td>SINGA version</td><td>'2.0.0-rc0', '2.0.0', '1.2.0'</td></tr>
+<tr><td><code>cpu</code></td><td>the image cannot run on GPUs</td><td>'cpu'</td></tr>
+<tr><td><code>gpu</code></td><td>the image can run on Nvidia GPUs</td><td>'gpu', or 'cudax.x-cudnnx.x' e.g., 'cuda10.0-cudnn7.3'</td></tr>
+<tr><td><code>devel</code></td><td>indicator for development</td><td>if absent, SINGA Python package is installed for runtime only; if present, the building environment is also created, you can recompile SINGA from source at '/root/singa'</td></tr>
+<tr><td><code>OS</code></td><td>indicate OS version number</td><td>'ubuntu16.04', 'ubuntu18.04'</td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="从源码编译"></a><a href="#从源码编译" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>您可以使用本地构建工具或conda-build在本地主机操作系统上或在Docker容器中从源代码<a href="/docs/3.2.0_Chinese/build">构建和安装SINGA</a>。</p>
+<h2><a class="anchor" aria-hidden="true" id="faq"></a><a href="#faq" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<ul>
+<li><p>Q: <code>from singa import tensor</code>错误</p>
+<p>A: 执行下面的命令,检查详细的错误:</p>
+<pre><code class="hljs css language-shell">python -c "from singa import _singa_wrap"
+<span class="hljs-meta">#</span><span class="bash"> go to the folder of _singa_wrap.so</span>
+ldd path to _singa_wrap.so
+python
+<span class="hljs-meta">></span><span class="bash">> import importlib</span>
+<span class="hljs-meta">></span><span class="bash">> importlib.import_module(<span class="hljs-string">'_singa_wrap'</span>)</span>
+</code></pre>
+<p><code>_singa_wrap.so</code> 的文件夹是 <code>~/miniconda3/lib/python3.7/site-packages/singa</code>。通常情况下,这个错误是由于依赖的库不匹配或缺失造成的,例如 cuDNN 或 protobuf。解决方法是创建一个新的虚拟环境,并在该环境中安装SINGA,例如:</p></li>
+</ul>
+<pre><code class="hljs css language-shell">conda create -n singa
+conda activate singa
+conda install -c nusdbsystem -c conda-forge singa-cpu
+</code></pre>
+<ul>
+<li><p>Q: 使用虚拟环境时,每次安装SINGA时,都会重新安装numpy。但是,当我运行<code>import numpy</code>时,numpy没有被使用。</p>
+<p>A:
+这可能是由<code>PYTHONPATH</code>环境变量引起的,在使用虚拟环境时,应将其设置为空,以避免与虚拟环境的路径冲突。</p></li>
+<li><p>Q: 当我在Mac OS X中运行SINGA时,得到如下错误 "Fatal Python error:
+PyThreadState_Get: no current thread Abort trap: 6"</p>
+<p>A: 这个错误通常发生在系统中有多个 Python 版本的时候,例如,操作系统自带的版本和 Homebrew 安装的版本。SINGA链接的Python必须与Python解释器相同。您可以通过<code>which python</code>来检查解释器python版本并通过<code>otool -L <path to _singa_wrap.so></code> 检查 SINGA 链接的 Python,如果通过conda安装SINGA,这个问题应该可以解决。</p></li>
+</ul>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-next button" href="/docs/3.2.0_Chinese/software-stack"><span>Software Stack</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用conda">使用Conda</a></li><li><a href="#使用pip">使用pip</a></li><li><a href="#使用docker">使用Docker</a></li><li><a href="#从源码编译">从源码编译</a></li><li><a href="#faq">FAQ</a></li></ul></nav></div><footer class="nav-footer" id="footer [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/issue-tracking.html b/content/docs/3.2.0_Chinese/issue-tracking.html
new file mode 100644
index 0000000..7d5d640
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/issue-tracking.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Issue Tracking · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/issue-tracking.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Issue Tracking</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contribu [...]
+<p>SINGA使用<a href="https://issues.apache.org/jira/browse/singa">JIRA</a>来管理问题,包括bug、新功能和讨论。</p>
+<p>我们现在正在转移到<a href="https://github.com/apache/singa/issues">Github Issues</a>。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/mail-lists"><span class="arrow-prev">← </span><span>Project Mailing Lists</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/security"><span>Security</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-squ [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/issue-tracking/index.html b/content/docs/3.2.0_Chinese/issue-tracking/index.html
new file mode 100644
index 0000000..7d5d640
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/issue-tracking/index.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Issue Tracking · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/issue-tracking.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Issue Tracking</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contribu [...]
+<p>SINGA使用<a href="https://issues.apache.org/jira/browse/singa">JIRA</a>来管理问题,包括bug、新功能和讨论。</p>
+<p>我们现在正在转移到<a href="https://github.com/apache/singa/issues">Github Issues</a>。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/mail-lists"><span class="arrow-prev">← </span><span>Project Mailing Lists</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/security"><span>Security</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo-squ [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/mail-lists.html b/content/docs/3.2.0_Chinese/mail-lists.html
new file mode 100644
index 0000000..038b275
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/mail-lists.html
@@ -0,0 +1,100 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Project Mailing Lists · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding cop [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/mail-lists.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Project Mailing Lists</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contr [...]
+<p>这些是为这个项目建立的邮件列表。每个列表都有一个订阅、退订和归档链接:</p>
+<table>
+<thead>
+<tr><th>Name</th><th>Post</th><th>Subscribe</th><th>Unsubscribe</th><th>Archive</th></tr>
+</thead>
+<tbody>
+<tr><td>Development</td><td><a href="mailto:dev@singa.incubator.apache.org">dev@singa.incubator.apache.org</a></td><td><a href="mailto:dev-subscribe@singa.incubator.apache.org">Subscribe</a></td><td><a href="mailto:dev-unsubscribe@singa.incubator.apache.org.">Unsubscribe</a></td><td><a href="http://mail-archives.apache.org/mod_mbox/singa-dev/">mail-archives.apache.org</a></td></tr>
+<tr><td>Commits</td><td><a href="mailto:commits@singa.incubator.apache.org">commits@singa.incubator.apache.org</a></td><td><a href="mailto:commits-subscribe@singa.incubator.apache.org">Subscribe</a></td><td><a href="mailto:commits-unsubscribe@singa.incubator.apache.org">Unsubscribe</a></td><td><a href="http://mail-archives.apache.org/mod_mbox/singa-commits/">mail-archives.apache.org</a></td></tr>
+<tr><td>Security</td><td><a href="mailto:security@singa.apache.org">security@singa.apache.org</a></td><td>private</td><td>private</td><td>private</td></tr>
+</tbody>
+</table>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/source-repository"><span class="arrow-prev">← </span><span>Source Repository</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/issue-tracking"><span>Issue Tracking</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/mail-lists/index.html b/content/docs/3.2.0_Chinese/mail-lists/index.html
new file mode 100644
index 0000000..038b275
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/mail-lists/index.html
@@ -0,0 +1,100 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Project Mailing Lists · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding cop [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/mail-lists.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Project Mailing Lists</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contr [...]
+<p>这些是为这个项目建立的邮件列表。每个列表都有一个订阅、退订和归档链接:</p>
+<table>
+<thead>
+<tr><th>Name</th><th>Post</th><th>Subscribe</th><th>Unsubscribe</th><th>Archive</th></tr>
+</thead>
+<tbody>
+<tr><td>Development</td><td><a href="mailto:dev@singa.incubator.apache.org">dev@singa.incubator.apache.org</a></td><td><a href="mailto:dev-subscribe@singa.incubator.apache.org">Subscribe</a></td><td><a href="mailto:dev-unsubscribe@singa.incubator.apache.org.">Unsubscribe</a></td><td><a href="http://mail-archives.apache.org/mod_mbox/singa-dev/">mail-archives.apache.org</a></td></tr>
+<tr><td>Commits</td><td><a href="mailto:commits@singa.incubator.apache.org">commits@singa.incubator.apache.org</a></td><td><a href="mailto:commits-subscribe@singa.incubator.apache.org">Subscribe</a></td><td><a href="mailto:commits-unsubscribe@singa.incubator.apache.org">Unsubscribe</a></td><td><a href="http://mail-archives.apache.org/mod_mbox/singa-commits/">mail-archives.apache.org</a></td></tr>
+<tr><td>Security</td><td><a href="mailto:security@singa.apache.org">security@singa.apache.org</a></td><td>private</td><td>private</td><td>private</td></tr>
+</tbody>
+</table>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/source-repository"><span class="arrow-prev">← </span><span>Source Repository</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/issue-tracking"><span>Issue Tracking</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/onnx.html b/content/docs/3.2.0_Chinese/onnx.html
new file mode 100644
index 0000000..fd91553
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/onnx.html
@@ -0,0 +1,686 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>ONNX · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/onnx.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">ONNX</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreemen [...]
+<p><a href="https://onnx.ai/">ONNX</a> 是机器学习模型的开放表示格式,它使AI开发人员能够在不同的库和工具中使用模型。SINGA支持加载ONNX格式模型用于训练和inference,并将使用SINGA API(如<a href="./module">Module</a>)定义的模型保存为ONNX格式。</p>
+<p>SINGA在以下<a href="https://github.com/onnx/onnx/blob/master/docs/Versioning.md">版本</a>中的ONNX中测试过。</p>
+<table>
+<thead>
+<tr><th>ONNX version</th><th>File format version</th><th>Opset version ai.onnx</th><th>Opset version ai.onnx.ml</th><th>Opset version ai.onnx.training</th></tr>
+</thead>
+<tbody>
+<tr><td>1.6.0</td><td>6</td><td>11</td><td>2</td><td>-</td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="通常用法"></a><a href="#通常用法" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<h3><a class="anchor" aria-hidden="true" id="从onnx中读取一个model到singa"></a><a href="#从onnx中读取一个model到singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>在通过 <code>onnx.load</code> 从磁盘加载 ONNX 模型后,您需要更新模型的batch_size,因为对于大多数模型来说,它们使用一个占位符来表示其批处理量。我们在这里举一个例子,若要 <code>update_batch_size</code>,你只需要更新输入和输出的 batch_size,内部的 tensors 的形状会自动推断出来。</p>
+<p>然后,您可以使用 <code>sonnx.prepare</code> 来准备 SINGA 模型。该函数将 ONNX 模型图中的所有节点迭代并翻译成 SINGA 运算符,加载所有存储的权重并推断每个中间张量的形状。</p>
+<pre><code class="hljs css language-python3"><span class="hljs-built_in">import</span> onnx
+from singa <span class="hljs-built_in">import</span> device
+from singa <span class="hljs-built_in">import</span> sonnx
+
+<span class="hljs-comment"># if the input has multiple tensors? can put this function inside prepare()?</span>
+def update_batch_size(onnx_model, batch_size):
+ <span class="hljs-attr">model_input</span> = onnx_model.graph.input[<span class="hljs-number">0</span>]
+ model_input.type.tensor_type.shape.dim[<span class="hljs-number">0</span>].<span class="hljs-attr">dim_value</span> = batch_size
+ <span class="hljs-attr">model_output</span> = onnx_model.graph.output[<span class="hljs-number">0</span>]
+ model_output.type.tensor_type.shape.dim[<span class="hljs-number">0</span>].<span class="hljs-attr">dim_value</span> = batch_size
+ return onnx_model
+
+
+<span class="hljs-attr">model_path</span> = <span class="hljs-string">"PATH/To/ONNX/MODEL"</span>
+<span class="hljs-attr">onnx_model</span> = onnx.load(model_path)
+
+<span class="hljs-comment"># set batch size</span>
+<span class="hljs-attr">onnx_model</span> = update_batch_size(onnx_model, <span class="hljs-number">1</span>)
+
+<span class="hljs-comment"># convert onnx graph nodes into SINGA operators</span>
+<span class="hljs-attr">dev</span> = device.create_cuda_gpu()
+<span class="hljs-attr">sg_ir</span> = sonnx.prepare(onnx_model, <span class="hljs-attr">device=dev)</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="inference-singa模型"></a><a href="#inference-singa模型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>一旦创建了模型,就可以通过调用<code>sg_ir.run</code>进行inference。输入和输出必须是SINGA Tensor实例,由于SINGA模型以列表形式返回输出,如果只有一个输出,你只需要从输出中取第一个元素即可。</p>
+<pre><code class="hljs css language-python3"><span class="hljs-comment"># can warp the following code in prepare()</span>
+<span class="hljs-comment"># and provide a flag training=True/False?</span>
+
+<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Infer</span>:</span>
+
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(<span class="hljs-keyword">self</span>, sg_ir)</span></span>:
+ <span class="hljs-keyword">self</span>.sg_ir = sg_ir
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(<span class="hljs-keyword">self</span>, x)</span></span>:
+ <span class="hljs-keyword">return</span> sg_ir.run([x])[<span class="hljs-number">0</span>]
+
+
+data = get_dataset()
+x = tensor.Tensor(device=dev, data=data)
+
+model = Infer(sg_ir)
+y = model.forward(x)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="将singa模型保存成onnx格式"></a><a href="#将singa模型保存成onnx格式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>给定输入时序和输出时序,由运算符产生的模型,你可以追溯所有内部操作。因此,一个SINGA模型是由输入和输出张量定义的,要将 SINGA 模型导出为 ONNX 格式,您只需提供输入和输出张量列表。</p>
+<pre><code class="hljs css language-python3"># <span class="hljs-symbol">x</span> is the input tensor, <span class="hljs-symbol">y</span> is the output tensor
+sonnx.to_onnx([<span class="hljs-symbol">x</span>], [<span class="hljs-symbol">y</span>])
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="在onnx模型上重新训练"></a><a href="#在onnx模型上重新训练" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>要使用 SINGA 训练(或改进)ONNX 模型,您需要设置内部的张量为可训练状态:</p>
+<pre><code class="hljs css language-python3"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Infer</span>:</span>
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, sg_ir)</span>:</span>
+ self.sg_ir = sg_ir
+ <span class="hljs-comment">## can wrap these codes in sonnx?</span>
+ <span class="hljs-keyword">for</span> idx, tens <span class="hljs-keyword">in</span> sg_ir.tensor_map.items():
+ <span class="hljs-comment"># allow the tensors to be updated</span>
+ tens.requires_grad = <span class="hljs-literal">True</span>
+ tens.stores_grad = <span class="hljs-literal">True</span>
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ <span class="hljs-keyword">return</span> sg_ir.run([x])[<span class="hljs-number">0</span>]
+
+autograd.training = <span class="hljs-literal">False</span>
+model = Infer(sg_ir)
+
+autograd.training = <span class="hljs-literal">True</span>
+<span class="hljs-comment"># then you training the model like normal</span>
+<span class="hljs-comment"># give more details??</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="在onnx模型上做迁移学习"></a><a href="#在onnx模型上做迁移学习" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>您也可以在ONNX模型的最后附加一些图层来进行转移学习。<code>last_layers</code> 意味着您从 [0, last_layers] 切断 ONNX 层。然后您可以通过普通的SINGA模型附加更多的层。</p>
+<pre><code class="hljs css language-python3">class Trans:
+
+ def __init__(<span class="hljs-literal">self</span>, sg_ir, last_layers):
+ <span class="hljs-literal">self</span>.sg_ir = sg_ir
+ <span class="hljs-literal">self</span>.last_layers = last_layers
+ <span class="hljs-literal">self</span>.append_linear1 = autograd.Linear(<span class="hljs-number">500</span>, <span class="hljs-number">128</span>, bias=False)
+ <span class="hljs-literal">self</span>.append_linear2 = autograd.Linear(<span class="hljs-number">128</span>, <span class="hljs-number">32</span>, bias=False)
+ <span class="hljs-literal">self</span>.append_linear3 = autograd.Linear(<span class="hljs-number">32</span>, <span class="hljs-number">10</span>, bias=False)
+
+ def forward(<span class="hljs-literal">self</span>, <span class="hljs-symbol">x</span>):
+ <span class="hljs-symbol">y</span> = sg_ir.run([<span class="hljs-symbol">x</span>], last_layers=<span class="hljs-literal">self</span>.last_layers)[<span class="hljs-number">0</span>]
+ <span class="hljs-symbol">y</span> = <span class="hljs-literal">self</span>.append_linear1(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = autograd.relu(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = <span class="hljs-literal">self</span>.append_linear2(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = autograd.relu(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = <span class="hljs-literal">self</span>.append_linear3(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = autograd.relu(<span class="hljs-symbol">y</span>)
+ <span class="hljs-keyword">return</span> <span class="hljs-symbol">y</span>
+
+autograd.training = False
+model = Trans(sg_ir, <span class="hljs-number">-1</span>)
+
+# <span class="hljs-keyword">then</span> you training the model like normal
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="一个完整示例"></a><a href="#一个完整示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>本部分以mnist为例,介绍SINGA ONNX的使用方法。在这部分,将展示如何导出、加载、inference、再训练和迁移学习 mnist 模型的例子。您可以在<a href="https://colab.research.google.com/drive/1-YOfQqqw3HNhS8WpB8xjDQYutRdUdmCq">这里</a>试用这部分内容。</p>
+<h3><a class="anchor" aria-hidden="true" id="读取数据集"></a><a href="#读取数据集" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>首先,你需要导入一些必要的库,并定义一些辅助函数来下载和预处理数据集:</p>
+<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> os
+<span class="hljs-keyword">import</span> urllib.request
+<span class="hljs-keyword">import</span> gzip
+<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
+<span class="hljs-keyword">import</span> codecs
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> device
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> autograd
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> sonnx
+<span class="hljs-keyword">import</span> onnx
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">load_dataset</span><span class="hljs-params">()</span>:</span>
+ train_x_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz'</span>
+ train_y_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz'</span>
+ valid_x_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz'</span>
+ valid_y_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz'</span>
+ train_x = read_image_file(check_exist_or_download(train_x_url)).astype(
+ np.float32)
+ train_y = read_label_file(check_exist_or_download(train_y_url)).astype(
+ np.float32)
+ valid_x = read_image_file(check_exist_or_download(valid_x_url)).astype(
+ np.float32)
+ valid_y = read_label_file(check_exist_or_download(valid_y_url)).astype(
+ np.float32)
+ <span class="hljs-keyword">return</span> train_x, train_y, valid_x, valid_y
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">check_exist_or_download</span><span class="hljs-params">(url)</span>:</span>
+
+ download_dir = <span class="hljs-string">'/tmp/'</span>
+
+ name = url.rsplit(<span class="hljs-string">'/'</span>, <span class="hljs-number">1</span>)[<span class="hljs-number">-1</span>]
+ filename = os.path.join(download_dir, name)
+ <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> os.path.isfile(filename):
+ print(<span class="hljs-string">"Downloading %s"</span> % url)
+ urllib.request.urlretrieve(url, filename)
+ <span class="hljs-keyword">return</span> filename
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">read_label_file</span><span class="hljs-params">(path)</span>:</span>
+ <span class="hljs-keyword">with</span> gzip.open(path, <span class="hljs-string">'rb'</span>) <span class="hljs-keyword">as</span> f:
+ data = f.read()
+ <span class="hljs-keyword">assert</span> get_int(data[:<span class="hljs-number">4</span>]) == <span class="hljs-number">2049</span>
+ length = get_int(data[<span class="hljs-number">4</span>:<span class="hljs-number">8</span>])
+ parsed = np.frombuffer(data, dtype=np.uint8, offset=<span class="hljs-number">8</span>).reshape(
+ (length))
+ <span class="hljs-keyword">return</span> parsed
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_int</span><span class="hljs-params">(b)</span>:</span>
+ <span class="hljs-keyword">return</span> int(codecs.encode(b, <span class="hljs-string">'hex'</span>), <span class="hljs-number">16</span>)
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">read_image_file</span><span class="hljs-params">(path)</span>:</span>
+ <span class="hljs-keyword">with</span> gzip.open(path, <span class="hljs-string">'rb'</span>) <span class="hljs-keyword">as</span> f:
+ data = f.read()
+ <span class="hljs-keyword">assert</span> get_int(data[:<span class="hljs-number">4</span>]) == <span class="hljs-number">2051</span>
+ length = get_int(data[<span class="hljs-number">4</span>:<span class="hljs-number">8</span>])
+ num_rows = get_int(data[<span class="hljs-number">8</span>:<span class="hljs-number">12</span>])
+ num_cols = get_int(data[<span class="hljs-number">12</span>:<span class="hljs-number">16</span>])
+ parsed = np.frombuffer(data, dtype=np.uint8, offset=<span class="hljs-number">16</span>).reshape(
+ (length, <span class="hljs-number">1</span>, num_rows, num_cols))
+ <span class="hljs-keyword">return</span> parsed
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">to_categorical</span><span class="hljs-params">(y, num_classes)</span>:</span>
+ y = np.array(y, dtype=<span class="hljs-string">"int"</span>)
+ n = y.shape[<span class="hljs-number">0</span>]
+ categorical = np.zeros((n, num_classes))
+ categorical[np.arange(n), y] = <span class="hljs-number">1</span>
+ categorical = categorical.astype(np.float32)
+ <span class="hljs-keyword">return</span> categorical
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="mnist模型"></a><a href="#mnist模型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>然后你可以定义一个叫做<strong>CNN</strong>的类来构造mnist模型,这个模型由几个卷积层、池化层、全连接层和relu层组成。你也可以定义一个函数来计算我们结果的<strong>准确性</strong>。最后,你可以定义一个<strong>训练函数</strong>和一个<strong>测试函数</strong>来处理训练和预测的过程。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CNN</span>:</span>
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self)</span>:</span>
+ self.conv1 = autograd.Conv2d(<span class="hljs-number">1</span>, <span class="hljs-number">20</span>, <span class="hljs-number">5</span>, padding=<span class="hljs-number">0</span>)
+ self.conv2 = autograd.Conv2d(<span class="hljs-number">20</span>, <span class="hljs-number">50</span>, <span class="hljs-number">5</span>, padding=<span class="hljs-number">0</span>)
+ self.linear1 = autograd.Linear(<span class="hljs-number">4</span> * <span class="hljs-number">4</span> * <span class="hljs-number">50</span>, <span class="hljs-number">500</span>, bias=<span class="hljs-literal">False</span>)
+ self.linear2 = autograd.Linear(<span class="hljs-number">500</span>, <span class="hljs-number">10</span>, bias=<span class="hljs-literal">False</span>)
+ self.pooling1 = autograd.MaxPool2d(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, padding=<span class="hljs-number">0</span>)
+ self.pooling2 = autograd.MaxPool2d(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, padding=<span class="hljs-number">0</span>)
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ y = self.conv1(x)
+ y = autograd.relu(y)
+ y = self.pooling1(y)
+ y = self.conv2(y)
+ y = autograd.relu(y)
+ y = self.pooling2(y)
+ y = autograd.flatten(y)
+ y = self.linear1(y)
+ y = autograd.relu(y)
+ y = self.linear2(y)
+ <span class="hljs-keyword">return</span> y
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">accuracy</span><span class="hljs-params">(pred, target)</span>:</span>
+ y = np.argmax(pred, axis=<span class="hljs-number">1</span>)
+ t = np.argmax(target, axis=<span class="hljs-number">1</span>)
+ a = y == t
+ <span class="hljs-keyword">return</span> np.array(a, <span class="hljs-string">"int"</span>).sum() / float(len(t))
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">train</span><span class="hljs-params">(model,
+ x,
+ y,
+ epochs=<span class="hljs-number">1</span>,
+ batch_size=<span class="hljs-number">64</span>,
+ dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+
+ output_batch = model.forward(x_batch)
+ <span class="hljs-comment"># onnx_model = sonnx.to_onnx([x_batch], [y])</span>
+ <span class="hljs-comment"># print('The model is:\n{}'.format(onnx_model))</span>
+
+ loss = autograd.softmax_cross_entropy(output_batch, target_batch)
+ accuracy_rate = accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ sgd = opt.SGD(lr=<span class="hljs-number">0.001</span>)
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, gp)
+ sgd.step()
+
+ <span class="hljs-keyword">if</span> b % <span class="hljs-number">1e2</span> == <span class="hljs-number">0</span>:
+ print(<span class="hljs-string">"acc %6.2f loss, %6.2f"</span> %
+ (accuracy_rate, tensor.to_numpy(loss)[<span class="hljs-number">0</span>]))
+ print(<span class="hljs-string">"training completed"</span>)
+ <span class="hljs-keyword">return</span> x_batch, output_batch
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">test</span><span class="hljs-params">(model, x, y, batch_size=<span class="hljs-number">64</span>, dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ result = <span class="hljs-number">0</span>
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+
+ output_batch = model.forward(x_batch)
+ result += accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ print(<span class="hljs-string">"testing acc %6.2f"</span> % (result / batch_number))
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="训练mnist模型并将其导出到onnx"></a><a href="#训练mnist模型并将其导出到onnx" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.2 [...]
+<p>现在,你可以通过调用 <strong>soonx.to_onnx</strong> 函数来训练 mnist 模型并导出其 onnx 模型。</p>
+<pre><code class="hljs css language-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">make_onnx</span><span class="hljs-params">(x, y)</span>:</span>
+ <span class="hljs-keyword">return</span> sonnx.to_onnx([x], [y])
+
+<span class="hljs-comment"># create device</span>
+dev = device.create_cuda_gpu()
+<span class="hljs-comment">#dev = device.get_default_device()</span>
+<span class="hljs-comment"># create model</span>
+model = CNN()
+<span class="hljs-comment"># load data</span>
+train_x, train_y, valid_x, valid_y = load_dataset()
+<span class="hljs-comment"># normalization</span>
+train_x = train_x / <span class="hljs-number">255</span>
+valid_x = valid_x / <span class="hljs-number">255</span>
+train_y = to_categorical(train_y, <span class="hljs-number">10</span>)
+valid_y = to_categorical(valid_y, <span class="hljs-number">10</span>)
+<span class="hljs-comment"># do training</span>
+autograd.training = <span class="hljs-literal">True</span>
+x, y = train(model, train_x, train_y, dev=dev)
+onnx_model = make_onnx(x, y)
+<span class="hljs-comment"># print('The model is:\n{}'.format(onnx_model))</span>
+
+<span class="hljs-comment"># Save the ONNX model</span>
+model_path = os.path.join(<span class="hljs-string">'/'</span>, <span class="hljs-string">'tmp'</span>, <span class="hljs-string">'mnist.onnx'</span>)
+onnx.save(onnx_model, model_path)
+print(<span class="hljs-string">'The model is saved.'</span>)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="inference"></a><a href="#inference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
+<p>导出onnx模型后,可以在'/tmp'目录下找到一个名为<strong>mnist.onnx</strong>的文件,这个模型可以被其他库导入。现在,如果你想把这个onnx模型再次导入到singa中,并使用验证数据集进行推理,你可以定义一个叫做<strong>Infer</strong>的类,Infer的前向函数将被测试函数调用,对验证数据集进行推理。此外,你应该把训练的标签设置为<strong>False</strong>,以固定自变量算子的梯度。</p>
+<p>在导入onnx模型时,需要先调用<strong>onnx.load</strong>来加载onnx模型。然后将onnx模型输入到 <strong>soonx.prepare</strong>中进行解析,并启动到一个singa模型(代码中的<strong>sg_ir</strong>)。sg_ir里面包含了一个singa图,然后就可以通过输入到它的run函数中运行一步推理。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Infer</span>:</span>
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, sg_ir)</span>:</span>
+ self.sg_ir = sg_ir
+ <span class="hljs-keyword">for</span> idx, tens <span class="hljs-keyword">in</span> sg_ir.tensor_map.items():
+ <span class="hljs-comment"># allow the tensors to be updated</span>
+ tens.requires_grad = <span class="hljs-literal">True</span>
+ tens.stores_grad= <span class="hljs-literal">True</span>
+ sg_ir.tensor_map[idx] = tens
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ <span class="hljs-keyword">return</span> sg_ir.run([x])[<span class="hljs-number">0</span>] <span class="hljs-comment"># we can run one step of inference by feeding input</span>
+
+<span class="hljs-comment"># load the ONNX model</span>
+onnx_model = onnx.load(model_path)
+sg_ir = sonnx.prepare(onnx_model, device=dev) <span class="hljs-comment"># parse and initiate to a singa model</span>
+
+<span class="hljs-comment"># inference</span>
+autograd.training = <span class="hljs-literal">False</span>
+print(<span class="hljs-string">'The inference result is:'</span>)
+test(Infer(sg_ir), valid_x, valid_y, dev=dev)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="重训练"></a><a href="#重训练" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<p>假设导入模型后,想再次对模型进行重新训练,我们可以定义一个名为<strong>re_train</strong>的函数。在调用这个re_train函数之前,我们应该将训练的标签设置为<strong>True</strong>,以使自变量运算符更新其梯度。而在完成训练后,我们再将其设置为<strong>False</strong>,以调用做推理的测试函数。</p>
+<pre><code class="hljs css language-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">re_train</span><span class="hljs-params">(sg_ir,
+ x,
+ y,
+ epochs=<span class="hljs-number">1</span>,
+ batch_size=<span class="hljs-number">64</span>,
+ dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ new_model = Infer(sg_ir)
+
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+
+ output_batch = new_model.forward(x_batch)
+
+ loss = autograd.softmax_cross_entropy(output_batch, target_batch)
+ accuracy_rate = accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ sgd = opt.SGD(lr=<span class="hljs-number">0.01</span>)
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, gp)
+ sgd.step()
+
+ <span class="hljs-keyword">if</span> b % <span class="hljs-number">1e2</span> == <span class="hljs-number">0</span>:
+ print(<span class="hljs-string">"acc %6.2f loss, %6.2f"</span> %
+ (accuracy_rate, tensor.to_numpy(loss)[<span class="hljs-number">0</span>]))
+ print(<span class="hljs-string">"re-training completed"</span>)
+ <span class="hljs-keyword">return</span> new_model
+
+<span class="hljs-comment"># load the ONNX model</span>
+onnx_model = onnx.load(model_path)
+sg_ir = sonnx.prepare(onnx_model, device=dev)
+
+<span class="hljs-comment"># re-training</span>
+autograd.training = <span class="hljs-literal">True</span>
+new_model = re_train(sg_ir, train_x, train_y, dev=dev)
+autograd.training = <span class="hljs-literal">False</span>
+test(new_model, valid_x, valid_y, dev=dev)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="迁移学习"></a><a href="#迁移学习" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>最后,如果我们想做迁移学习,我们可以定义一个名为<strong>Trans</strong>的函数,在onnx模型后追加一些层。为了演示,代码中只在onnx模型后追加了几个线性(全连接)和relu。可以定义一个transfer_learning函数来处理transfer-learning模型的训练过程,而训练的标签和前面一个的一样。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Trans</span>:</span>
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, sg_ir, last_layers)</span>:</span>
+ self.sg_ir = sg_ir
+ self.last_layers = last_layers
+ self.append_linear1 = autograd.Linear(<span class="hljs-number">500</span>, <span class="hljs-number">128</span>, bias=<span class="hljs-literal">False</span>)
+ self.append_linear2 = autograd.Linear(<span class="hljs-number">128</span>, <span class="hljs-number">32</span>, bias=<span class="hljs-literal">False</span>)
+ self.append_linear3 = autograd.Linear(<span class="hljs-number">32</span>, <span class="hljs-number">10</span>, bias=<span class="hljs-literal">False</span>)
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ y = sg_ir.run([x], last_layers=self.last_layers)[<span class="hljs-number">0</span>]
+ y = self.append_linear1(y)
+ y = autograd.relu(y)
+ y = self.append_linear2(y)
+ y = autograd.relu(y)
+ y = self.append_linear3(y)
+ y = autograd.relu(y)
+ <span class="hljs-keyword">return</span> y
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">transfer_learning</span><span class="hljs-params">(sg_ir,
+ x,
+ y,
+ epochs=<span class="hljs-number">1</span>,
+ batch_size=<span class="hljs-number">64</span>,
+ dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ trans_model = Trans(sg_ir, <span class="hljs-number">-1</span>)
+
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+ output_batch = trans_model.forward(x_batch)
+
+ loss = autograd.softmax_cross_entropy(output_batch, target_batch)
+ accuracy_rate = accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ sgd = opt.SGD(lr=<span class="hljs-number">0.07</span>)
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, gp)
+ sgd.step()
+
+ <span class="hljs-keyword">if</span> b % <span class="hljs-number">1e2</span> == <span class="hljs-number">0</span>:
+ print(<span class="hljs-string">"acc %6.2f loss, %6.2f"</span> %
+ (accuracy_rate, tensor.to_numpy(loss)[<span class="hljs-number">0</span>]))
+ print(<span class="hljs-string">"transfer-learning completed"</span>)
+ <span class="hljs-keyword">return</span> trans_mode
+
+<span class="hljs-comment"># load the ONNX model</span>
+onnx_model = onnx.load(model_path)
+sg_ir = sonnx.prepare(onnx_model, device=dev)
+
+<span class="hljs-comment"># transfer-learning</span>
+autograd.training = <span class="hljs-literal">True</span>
+new_model = transfer_learning(sg_ir, train_x, train_y, dev=dev)
+autograd.training = <span class="hljs-literal">False</span>
+test(new_model, valid_x, valid_y, dev=dev)
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="onnx模型库"></a><a href="#onnx模型库" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p><a href="https://github.com/onnx/models">ONNX 模型库</a>是由社区成员贡献的 ONNX 格式的预先训练的最先进模型的集合。SINGA 现在已经支持了几个 CV 和 NLP 模型。将来会支持更多模型。</p>
+<h3><a class="anchor" aria-hidden="true" id="图像分类"></a><a href="#图像分类" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>这套模型以图像作为输入,然后将图像中的主要物体分为1000个物体类别,如键盘、鼠标、铅笔和许多动物。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/mobilenet">MobileNet</a></b></td><td><a href="https://arxiv.org/abs/1801.04381">Sandler et al.</a></td><td>最适合移动和嵌入式视觉应用的轻量级深度神经网络。 <br>Top-5 error from paper - ~10%</td><td><a href="https://colab.research.google.com/drive/1HsixqJMIpKyEPhkbB8jy7NwNEFEAUWAf"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/resnet">ResNet18</a></b></td><td><a href="https://arxiv.org/abs/1512.03385">He et al.</a></td><td>一个CNN模型(多达152层),在对图像进行分类时,使用shortcut来实现更高的准确性。 <br> Top-5 error from paper - ~3.6%</td><td><a href="https://colab.research.google.com/drive/1u1RYefSsVbiP4I-5wiBKHjsT9L0FxLm9"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/vgg">VGG16</a></b></td><td><a href="https://arxiv.org/abs/1409.1556">Simonyan et al.</a></td><td>深度CNN模型(多达19层)。类似于AlexNet,但使用多个较小的内核大小的滤波器,在分类图像时提供更高的准确性。 <br>Top-5 error from paper - ~8%</td><td><a href="https://colab.research.google.com/drive/14kxgRKtbjPCKKsDJVNi3AvTev81Gp_Ds"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/shufflenet">ShuffleNet_V2</a></b></td><td><a href="https://arxiv.org/pdf/1707.01083.pdf">Simonyan et al.</a></td><td>专门为移动设备设计的计算效率极高的CNN模型。这种网络架构设计考虑了速度等直接指标,而不是FLOP等间接指标。 Top-1 error from paper - ~30.6%</td><td><a href="https://colab.research.google.com/drive/19HfRu3YHP_H2z3BcZujVFRp23_J5XsuA?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+</tbody>
+</table>
+<h3><a class="anchor" aria-hidden="true" id="目标检测"></a><a href="#目标检测" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>目标检测模型可以检测图像中是否存在多个对象,并将图像中检测到对象的区域分割出来。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/tiny_yolov2">Tiny YOLOv2</a></b></td><td><a href="https://arxiv.org/pdf/1612.08242.pdf">Redmon et al.</a></td><td>一个用于目标检测的实时CNN,可以检测20个不同的类。一个更复杂的完整YOLOv2网络的小版本。</td><td><a href="https://colab.research.google.com/drive/11V4I6cRjIJNUv5ZGsEGwqHuoQEie6b1T"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+</tbody>
+</table>
+<h3><a class="anchor" aria-hidden="true" id="面部识别"></a><a href="#面部识别" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>人脸检测模型可以识别和/或识别给定图像中的人脸和情绪。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/body_analysis/arcface">ArcFace</a></b></td><td><a href="https://arxiv.org/abs/1801.07698">Deng et al.</a></td><td>一种基于CNN的人脸识别模型,它可以学习人脸的判别特征,并对输入的人脸图像进行分析。</td><td><a href="https://colab.research.google.com/drive/1qanaqUKGIDtifdzEzJOHjEj4kYzA9uJC"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/body_analysis/emotion_ferplus">Emotion FerPlus</a></b></td><td><a href="https://arxiv.org/abs/1608.01041">Barsoum et al.</a></td><td>基于人脸图像训练的情感识别深度CNN。</td><td><a href="https://colab.research.google.com/drive/1XHtBQGRhe58PDi4LGYJzYueWBeWbO23r"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+</tbody>
+</table>
+<h3><a class="anchor" aria-hidden="true" id="机器理解"></a><a href="#机器理解" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>这个自然语言处理模型的子集,可以回答关于给定上下文段落的问题。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/text/machine_comprehension/bert-squad">BERT-Squad</a></b></td><td><a href="https://arxiv.org/pdf/1810.04805.pdf">Devlin et al.</a></td><td>该模型根据给定输入段落的上下文回答问题。</td><td><a href="https://colab.research.google.com/drive/1kud-lUPjS_u-TkDAzihBTw0Vqr0FjCE-"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/text/machine_comprehension/roberta">RoBERTa</a></b></td><td><a href="https://arxiv.org/pdf/1907.11692.pdf">Devlin et al.</a></td><td>一个基于大型变换器的模型,根据给定的输入文本预测情感。</td><td><a href="https://colab.research.google.com/drive/1F-c4LJSx3Cb2jW6tP7f8nAZDigyLH6iN?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/text/machine_comprehension/gpt-2">GPT-2</a></b></td><td><a href="https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf">Devlin et al.</a></td><td>一个基于大型变换器的语言模型,给定一些文本中的单词序列,预测下一个单词。</td><td><a href="https://colab.research.google.com/drive/1ZlXLSIMppPch6HgzKRillJiUcWn3PiK7?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In [...]
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="支持的操作符"></a><a href="#支持的操作符" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>onnx支持下列运算:</p>
+<ul>
+<li>Acos</li>
+<li>Acosh</li>
+<li>Add</li>
+<li>And</li>
+<li>Asin</li>
+<li>Asinh</li>
+<li>Atan</li>
+<li>Atanh</li>
+<li>AveragePool</li>
+<li>BatchNormalization</li>
+<li>Cast</li>
+<li>Ceil</li>
+<li>Clip</li>
+<li>Concat</li>
+<li>ConstantOfShape</li>
+<li>Conv</li>
+<li>Cos</li>
+<li>Cosh</li>
+<li>Div</li>
+<li>Dropout</li>
+<li>Elu</li>
+<li>Equal</li>
+<li>Erf</li>
+<li>Expand</li>
+<li>Flatten</li>
+<li>Gather</li>
+<li>Gemm</li>
+<li>GlobalAveragePool</li>
+<li>Greater</li>
+<li>HardSigmoid</li>
+<li>Identity</li>
+<li>LeakyRelu</li>
+<li>Less</li>
+<li>Log</li>
+<li>MatMul</li>
+<li>Max</li>
+<li>MaxPool</li>
+<li>Mean</li>
+<li>Min</li>
+<li>Mul</li>
+<li>Neg</li>
+<li>NonZero</li>
+<li>Not</li>
+<li>OneHot</li>
+<li>Or</li>
+<li>Pad</li>
+<li>Pow</li>
+<li>PRelu</li>
+<li>Reciprocal</li>
+<li>ReduceMean</li>
+<li>ReduceSum</li>
+<li>Relu</li>
+<li>Reshape</li>
+<li>ScatterElements</li>
+<li>Selu</li>
+<li>Shape</li>
+<li>Sigmoid</li>
+<li>Sign</li>
+<li>Sin</li>
+<li>Sinh</li>
+<li>Slice</li>
+<li>Softmax</li>
+<li>Softplus</li>
+<li>Softsign</li>
+<li>Split</li>
+<li>Sqrt</li>
+<li>Squeeze</li>
+<li>Sub</li>
+<li>Sum</li>
+<li>Tan</li>
+<li>Tanh</li>
+<li>Tile</li>
+<li>Transpose</li>
+<li>Unsqueeze</li>
+<li>Upsample</li>
+<li>Where</li>
+<li>Xor</li>
+</ul>
+<h3><a class="anchor" aria-hidden="true" id="对onnx后端的特别说明"></a><a href="#对onnx后端的特别说明" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<ul>
+<li><p>Conv, MaxPool 以及 AveragePool</p>
+<p>输入必须是1d<code>(N*C*H)</code>和2d<code>(N*C*H*W)</code>的形状,<code>dilation</code>必须是1。</p></li>
+<li><p>BatchNormalization</p>
+<p><code>epsilon</code> 设定为1e-05,不能改变</p></li>
+<li><p>Cast</p>
+<p>只支持float32和int32,其他类型都会转向这两种类型。</p></li>
+<li><p>Squeeze and Unsqueeze</p>
+<p>如果你在<code>Tensor</code>和Scalar之间<code>Squeeze</code>或<code>Unsqueeze</code>时遇到错误,请向我们报告。</p></li>
+<li><p>Empty tensor</p>
+<p>空张量在SINGA是非法的。</p></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>SINGA ONNX的代码在<code>python/singa/soonx.py</code>中,主要有三个类,<code>SingaFrontend</code>、<code>SingaBackend</code>和<code>SingaRep</code>。<code>SingaFrontend</code>将SINGA模型翻译成ONNX模型;<code>SingaBackend</code>将ONNX模型翻译成<code>SingaRep</code>对象,其中存储了所有的SINGA运算符和张量(本文档中的张量指SINGA Tensor);<code>SingaRep</code>可以像SINGA模型一样运行。</p>
+<h3><a class="anchor" aria-hidden="true" id="singafrontend"></a><a href="#singafrontend" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p><code>SingaFrontend</code>的入口函数是<code>singa_to_onnx_model</code>,它也被称为<code>to_onnx</code>,<code>singa_to_onnx_model</code>创建了ONNX模型,它还通过<code>singa_to_onnx_graph</code>创建了一个ONNX图。</p>
+<p><code>singa_to_onnx_graph</code>接受模型的输出,并从输出中递归迭代SINGA模型的图,得到所有的运算符,形成一个队列。SINGA模型的输入和中间张量,即可训练的权重,同时被获取。输入存储在<code>onnx_model.graph.input</code>中;输出存储在<code>onnx_model.graph.output</code>中;可训练权重存储在<code>onnx_model.graph.initializer</code>中。</p>
+<p>然后将队列中的SINGA运算符逐一翻译成ONNX运算符。<code>_rename_operators</code> 定义了 SINGA 和 ONNX 之间的运算符名称映射。<code>_special_operators</code> 定义了翻译运算符时要使用的函数。</p>
+<p>此外,SINGA 中的某些运算符与 ONNX 的定义不同,即 ONNX 将 SINGA 运算符的某些属性视为输入,因此 <code>_unhandled_operators</code> 定义了处理特殊运算符的函数。</p>
+<p>由于SINGA中的布尔类型被视为int32,所以<code>_bool_operators</code>定义了要改变的操作符为布尔类型。</p>
+<h3><a class="anchor" aria-hidden="true" id="singabackend"></a><a href="#singabackend" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p><code>SingaBackend</code>的入口函数是<code>prepare</code>,它检查ONNX模型的版本,然后调用<code>_onnx_model_to_singa_net</code>。</p>
+<p><code>_onnx_model_to_singa_net</code>的目的是获取SINGA的时序和运算符。tensors在ONNX中以其名称存储在字典中,而操作符则以<code>namedtuple('SingaOps', ['name', 'op', 'handle', 'forward'])</code>的形式存储在队列中。对于每个运算符,<code>name</code>是它的ONNX节点名称;<code>op</code>是ONNX节点;<code>forward</code>是SINGA运算符的转发函数;<code>handle</code>是为一些特殊的运算符准备的,如Conv和Pooling,它们有<code>handle</code>对象。</p>
+<p><code>_onnx_model_to_singa_net</code>的第一步是调用<code>_init_graph_parameter</code>来获取模型内的所有tensors。对于可训练的权重,可以从<code>onnx_model.graph.initializer</code>中初始化<code>SINGA Tensor</code>。请注意,权重也可能存储在图的输入或称为<code>Constant</code>的ONNX节点中,SINGA也可以处理这些。</p>
+<p>虽然所有的权重都存储在ONNX模型中,但模型的输入是未知的,只有它的形状和类型。所以SINGA支持两种方式来初始化输入,1、根据其形状和类型生成随机张量,2、允许用户分配输入。第一种方法对大多数模型都很好,但是对于一些模型,比如BERT,矩阵的指数不能随机生成,否则会产生错误。</p>
+<p>然后,<code>_onnx_model_to_singa_net</code>迭代ONNX图中的所有节点,将其翻译成SIGNA运算符。另外,<code>_rename_operators</code> 定义了 SINGA 和 ONNX 之间的运算符名称映射。<code>_special_operators</code> 定义翻译运算符时要使用的函数。<code>_run_node</code>通过输入时序来运行生成的 SINGA 模型,并存储其输出时序,供以后的运算符使用。</p>
+<p>该类最后返回一个<code>SingaRep</code>对象,并在其中存储所有SINGA时序和运算符。</p>
+<h3><a class="anchor" aria-hidden="true" id="singarep"></a><a href="#singarep" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p><code>SingaBackend</code>存储所有的SINGA tensors和运算符。<code>run</code>接受模型的输入,并按照运算符队列逐个运行SINGA运算符。用户可以使用<code>last_layers</code>来决定是否将模型运行到最后几层。将 <code>all_outputs</code> 设置为 <code>False</code> 表示只得到最后的输出,设置为 <code>True</code> 表示也得到所有的中间输出。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/graph"><span class="arrow-prev">← </span><span>Model</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/dist-train"><span>Distributed Training</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#通常用法">通常用法</a><ul class="toc-headings"><li><a href="#从onnx中读取一个model到singa">从ONNX中读取一个Model到SINGA</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/onnx/index.html b/content/docs/3.2.0_Chinese/onnx/index.html
new file mode 100644
index 0000000..fd91553
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/onnx/index.html
@@ -0,0 +1,686 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>ONNX · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/onnx.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">ONNX</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreemen [...]
+<p><a href="https://onnx.ai/">ONNX</a> 是机器学习模型的开放表示格式,它使AI开发人员能够在不同的库和工具中使用模型。SINGA支持加载ONNX格式模型用于训练和inference,并将使用SINGA API(如<a href="./module">Module</a>)定义的模型保存为ONNX格式。</p>
+<p>SINGA在以下<a href="https://github.com/onnx/onnx/blob/master/docs/Versioning.md">版本</a>中的ONNX中测试过。</p>
+<table>
+<thead>
+<tr><th>ONNX version</th><th>File format version</th><th>Opset version ai.onnx</th><th>Opset version ai.onnx.ml</th><th>Opset version ai.onnx.training</th></tr>
+</thead>
+<tbody>
+<tr><td>1.6.0</td><td>6</td><td>11</td><td>2</td><td>-</td></tr>
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="通常用法"></a><a href="#通常用法" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<h3><a class="anchor" aria-hidden="true" id="从onnx中读取一个model到singa"></a><a href="#从onnx中读取一个model到singa" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
+<p>在通过 <code>onnx.load</code> 从磁盘加载 ONNX 模型后,您需要更新模型的batch_size,因为对于大多数模型来说,它们使用一个占位符来表示其批处理量。我们在这里举一个例子,若要 <code>update_batch_size</code>,你只需要更新输入和输出的 batch_size,内部的 tensors 的形状会自动推断出来。</p>
+<p>然后,您可以使用 <code>sonnx.prepare</code> 来准备 SINGA 模型。该函数将 ONNX 模型图中的所有节点迭代并翻译成 SINGA 运算符,加载所有存储的权重并推断每个中间张量的形状。</p>
+<pre><code class="hljs css language-python3"><span class="hljs-built_in">import</span> onnx
+from singa <span class="hljs-built_in">import</span> device
+from singa <span class="hljs-built_in">import</span> sonnx
+
+<span class="hljs-comment"># if the input has multiple tensors? can put this function inside prepare()?</span>
+def update_batch_size(onnx_model, batch_size):
+ <span class="hljs-attr">model_input</span> = onnx_model.graph.input[<span class="hljs-number">0</span>]
+ model_input.type.tensor_type.shape.dim[<span class="hljs-number">0</span>].<span class="hljs-attr">dim_value</span> = batch_size
+ <span class="hljs-attr">model_output</span> = onnx_model.graph.output[<span class="hljs-number">0</span>]
+ model_output.type.tensor_type.shape.dim[<span class="hljs-number">0</span>].<span class="hljs-attr">dim_value</span> = batch_size
+ return onnx_model
+
+
+<span class="hljs-attr">model_path</span> = <span class="hljs-string">"PATH/To/ONNX/MODEL"</span>
+<span class="hljs-attr">onnx_model</span> = onnx.load(model_path)
+
+<span class="hljs-comment"># set batch size</span>
+<span class="hljs-attr">onnx_model</span> = update_batch_size(onnx_model, <span class="hljs-number">1</span>)
+
+<span class="hljs-comment"># convert onnx graph nodes into SINGA operators</span>
+<span class="hljs-attr">dev</span> = device.create_cuda_gpu()
+<span class="hljs-attr">sg_ir</span> = sonnx.prepare(onnx_model, <span class="hljs-attr">device=dev)</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="inference-singa模型"></a><a href="#inference-singa模型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>一旦创建了模型,就可以通过调用<code>sg_ir.run</code>进行inference。输入和输出必须是SINGA Tensor实例,由于SINGA模型以列表形式返回输出,如果只有一个输出,你只需要从输出中取第一个元素即可。</p>
+<pre><code class="hljs css language-python3"><span class="hljs-comment"># can warp the following code in prepare()</span>
+<span class="hljs-comment"># and provide a flag training=True/False?</span>
+
+<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Infer</span>:</span>
+
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(<span class="hljs-keyword">self</span>, sg_ir)</span></span>:
+ <span class="hljs-keyword">self</span>.sg_ir = sg_ir
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(<span class="hljs-keyword">self</span>, x)</span></span>:
+ <span class="hljs-keyword">return</span> sg_ir.run([x])[<span class="hljs-number">0</span>]
+
+
+data = get_dataset()
+x = tensor.Tensor(device=dev, data=data)
+
+model = Infer(sg_ir)
+y = model.forward(x)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="将singa模型保存成onnx格式"></a><a href="#将singa模型保存成onnx格式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>给定输入时序和输出时序,由运算符产生的模型,你可以追溯所有内部操作。因此,一个SINGA模型是由输入和输出张量定义的,要将 SINGA 模型导出为 ONNX 格式,您只需提供输入和输出张量列表。</p>
+<pre><code class="hljs css language-python3"># <span class="hljs-symbol">x</span> is the input tensor, <span class="hljs-symbol">y</span> is the output tensor
+sonnx.to_onnx([<span class="hljs-symbol">x</span>], [<span class="hljs-symbol">y</span>])
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="在onnx模型上重新训练"></a><a href="#在onnx模型上重新训练" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>要使用 SINGA 训练(或改进)ONNX 模型,您需要设置内部的张量为可训练状态:</p>
+<pre><code class="hljs css language-python3"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Infer</span>:</span>
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, sg_ir)</span>:</span>
+ self.sg_ir = sg_ir
+ <span class="hljs-comment">## can wrap these codes in sonnx?</span>
+ <span class="hljs-keyword">for</span> idx, tens <span class="hljs-keyword">in</span> sg_ir.tensor_map.items():
+ <span class="hljs-comment"># allow the tensors to be updated</span>
+ tens.requires_grad = <span class="hljs-literal">True</span>
+ tens.stores_grad = <span class="hljs-literal">True</span>
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ <span class="hljs-keyword">return</span> sg_ir.run([x])[<span class="hljs-number">0</span>]
+
+autograd.training = <span class="hljs-literal">False</span>
+model = Infer(sg_ir)
+
+autograd.training = <span class="hljs-literal">True</span>
+<span class="hljs-comment"># then you training the model like normal</span>
+<span class="hljs-comment"># give more details??</span>
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="在onnx模型上做迁移学习"></a><a href="#在onnx模型上做迁移学习" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>您也可以在ONNX模型的最后附加一些图层来进行转移学习。<code>last_layers</code> 意味着您从 [0, last_layers] 切断 ONNX 层。然后您可以通过普通的SINGA模型附加更多的层。</p>
+<pre><code class="hljs css language-python3">class Trans:
+
+ def __init__(<span class="hljs-literal">self</span>, sg_ir, last_layers):
+ <span class="hljs-literal">self</span>.sg_ir = sg_ir
+ <span class="hljs-literal">self</span>.last_layers = last_layers
+ <span class="hljs-literal">self</span>.append_linear1 = autograd.Linear(<span class="hljs-number">500</span>, <span class="hljs-number">128</span>, bias=False)
+ <span class="hljs-literal">self</span>.append_linear2 = autograd.Linear(<span class="hljs-number">128</span>, <span class="hljs-number">32</span>, bias=False)
+ <span class="hljs-literal">self</span>.append_linear3 = autograd.Linear(<span class="hljs-number">32</span>, <span class="hljs-number">10</span>, bias=False)
+
+ def forward(<span class="hljs-literal">self</span>, <span class="hljs-symbol">x</span>):
+ <span class="hljs-symbol">y</span> = sg_ir.run([<span class="hljs-symbol">x</span>], last_layers=<span class="hljs-literal">self</span>.last_layers)[<span class="hljs-number">0</span>]
+ <span class="hljs-symbol">y</span> = <span class="hljs-literal">self</span>.append_linear1(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = autograd.relu(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = <span class="hljs-literal">self</span>.append_linear2(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = autograd.relu(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = <span class="hljs-literal">self</span>.append_linear3(<span class="hljs-symbol">y</span>)
+ <span class="hljs-symbol">y</span> = autograd.relu(<span class="hljs-symbol">y</span>)
+ <span class="hljs-keyword">return</span> <span class="hljs-symbol">y</span>
+
+autograd.training = False
+model = Trans(sg_ir, <span class="hljs-number">-1</span>)
+
+# <span class="hljs-keyword">then</span> you training the model like normal
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="一个完整示例"></a><a href="#一个完整示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>本部分以mnist为例,介绍SINGA ONNX的使用方法。在这部分,将展示如何导出、加载、inference、再训练和迁移学习 mnist 模型的例子。您可以在<a href="https://colab.research.google.com/drive/1-YOfQqqw3HNhS8WpB8xjDQYutRdUdmCq">这里</a>试用这部分内容。</p>
+<h3><a class="anchor" aria-hidden="true" id="读取数据集"></a><a href="#读取数据集" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>首先,你需要导入一些必要的库,并定义一些辅助函数来下载和预处理数据集:</p>
+<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> os
+<span class="hljs-keyword">import</span> urllib.request
+<span class="hljs-keyword">import</span> gzip
+<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
+<span class="hljs-keyword">import</span> codecs
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> device
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> tensor
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> autograd
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> sonnx
+<span class="hljs-keyword">import</span> onnx
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">load_dataset</span><span class="hljs-params">()</span>:</span>
+ train_x_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz'</span>
+ train_y_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz'</span>
+ valid_x_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz'</span>
+ valid_y_url = <span class="hljs-string">'http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz'</span>
+ train_x = read_image_file(check_exist_or_download(train_x_url)).astype(
+ np.float32)
+ train_y = read_label_file(check_exist_or_download(train_y_url)).astype(
+ np.float32)
+ valid_x = read_image_file(check_exist_or_download(valid_x_url)).astype(
+ np.float32)
+ valid_y = read_label_file(check_exist_or_download(valid_y_url)).astype(
+ np.float32)
+ <span class="hljs-keyword">return</span> train_x, train_y, valid_x, valid_y
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">check_exist_or_download</span><span class="hljs-params">(url)</span>:</span>
+
+ download_dir = <span class="hljs-string">'/tmp/'</span>
+
+ name = url.rsplit(<span class="hljs-string">'/'</span>, <span class="hljs-number">1</span>)[<span class="hljs-number">-1</span>]
+ filename = os.path.join(download_dir, name)
+ <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> os.path.isfile(filename):
+ print(<span class="hljs-string">"Downloading %s"</span> % url)
+ urllib.request.urlretrieve(url, filename)
+ <span class="hljs-keyword">return</span> filename
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">read_label_file</span><span class="hljs-params">(path)</span>:</span>
+ <span class="hljs-keyword">with</span> gzip.open(path, <span class="hljs-string">'rb'</span>) <span class="hljs-keyword">as</span> f:
+ data = f.read()
+ <span class="hljs-keyword">assert</span> get_int(data[:<span class="hljs-number">4</span>]) == <span class="hljs-number">2049</span>
+ length = get_int(data[<span class="hljs-number">4</span>:<span class="hljs-number">8</span>])
+ parsed = np.frombuffer(data, dtype=np.uint8, offset=<span class="hljs-number">8</span>).reshape(
+ (length))
+ <span class="hljs-keyword">return</span> parsed
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_int</span><span class="hljs-params">(b)</span>:</span>
+ <span class="hljs-keyword">return</span> int(codecs.encode(b, <span class="hljs-string">'hex'</span>), <span class="hljs-number">16</span>)
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">read_image_file</span><span class="hljs-params">(path)</span>:</span>
+ <span class="hljs-keyword">with</span> gzip.open(path, <span class="hljs-string">'rb'</span>) <span class="hljs-keyword">as</span> f:
+ data = f.read()
+ <span class="hljs-keyword">assert</span> get_int(data[:<span class="hljs-number">4</span>]) == <span class="hljs-number">2051</span>
+ length = get_int(data[<span class="hljs-number">4</span>:<span class="hljs-number">8</span>])
+ num_rows = get_int(data[<span class="hljs-number">8</span>:<span class="hljs-number">12</span>])
+ num_cols = get_int(data[<span class="hljs-number">12</span>:<span class="hljs-number">16</span>])
+ parsed = np.frombuffer(data, dtype=np.uint8, offset=<span class="hljs-number">16</span>).reshape(
+ (length, <span class="hljs-number">1</span>, num_rows, num_cols))
+ <span class="hljs-keyword">return</span> parsed
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">to_categorical</span><span class="hljs-params">(y, num_classes)</span>:</span>
+ y = np.array(y, dtype=<span class="hljs-string">"int"</span>)
+ n = y.shape[<span class="hljs-number">0</span>]
+ categorical = np.zeros((n, num_classes))
+ categorical[np.arange(n), y] = <span class="hljs-number">1</span>
+ categorical = categorical.astype(np.float32)
+ <span class="hljs-keyword">return</span> categorical
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="mnist模型"></a><a href="#mnist模型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>然后你可以定义一个叫做<strong>CNN</strong>的类来构造mnist模型,这个模型由几个卷积层、池化层、全连接层和relu层组成。你也可以定义一个函数来计算我们结果的<strong>准确性</strong>。最后,你可以定义一个<strong>训练函数</strong>和一个<strong>测试函数</strong>来处理训练和预测的过程。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CNN</span>:</span>
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self)</span>:</span>
+ self.conv1 = autograd.Conv2d(<span class="hljs-number">1</span>, <span class="hljs-number">20</span>, <span class="hljs-number">5</span>, padding=<span class="hljs-number">0</span>)
+ self.conv2 = autograd.Conv2d(<span class="hljs-number">20</span>, <span class="hljs-number">50</span>, <span class="hljs-number">5</span>, padding=<span class="hljs-number">0</span>)
+ self.linear1 = autograd.Linear(<span class="hljs-number">4</span> * <span class="hljs-number">4</span> * <span class="hljs-number">50</span>, <span class="hljs-number">500</span>, bias=<span class="hljs-literal">False</span>)
+ self.linear2 = autograd.Linear(<span class="hljs-number">500</span>, <span class="hljs-number">10</span>, bias=<span class="hljs-literal">False</span>)
+ self.pooling1 = autograd.MaxPool2d(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, padding=<span class="hljs-number">0</span>)
+ self.pooling2 = autograd.MaxPool2d(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>, padding=<span class="hljs-number">0</span>)
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ y = self.conv1(x)
+ y = autograd.relu(y)
+ y = self.pooling1(y)
+ y = self.conv2(y)
+ y = autograd.relu(y)
+ y = self.pooling2(y)
+ y = autograd.flatten(y)
+ y = self.linear1(y)
+ y = autograd.relu(y)
+ y = self.linear2(y)
+ <span class="hljs-keyword">return</span> y
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">accuracy</span><span class="hljs-params">(pred, target)</span>:</span>
+ y = np.argmax(pred, axis=<span class="hljs-number">1</span>)
+ t = np.argmax(target, axis=<span class="hljs-number">1</span>)
+ a = y == t
+ <span class="hljs-keyword">return</span> np.array(a, <span class="hljs-string">"int"</span>).sum() / float(len(t))
+
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">train</span><span class="hljs-params">(model,
+ x,
+ y,
+ epochs=<span class="hljs-number">1</span>,
+ batch_size=<span class="hljs-number">64</span>,
+ dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+
+ output_batch = model.forward(x_batch)
+ <span class="hljs-comment"># onnx_model = sonnx.to_onnx([x_batch], [y])</span>
+ <span class="hljs-comment"># print('The model is:\n{}'.format(onnx_model))</span>
+
+ loss = autograd.softmax_cross_entropy(output_batch, target_batch)
+ accuracy_rate = accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ sgd = opt.SGD(lr=<span class="hljs-number">0.001</span>)
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, gp)
+ sgd.step()
+
+ <span class="hljs-keyword">if</span> b % <span class="hljs-number">1e2</span> == <span class="hljs-number">0</span>:
+ print(<span class="hljs-string">"acc %6.2f loss, %6.2f"</span> %
+ (accuracy_rate, tensor.to_numpy(loss)[<span class="hljs-number">0</span>]))
+ print(<span class="hljs-string">"training completed"</span>)
+ <span class="hljs-keyword">return</span> x_batch, output_batch
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">test</span><span class="hljs-params">(model, x, y, batch_size=<span class="hljs-number">64</span>, dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ result = <span class="hljs-number">0</span>
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+
+ output_batch = model.forward(x_batch)
+ result += accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ print(<span class="hljs-string">"testing acc %6.2f"</span> % (result / batch_number))
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="训练mnist模型并将其导出到onnx"></a><a href="#训练mnist模型并将其导出到onnx" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.2 [...]
+<p>现在,你可以通过调用 <strong>soonx.to_onnx</strong> 函数来训练 mnist 模型并导出其 onnx 模型。</p>
+<pre><code class="hljs css language-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">make_onnx</span><span class="hljs-params">(x, y)</span>:</span>
+ <span class="hljs-keyword">return</span> sonnx.to_onnx([x], [y])
+
+<span class="hljs-comment"># create device</span>
+dev = device.create_cuda_gpu()
+<span class="hljs-comment">#dev = device.get_default_device()</span>
+<span class="hljs-comment"># create model</span>
+model = CNN()
+<span class="hljs-comment"># load data</span>
+train_x, train_y, valid_x, valid_y = load_dataset()
+<span class="hljs-comment"># normalization</span>
+train_x = train_x / <span class="hljs-number">255</span>
+valid_x = valid_x / <span class="hljs-number">255</span>
+train_y = to_categorical(train_y, <span class="hljs-number">10</span>)
+valid_y = to_categorical(valid_y, <span class="hljs-number">10</span>)
+<span class="hljs-comment"># do training</span>
+autograd.training = <span class="hljs-literal">True</span>
+x, y = train(model, train_x, train_y, dev=dev)
+onnx_model = make_onnx(x, y)
+<span class="hljs-comment"># print('The model is:\n{}'.format(onnx_model))</span>
+
+<span class="hljs-comment"># Save the ONNX model</span>
+model_path = os.path.join(<span class="hljs-string">'/'</span>, <span class="hljs-string">'tmp'</span>, <span class="hljs-string">'mnist.onnx'</span>)
+onnx.save(onnx_model, model_path)
+print(<span class="hljs-string">'The model is saved.'</span>)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="inference"></a><a href="#inference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
+<p>导出onnx模型后,可以在'/tmp'目录下找到一个名为<strong>mnist.onnx</strong>的文件,这个模型可以被其他库导入。现在,如果你想把这个onnx模型再次导入到singa中,并使用验证数据集进行推理,你可以定义一个叫做<strong>Infer</strong>的类,Infer的前向函数将被测试函数调用,对验证数据集进行推理。此外,你应该把训练的标签设置为<strong>False</strong>,以固定自变量算子的梯度。</p>
+<p>在导入onnx模型时,需要先调用<strong>onnx.load</strong>来加载onnx模型。然后将onnx模型输入到 <strong>soonx.prepare</strong>中进行解析,并启动到一个singa模型(代码中的<strong>sg_ir</strong>)。sg_ir里面包含了一个singa图,然后就可以通过输入到它的run函数中运行一步推理。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Infer</span>:</span>
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, sg_ir)</span>:</span>
+ self.sg_ir = sg_ir
+ <span class="hljs-keyword">for</span> idx, tens <span class="hljs-keyword">in</span> sg_ir.tensor_map.items():
+ <span class="hljs-comment"># allow the tensors to be updated</span>
+ tens.requires_grad = <span class="hljs-literal">True</span>
+ tens.stores_grad= <span class="hljs-literal">True</span>
+ sg_ir.tensor_map[idx] = tens
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ <span class="hljs-keyword">return</span> sg_ir.run([x])[<span class="hljs-number">0</span>] <span class="hljs-comment"># we can run one step of inference by feeding input</span>
+
+<span class="hljs-comment"># load the ONNX model</span>
+onnx_model = onnx.load(model_path)
+sg_ir = sonnx.prepare(onnx_model, device=dev) <span class="hljs-comment"># parse and initiate to a singa model</span>
+
+<span class="hljs-comment"># inference</span>
+autograd.training = <span class="hljs-literal">False</span>
+print(<span class="hljs-string">'The inference result is:'</span>)
+test(Infer(sg_ir), valid_x, valid_y, dev=dev)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="重训练"></a><a href="#重训练" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.2 [...]
+<p>假设导入模型后,想再次对模型进行重新训练,我们可以定义一个名为<strong>re_train</strong>的函数。在调用这个re_train函数之前,我们应该将训练的标签设置为<strong>True</strong>,以使自变量运算符更新其梯度。而在完成训练后,我们再将其设置为<strong>False</strong>,以调用做推理的测试函数。</p>
+<pre><code class="hljs css language-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">re_train</span><span class="hljs-params">(sg_ir,
+ x,
+ y,
+ epochs=<span class="hljs-number">1</span>,
+ batch_size=<span class="hljs-number">64</span>,
+ dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ new_model = Infer(sg_ir)
+
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+
+ output_batch = new_model.forward(x_batch)
+
+ loss = autograd.softmax_cross_entropy(output_batch, target_batch)
+ accuracy_rate = accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ sgd = opt.SGD(lr=<span class="hljs-number">0.01</span>)
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, gp)
+ sgd.step()
+
+ <span class="hljs-keyword">if</span> b % <span class="hljs-number">1e2</span> == <span class="hljs-number">0</span>:
+ print(<span class="hljs-string">"acc %6.2f loss, %6.2f"</span> %
+ (accuracy_rate, tensor.to_numpy(loss)[<span class="hljs-number">0</span>]))
+ print(<span class="hljs-string">"re-training completed"</span>)
+ <span class="hljs-keyword">return</span> new_model
+
+<span class="hljs-comment"># load the ONNX model</span>
+onnx_model = onnx.load(model_path)
+sg_ir = sonnx.prepare(onnx_model, device=dev)
+
+<span class="hljs-comment"># re-training</span>
+autograd.training = <span class="hljs-literal">True</span>
+new_model = re_train(sg_ir, train_x, train_y, dev=dev)
+autograd.training = <span class="hljs-literal">False</span>
+test(new_model, valid_x, valid_y, dev=dev)
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="迁移学习"></a><a href="#迁移学习" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>最后,如果我们想做迁移学习,我们可以定义一个名为<strong>Trans</strong>的函数,在onnx模型后追加一些层。为了演示,代码中只在onnx模型后追加了几个线性(全连接)和relu。可以定义一个transfer_learning函数来处理transfer-learning模型的训练过程,而训练的标签和前面一个的一样。</p>
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Trans</span>:</span>
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, sg_ir, last_layers)</span>:</span>
+ self.sg_ir = sg_ir
+ self.last_layers = last_layers
+ self.append_linear1 = autograd.Linear(<span class="hljs-number">500</span>, <span class="hljs-number">128</span>, bias=<span class="hljs-literal">False</span>)
+ self.append_linear2 = autograd.Linear(<span class="hljs-number">128</span>, <span class="hljs-number">32</span>, bias=<span class="hljs-literal">False</span>)
+ self.append_linear3 = autograd.Linear(<span class="hljs-number">32</span>, <span class="hljs-number">10</span>, bias=<span class="hljs-literal">False</span>)
+
+ <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">forward</span><span class="hljs-params">(self, x)</span>:</span>
+ y = sg_ir.run([x], last_layers=self.last_layers)[<span class="hljs-number">0</span>]
+ y = self.append_linear1(y)
+ y = autograd.relu(y)
+ y = self.append_linear2(y)
+ y = autograd.relu(y)
+ y = self.append_linear3(y)
+ y = autograd.relu(y)
+ <span class="hljs-keyword">return</span> y
+
+<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">transfer_learning</span><span class="hljs-params">(sg_ir,
+ x,
+ y,
+ epochs=<span class="hljs-number">1</span>,
+ batch_size=<span class="hljs-number">64</span>,
+ dev=device.get_default_device<span class="hljs-params">()</span>)</span>:</span>
+ batch_number = x.shape[<span class="hljs-number">0</span>] // batch_size
+
+ trans_model = Trans(sg_ir, <span class="hljs-number">-1</span>)
+
+ <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(epochs):
+ <span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(batch_number):
+ l_idx = b * batch_size
+ r_idx = (b + <span class="hljs-number">1</span>) * batch_size
+
+ x_batch = tensor.Tensor(device=dev, data=x[l_idx:r_idx])
+ target_batch = tensor.Tensor(device=dev, data=y[l_idx:r_idx])
+ output_batch = trans_model.forward(x_batch)
+
+ loss = autograd.softmax_cross_entropy(output_batch, target_batch)
+ accuracy_rate = accuracy(tensor.to_numpy(output_batch),
+ tensor.to_numpy(target_batch))
+
+ sgd = opt.SGD(lr=<span class="hljs-number">0.07</span>)
+ <span class="hljs-keyword">for</span> p, gp <span class="hljs-keyword">in</span> autograd.backward(loss):
+ sgd.update(p, gp)
+ sgd.step()
+
+ <span class="hljs-keyword">if</span> b % <span class="hljs-number">1e2</span> == <span class="hljs-number">0</span>:
+ print(<span class="hljs-string">"acc %6.2f loss, %6.2f"</span> %
+ (accuracy_rate, tensor.to_numpy(loss)[<span class="hljs-number">0</span>]))
+ print(<span class="hljs-string">"transfer-learning completed"</span>)
+ <span class="hljs-keyword">return</span> trans_mode
+
+<span class="hljs-comment"># load the ONNX model</span>
+onnx_model = onnx.load(model_path)
+sg_ir = sonnx.prepare(onnx_model, device=dev)
+
+<span class="hljs-comment"># transfer-learning</span>
+autograd.training = <span class="hljs-literal">True</span>
+new_model = transfer_learning(sg_ir, train_x, train_y, dev=dev)
+autograd.training = <span class="hljs-literal">False</span>
+test(new_model, valid_x, valid_y, dev=dev)
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="onnx模型库"></a><a href="#onnx模型库" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p><a href="https://github.com/onnx/models">ONNX 模型库</a>是由社区成员贡献的 ONNX 格式的预先训练的最先进模型的集合。SINGA 现在已经支持了几个 CV 和 NLP 模型。将来会支持更多模型。</p>
+<h3><a class="anchor" aria-hidden="true" id="图像分类"></a><a href="#图像分类" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>这套模型以图像作为输入,然后将图像中的主要物体分为1000个物体类别,如键盘、鼠标、铅笔和许多动物。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/mobilenet">MobileNet</a></b></td><td><a href="https://arxiv.org/abs/1801.04381">Sandler et al.</a></td><td>最适合移动和嵌入式视觉应用的轻量级深度神经网络。 <br>Top-5 error from paper - ~10%</td><td><a href="https://colab.research.google.com/drive/1HsixqJMIpKyEPhkbB8jy7NwNEFEAUWAf"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/resnet">ResNet18</a></b></td><td><a href="https://arxiv.org/abs/1512.03385">He et al.</a></td><td>一个CNN模型(多达152层),在对图像进行分类时,使用shortcut来实现更高的准确性。 <br> Top-5 error from paper - ~3.6%</td><td><a href="https://colab.research.google.com/drive/1u1RYefSsVbiP4I-5wiBKHjsT9L0FxLm9"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/vgg">VGG16</a></b></td><td><a href="https://arxiv.org/abs/1409.1556">Simonyan et al.</a></td><td>深度CNN模型(多达19层)。类似于AlexNet,但使用多个较小的内核大小的滤波器,在分类图像时提供更高的准确性。 <br>Top-5 error from paper - ~8%</td><td><a href="https://colab.research.google.com/drive/14kxgRKtbjPCKKsDJVNi3AvTev81Gp_Ds"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/classification/shufflenet">ShuffleNet_V2</a></b></td><td><a href="https://arxiv.org/pdf/1707.01083.pdf">Simonyan et al.</a></td><td>专门为移动设备设计的计算效率极高的CNN模型。这种网络架构设计考虑了速度等直接指标,而不是FLOP等间接指标。 Top-1 error from paper - ~30.6%</td><td><a href="https://colab.research.google.com/drive/19HfRu3YHP_H2z3BcZujVFRp23_J5XsuA?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+</tbody>
+</table>
+<h3><a class="anchor" aria-hidden="true" id="目标检测"></a><a href="#目标检测" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>目标检测模型可以检测图像中是否存在多个对象,并将图像中检测到对象的区域分割出来。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/tiny_yolov2">Tiny YOLOv2</a></b></td><td><a href="https://arxiv.org/pdf/1612.08242.pdf">Redmon et al.</a></td><td>一个用于目标检测的实时CNN,可以检测20个不同的类。一个更复杂的完整YOLOv2网络的小版本。</td><td><a href="https://colab.research.google.com/drive/11V4I6cRjIJNUv5ZGsEGwqHuoQEie6b1T"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+</tbody>
+</table>
+<h3><a class="anchor" aria-hidden="true" id="面部识别"></a><a href="#面部识别" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>人脸检测模型可以识别和/或识别给定图像中的人脸和情绪。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/body_analysis/arcface">ArcFace</a></b></td><td><a href="https://arxiv.org/abs/1801.07698">Deng et al.</a></td><td>一种基于CNN的人脸识别模型,它可以学习人脸的判别特征,并对输入的人脸图像进行分析。</td><td><a href="https://colab.research.google.com/drive/1qanaqUKGIDtifdzEzJOHjEj4kYzA9uJC"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/vision/body_analysis/emotion_ferplus">Emotion FerPlus</a></b></td><td><a href="https://arxiv.org/abs/1608.01041">Barsoum et al.</a></td><td>基于人脸图像训练的情感识别深度CNN。</td><td><a href="https://colab.research.google.com/drive/1XHtBQGRhe58PDi4LGYJzYueWBeWbO23r"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+</tbody>
+</table>
+<h3><a class="anchor" aria-hidden="true" id="机器理解"></a><a href="#机器理解" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>这个自然语言处理模型的子集,可以回答关于给定上下文段落的问题。</p>
+<table>
+<thead>
+<tr><th>Model Class</th><th>Reference</th><th>Description</th><th>Link</th></tr>
+</thead>
+<tbody>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/text/machine_comprehension/bert-squad">BERT-Squad</a></b></td><td><a href="https://arxiv.org/pdf/1810.04805.pdf">Devlin et al.</a></td><td>该模型根据给定输入段落的上下文回答问题。</td><td><a href="https://colab.research.google.com/drive/1kud-lUPjS_u-TkDAzihBTw0Vqr0FjCE-"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/text/machine_comprehension/roberta">RoBERTa</a></b></td><td><a href="https://arxiv.org/pdf/1907.11692.pdf">Devlin et al.</a></td><td>一个基于大型变换器的模型,根据给定的输入文本预测情感。</td><td><a href="https://colab.research.google.com/drive/1F-c4LJSx3Cb2jW6tP7f8nAZDigyLH6iN?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a></td></tr>
+<tr><td><b><a href="https://github.com/onnx/models/tree/master/text/machine_comprehension/gpt-2">GPT-2</a></b></td><td><a href="https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf">Devlin et al.</a></td><td>一个基于大型变换器的语言模型,给定一些文本中的单词序列,预测下一个单词。</td><td><a href="https://colab.research.google.com/drive/1ZlXLSIMppPch6HgzKRillJiUcWn3PiK7?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In [...]
+</tbody>
+</table>
+<h2><a class="anchor" aria-hidden="true" id="支持的操作符"></a><a href="#支持的操作符" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>onnx支持下列运算:</p>
+<ul>
+<li>Acos</li>
+<li>Acosh</li>
+<li>Add</li>
+<li>And</li>
+<li>Asin</li>
+<li>Asinh</li>
+<li>Atan</li>
+<li>Atanh</li>
+<li>AveragePool</li>
+<li>BatchNormalization</li>
+<li>Cast</li>
+<li>Ceil</li>
+<li>Clip</li>
+<li>Concat</li>
+<li>ConstantOfShape</li>
+<li>Conv</li>
+<li>Cos</li>
+<li>Cosh</li>
+<li>Div</li>
+<li>Dropout</li>
+<li>Elu</li>
+<li>Equal</li>
+<li>Erf</li>
+<li>Expand</li>
+<li>Flatten</li>
+<li>Gather</li>
+<li>Gemm</li>
+<li>GlobalAveragePool</li>
+<li>Greater</li>
+<li>HardSigmoid</li>
+<li>Identity</li>
+<li>LeakyRelu</li>
+<li>Less</li>
+<li>Log</li>
+<li>MatMul</li>
+<li>Max</li>
+<li>MaxPool</li>
+<li>Mean</li>
+<li>Min</li>
+<li>Mul</li>
+<li>Neg</li>
+<li>NonZero</li>
+<li>Not</li>
+<li>OneHot</li>
+<li>Or</li>
+<li>Pad</li>
+<li>Pow</li>
+<li>PRelu</li>
+<li>Reciprocal</li>
+<li>ReduceMean</li>
+<li>ReduceSum</li>
+<li>Relu</li>
+<li>Reshape</li>
+<li>ScatterElements</li>
+<li>Selu</li>
+<li>Shape</li>
+<li>Sigmoid</li>
+<li>Sign</li>
+<li>Sin</li>
+<li>Sinh</li>
+<li>Slice</li>
+<li>Softmax</li>
+<li>Softplus</li>
+<li>Softsign</li>
+<li>Split</li>
+<li>Sqrt</li>
+<li>Squeeze</li>
+<li>Sub</li>
+<li>Sum</li>
+<li>Tan</li>
+<li>Tanh</li>
+<li>Tile</li>
+<li>Transpose</li>
+<li>Unsqueeze</li>
+<li>Upsample</li>
+<li>Where</li>
+<li>Xor</li>
+</ul>
+<h3><a class="anchor" aria-hidden="true" id="对onnx后端的特别说明"></a><a href="#对onnx后端的特别说明" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<ul>
+<li><p>Conv, MaxPool 以及 AveragePool</p>
+<p>输入必须是1d<code>(N*C*H)</code>和2d<code>(N*C*H*W)</code>的形状,<code>dilation</code>必须是1。</p></li>
+<li><p>BatchNormalization</p>
+<p><code>epsilon</code> 设定为1e-05,不能改变</p></li>
+<li><p>Cast</p>
+<p>只支持float32和int32,其他类型都会转向这两种类型。</p></li>
+<li><p>Squeeze and Unsqueeze</p>
+<p>如果你在<code>Tensor</code>和Scalar之间<code>Squeeze</code>或<code>Unsqueeze</code>时遇到错误,请向我们报告。</p></li>
+<li><p>Empty tensor</p>
+<p>空张量在SINGA是非法的。</p></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="实现"></a><a href="#实现" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>SINGA ONNX的代码在<code>python/singa/soonx.py</code>中,主要有三个类,<code>SingaFrontend</code>、<code>SingaBackend</code>和<code>SingaRep</code>。<code>SingaFrontend</code>将SINGA模型翻译成ONNX模型;<code>SingaBackend</code>将ONNX模型翻译成<code>SingaRep</code>对象,其中存储了所有的SINGA运算符和张量(本文档中的张量指SINGA Tensor);<code>SingaRep</code>可以像SINGA模型一样运行。</p>
+<h3><a class="anchor" aria-hidden="true" id="singafrontend"></a><a href="#singafrontend" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p><code>SingaFrontend</code>的入口函数是<code>singa_to_onnx_model</code>,它也被称为<code>to_onnx</code>,<code>singa_to_onnx_model</code>创建了ONNX模型,它还通过<code>singa_to_onnx_graph</code>创建了一个ONNX图。</p>
+<p><code>singa_to_onnx_graph</code>接受模型的输出,并从输出中递归迭代SINGA模型的图,得到所有的运算符,形成一个队列。SINGA模型的输入和中间张量,即可训练的权重,同时被获取。输入存储在<code>onnx_model.graph.input</code>中;输出存储在<code>onnx_model.graph.output</code>中;可训练权重存储在<code>onnx_model.graph.initializer</code>中。</p>
+<p>然后将队列中的SINGA运算符逐一翻译成ONNX运算符。<code>_rename_operators</code> 定义了 SINGA 和 ONNX 之间的运算符名称映射。<code>_special_operators</code> 定义了翻译运算符时要使用的函数。</p>
+<p>此外,SINGA 中的某些运算符与 ONNX 的定义不同,即 ONNX 将 SINGA 运算符的某些属性视为输入,因此 <code>_unhandled_operators</code> 定义了处理特殊运算符的函数。</p>
+<p>由于SINGA中的布尔类型被视为int32,所以<code>_bool_operators</code>定义了要改变的操作符为布尔类型。</p>
+<h3><a class="anchor" aria-hidden="true" id="singabackend"></a><a href="#singabackend" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p><code>SingaBackend</code>的入口函数是<code>prepare</code>,它检查ONNX模型的版本,然后调用<code>_onnx_model_to_singa_net</code>。</p>
+<p><code>_onnx_model_to_singa_net</code>的目的是获取SINGA的时序和运算符。tensors在ONNX中以其名称存储在字典中,而操作符则以<code>namedtuple('SingaOps', ['name', 'op', 'handle', 'forward'])</code>的形式存储在队列中。对于每个运算符,<code>name</code>是它的ONNX节点名称;<code>op</code>是ONNX节点;<code>forward</code>是SINGA运算符的转发函数;<code>handle</code>是为一些特殊的运算符准备的,如Conv和Pooling,它们有<code>handle</code>对象。</p>
+<p><code>_onnx_model_to_singa_net</code>的第一步是调用<code>_init_graph_parameter</code>来获取模型内的所有tensors。对于可训练的权重,可以从<code>onnx_model.graph.initializer</code>中初始化<code>SINGA Tensor</code>。请注意,权重也可能存储在图的输入或称为<code>Constant</code>的ONNX节点中,SINGA也可以处理这些。</p>
+<p>虽然所有的权重都存储在ONNX模型中,但模型的输入是未知的,只有它的形状和类型。所以SINGA支持两种方式来初始化输入,1、根据其形状和类型生成随机张量,2、允许用户分配输入。第一种方法对大多数模型都很好,但是对于一些模型,比如BERT,矩阵的指数不能随机生成,否则会产生错误。</p>
+<p>然后,<code>_onnx_model_to_singa_net</code>迭代ONNX图中的所有节点,将其翻译成SIGNA运算符。另外,<code>_rename_operators</code> 定义了 SINGA 和 ONNX 之间的运算符名称映射。<code>_special_operators</code> 定义翻译运算符时要使用的函数。<code>_run_node</code>通过输入时序来运行生成的 SINGA 模型,并存储其输出时序,供以后的运算符使用。</p>
+<p>该类最后返回一个<code>SingaRep</code>对象,并在其中存储所有SINGA时序和运算符。</p>
+<h3><a class="anchor" aria-hidden="true" id="singarep"></a><a href="#singarep" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<p><code>SingaBackend</code>存储所有的SINGA tensors和运算符。<code>run</code>接受模型的输入,并按照运算符队列逐个运行SINGA运算符。用户可以使用<code>last_layers</code>来决定是否将模型运行到最后几层。将 <code>all_outputs</code> 设置为 <code>False</code> 表示只得到最后的输出,设置为 <code>True</code> 表示也得到所有的中间输出。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/graph"><span class="arrow-prev">← </span><span>Model</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/dist-train"><span>Distributed Training</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#通常用法">通常用法</a><ul class="toc-headings"><li><a href="#从onnx中读取一个model到singa">从ONNX中读取一个Model到SINGA</a>< [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/optimizer.html b/content/docs/3.2.0_Chinese/optimizer.html
new file mode 100644
index 0000000..0ef0caa
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/optimizer.html
@@ -0,0 +1,188 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Optimizer · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/optimizer.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Optimizer</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor licens [...]
+<p>SINGA支持各种流行的优化器,包括动量随机梯度下降、Adam、RMSProp和AdaGrad等。对于每一种优化器,它都支持使用衰减调度器来安排不同时间段的学习率。优化器和衰减调度器包含在<code>singa/opt.py</code>中。</p>
+<h2><a class="anchor" aria-hidden="true" id="创建一个优化器"></a><a href="#创建一个优化器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<ol>
+<li>带动量的SGD</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter momentum</span>
+momentum = <span class="hljs-number">0.9</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.SGD(lr=lr, momentum=momentum, weight_decay=weight_decay)
+</code></pre>
+<ol start="2">
+<li>RMSProp</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter rho</span>
+rho = <span class="hljs-number">0.9</span>
+<span class="hljs-comment"># define hyperparameter epsilon</span>
+epsilon = <span class="hljs-number">1e-8</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.RMSProp(lr=lr, rho=rho, epsilon=epsilon, weight_decay=weight_decay)
+</code></pre>
+<ol start="3">
+<li>AdaGrad</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter epsilon</span>
+epsilon = <span class="hljs-number">1e-8</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.AdaGrad(lr=lr, epsilon=epsilon, weight_decay=weight_decay)
+</code></pre>
+<ol start="4">
+<li>Adam</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter beta 1</span>
+beta_1= <span class="hljs-number">0.9</span>
+<span class="hljs-comment"># define hyperparameter beta 2</span>
+beta_1= <span class="hljs-number">0.999</span>
+<span class="hljs-comment"># define hyperparameter epsilon</span>
+epsilon = <span class="hljs-number">1e-8</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.Adam(lr=lr, beta_1=beta_1, beta_2=beta_2, epsilon=epsilon, weight_decay=weight_decay)
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="创建一个衰减调度器"></a><a href="#创建一个衰减调度器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+
+<span class="hljs-comment"># define initial learning rate</span>
+lr_init = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define the rate of decay in the decay scheduler</span>
+decay_rate = <span class="hljs-number">0.95</span>
+<span class="hljs-comment"># define whether the learning rate schedule is a staircase shape</span>
+staircase=<span class="hljs-literal">True</span>
+<span class="hljs-comment"># define the decay step of the decay scheduler (in this example the lr is decreased at every 2 steps)</span>
+decay_steps = <span class="hljs-number">2</span>
+
+<span class="hljs-comment"># create the decay scheduler, the schedule of lr becomes lr_init * (decay_rate ^ (step // decay_steps) )</span>
+lr = opt.ExponentialDecay(<span class="hljs-number">0.1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">0.5</span>, <span class="hljs-literal">True</span>)
+<span class="hljs-comment"># Use the lr to create an optimizer</span>
+sgd = opt.SGD(lr=lr, momentum=<span class="hljs-number">0.9</span>, weight_decay=<span class="hljs-number">0.0001</span>)
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="使用模型api中的优化器"></a><a href="#使用模型api中的优化器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>当我们创建模型时,我们需要将优化器附加到模型上:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># create a CNN using the Model API</span>
+model = CNN()
+
+<span class="hljs-comment"># initialize optimizer and attach it to the model</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.005</span>, momentum=<span class="hljs-number">0.9</span>, weight_decay=<span class="hljs-number">1e-5</span>)
+model.set_optimizer(sgd)
+</code></pre>
+<p>然后,当我们调用模型时,它会运行利用优化器的 <code>train_one_batch</code> 方法。</p>
+<p>因此,一个迭代循环优化模型的例子是:</p>
+<pre><code class="hljs css language-python"><span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(num_train_batch):
+ <span class="hljs-comment"># generate the next mini-batch</span>
+ x, y = ...
+
+ <span class="hljs-comment"># Copy the data into input tensors</span>
+ tx.copy_from_numpy(x)
+ ty.copy_from_numpy(y)
+
+ <span class="hljs-comment"># Training with one batch</span>
+ out, loss = model(tx, ty)
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/autograd"><span class="arrow-prev">← </span><span>Autograd</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/graph"><span>Model</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#创建一个优化器">创建一个优化器</a></li><li><a href="#创建一个衰减调度器">创建一个衰减调度器</a></li><li><a href="#使用模型api中的优化器">使用模型API中的优化器</a></li [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/optimizer/index.html b/content/docs/3.2.0_Chinese/optimizer/index.html
new file mode 100644
index 0000000..0ef0caa
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/optimizer/index.html
@@ -0,0 +1,188 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Optimizer · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/optimizer.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Optimizer</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor licens [...]
+<p>SINGA支持各种流行的优化器,包括动量随机梯度下降、Adam、RMSProp和AdaGrad等。对于每一种优化器,它都支持使用衰减调度器来安排不同时间段的学习率。优化器和衰减调度器包含在<code>singa/opt.py</code>中。</p>
+<h2><a class="anchor" aria-hidden="true" id="创建一个优化器"></a><a href="#创建一个优化器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<ol>
+<li>带动量的SGD</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter momentum</span>
+momentum = <span class="hljs-number">0.9</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.SGD(lr=lr, momentum=momentum, weight_decay=weight_decay)
+</code></pre>
+<ol start="2">
+<li>RMSProp</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter rho</span>
+rho = <span class="hljs-number">0.9</span>
+<span class="hljs-comment"># define hyperparameter epsilon</span>
+epsilon = <span class="hljs-number">1e-8</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.RMSProp(lr=lr, rho=rho, epsilon=epsilon, weight_decay=weight_decay)
+</code></pre>
+<ol start="3">
+<li>AdaGrad</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter epsilon</span>
+epsilon = <span class="hljs-number">1e-8</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.AdaGrad(lr=lr, epsilon=epsilon, weight_decay=weight_decay)
+</code></pre>
+<ol start="4">
+<li>Adam</li>
+</ol>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># define hyperparameter learning rate</span>
+lr = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define hyperparameter beta 1</span>
+beta_1= <span class="hljs-number">0.9</span>
+<span class="hljs-comment"># define hyperparameter beta 2</span>
+beta_1= <span class="hljs-number">0.999</span>
+<span class="hljs-comment"># define hyperparameter epsilon</span>
+epsilon = <span class="hljs-number">1e-8</span>
+<span class="hljs-comment"># define hyperparameter weight decay</span>
+weight_decay = <span class="hljs-number">0.0001</span>
+
+<span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+sgd = opt.Adam(lr=lr, beta_1=beta_1, beta_2=beta_2, epsilon=epsilon, weight_decay=weight_decay)
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="创建一个衰减调度器"></a><a href="#创建一个衰减调度器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> singa <span class="hljs-keyword">import</span> opt
+
+<span class="hljs-comment"># define initial learning rate</span>
+lr_init = <span class="hljs-number">0.001</span>
+<span class="hljs-comment"># define the rate of decay in the decay scheduler</span>
+decay_rate = <span class="hljs-number">0.95</span>
+<span class="hljs-comment"># define whether the learning rate schedule is a staircase shape</span>
+staircase=<span class="hljs-literal">True</span>
+<span class="hljs-comment"># define the decay step of the decay scheduler (in this example the lr is decreased at every 2 steps)</span>
+decay_steps = <span class="hljs-number">2</span>
+
+<span class="hljs-comment"># create the decay scheduler, the schedule of lr becomes lr_init * (decay_rate ^ (step // decay_steps) )</span>
+lr = opt.ExponentialDecay(<span class="hljs-number">0.1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">0.5</span>, <span class="hljs-literal">True</span>)
+<span class="hljs-comment"># Use the lr to create an optimizer</span>
+sgd = opt.SGD(lr=lr, momentum=<span class="hljs-number">0.9</span>, weight_decay=<span class="hljs-number">0.0001</span>)
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="使用模型api中的优化器"></a><a href="#使用模型api中的优化器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>当我们创建模型时,我们需要将优化器附加到模型上:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># create a CNN using the Model API</span>
+model = CNN()
+
+<span class="hljs-comment"># initialize optimizer and attach it to the model</span>
+sgd = opt.SGD(lr=<span class="hljs-number">0.005</span>, momentum=<span class="hljs-number">0.9</span>, weight_decay=<span class="hljs-number">1e-5</span>)
+model.set_optimizer(sgd)
+</code></pre>
+<p>然后,当我们调用模型时,它会运行利用优化器的 <code>train_one_batch</code> 方法。</p>
+<p>因此,一个迭代循环优化模型的例子是:</p>
+<pre><code class="hljs css language-python"><span class="hljs-keyword">for</span> b <span class="hljs-keyword">in</span> range(num_train_batch):
+ <span class="hljs-comment"># generate the next mini-batch</span>
+ x, y = ...
+
+ <span class="hljs-comment"># Copy the data into input tensors</span>
+ tx.copy_from_numpy(x)
+ ty.copy_from_numpy(y)
+
+ <span class="hljs-comment"># Training with one batch</span>
+ out, loss = model(tx, ty)
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/autograd"><span class="arrow-prev">← </span><span>Autograd</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/graph"><span>Model</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#创建一个优化器">创建一个优化器</a></li><li><a href="#创建一个衰减调度器">创建一个衰减调度器</a></li><li><a href="#使用模型api中的优化器">使用模型API中的优化器</a></li [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
+ if (e.keyCode === 191) {
+ const search = document.getElementById('search_input_react');
+ search && search.focus();
+ }
+ });
+ </script><script>
+ var search = docsearch({
+
+ apiKey: '45202133606c0b5fa6d21cddc4725dd8',
+ indexName: 'apache_singa',
+ inputSelector: '#search_input_react',
+ algoliaOptions: {"facetFilters":["language:en","version:3.0.0"]}
+ });
+ </script></body></html>
\ No newline at end of file
diff --git a/content/docs/3.2.0_Chinese/security.html b/content/docs/3.2.0_Chinese/security.html
new file mode 100644
index 0000000..295e169
--- /dev/null
+++ b/content/docs/3.2.0_Chinese/security.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Security · Apache SINGA</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owners [...]
+ document.addEventListener('DOMContentLoaded', function() {
+ addBackToTop(
+ {"zIndex":100}
+ )
+ });
+ </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/singa.png" alt="Apache SINGA"/></a><a href="/versions"><h3>3.2.0_Chinese</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-sit [...]
+ var coll = document.getElementsByClassName('collapsible');
+ var checkActiveCategory = true;
+ for (var i = 0; i < coll.length; i++) {
+ var links = coll[i].nextElementSibling.getElementsByTagName('*');
+ if (checkActiveCategory){
+ for (var j = 0; j < links.length; j++) {
+ if (links[j].classList.contains('navListItemActive')){
+ coll[i].nextElementSibling.classList.toggle('hide');
+ coll[i].childNodes[1].classList.toggle('rotate');
+ checkActiveCategory = false;
+ break;
+ }
+ }
+ }
+
+ coll[i].addEventListener('click', function() {
+ var arrow = this.childNodes[1];
+ arrow.classList.toggle('rotate');
+ var content = this.nextElementSibling;
+ content.classList.toggle('hide');
+ });
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ createToggler('#navToggler', '#docsNav', 'docsSliderActive');
+ createToggler('#tocToggler', 'body', 'tocActive');
+
+ var headings = document.querySelector('.toc-headings');
+ headings && headings.addEventListener('click', function(event) {
+ var el = event.target;
+ while(el !== headings){
+ if (el.tagName === 'A') {
+ document.body.classList.remove('tocActive');
+ break;
+ } else{
+ el = el.parentNode;
+ }
+ }
+ }, false);
+
+ function createToggler(togglerSelector, targetSelector, className) {
+ var toggler = document.querySelector(togglerSelector);
+ var target = document.querySelector(targetSelector);
+
+ if (!toggler) {
+ return;
+ }
+
+ toggler.onclick = function(event) {
+ event.preventDefault();
+
+ target.classList.toggle(className);
+ };
+ }
+ });
+ </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/singa-doc/blob/master/docs-site/docs/security.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">Security</h1></header><article><div><span><!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license [...]
+<p>用户可以向<a href="mailto:security@singa.apache.org">SINGA安全团队邮件列表</a>报告安全漏洞。</p>
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/3.2.0_Chinese/issue-tracking"><span class="arrow-prev">← </span><span>Issue Tracking</span></a><a class="docs-next button" href="/docs/3.2.0_Chinese/team-list"><span>The SINGA Team</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/singa-logo [...]
+ The Apache Software Foundation. All rights reserved.
+ Apache SINGA, Apache, the Apache feather logo, and
+ the Apache SINGA project logos are trademarks of The
+ Apache Software Foundation. All other marks mentioned
+ may be trademarks or registered trademarks of their
+ respective owners.</section></div></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter- [...]
+ document.addEventListener('keyup', function(e) {
+ if (e.target !== document.body) {
+ return;
+ }
+ // keyCode for '/' (slash)
... 2739 lines suppressed ...