Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
14dad2b2
提交
14dad2b2
authored
7月 23, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1987 from nouiz/doc
Doc
上级
dc0ad48c
73dbe1bd
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
61 行增加
和
3 行删除
+61
-3
graphstructures.txt
doc/extending/graphstructures.txt
+56
-0
nnet.py
theano/sandbox/cuda/nnet.py
+5
-3
没有找到文件。
doc/extending/graphstructures.txt
浏览文件 @
14dad2b2
...
...
@@ -371,3 +371,59 @@ A constant does not need to be specified in a :func:`function
<function.function>`'s list
of inputs. In fact, doing so will raise an exception.
Graph Structures Extension
==========================
When we start the compilation of a Theano function, we compute some
extra information. This section describes a portion of the information
that is made available. Not everything is described, so email
theano-dev if you need something that is missing.
The graph gets cloned at the start of compilation, so modifications done
during compilation won't affect the user graph.
Each variable receives a new field called clients. It is a list with
references to every place in the graph where this variable is used. If
its length is 0, it means the variable isn't used. Each place where it
is used is described by a tuple of 2 elements. There are two types of
pairs:
- The first element is an Apply node.
- The first element is the string "output". It means the
function outputs this variable.
In both types of pairs, the second element of the tuple is an index,
such that: ``var.clients[*][0].inputs[index]`` or
``fgraph.outputs[index]`` is that variable.
.. code-block:: python
import theano
v = theano.tensor.vector()
f = theano.function([v], (v+1).sum())
theano.printing.debugprint(f)
# Sorted list of all nodes in the compiled graph.
topo = f.maker.fgraph.toposort()
topo[0].outputs[0].clients
# [(Sum(Elemwise{add,no_inplace}.0), 0)]
topo[1].outputs[0].clients
# [('output', 0)]
# An internal variable
var = topo[0].outputs[0]
client = var.clients[0]
client
# (Sum(Elemwise{add,no_inplace}.0), 0)
type(clients[0][0])
# <class 'theano.gof.graph.Apply'>
assert client[0].inputs[client[1]] is var
# An output of the graph
var = topo[1].outputs[0]
client = var.clients[0]
client
# ('output', 0)
assert f.maker.fgraph.outputs[client[1]] is var
theano/sandbox/cuda/nnet.py
浏览文件 @
14dad2b2
...
...
@@ -549,7 +549,7 @@ class GpuSoftmaxWithBias(GpuOp):
def
c_code_cache_version
(
self
):
#return ()
return
(
8
,)
+
inline_softmax
.
code_version
return
(
9
,)
+
inline_softmax
.
code_version
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
x
,
b
=
inp
...
...
@@ -649,9 +649,11 @@ class GpuSoftmaxWithBias(GpuOp):
if( cudaSuccess != err)
{
PyErr_Format(PyExc_RuntimeError,
"Cuda error:
%%
s:
%%
s.
\\
n",
"Cuda error:
%%
s:
%%
s. n_blocks=
%%
d,"
" n_threads=
%%
d, n_shared_bytes=
%%
d
\\
n",
"kSoftmaxWithBias_
%(nodename)
s",
cudaGetErrorString(err));
cudaGetErrorString(err),
n_blocks, n_threads, n_shared_bytes);
%(fail)
s;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论