Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f02a596e
提交
f02a596e
authored
9月 10, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2101 from nouiz/mixed
Mixed
上级
ff91a554
d53dd639
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
28 行增加
和
25 行删除
+28
-25
faq.txt
doc/tutorial/faq.txt
+3
-0
function_module.py
theano/compile/function_module.py
+1
-1
ops.py
theano/compile/ops.py
+2
-6
test_ops.py
theano/compile/tests/test_ops.py
+6
-0
elemwise.py
theano/tensor/elemwise.py
+14
-18
opt.py
theano/tensor/opt.py
+2
-0
没有找到文件。
doc/tutorial/faq.txt
浏览文件 @
f02a596e
...
@@ -98,3 +98,6 @@ inside a function would provide float64 as output.
...
@@ -98,3 +98,6 @@ inside a function would provide float64 as output.
Since the GPU can't compute this kind of output, it would be
Since the GPU can't compute this kind of output, it would be
preferable not to use those dtypes together.
preferable not to use those dtypes together.
To help you find where float64 are created, see the
:attr:`warn_float64` Theano flag.
theano/compile/function_module.py
浏览文件 @
f02a596e
...
@@ -584,7 +584,7 @@ class Function(object):
...
@@ -584,7 +584,7 @@ class Function(object):
# done by raise_with_op is not implemented in C.
# done by raise_with_op is not implemented in C.
if
hasattr
(
self
.
fn
,
'thunks'
):
if
hasattr
(
self
.
fn
,
'thunks'
):
# For the CVM
# For the CVM
gof
.
vm
.
raise_with_op
(
gof
.
link
.
raise_with_op
(
self
.
fn
.
nodes
[
self
.
fn
.
position_of_error
],
self
.
fn
.
nodes
[
self
.
fn
.
position_of_error
],
self
.
fn
.
thunks
[
self
.
fn
.
position_of_error
])
self
.
fn
.
thunks
[
self
.
fn
.
position_of_error
])
else
:
else
:
...
...
theano/compile/ops.py
浏览文件 @
f02a596e
...
@@ -314,15 +314,11 @@ class Shape_i(gof.Op):
...
@@ -314,15 +314,11 @@ class Shape_i(gof.Op):
check_input
=
False
check_input
=
False
__props__
=
(
"i"
,)
def
__init__
(
self
,
i
):
def
__init__
(
self
,
i
):
self
.
i
=
i
self
.
i
=
i
def
__hash__
(
self
):
return
hash
(
type
(
self
))
^
self
.
i
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
and
self
.
i
==
other
.
i
def
__str__
(
self
):
def
__str__
(
self
):
return
'
%
s{
%
i}'
%
(
self
.
__class__
.
__name__
,
self
.
i
)
return
'
%
s{
%
i}'
%
(
self
.
__class__
.
__name__
,
self
.
i
)
...
...
theano/compile/tests/test_ops.py
浏览文件 @
f02a596e
...
@@ -19,6 +19,7 @@ import pickle
...
@@ -19,6 +19,7 @@ import pickle
def
mul
(
a
,
b
):
def
mul
(
a
,
b
):
return
a
*
b
return
a
*
b
class
OpDecoratorTests
(
utt
.
InferShapeTester
):
class
OpDecoratorTests
(
utt
.
InferShapeTester
):
def
test_1arg
(
self
):
def
test_1arg
(
self
):
x
=
dmatrix
(
'x'
)
x
=
dmatrix
(
'x'
)
...
@@ -77,3 +78,8 @@ class OpDecoratorTests(utt.InferShapeTester):
...
@@ -77,3 +78,8 @@ class OpDecoratorTests(utt.InferShapeTester):
m2
=
pickle
.
loads
(
s
)
m2
=
pickle
.
loads
(
s
)
assert
m2
.
owner
.
op
==
m
.
owner
.
op
assert
m2
.
owner
.
op
==
m
.
owner
.
op
def
test_shape_i_hash
():
assert
isinstance
(
theano
.
tensor
.
opt
.
Shape_i
(
np
.
int64
(
1
))
.
__hash__
(),
int
)
theano/tensor/elemwise.py
浏览文件 @
f02a596e
...
@@ -1836,6 +1836,20 @@ class CAReduceDtype(CAReduce):
...
@@ -1836,6 +1836,20 @@ class CAReduceDtype(CAReduce):
assert
op
.
acc_dtype
is
not
None
assert
op
.
acc_dtype
is
not
None
return
CAReduce
.
make_node
(
op
,
input
)
return
CAReduce
.
make_node
(
op
,
input
)
def
__str__
(
self
):
name
=
self
.
__class__
.
__name__
if
self
.
__class__
.
__name__
==
"CAReduceDtype"
:
name
=
"ReduceDtype{
%
s}"
%
self
.
scalar_op
,
axis
=
""
if
self
.
axis
is
not
None
:
axis
=
", "
.
join
(
str
(
x
)
for
x
in
self
.
axis
)
axis
=
"axis=[
%
s], "
%
axis
return
"
%
s{
%
sacc_dtype=
%
s}"
%
(
name
,
axis
,
str
(
self
.
acc_dtype
)
)
class
Sum
(
CAReduceDtype
):
class
Sum
(
CAReduceDtype
):
"""
"""
...
@@ -1908,12 +1922,6 @@ class Sum(CAReduceDtype):
...
@@ -1908,12 +1922,6 @@ class Sum(CAReduceDtype):
return
[
None
]
return
[
None
]
return
self
(
*
eval_points
,
**
dict
(
return_list
=
True
))
return
self
(
*
eval_points
,
**
dict
(
return_list
=
True
))
def
__str__
(
self
):
if
self
.
axis
is
None
:
return
"Sum"
else
:
return
"Sum{
%
s}"
%
", "
.
join
(
map
(
str
,
self
.
axis
))
class
Prod
(
CAReduceDtype
):
class
Prod
(
CAReduceDtype
):
"""
"""
...
@@ -2067,12 +2075,6 @@ class Prod(CAReduceDtype):
...
@@ -2067,12 +2075,6 @@ class Prod(CAReduceDtype):
return
[
final_grad
]
return
[
final_grad
]
def
__str__
(
self
):
if
self
.
axis
is
None
:
return
"Prod"
else
:
return
"Prod{
%
s}"
%
", "
.
join
(
map
(
str
,
self
.
axis
))
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
,)
return
(
1
,)
...
@@ -2113,9 +2115,3 @@ class ProdWithoutZeros(CAReduceDtype):
...
@@ -2113,9 +2115,3 @@ class ProdWithoutZeros(CAReduceDtype):
def
__init__
(
self
,
axis
=
None
,
dtype
=
None
,
acc_dtype
=
None
):
def
__init__
(
self
,
axis
=
None
,
dtype
=
None
,
acc_dtype
=
None
):
CAReduceDtype
.
__init__
(
self
,
mul_without_zeros
,
axis
=
axis
,
CAReduceDtype
.
__init__
(
self
,
mul_without_zeros
,
axis
=
axis
,
dtype
=
dtype
,
acc_dtype
=
acc_dtype
)
dtype
=
dtype
,
acc_dtype
=
acc_dtype
)
def
__str__
(
self
):
if
self
.
axis
is
None
:
return
"ProdWithoutZeros"
else
:
return
"ProdWithoutZeros{
%
s}"
%
", "
.
join
(
map
(
str
,
self
.
axis
))
theano/tensor/opt.py
浏览文件 @
f02a596e
...
@@ -1427,6 +1427,8 @@ class Assert(T.Op):
...
@@ -1427,6 +1427,8 @@ class Assert(T.Op):
self
.
msg
=
"Theano Assert failed!"
self
.
msg
=
"Theano Assert failed!"
def
make_node
(
self
,
value
,
*
conds
):
def
make_node
(
self
,
value
,
*
conds
):
if
not
isinstance
(
value
,
Variable
):
value
=
T
.
as_tensor_variable
(
value
)
cond
=
[
T
.
as_tensor_variable
(
c
)
for
c
in
conds
]
cond
=
[
T
.
as_tensor_variable
(
c
)
for
c
in
conds
]
assert
numpy
.
all
([
c
.
type
.
ndim
==
0
for
c
in
cond
])
assert
numpy
.
all
([
c
.
type
.
ndim
==
0
for
c
in
cond
])
return
gof
.
Apply
(
self
,
[
value
]
+
cond
,
[
value
.
type
()])
return
gof
.
Apply
(
self
,
[
value
]
+
cond
,
[
value
.
type
()])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论