Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e945851a
提交
e945851a
authored
4月 12, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
9a44f9bf
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
2 行增加
和
7 行删除
+2
-7
test_tutorial.py
theano/tests/test_tutorial.py
+2
-7
没有找到文件。
theano/tests/test_tutorial.py
浏览文件 @
e945851a
...
@@ -1137,6 +1137,7 @@ class T_graphstructures(unittest.TestCase):
...
@@ -1137,6 +1137,7 @@ class T_graphstructures(unittest.TestCase):
assert
e
.
owner
.
inputs
[
1
]
.
owner
.
inputs
[
0
]
is
y
assert
e
.
owner
.
inputs
[
1
]
.
owner
.
inputs
[
0
]
is
y
assert
e
.
owner
.
inputs
[
1
]
.
owner
.
inputs
[
1
]
is
z
assert
e
.
owner
.
inputs
[
1
]
.
owner
.
inputs
[
1
]
is
z
class
T_scan
(
unittest
.
TestCase
):
class
T_scan
(
unittest
.
TestCase
):
## All tests here belong to
## All tests here belong to
## http://deeplearning.net/software/theano/tutorial/loop.html
## http://deeplearning.net/software/theano/tutorial/loop.html
...
@@ -1144,7 +1145,6 @@ class T_scan(unittest.TestCase):
...
@@ -1144,7 +1145,6 @@ class T_scan(unittest.TestCase):
## Any change you do here also add it to the tutorial !
## Any change you do here also add it to the tutorial !
def
test_elemwise
(
self
):
def
test_elemwise
(
self
):
# defining the tensor variables
# defining the tensor variables
X
=
T
.
matrix
(
"X"
)
X
=
T
.
matrix
(
"X"
)
W
=
T
.
matrix
(
"W"
)
W
=
T
.
matrix
(
"W"
)
...
@@ -1167,7 +1167,6 @@ class T_scan(unittest.TestCase):
...
@@ -1167,7 +1167,6 @@ class T_scan(unittest.TestCase):
print
"Numpy results:"
,
numpy
.
tanh
(
x
.
dot
(
w
)
+
b
)
print
"Numpy results:"
,
numpy
.
tanh
(
x
.
dot
(
w
)
+
b
)
def
test_sequence
(
self
):
def
test_sequence
(
self
):
# define tensor variables
# define tensor variables
X
=
T
.
vector
(
"X"
)
X
=
T
.
vector
(
"X"
)
W
=
T
.
matrix
(
"W"
)
W
=
T
.
matrix
(
"W"
)
...
@@ -1228,7 +1227,6 @@ class T_scan(unittest.TestCase):
...
@@ -1228,7 +1227,6 @@ class T_scan(unittest.TestCase):
numpy
.
sqrt
((
x
**
2
)
.
sum
(
0
))
numpy
.
sqrt
((
x
**
2
)
.
sum
(
0
))
def
test_trace
(
self
):
def
test_trace
(
self
):
# define tensor variable
# define tensor variable
X
=
T
.
matrix
(
"X"
)
X
=
T
.
matrix
(
"X"
)
results
,
updates
=
theano
.
scan
(
lambda
i
,
j
,
t_f
:
T
.
cast
(
X
[
i
,
j
]
+
\
results
,
updates
=
theano
.
scan
(
lambda
i
,
j
,
t_f
:
T
.
cast
(
X
[
i
,
j
]
+
\
...
@@ -1250,7 +1248,6 @@ class T_scan(unittest.TestCase):
...
@@ -1250,7 +1248,6 @@ class T_scan(unittest.TestCase):
print
"Numpy results:"
,
numpy
.
diagonal
(
x
)
.
sum
()
print
"Numpy results:"
,
numpy
.
diagonal
(
x
)
.
sum
()
def
test_taps
(
self
):
def
test_taps
(
self
):
# define tensor variables
# define tensor variables
X
=
T
.
matrix
(
"X"
)
X
=
T
.
matrix
(
"X"
)
W
=
T
.
matrix
(
"W"
)
W
=
T
.
matrix
(
"W"
)
...
@@ -1293,7 +1290,6 @@ class T_scan(unittest.TestCase):
...
@@ -1293,7 +1290,6 @@ class T_scan(unittest.TestCase):
print
"Numpy results:"
,
x_res
print
"Numpy results:"
,
x_res
def
test_jacobian
(
self
):
def
test_jacobian
(
self
):
# define tensor variables
# define tensor variables
v
=
T
.
vector
()
v
=
T
.
vector
()
A
=
T
.
matrix
()
A
=
T
.
matrix
()
...
@@ -1318,7 +1314,7 @@ class T_scan(unittest.TestCase):
...
@@ -1318,7 +1314,7 @@ class T_scan(unittest.TestCase):
n_sym
=
T
.
iscalar
(
"n_sym"
)
n_sym
=
T
.
iscalar
(
"n_sym"
)
results
,
updates
=
theano
.
scan
(
lambda
:{
k
:(
k
+
1
)},
n_steps
=
n_sym
)
results
,
updates
=
theano
.
scan
(
lambda
:{
k
:(
k
+
1
)},
n_steps
=
n_sym
)
accumulator
=
theano
.
function
([
n_sym
],
[],
updates
=
updates
,
\
accumulator
=
theano
.
function
([
n_sym
],
[],
updates
=
updates
,
allow_input_downcast
=
True
)
allow_input_downcast
=
True
)
print
"Before 5 steps:"
,
k
.
get_value
()
print
"Before 5 steps:"
,
k
.
get_value
()
...
@@ -1346,4 +1342,3 @@ class T_scan(unittest.TestCase):
...
@@ -1346,4 +1342,3 @@ class T_scan(unittest.TestCase):
b
=
numpy
.
ones
((
2
))
b
=
numpy
.
ones
((
2
))
print
compute_with_bnoise
(
x
,
w
,
b
)
print
compute_with_bnoise
(
x
,
w
,
b
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论