Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2b480e4a
提交
2b480e4a
authored
11月 09, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tutorial - initial commit of aliasing file
上级
2fcee654
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
70 行增加
和
0 行删除
+70
-0
aliasing.txt
doc/tutorial/aliasing.txt
+70
-0
没有找到文件。
doc/tutorial/aliasing.txt
0 → 100644
浏览文件 @
2b480e4a
.. _basictutaliasing:
===============
Memory Aliasing
===============
The aggressive reuse of memory is one of the ways Theano makes code fast, and
it's important for the correctness and speed of your program that you understand
which buffers Theano might alias to which others.
This file describes the principles for how Theano treats memory, and explains
when you might want to change the default behaviour of some functions and
methods for faster performance.
The memory model: 2 spaces
==========================
There are some simple principles that guide Theano's treatment of memory. The
main idea is that there is a pool of memory managed by Theano, and Theano tracks
changes to values in that pool.
1. Theano manages its own memory space, which typically does not overlap with
the memory of normal python variables that non-theano code creates.
2. Theano's memory space includes the buffers allocated to store shared
variables and the temporaries used to evaluate Functions.
3. Physically, Theano's memory space may be spread across the host, a GPU
device(s), and in the future may even include objects on a remote machine.
4. The memory allocated for a shared variable buffer is unique: it is never
aliased to another shared variable.
5. Theano's managed memory is constant while Theano Functions are not running
and theano library code is not running.
6. The default behaviour of Function is to return user-space values for
outputs, and to expect user-space values for inputs.
The distinction between Theano-managed memory and user-managed memory can be
broken down by some theano functions (e.g. In, Out,shared, get_value)) by using
a ``borrow=True`` flag. This can make those methods faster (by avoiding copy
operations) at the expense of risking subtle bugs in the overall program (by
aliasing memory).
The rest of this section is aimed at helping you to understand when it is safe
to use the ``borrow=True`` argument and reap the benefit of faster code.
Borrowing when creating shared variables
========================================
TODO
Borrowing when construction Function objects
============================================
TODO
Borrowing when accessing value of shared variable
=================================================
TODO
Describe interaction with 'raw' flag as well.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论