Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
bc0f3a93
提交
bc0f3a93
authored
8月 30, 2017
作者:
Reyhane Askari
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
removed with_stack_trace and other small changes
上级
5d23dc6f
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
11 行增加
和
42 行删除
+11
-42
opt.py
theano/gof/opt.py
+1
-29
basic_ops.py
theano/gpuarray/basic_ops.py
+3
-3
blas.py
theano/gpuarray/blas.py
+3
-6
opt.py
theano/gpuarray/opt.py
+2
-2
opt_uncanonicalize.py
theano/tensor/opt_uncanonicalize.py
+2
-2
没有找到文件。
theano/gof/opt.py
浏览文件 @
bc0f3a93
...
@@ -2903,7 +2903,7 @@ def pre_greedy_local_optimizer(list_optimizations, out):
...
@@ -2903,7 +2903,7 @@ def pre_greedy_local_optimizer(list_optimizations, out):
def
copy_stack_trace
(
from_var
,
to_var
):
def
copy_stack_trace
(
from_var
,
to_var
):
"""
"""
Copies the stack trace from one or more tensor variables to
Copies the stack trace from one or more tensor variables to
one or more tensor variables.
one or more tensor variables
and returns the destination variables
.
Parameters
Parameters
----------
----------
...
@@ -2947,34 +2947,6 @@ def copy_stack_trace(from_var, to_var):
...
@@ -2947,34 +2947,6 @@ def copy_stack_trace(from_var, to_var):
# Copy over stack traces from from_var to each variable to
# Copy over stack traces from from_var to each variable to
# to_var, including the stack_trace of the to_var before
# to_var, including the stack_trace of the to_var before
to_var
.
tag
.
trace
=
getattr
(
to_var
.
tag
,
'trace'
,
[])
+
tr
to_var
.
tag
.
trace
=
getattr
(
to_var
.
tag
,
'trace'
,
[])
+
tr
def
with_stack_trace
(
from_var
,
to_var
):
"""
Copies the stack trace from one or more tensor variables to
one or more tensor variables and returns the destination variables.
Parameters
----------
from_var
Tensor variable or list of tensor variables to copy stack traces from.
to_var
Tensor variable or list of tensor variables to copy stack traces to.
Returns
-------
tensor variable or list of tensor variables
`to_var`, augmented with the stack traces from `from_var`.
Notes
-----
The stacktrace is assumed to be of the form of a list of lists
of tuples. Each tuple contains the filename, line number, function name
and so on. Each list of tuples contains the truples belonging to a
particular variable.
"""
copy_stack_trace
(
from_var
,
to_var
)
return
to_var
return
to_var
...
...
theano/gpuarray/basic_ops.py
浏览文件 @
bc0f3a93
...
@@ -15,7 +15,7 @@ from theano.tensor.basic import (
...
@@ -15,7 +15,7 @@ from theano.tensor.basic import (
from
theano.gof
import
HideC
,
COp
,
ParamsType
from
theano.gof
import
HideC
,
COp
,
ParamsType
from
theano.gof.utils
import
MethodNotDefined
from
theano.gof.utils
import
MethodNotDefined
from
theano.gof.opt
import
with
_stack_trace
from
theano.gof.opt
import
copy
_stack_trace
from
collections
import
deque
from
collections
import
deque
...
@@ -76,11 +76,11 @@ def as_gpuarray_variable(x, context_name):
...
@@ -76,11 +76,11 @@ def as_gpuarray_variable(x, context_name):
# If we couldn't deal with transfers, then maybe it's a tensor
# If we couldn't deal with transfers, then maybe it's a tensor
if
isinstance
(
x
.
type
,
tensor
.
TensorType
):
if
isinstance
(
x
.
type
,
tensor
.
TensorType
):
return
with
_stack_trace
(
x
,
GpuFromHost
(
context_name
)(
x
))
return
copy
_stack_trace
(
x
,
GpuFromHost
(
context_name
)(
x
))
# Try _as_GpuArrayVariable if possible
# Try _as_GpuArrayVariable if possible
if
hasattr
(
x
,
'_as_GpuArrayVariable'
):
if
hasattr
(
x
,
'_as_GpuArrayVariable'
):
return
with
_stack_trace
(
x
,
x
.
_as_GpuArrayVariable
(
context_name
))
return
copy
_stack_trace
(
x
,
x
.
_as_GpuArrayVariable
(
context_name
))
# If it didn't work try for a constant
# If it didn't work try for a constant
ctx
=
get_context
(
context_name
)
ctx
=
get_context
(
context_name
)
...
...
theano/gpuarray/blas.py
浏览文件 @
bc0f3a93
...
@@ -1831,20 +1831,17 @@ class GpuCorr3dMM_gradInputs(BaseGpuCorr3dMM):
...
@@ -1831,20 +1831,17 @@ class GpuCorr3dMM_gradInputs(BaseGpuCorr3dMM):
@inplace_allocempty
(
GpuGemv
,
0
)
@inplace_allocempty
(
GpuGemv
,
0
)
def
local_inplace_gpuagemv
(
node
,
inputs
):
def
local_inplace_gpuagemv
(
node
,
inputs
):
with
inherit_stack_trace
(
node
.
outputs
):
return
[
gpugemv_inplace
(
*
inputs
)]
return
[
gpugemv_inplace
(
*
inputs
)]
@inplace_allocempty
(
GpuGemm
,
0
)
@inplace_allocempty
(
GpuGemm
,
0
)
def
local_inplace_gpuagemm
(
node
,
inputs
):
def
local_inplace_gpuagemm
(
node
,
inputs
):
with
inherit_stack_trace
(
node
.
outputs
):
return
[
gpugemm_inplace
(
*
inputs
)]
return
[
gpugemm_inplace
(
*
inputs
)]
@inplace_allocempty
(
GpuGer
,
0
)
@inplace_allocempty
(
GpuGer
,
0
)
def
local_inplace_gpuager
(
node
,
inputs
):
def
local_inplace_gpuager
(
node
,
inputs
):
with
inherit_stack_trace
(
node
.
outputs
):
return
[
gpuger_inplace
(
*
inputs
)]
return
[
gpuger_inplace
(
*
inputs
)]
@inplace_allocempty
(
GpuGemmBatch
,
0
)
@inplace_allocempty
(
GpuGemmBatch
,
0
)
...
...
theano/gpuarray/opt.py
浏览文件 @
bc0f3a93
...
@@ -16,7 +16,7 @@ from theano.gof import (local_optimizer, EquilibriumDB, TopoOptimizer,
...
@@ -16,7 +16,7 @@ from theano.gof import (local_optimizer, EquilibriumDB, TopoOptimizer,
LocalGroupDB
,
LocalGroupDB
,
SequenceDB
,
Optimizer
,
DB
,
toolbox
,
graph
)
SequenceDB
,
Optimizer
,
DB
,
toolbox
,
graph
)
from
theano.gof.opt
import
(
LocalMetaOptimizer
,
copy_stack_trace
,
from
theano.gof.opt
import
(
LocalMetaOptimizer
,
copy_stack_trace
,
with_stack_trace
,
inherit_stack_trace
)
inherit_stack_trace
)
from
theano.ifelse
import
IfElse
from
theano.ifelse
import
IfElse
from
theano.misc.ordered_set
import
OrderedSet
from
theano.misc.ordered_set
import
OrderedSet
...
@@ -468,7 +468,7 @@ class GraphToGPU(Optimizer):
...
@@ -468,7 +468,7 @@ class GraphToGPU(Optimizer):
new_o
.
owner
.
inputs
[
0
]
.
type
==
o
.
type
):
new_o
.
owner
.
inputs
[
0
]
.
type
==
o
.
type
):
new_o
=
new_o
.
owner
.
inputs
[
0
]
new_o
=
new_o
.
owner
.
inputs
[
0
]
else
:
else
:
new_o
=
with
_stack_trace
(
o
,
safe_to_cpu
(
new_o
))
new_o
=
copy
_stack_trace
(
o
,
safe_to_cpu
(
new_o
))
new_nodes
.
append
(
new_o
)
new_nodes
.
append
(
new_o
)
fgraph
.
replace_all_validate
(
zip
(
fgraph
.
outputs
,
new_nodes
),
fgraph
.
replace_all_validate
(
zip
(
fgraph
.
outputs
,
new_nodes
),
reason
=
self
.
__class__
.
__name__
)
reason
=
self
.
__class__
.
__name__
)
...
...
theano/tensor/opt_uncanonicalize.py
浏览文件 @
bc0f3a93
...
@@ -43,7 +43,7 @@ from theano.tensor import DimShuffle, Subtensor
...
@@ -43,7 +43,7 @@ from theano.tensor import DimShuffle, Subtensor
from
theano.tensor.opt
import
register_uncanonicalize
from
theano.tensor.opt
import
register_uncanonicalize
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
theano.gof.opt
import
copy_stack_trace
,
with_stack_trace
from
theano.gof.opt
import
copy_stack_trace
_logger
=
logging
.
getLogger
(
'theano.tensor.opt'
)
_logger
=
logging
.
getLogger
(
'theano.tensor.opt'
)
...
@@ -89,7 +89,7 @@ def local_max_to_min(node):
...
@@ -89,7 +89,7 @@ def local_max_to_min(node):
neg
=
max
.
owner
.
inputs
[
0
]
neg
=
max
.
owner
.
inputs
[
0
]
if
neg
.
owner
and
neg
.
owner
.
op
==
T
.
neg
:
if
neg
.
owner
and
neg
.
owner
.
op
==
T
.
neg
:
new
=
CAReduce
(
scal
.
minimum
,
max
.
owner
.
op
.
axis
)(
neg
.
owner
.
inputs
[
0
])
new
=
CAReduce
(
scal
.
minimum
,
max
.
owner
.
op
.
axis
)(
neg
.
owner
.
inputs
[
0
])
return
[
with
_stack_trace
(
node
.
outputs
[
0
],
new
)]
return
[
copy
_stack_trace
(
node
.
outputs
[
0
],
new
)]
return
False
return
False
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论