Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
45742adf
提交
45742adf
authored
8月 04, 2009
作者:
dumitru@deepnets.mtv.corp.google.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More backporting
上级
3126f874
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
56 行增加
和
22 行删除
+56
-22
mode.py
theano/compile/mode.py
+1
-1
module.py
theano/compile/module.py
+4
-2
cc.py
theano/gof/cc.py
+2
-0
toolbox.py
theano/gof/toolbox.py
+2
-0
basic.py
theano/scalar/basic.py
+1
-1
basic.py
theano/tensor/basic.py
+1
-1
rmodule.py
theano/tensor/deprecated/rmodule.py
+8
-5
elemwise.py
theano/tensor/elemwise.py
+1
-1
nnet.py
theano/tensor/nnet.py
+25
-8
opt.py
theano/tensor/opt.py
+1
-1
unittest_tools.py
theano/tests/unittest_tools.py
+10
-2
没有找到文件。
theano/compile/mode.py
浏览文件 @
45742adf
import
numpy
import
numpy
import
os
import
os
import
scipy.sparse
as
sp
import
scipy.sparse
as
sp
from
..
import
gof
from
theano
import
gof
def
check_equal
(
x
,
y
):
def
check_equal
(
x
,
y
):
"""
"""
...
...
theano/compile/module.py
浏览文件 @
45742adf
...
@@ -11,10 +11,12 @@ from theano.printing import pprint
...
@@ -11,10 +11,12 @@ from theano.printing import pprint
import
io
,
sys
import
io
,
sys
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
from
functools
import
partial
from
collections
import
defaultdict
from
collections
import
defaultdict
else
:
from
theano.gof.python25
import
any
,
all
,
defaultdict
,
partial
from
itertools
import
chain
from
itertools
import
chain
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
from
functools
import
partial
import
function_module
as
F
import
function_module
as
F
import
mode
as
get_mode
import
mode
as
get_mode
...
...
theano/gof/cc.py
浏览文件 @
45742adf
...
@@ -10,6 +10,8 @@ import md5
...
@@ -10,6 +10,8 @@ import md5
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
import
hashlib
import
hashlib
from
theano.gof.python25
import
any
,
all
# weave import
# weave import
from
scipy
import
weave
from
scipy
import
weave
...
...
theano/gof/toolbox.py
浏览文件 @
45742adf
...
@@ -2,6 +2,8 @@ import sys
...
@@ -2,6 +2,8 @@ import sys
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
from
functools
import
partial
from
functools
import
partial
else
:
from
theano.gof.python25
import
partial
import
graph
import
graph
...
...
theano/scalar/basic.py
浏览文件 @
45742adf
...
@@ -6,7 +6,7 @@ import numpy
...
@@ -6,7 +6,7 @@ import numpy
from
theano
import
gof
from
theano
import
gof
from
theano.gof
import
Op
,
utils
,
Variable
,
Constant
,
Type
,
Apply
,
Env
from
theano.gof
import
Op
,
utils
,
Variable
,
Constant
,
Type
,
Apply
,
Env
from
theano.gof.python25
import
partial
,
all
from
theano.gof.python25
import
partial
,
all
,
any
def
upcast
(
dtype
,
*
dtypes
):
def
upcast
(
dtype
,
*
dtypes
):
z
=
numpy
.
zeros
((),
dtype
=
dtype
)
z
=
numpy
.
zeros
((),
dtype
=
dtype
)
...
...
theano/tensor/basic.py
浏览文件 @
45742adf
...
@@ -18,7 +18,7 @@ from theano import gradient
...
@@ -18,7 +18,7 @@ from theano import gradient
import
elemwise
import
elemwise
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
theano.gof.python25
import
partial
,
any
from
theano.gof.python25
import
partial
,
any
,
all
from
theano
import
compile
,
printing
from
theano
import
compile
,
printing
from
theano.printing
import
pprint
,
Print
from
theano.printing
import
pprint
,
Print
...
...
theano/tensor/deprecated/rmodule.py
浏览文件 @
45742adf
"""Define RModule, a Module providing random number streams in Theano graphs."""
"""Define RModule, a Module providing random number streams in Theano graphs."""
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
import
sys
import
sys
import
functools
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
from
functools
import
partial
from
functools
import
partial
else
:
from
theano.gof.python25
import
partial
from
collections
import
deque
from
collections
import
deque
import
numpy
import
numpy
from
copy
import
copy
from
copy
import
copy
from
..
.compile
import
(
SymbolicInputKit
,
SymbolicInput
,
from
theano
.compile
import
(
SymbolicInputKit
,
SymbolicInput
,
Module
,
module
,
Method
,
Member
,
In
,
Component
)
Module
,
module
,
Method
,
Member
,
In
,
Component
)
from
..
.gof
import
Container
from
theano
.gof
import
Container
from
..
.tensor
import
raw_random
from
theano
.tensor
import
raw_random
class
KitComponent
(
Component
):
class
KitComponent
(
Component
):
"""
"""
...
...
theano/tensor/elemwise.py
浏览文件 @
45742adf
...
@@ -8,7 +8,7 @@ from theano import scalar
...
@@ -8,7 +8,7 @@ from theano import scalar
from
theano.scalar
import
Scalar
from
theano.scalar
import
Scalar
from
theano
import
printing
from
theano
import
printing
from
theano.printing
import
pprint
from
theano.printing
import
pprint
from
theano.gof.python25
import
all
from
theano.gof.python25
import
all
,
any
from
copy
import
copy
,
deepcopy
from
copy
import
copy
,
deepcopy
...
...
theano/tensor/nnet.py
浏览文件 @
45742adf
...
@@ -2,15 +2,15 @@
...
@@ -2,15 +2,15 @@
## Not all of those ops have been thoroughly tested.
## Not all of those ops have been thoroughly tested.
#from theano import tensor, scalar
#from theano import tensor, scalar
from
..
import
gof
from
theano
import
gof
from
..
import
scalar
from
theano
import
scalar
from
..
import
printing
from
theano
import
printing
from
.
.printing
import
pprint
from
theano
.printing
import
pprint
import
basic
as
tensor
import
basic
as
tensor
import
elemwise
import
elemwise
import
numpy
import
numpy
import
opt
import
opt
from
.
.compile
import
optdb
from
theano
.compile
import
optdb
############
############
#
#
...
@@ -404,8 +404,19 @@ def local_softmax_with_bias(node):
...
@@ -404,8 +404,19 @@ def local_softmax_with_bias(node):
assert
non_vectors
#not empty
assert
non_vectors
#not empty
if
vectors
:
if
vectors
:
#we're in business...
#we're in business...
vector_sum
=
tensor
.
add
(
*
vectors
)
if
len
(
vectors
)
>
1
else
vectors
[
0
]
if
len
(
vectors
)
>
1
:
non_vector_sum
=
tensor
.
add
(
*
non_vectors
)
if
len
(
non_vectors
)
>
1
else
non_vectors
[
0
]
vector_sum
=
tensor
.
add
(
*
vectors
)
else
:
vector_sum
=
vectors
[
0
]
#backport
#vector_sum = tensor.add(*vectors) if len(vectors)>1 else vectors[0]
if
len
(
non_vectors
)
>
1
:
non_vector_sum
=
tensor
.
add
(
*
non_vectors
)
else
:
non_vector_sum
=
non_vectors
[
0
]
#non_vector_sum = tensor.add(*non_vectors) if len(non_vectors)>1 else non_vectors[0]
try
:
try
:
sm_bias
=
softmax_with_bias
(
non_vector_sum
,
vector_sum
)
sm_bias
=
softmax_with_bias
(
non_vector_sum
,
vector_sum
)
except
:
except
:
...
@@ -909,8 +920,14 @@ def categorical_crossentropy(coding_dist, true_dist, axis=1):
...
@@ -909,8 +920,14 @@ def categorical_crossentropy(coding_dist, true_dist, axis=1):
if
true_dist
.
ndim
==
2
:
if
true_dist
.
ndim
==
2
:
return
-
theano
.
sum
(
true_dist
*
log
(
coding_dist
),
axis
=
axis
)
return
-
theano
.
sum
(
true_dist
*
log
(
coding_dist
),
axis
=
axis
)
else
:
else
:
if
axis
==
0
:
retval
=
coding_dist
.
T
else
:
retval
=
coding_dist
,
return
categorical_crossentropy_1hot
(
return
categorical_crossentropy_1hot
(
coding_dist
.
T
if
axis
==
0
else
coding_dist
,
#backport
#coding_dist.T if axis == 0 else coding_dist,
retval
,
true_dist
)
true_dist
)
...
...
theano/tensor/opt.py
浏览文件 @
45742adf
...
@@ -17,7 +17,7 @@ import sys
...
@@ -17,7 +17,7 @@ import sys
from
theano
import
compile
#to register the optimizer built by this file
from
theano
import
compile
#to register the optimizer built by this file
from
theano.compile.debugmode
import
_debugprint
from
theano.compile.debugmode
import
_debugprint
from
theano.gof.python25
import
any
from
theano.gof.python25
import
any
,
all
# Utilities
# Utilities
...
...
theano/tests/unittest_tools.py
浏览文件 @
45742adf
...
@@ -18,10 +18,18 @@ def fetch_seed(pseed=None):
...
@@ -18,10 +18,18 @@ def fetch_seed(pseed=None):
"""
"""
seed
=
pseed
or
os
.
getenv
(
"THEANO_UNITTEST_SEED"
,
666
)
seed
=
pseed
or
os
.
getenv
(
"THEANO_UNITTEST_SEED"
,
666
)
seed
=
None
if
seed
==
'random'
else
seed
if
seed
==
'random'
:
seed
=
None
#backport
#seed = None if seed=='random' else seed
try
:
try
:
seed
=
int
(
seed
)
if
seed
else
None
if
seed
:
seed
=
int
(
seed
)
else
:
seed
=
None
#backport
#seed = int(seed) if seed else None
except
ValueError
:
except
ValueError
:
print
>>
sys
.
stderr
,
'Error: THEANO_UNITTEST_SEED contains '
\
print
>>
sys
.
stderr
,
'Error: THEANO_UNITTEST_SEED contains '
\
'invalid seed, using None instead'
'invalid seed, using None instead'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论