Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
593b4d5b
提交
593b4d5b
authored
9月 17, 2014
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2048 from daemonmaker/master
Moved general FAQ to top-level index page.
上级
c78d8db1
c44ed675
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
69 行增加
和
1 行删除
+69
-1
faq.txt
doc/faq.txt
+68
-0
index.txt
doc/index.txt
+1
-0
index.txt
doc/tutorial/index.txt
+0
-1
没有找到文件。
doc/
tutorial/
faq.txt
→
doc/faq.txt
浏览文件 @
593b4d5b
...
@@ -39,6 +39,30 @@ CPUs. In fact, Theano asks g++ what are the equivalent flags it uses, and re-use
...
@@ -39,6 +39,30 @@ CPUs. In fact, Theano asks g++ what are the equivalent flags it uses, and re-use
them directly.
them directly.
Faster Theano Function Compilation
----------------------------------
Theano function compilation can be time consuming. It can be sped up by setting
the flag ``mode=FAST_COMPILE`` which instructs Theano to skip most
optimizations and disables the generation of any c/cuda code. This is useful
for quickly testing a simple idea.
If c/cuda code is necessary, as when using a GPU, the flag
``optimizer=fast_compile`` can be used instead. It instructs Theano to skip time
consuming optimizations but still generate c/cuda code. To get the most out of
this flag requires using a development version of Theano instead of the latest
release (0.6).
Similarly using the flag ``optimizer_excluding=inplace`` will speed up
compilation by preventing optimizations that replace operations with a version
that reuses memory where it will not negatively impact the integrity of the
operation. Such optimizations can be time consuming. However using this flag will
result in greater memory usage because space must be allocated for the results
which would be unnecessary otherwise. In short, using this flag will speed up
compilation but it will also use more memory because
``optimizer_excluding=inplace`` excludes inplace optimizations resulting
in a trade off between speed of compilation and memory usage.
Faster Theano function
Faster Theano function
----------------------
----------------------
...
@@ -62,12 +86,56 @@ can disable it by setting ``f.trust_input`` to True.
...
@@ -62,12 +86,56 @@ can disable it by setting ``f.trust_input`` to True.
Make sure the types of arguments you provide match those defined when
Make sure the types of arguments you provide match those defined when
the function was compiled.
the function was compiled.
For example, replace the following
.. code-block:: python
x = theano.tensor.scalar('x')
f = function([x], x + 1.)
f(10.)
with
.. code-block:: python
x = theano.tensor.scalar('x')
f = function([x], x + 1.)
f.trust_input = True
f(numpy.array([10.], dtype=theano.config.floatX))
Also, for small Theano functions, you can remove more Python overhead by
Also, for small Theano functions, you can remove more Python overhead by
making a Theano function that does not take any input. You can use shared
making a Theano function that does not take any input. You can use shared
variables to achieve this. Then you can call it like this: ``f.fn()`` or
variables to achieve this. Then you can call it like this: ``f.fn()`` or
``f.fn(n_calls=N)`` to speed it up. In the last case, only the last
``f.fn(n_calls=N)`` to speed it up. In the last case, only the last
function output (out of N calls) is returned.
function output (out of N calls) is returned.
Out of memory... but not really
-------------------------------
Occasionally Theano may fail to allocate memory when there appears to be more
than enough reporting:
Error allocating X bytes of device memory (out of memory). Driver report Y
bytes free and Z total.
where X is far less than Y and Z (i.e. X << Y < Z).
This scenario arises when an operation requires allocation of a large contiguous
block of memory but no blocks of sufficient size are available.
GPUs do not have virtual memory and as such all allocations must be assigned to
a continuous memory region. CPUs do not have this limitation because or their
support for virtual memory. Multiple allocations on a GPU can result in memory
fragmentation which can makes it more difficult to find contiguous regions
of memory of sufficient size during subsequent memory allocations.
A known example is related to writing data to shared variables. When updating a
shared variable Theano will allocate new space if the size of the data does not
match the size of the space already assigned to the variable. This can lead to
memory fragmentation which means that a continugous block of memory of
sufficient capacity may not be available even if the free memory overall is
large enough.
Related Projects
Related Projects
----------------
----------------
...
...
doc/index.txt
浏览文件 @
593b4d5b
...
@@ -112,6 +112,7 @@ Roughly in order of what you'll want to check out:
...
@@ -112,6 +112,7 @@ Roughly in order of what you'll want to check out:
* :ref:`introduction` -- What is Theano?
* :ref:`introduction` -- What is Theano?
* :ref:`tutorial` -- Learn the basics.
* :ref:`tutorial` -- Learn the basics.
* :ref:`libdoc` -- Theano's functionality, module by module.
* :ref:`libdoc` -- Theano's functionality, module by module.
* :ref:`faq` -- A set of commonly asked questions.
* :ref:`optimizations` -- Guide to Theano's graph optimizations.
* :ref:`optimizations` -- Guide to Theano's graph optimizations.
* :ref:`extending` -- Learn to add a Type, Op, or graph optimization.
* :ref:`extending` -- Learn to add a Type, Op, or graph optimization.
* :ref:`dev_start_guide` -- How to contribute code to Theano.
* :ref:`dev_start_guide` -- How to contribute code to Theano.
...
...
doc/tutorial/index.txt
浏览文件 @
593b4d5b
...
@@ -43,6 +43,5 @@ you out.
...
@@ -43,6 +43,5 @@ you out.
debug_faq
debug_faq
profiling
profiling
extending_theano
extending_theano
faq
python-memory-management
python-memory-management
multi_cores
multi_cores
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论