Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
51869d9e
提交
51869d9e
authored
3月 24, 2017
作者:
Frédéric Bastien
提交者:
GitHub
3月 24, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5759 from Amrithasuresh/master
Updated numpy as np #4218
上级
a4126bcc
f7383a84
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
16 行增加
和
16 行删除
+16
-16
mlp_test.py
theano/tensor/tests/mlp_test.py
+16
-16
test_basic.py
theano/tensor/tests/test_basic.py
+0
-0
test_blas.py
theano/tensor/tests/test_blas.py
+0
-0
test_blas_scipy.py
theano/tensor/tests/test_blas_scipy.py
+0
-0
test_complex.py
theano/tensor/tests/test_complex.py
+0
-0
test_elemwise.py
theano/tensor/tests/test_elemwise.py
+0
-0
test_extra_ops.py
theano/tensor/tests/test_extra_ops.py
+0
-0
test_fft.py
theano/tensor/tests/test_fft.py
+0
-0
test_fourier.py
theano/tensor/tests/test_fourier.py
+0
-0
test_gc.py
theano/tensor/tests/test_gc.py
+0
-0
test_inc_subtensor.py
theano/tensor/tests/test_inc_subtensor.py
+0
-0
test_io.py
theano/tensor/tests/test_io.py
+0
-0
test_keepdims.py
theano/tensor/tests/test_keepdims.py
+0
-0
test_merge.py
theano/tensor/tests/test_merge.py
+0
-0
test_misc.py
theano/tensor/tests/test_misc.py
+0
-0
test_nlinalg.py
theano/tensor/tests/test_nlinalg.py
+0
-0
test_opt.py
theano/tensor/tests/test_opt.py
+0
-0
test_opt_uncanonicalize.py
theano/tensor/tests/test_opt_uncanonicalize.py
+0
-0
test_raw_random.py
theano/tensor/tests/test_raw_random.py
+0
-0
test_shared_randomstreams.py
theano/tensor/tests/test_shared_randomstreams.py
+0
-0
test_sharedvar.py
theano/tensor/tests/test_sharedvar.py
+0
-0
test_slinalg.py
theano/tensor/tests/test_slinalg.py
+0
-0
test_subtensor.py
theano/tensor/tests/test_subtensor.py
+0
-0
test_utils.py
theano/tensor/tests/test_utils.py
+0
-0
没有找到文件。
theano/tensor/tests/mlp_test.py
浏览文件 @
51869d9e
...
@@ -8,7 +8,7 @@ __docformat__ = 'restructedtext en'
...
@@ -8,7 +8,7 @@ __docformat__ = 'restructedtext en'
from
collections
import
OrderedDict
from
collections
import
OrderedDict
import
numpy
import
numpy
as
np
import
theano
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
T
...
@@ -17,12 +17,12 @@ import theano.tensor as T
...
@@ -17,12 +17,12 @@ import theano.tensor as T
def
gen_data
():
def
gen_data
():
# generate the dataset
# generate the dataset
train_set
=
(
n
umpy
.
asarray
(
numpy
.
random
.
rand
(
10000
,
784
),
dtype
=
'float32'
),
train_set
=
(
n
p
.
asarray
(
np
.
random
.
rand
(
10000
,
784
),
dtype
=
'float32'
),
n
umpy
.
asarray
(
numpy
.
random
.
rand
(
10000
)
*
10
,
dtype
=
'int64'
))
n
p
.
asarray
(
np
.
random
.
rand
(
10000
)
*
10
,
dtype
=
'int64'
))
valid_set
=
(
n
umpy
.
asarray
(
numpy
.
random
.
rand
(
10000
,
784
),
dtype
=
'float32'
),
valid_set
=
(
n
p
.
asarray
(
np
.
random
.
rand
(
10000
,
784
),
dtype
=
'float32'
),
n
umpy
.
asarray
(
numpy
.
random
.
rand
(
10000
)
*
10
,
dtype
=
'int64'
))
n
p
.
asarray
(
np
.
random
.
rand
(
10000
)
*
10
,
dtype
=
'int64'
))
test_set
=
(
n
umpy
.
asarray
(
numpy
.
random
.
rand
(
10000
,
784
),
dtype
=
'float32'
),
test_set
=
(
n
p
.
asarray
(
np
.
random
.
rand
(
10000
,
784
),
dtype
=
'float32'
),
n
umpy
.
asarray
(
numpy
.
random
.
rand
(
10000
)
*
10
,
dtype
=
'int64'
))
n
p
.
asarray
(
np
.
random
.
rand
(
10000
)
*
10
,
dtype
=
'int64'
))
def
shared_dataset
(
data_xy
):
def
shared_dataset
(
data_xy
):
""" Function that loads the dataset into shared variables
""" Function that loads the dataset into shared variables
...
@@ -33,8 +33,8 @@ def gen_data():
...
@@ -33,8 +33,8 @@ def gen_data():
variable) would lead to a large decrease in performance.
variable) would lead to a large decrease in performance.
"""
"""
data_x
,
data_y
=
data_xy
data_x
,
data_y
=
data_xy
shared_x
=
theano
.
shared
(
n
umpy
.
asarray
(
data_x
,
dtype
=
theano
.
config
.
floatX
))
shared_x
=
theano
.
shared
(
n
p
.
asarray
(
data_x
,
dtype
=
theano
.
config
.
floatX
))
shared_y
=
theano
.
shared
(
n
umpy
.
asarray
(
data_y
,
dtype
=
theano
.
config
.
floatX
))
shared_y
=
theano
.
shared
(
n
p
.
asarray
(
data_y
,
dtype
=
theano
.
config
.
floatX
))
# When storing data on the GPU it has to be stored as floats
# When storing data on the GPU it has to be stored as floats
# therefore we will store the labels as ``floatX`` as well
# therefore we will store the labels as ``floatX`` as well
# (``shared_y`` does exactly that). But during our computations
# (``shared_y`` does exactly that). But during our computations
...
@@ -79,7 +79,7 @@ class LogisticRegression(object):
...
@@ -79,7 +79,7 @@ class LogisticRegression(object):
"""
"""
# initialize with 0 the weights W as a matrix of shape (n_in, n_out)
# initialize with 0 the weights W as a matrix of shape (n_in, n_out)
self
.
W
=
theano
.
shared
(
value
=
n
umpy
.
zeros
((
n_in
,
n_out
),
dtype
=
theano
.
config
.
floatX
),
self
.
W
=
theano
.
shared
(
value
=
n
p
.
zeros
((
n_in
,
n_out
),
dtype
=
theano
.
config
.
floatX
),
name
=
name_prefix
+
'W'
)
name
=
name_prefix
+
'W'
)
# compute vector of class-membership probabilities in symbolic form
# compute vector of class-membership probabilities in symbolic form
...
@@ -129,7 +129,7 @@ class HiddenLayer(object):
...
@@ -129,7 +129,7 @@ class HiddenLayer(object):
Hidden unit activation is given by: tanh(dot(input,W) + b)
Hidden unit activation is given by: tanh(dot(input,W) + b)
:type rng: n
umpy
.random.RandomState
:type rng: n
p
.random.RandomState
:param rng: a random number generator used to initialize weights
:param rng: a random number generator used to initialize weights
:type input: theano.tensor.dmatrix
:type input: theano.tensor.dmatrix
...
@@ -151,9 +151,9 @@ class HiddenLayer(object):
...
@@ -151,9 +151,9 @@ class HiddenLayer(object):
# from -6./sqrt(n_in+n_hidden) and 6./sqrt(n_in+n_hidden)
# from -6./sqrt(n_in+n_hidden) and 6./sqrt(n_in+n_hidden)
# the output of uniform if converted using asarray to dtype
# the output of uniform if converted using asarray to dtype
# theano.config.floatX so that the code is runable on GPU
# theano.config.floatX so that the code is runable on GPU
W_values
=
n
umpy
.
asarray
(
rng
.
uniform
(
\
W_values
=
n
p
.
asarray
(
rng
.
uniform
(
\
low
=-
n
umpy
.
sqrt
(
6.
/
(
n_in
+
n_out
)),
\
low
=-
n
p
.
sqrt
(
6.
/
(
n_in
+
n_out
)),
\
high
=
n
umpy
.
sqrt
(
6.
/
(
n_in
+
n_out
)),
\
high
=
n
p
.
sqrt
(
6.
/
(
n_in
+
n_out
)),
\
size
=
(
n_in
,
n_out
)),
dtype
=
theano
.
config
.
floatX
)
size
=
(
n_in
,
n_out
)),
dtype
=
theano
.
config
.
floatX
)
self
.
W
=
theano
.
shared
(
value
=
W_values
,
name
=
name_prefix
+
'W'
)
self
.
W
=
theano
.
shared
(
value
=
W_values
,
name
=
name_prefix
+
'W'
)
...
@@ -176,7 +176,7 @@ class MLP(object):
...
@@ -176,7 +176,7 @@ class MLP(object):
def
__init__
(
self
,
rng
,
input
,
n_in
,
n_hidden
,
n_out
):
def
__init__
(
self
,
rng
,
input
,
n_in
,
n_hidden
,
n_out
):
"""Initialize the parameters for the multilayer perceptron
"""Initialize the parameters for the multilayer perceptron
:type rng: n
umpy
.random.RandomState
:type rng: n
p
.random.RandomState
:param rng: a random number generator used to initialize weights
:param rng: a random number generator used to initialize weights
:type input: theano.tensor.TensorType
:type input: theano.tensor.TensorType
...
@@ -265,7 +265,7 @@ def test_mlp():
...
@@ -265,7 +265,7 @@ def test_mlp():
y
=
T
.
ivector
(
'y'
)
# the labels are presented as 1D vector of
y
=
T
.
ivector
(
'y'
)
# the labels are presented as 1D vector of
# [int] labels
# [int] labels
rng
=
n
umpy
.
random
.
RandomState
(
1234
)
rng
=
n
p
.
random
.
RandomState
(
1234
)
# construct the MLP class
# construct the MLP class
classifier
=
MLP
(
rng
=
rng
,
input
=
x
,
n_in
=
28
*
28
,
n_hidden
=
500
,
n_out
=
10
)
classifier
=
MLP
(
rng
=
rng
,
input
=
x
,
n_in
=
28
*
28
,
n_hidden
=
500
,
n_out
=
10
)
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
51869d9e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
theano/tensor/tests/test_blas.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_blas_scipy.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_complex.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_elemwise.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_extra_ops.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_fft.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_fourier.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_gc.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_inc_subtensor.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_io.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_keepdims.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_merge.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_misc.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_nlinalg.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_opt.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_opt_uncanonicalize.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_raw_random.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_shared_randomstreams.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_sharedvar.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_slinalg.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_subtensor.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
theano/tensor/tests/test_utils.py
浏览文件 @
51869d9e
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论