Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
73c28a05
提交
73c28a05
authored
2月 26, 2016
作者:
Caglar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added the only_process_constants.
上级
6f97e51d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
136 行增加
和
0 行删除
+136
-0
test_debugprint.py
theano/compile/tests/test_debugprint.py
+32
-0
check.py
theano/sandbox/cuda/check.py
+1
-0
test_gpuarray.py
theano/sandbox/cuda/test_gpuarray.py
+75
-0
opt.py
theano/tensor/opt.py
+0
-0
test_debugprint.py
theano/tests/test_debugprint.py
+15
-0
test_scanmode.py
theano/tests/test_scanmode.py
+13
-0
没有找到文件。
theano/compile/tests/test_debugprint.py
0 → 100644
浏览文件 @
73c28a05
import
theano
import
theano.tensor
as
T
def
test_debugprint
():
k
=
T
.
iscalar
(
"k"
)
A
=
T
.
vector
(
"A"
)
# Symbolic description of the result
result
,
updates
=
theano
.
scan
(
fn
=
lambda
prior_result
,
A
:
prior_result
*
A
,
outputs_info
=
T
.
ones_like
(
A
),
non_sequences
=
A
,
n_steps
=
k
,
name
=
"scan"
)
final_result
=
result
[
-
1
]
# compiled function that returns A**k
power
=
theano
.
function
(
inputs
=
[
A
,
k
],
outputs
=
final_result
,
updates
=
updates
,
mode
=
'DebugMode'
)
#a = theano.printing.debugprint(power, file="str")
#a = theano.compile.debugmode.debugprint(power,
# prefix="test")
#print(a)
theano
.
printing
.
debugprint
(
power
)
print
power
(
range
(
10
),
2
)
print
power
(
range
(
10
),
4
)
test_debugprint
()
theano/sandbox/cuda/check.py
0 → 100644
浏览文件 @
73c28a05
import
theano
;
import
numpy
;
a
=
theano
.
shared
(
numpy
.
zeros
(
100000
)
.
astype
(
'float32'
))
theano/sandbox/cuda/test_gpuarray.py
0 → 100644
浏览文件 @
73c28a05
from
theano.sandbox.cuda.cula
import
gpu_solve
import
numpy
as
np
import
theano.tensor
as
TT
import
theano
def
thrash
():
import
numpy
as
np
A_val
=
np
.
asarray
([[
2
,
0
,
0
],
[
0
,
1
,
0
],
[
0
,
0
,
1
]],
dtype
=
"float32"
)
#b_val = np.asarray([[0.5, 0, 0], [0, 0.5, 0], [0, 0, 0.5]], dtype="float32")
b_val
=
np
.
asarray
([[
0.5
],
[
0.5
],
[
0.5
]],
dtype
=
"float32"
)
A_empty
=
np
.
zeros
((
3
,
3
))
.
astype
(
"float32"
)
b_empty
=
np
.
zeros
((
3
,
1
))
.
astype
(
"float32"
)
import
theano
A
=
TT
.
matrix
(
"A"
,
dtype
=
"float32"
)
b
=
TT
.
matrix
(
"b"
,
dtype
=
"float32"
)
#theano.config.compute_test_value = 'warn'
#A.tag.test_value = A_val
#b.tag.test_value = b_val
#A = theano.shared(A_val)
#b = theano.shared(b_val)
from
theano.misc.pycuda_utils
import
to_gpuarray
solver
=
gpu_solve
(
A
,
b
)
fn
=
theano
.
function
([
A
,
b
],
[
solver
])
res
=
fn
(
A_val
,
b_val
)
print
(
np
.
asarray
(
res
[
0
]))
#import ipdb; ipdb.set_trace()
def
thrash2
():
import
numpy
as
np
A_val
=
np
.
asarray
([[
2
,
0
,
0
],
[
0
,
1
,
0
],
[
0
,
0
,
1
]],
dtype
=
"float32"
)
#A_val = np.random.uniform(-0.01, 0.01, (10, 10)).astype("float32")
#A_val +=1
#A_val = np.linalg.svd(A_val)[0]
#A_val = (A_val + A_val.T) / 2.0
x_val
=
np
.
random
.
uniform
(
-
0.4
,
0.4
,
(
A_val
.
shape
[
1
],
1
))
.
astype
(
"float32"
)
b_val
=
np
.
dot
(
A_val
,
x_val
)
#b_val = np.asarray([[0.5, 0, 0], [0, 0.5, 0], [0, 0, 0.5]], dtype="float32")
#b_val = np.asarray([[0.5], [0.5], [0.5]], dtype="float32")
#A_empty = np.zeros((A_val.shape[1], A_val.shape[1])).astype("float32")
x_res
=
np
.
zeros
((
A_val
.
shape
[
1
],
1
))
.
astype
(
"float32"
)
import
theano
A
=
TT
.
matrix
(
"A"
,
dtype
=
"float32"
)
b
=
TT
.
matrix
(
"b"
,
dtype
=
"float32"
)
#theano.config.compute_test_value = 'warn'
#A.tag.test_value = A_val
#b.tag.test_value = b_val
#A = theano.shared(A_val)
#b = theano.shared(b_val)
from
theano.misc.pycuda_utils
import
to_gpuarray
solver
=
gpu_solve
(
A
,
b
)
fn
=
theano
.
function
([
A
,
b
],
[
solver
])
res
=
fn
(
A_val
,
b_val
)
res
[
0
]
.
get
(
x_res
)
print
(
np
.
allclose
(
x_res
,
x_val
))
import
ipdb
;
ipdb
.
set_trace
()
thrash2
()
theano/tensor/opt.py
浏览文件 @
73c28a05
差异被折叠。
点击展开。
theano/tests/test_debugprint.py
0 → 100644
浏览文件 @
73c28a05
import
theano
import
theano.tensor
as
T
from
theano
import
printing
X
=
T
.
matrix
(
'X'
)
results
,
updates
=
theano
.
scan
(
fn
=
lambda
x
:
2
*
x
.
sum
()
+
1
,
outputs_info
=
None
,
sequences
=
[
X
],
non_sequences
=
None
)
printing
.
debugprint
(
theano
.
function
([
X
],
results
))
theano/tests/test_scanmode.py
0 → 100644
浏览文件 @
73c28a05
import
theano
import
theano.tensor
as
T
from
theano
import
printing
X
=
T
.
matrix
(
'X'
)
results
,
updates
=
theano
.
scan
(
fn
=
lambda
x
:
2
*
x
.
sum
()
+
3
,
outputs_info
=
None
,
sequences
=
[
X
],
non_sequences
=
None
)
printing
.
debugprint
(
results
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论