Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
68880f84
提交
68880f84
authored
2月 17, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update opts using values_eq_approx to the new interface.
上级
2f739edc
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
16 行增加
和
16 行删除
+16
-16
extra_ops.py
theano/sandbox/cuda/extra_ops.py
+1
-1
opt.py
theano/sandbox/cuda/opt.py
+4
-4
nnet.py
theano/tensor/nnet/nnet.py
+2
-2
sigm.py
theano/tensor/nnet/sigm.py
+2
-2
opt.py
theano/tensor/opt.py
+7
-7
没有找到文件。
theano/sandbox/cuda/extra_ops.py
浏览文件 @
68880f84
...
@@ -460,5 +460,5 @@ def use_gpu_cumsum(node):
...
@@ -460,5 +460,5 @@ def use_gpu_cumsum(node):
axis
=
0
axis
=
0
ret
=
host_from_gpu
(
GpuCumsum
(
axis
)(
x
))
ret
=
host_from_gpu
(
GpuCumsum
(
axis
)(
x
))
ret
.
values_eq_approx
=
values_eq_approx_high_tol
ret
.
tag
.
values_eq_approx
=
values_eq_approx_high_tol
return
[
ret
]
return
[
ret
]
theano/sandbox/cuda/opt.py
浏览文件 @
68880f84
...
@@ -1550,7 +1550,7 @@ def local_gpu_conv(node):
...
@@ -1550,7 +1550,7 @@ def local_gpu_conv(node):
gpu_from_host
(
kern
))
gpu_from_host
(
kern
))
out
=
tensor
.
patternbroadcast
(
out
,
out
=
tensor
.
patternbroadcast
(
out
,
node
.
outputs
[
0
]
.
broadcastable
)
node
.
outputs
[
0
]
.
broadcastable
)
out
.
values_eq_approx
=
values_eq_approx_high_tol
out
.
tag
.
values_eq_approx
=
values_eq_approx_high_tol
# in some case the ConvOp broadcast the last 2 dimensions
# in some case the ConvOp broadcast the last 2 dimensions
# differently then the gpu ConvOp
# differently then the gpu ConvOp
return
[
out
]
return
[
out
]
...
@@ -1569,7 +1569,7 @@ def local_gpu_conv(node):
...
@@ -1569,7 +1569,7 @@ def local_gpu_conv(node):
out
=
tensor
.
patternbroadcast
(
out
=
tensor
.
patternbroadcast
(
host_from_gpu
(
out
),
host_from_gpu
(
out
),
node
.
outputs
[
0
]
.
broadcastable
)
node
.
outputs
[
0
]
.
broadcastable
)
out
.
values_eq_approx
=
values_eq_approx_high_tol
out
.
tag
.
values_eq_approx
=
values_eq_approx_high_tol
# in some case the ConvOp broadcast the last 2 dimensions
# in some case the ConvOp broadcast the last 2 dimensions
# differently then the gpu ConvOp
# differently then the gpu ConvOp
return
[
out
]
return
[
out
]
...
@@ -2697,7 +2697,7 @@ def local_conv2d_gpu_conv(node):
...
@@ -2697,7 +2697,7 @@ def local_conv2d_gpu_conv(node):
# out is on the GPU because both inputs are.
# out is on the GPU because both inputs are.
out
=
theano
.
tensor
.
patternbroadcast
(
out
,
out
=
theano
.
tensor
.
patternbroadcast
(
out
,
node
.
outputs
[
0
]
.
broadcastable
)
node
.
outputs
[
0
]
.
broadcastable
)
out
.
values_eq_approx
=
values_eq_approx_high_tol
out
.
tag
.
values_eq_approx
=
values_eq_approx_high_tol
return
[
out
]
return
[
out
]
if
isinstance
(
node
.
op
,
BaseAbstractConv2d
):
if
isinstance
(
node
.
op
,
BaseAbstractConv2d
):
...
@@ -2724,7 +2724,7 @@ def local_conv2d_gpu_conv(node):
...
@@ -2724,7 +2724,7 @@ def local_conv2d_gpu_conv(node):
out
=
theano
.
tensor
.
patternbroadcast
(
out
=
theano
.
tensor
.
patternbroadcast
(
out
,
out
,
node
.
outputs
[
0
]
.
broadcastable
)
node
.
outputs
[
0
]
.
broadcastable
)
out
.
values_eq_approx
=
values_eq_approx_high_tol
out
.
tag
.
values_eq_approx
=
values_eq_approx_high_tol
# If the original output was on CPU, we have to transfer it
# If the original output was on CPU, we have to transfer it
if
isinstance
(
node
.
outputs
[
0
]
.
type
,
tensor
.
TensorType
):
if
isinstance
(
node
.
outputs
[
0
]
.
type
,
tensor
.
TensorType
):
return
[
tensor
.
as_tensor_variable
(
out
)]
return
[
tensor
.
as_tensor_variable
(
out
)]
...
...
theano/tensor/nnet/nnet.py
浏览文件 @
68880f84
...
@@ -752,7 +752,7 @@ def local_logsoftmax(node):
...
@@ -752,7 +752,7 @@ def local_logsoftmax(node):
inVars
=
node
.
inputs
[
0
]
.
owner
.
inputs
[
0
]
inVars
=
node
.
inputs
[
0
]
.
owner
.
inputs
[
0
]
new_op
=
LogSoftmax
()
new_op
=
LogSoftmax
()
ret
=
new_op
(
inVars
)
ret
=
new_op
(
inVars
)
ret
.
values_eq_approx
=
values_eq_approx_remove_inf
ret
.
tag
.
values_eq_approx
=
values_eq_approx_remove_inf
return
[
ret
]
return
[
ret
]
...
@@ -787,7 +787,7 @@ def local_logsoftmax_grad(node):
...
@@ -787,7 +787,7 @@ def local_logsoftmax_grad(node):
grads
=
tensor
.
alloc
(
grads
,
grads
.
shape
[
0
],
sm
.
shape
[
1
])
grads
=
tensor
.
alloc
(
grads
,
grads
.
shape
[
0
],
sm
.
shape
[
1
])
ret
=
grads
-
tensor
.
sum
(
grads
,
axis
=
1
,
keepdims
=
True
)
*
sm
ret
=
grads
-
tensor
.
sum
(
grads
,
axis
=
1
,
keepdims
=
True
)
*
sm
ret
.
values_eq_approx
=
values_eq_approx_remove_nan
ret
.
tag
.
values_eq_approx
=
values_eq_approx_remove_nan
return
[
ret
]
return
[
ret
]
...
...
theano/tensor/nnet/sigm.py
浏览文件 @
68880f84
...
@@ -269,7 +269,7 @@ def local_ultra_fast_sigmoid(node):
...
@@ -269,7 +269,7 @@ def local_ultra_fast_sigmoid(node):
# Other test could fail without good reason.
# Other test could fail without good reason.
return
tensor
.
TensorType
.
values_eq_approx
(
a
,
b
,
atol
=
0.02
)
return
tensor
.
TensorType
.
values_eq_approx
(
a
,
b
,
atol
=
0.02
)
# Let DebugMode know that there this opt approx the values.
# Let DebugMode know that there this opt approx the values.
out
.
values_eq_approx
=
values_eq_approx_remove_low_prec
out
.
tag
.
values_eq_approx
=
values_eq_approx_remove_low_prec
return
[
out
]
return
[
out
]
theano
.
compile
.
optdb
[
'uncanonicalize'
]
.
register
(
"local_ultra_fast_sigmoid"
,
theano
.
compile
.
optdb
[
'uncanonicalize'
]
.
register
(
"local_ultra_fast_sigmoid"
,
local_ultra_fast_sigmoid
)
local_ultra_fast_sigmoid
)
...
@@ -308,7 +308,7 @@ def local_hard_sigmoid(node):
...
@@ -308,7 +308,7 @@ def local_hard_sigmoid(node):
# Other test could fail without good reason.
# Other test could fail without good reason.
return
tensor
.
TensorType
.
values_eq_approx
(
a
,
b
,
atol
=
0.1
)
return
tensor
.
TensorType
.
values_eq_approx
(
a
,
b
,
atol
=
0.1
)
# Let DebugMode know that there this opt approx the values.
# Let DebugMode know that there this opt approx the values.
out
.
values_eq_approx
=
values_eq_approx_remove_low_prec
out
.
tag
.
values_eq_approx
=
values_eq_approx_remove_low_prec
return
[
out
]
return
[
out
]
theano
.
compile
.
optdb
[
'uncanonicalize'
]
.
register
(
"local_hard_sigmoid"
,
theano
.
compile
.
optdb
[
'uncanonicalize'
]
.
register
(
"local_hard_sigmoid"
,
local_hard_sigmoid
)
local_hard_sigmoid
)
...
...
theano/tensor/opt.py
浏览文件 @
68880f84
...
@@ -3705,7 +3705,7 @@ def local_mul_switch_sink(node):
...
@@ -3705,7 +3705,7 @@ def local_mul_switch_sink(node):
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
0
,
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
0
,
fmul
)]
fmul
)]
fct
[
0
]
.
values_eq_approx
=
values_eq_approx_remove_nan
fct
[
0
]
.
tag
.
values_eq_approx
=
values_eq_approx_remove_nan
# Copy over stacktrace for switch op from both previous
# Copy over stacktrace for switch op from both previous
# elementwise multiplication op and previous switch op,
# elementwise multiplication op and previous switch op,
...
@@ -3729,7 +3729,7 @@ def local_mul_switch_sink(node):
...
@@ -3729,7 +3729,7 @@ def local_mul_switch_sink(node):
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
fmul
,
0
)]
fmul
,
0
)]
fct
[
0
]
.
values_eq_approx
=
values_eq_approx_remove_nan
fct
[
0
]
.
tag
.
values_eq_approx
=
values_eq_approx_remove_nan
# Copy over stacktrace for switch op from both previous
# Copy over stacktrace for switch op from both previous
# elementwise multiplication op and previous switch op,
# elementwise multiplication op and previous switch op,
...
@@ -3773,7 +3773,7 @@ def local_div_switch_sink(node):
...
@@ -3773,7 +3773,7 @@ def local_div_switch_sink(node):
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
0
,
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
0
,
fdiv
)]
fdiv
)]
fct
[
0
]
.
values_eq_approx
=
values_eq_approx_remove_nan
fct
[
0
]
.
tag
.
values_eq_approx
=
values_eq_approx_remove_nan
# Copy over stacktrace for switch op from both previous
# Copy over stacktrace for switch op from both previous
# elementwise division op and previous switch op,
# elementwise division op and previous switch op,
...
@@ -3795,7 +3795,7 @@ def local_div_switch_sink(node):
...
@@ -3795,7 +3795,7 @@ def local_div_switch_sink(node):
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
fct
=
[
T
.
switch
(
switch
.
inputs
[
0
],
fdiv
,
0
)]
fdiv
,
0
)]
fct
[
0
]
.
values_eq_approx
=
values_eq_approx_remove_nan
fct
[
0
]
.
tag
.
values_eq_approx
=
values_eq_approx_remove_nan
# Copy over stacktrace for switch op from both previous
# Copy over stacktrace for switch op from both previous
# elementwise division op and previous switch op,
# elementwise division op and previous switch op,
...
@@ -5599,7 +5599,7 @@ def local_log_add(node):
...
@@ -5599,7 +5599,7 @@ def local_log_add(node):
ret
=
max_pre
+
T
.
log1p
(
T
.
exp
(
T
.
add
(
*
[
p
-
max_pre
ret
=
max_pre
+
T
.
log1p
(
T
.
exp
(
T
.
add
(
*
[
p
-
max_pre
for
p
in
pre_exp
])))
for
p
in
pre_exp
])))
ret
.
values_eq_approx
=
values_eq_approx_remove_inf
ret
.
tag
.
values_eq_approx
=
values_eq_approx_remove_inf
return
[
ret
]
return
[
ret
]
...
@@ -6023,7 +6023,7 @@ def local_log_erfc(node):
...
@@ -6023,7 +6023,7 @@ def local_log_erfc(node):
threshold
=
26.641747557
threshold
=
26.641747557
ret
=
T
.
switch
(
x
<
threshold
,
node
.
outputs
[
0
],
stab_value
)
ret
=
T
.
switch
(
x
<
threshold
,
node
.
outputs
[
0
],
stab_value
)
ret
.
values_eq_approx
=
values_eq_approx_remove_inf
ret
.
tag
.
values_eq_approx
=
values_eq_approx_remove_inf
return
[
ret
]
return
[
ret
]
...
@@ -6175,7 +6175,7 @@ def local_grad_log_erfc_neg(node):
...
@@ -6175,7 +6175,7 @@ def local_grad_log_erfc_neg(node):
ret
=
T
.
switch
(
x
<
threshold
,
true_div_no_mul
,
stab_value
)
ret
=
T
.
switch
(
x
<
threshold
,
true_div_no_mul
,
stab_value
)
if
y
:
if
y
:
ret
=
T
.
mul
(
ret
,
*
y
)
ret
=
T
.
mul
(
ret
,
*
y
)
ret
.
values_eq_approx
=
values_eq_approx_remove_inf_nan
ret
.
tag
.
values_eq_approx
=
values_eq_approx_remove_inf_nan
return
[
ret
]
return
[
ret
]
"""
"""
The libm used for the test is amdlibm
The libm used for the test is amdlibm
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论