Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3ac2f252
提交
3ac2f252
authored
11月 27, 2008
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
removed references to sys.maxint for drawing random integers. This introduced platform dependence
上级
f7225458
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
7 行增加
和
7 行删除
+7
-7
raw_random.py
theano/tensor/raw_random.py
+3
-3
test_naacl09.py
theano/tensor/tests/test_naacl09.py
+4
-4
没有找到文件。
theano/tensor/raw_random.py
浏览文件 @
3ac2f252
...
@@ -212,7 +212,7 @@ class RandomKit(SymbolicInputKit):
...
@@ -212,7 +212,7 @@ class RandomKit(SymbolicInputKit):
return
out
return
out
def
distribute
(
self
,
value
,
indices
,
containers
):
def
distribute
(
self
,
value
,
indices
,
containers
):
rg
=
partial
(
numpy
.
random
.
RandomState
(
value
)
.
randint
,
sys
.
maxint
)
rg
=
partial
(
numpy
.
random
.
RandomState
(
value
)
.
randint
,
2
**
32
)
elems
=
deque
(
zip
(
indices
,
containers
))
elems
=
deque
(
zip
(
indices
,
containers
))
i
=
0
i
=
0
while
elems
:
while
elems
:
...
@@ -270,7 +270,7 @@ class RModule(compile.Module):
...
@@ -270,7 +270,7 @@ class RModule(compile.Module):
# and a list of corresponding gof.Container instances. In this
# and a list of corresponding gof.Container instances. In this
# situation it will reseed all the rngs using the containers
# situation it will reseed all the rngs using the containers
# associated to them.
# associated to them.
c
.
_rkit
.
kit
.
distribute
(
seedgen
.
random_integers
(
sys
.
maxint
-
1
),
c
.
_rkit
.
kit
.
distribute
(
seedgen
.
random_integers
(
2
**
3
1
),
xrange
(
len
(
inst2
.
_rkit
)),
inst2
.
_rkit
)
xrange
(
len
(
inst2
.
_rkit
)),
inst2
.
_rkit
)
else
:
else
:
self
.
_rkit
.
kit
.
distribute
(
seedgen
.
random_integers
(
sys
.
maxint
-
1
),
xrange
(
len
(
inst
.
_rkit
)),
inst
.
_rkit
)
self
.
_rkit
.
kit
.
distribute
(
seedgen
.
random_integers
(
2
**
3
1
),
xrange
(
len
(
inst
.
_rkit
)),
inst
.
_rkit
)
theano/tensor/tests/test_naacl09.py
浏览文件 @
3ac2f252
...
@@ -324,8 +324,8 @@ class ConvolutionalMLPInstance(module.FancyModuleInstance, Loss01):
...
@@ -324,8 +324,8 @@ class ConvolutionalMLPInstance(module.FancyModuleInstance, Loss01):
# layer.lr = lr
# layer.lr = lr
for
i
in
self
.
input_representations
:
for
i
in
self
.
input_representations
:
# i.initialize(input_size=self.input_size, hidden_size=self.input_representation_size, seed=R.random_integers(
sys.maxint-1
), noise_level=noise_level, qfilter_relscale=qfilter_relscale)
# i.initialize(input_size=self.input_size, hidden_size=self.input_representation_size, seed=R.random_integers(
2**30
), noise_level=noise_level, qfilter_relscale=qfilter_relscale)
i
.
initialize
(
input_size
=
self
.
input_size
,
hidden_size
=
self
.
input_representation_size
,
noise_level
=
noise_level
,
seed
=
R
.
random_integers
(
sys
.
maxint
-
1
),
lr
=
lr
,
qfilter_relscale
=
qfilter_relscale
)
i
.
initialize
(
input_size
=
self
.
input_size
,
hidden_size
=
self
.
input_representation_size
,
noise_level
=
noise_level
,
seed
=
R
.
random_integers
(
2
**
30
),
lr
=
lr
,
qfilter_relscale
=
qfilter_relscale
)
for
i
in
self
.
input_representations
[
1
:]:
for
i
in
self
.
input_representations
[
1
:]:
assert
(
i
.
w1
==
self
.
input_representations
[
0
]
.
w1
)
.
all
()
assert
(
i
.
w1
==
self
.
input_representations
[
0
]
.
w1
)
.
all
()
...
@@ -334,9 +334,9 @@ class ConvolutionalMLPInstance(module.FancyModuleInstance, Loss01):
...
@@ -334,9 +334,9 @@ class ConvolutionalMLPInstance(module.FancyModuleInstance, Loss01):
assert
(
i
.
b2
==
self
.
input_representations
[
0
]
.
b2
)
.
all
()
assert
(
i
.
b2
==
self
.
input_representations
[
0
]
.
b2
)
.
all
()
assert
all
((
a
==
b
)
.
all
()
for
a
,
b
in
zip
(
i
.
qfilters
,
self
.
input_representations
[
0
]
.
qfilters
))
assert
all
((
a
==
b
)
.
all
()
for
a
,
b
in
zip
(
i
.
qfilters
,
self
.
input_representations
[
0
]
.
qfilters
))
self
.
hidden
.
initialize
(
input_size
=
(
len
(
self
.
inputs
)
*
self
.
input_representation_size
),
hidden_size
=
self
.
hidden_representation_size
,
noise_level
=
noise_level
,
seed
=
R
.
random_integers
(
sys
.
maxint
-
1
),
lr
=
lr
,
qfilter_relscale
=
qfilter_relscale
)
self
.
hidden
.
initialize
(
input_size
=
(
len
(
self
.
inputs
)
*
self
.
input_representation_size
),
hidden_size
=
self
.
hidden_representation_size
,
noise_level
=
noise_level
,
seed
=
R
.
random_integers
(
2
**
30
),
lr
=
lr
,
qfilter_relscale
=
qfilter_relscale
)
self
.
output
.
initialize
(
n_in
=
self
.
hidden_representation_size
,
n_out
=
self
.
output_size
,
lr
=
lr
,
seed
=
R
.
random_integers
(
sys
.
maxint
-
1
))
self
.
output
.
initialize
(
n_in
=
self
.
hidden_representation_size
,
n_out
=
self
.
output_size
,
lr
=
lr
,
seed
=
R
.
random_integers
(
2
**
30
))
class
ConvolutionalMLP
(
module
.
FancyModule
):
class
ConvolutionalMLP
(
module
.
FancyModule
):
InstanceType
=
ConvolutionalMLPInstance
InstanceType
=
ConvolutionalMLPInstance
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论