Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5dcad44a
提交
5dcad44a
authored
7月 23, 2015
作者:
Iban Harlouchet
提交者:
Arnaud Bergeron
9月 08, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
testcode for doc/tutorial/modes.txt
上级
b0c8223d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
63 行增加
和
13 行删除
+63
-13
modes.txt
doc/tutorial/modes.txt
+63
-13
没有找到文件。
doc/tutorial/modes.txt
浏览文件 @
5dcad44a
...
@@ -43,7 +43,7 @@ Exercise
...
@@ -43,7 +43,7 @@ Exercise
Consider the logistic regression:
Consider the logistic regression:
..
code-block:: python
..
testcode::
import numpy
import numpy
import theano
import theano
...
@@ -84,26 +84,76 @@ Consider the logistic regression:
...
@@ -84,26 +84,76 @@ Consider the logistic regression:
if any([x.op.__class__.__name__ in ['Gemv', 'CGemv', 'Gemm', 'CGemm'] for x in
if any([x.op.__class__.__name__ in ['Gemv', 'CGemv', 'Gemm', 'CGemm'] for x in
train.maker.fgraph.toposort()]):
train.maker.fgraph.toposort()]):
print
'Used the cpu'
print
('Used the cpu')
elif any([x.op.__class__.__name__ in ['GpuGemm', 'GpuGemv'] for x in
elif any([x.op.__class__.__name__ in ['GpuGemm', 'GpuGemv'] for x in
train.maker.fgraph.toposort()]):
train.maker.fgraph.toposort()]):
print
'Used the gpu'
print
('Used the gpu')
else:
else:
print
'ERROR, not able to tell if theano used the cpu or the gpu'
print
('ERROR, not able to tell if theano used the cpu or the gpu')
print
train.maker.fgraph.toposort(
)
print
(train.maker.fgraph.toposort()
)
for i in range(training_steps):
for i in range(training_steps):
pred, err = train(D[0], D[1])
pred, err = train(D[0], D[1])
#print "Final model:"
#print "Final model:"
#print w.get_value(), b.get_value()
#print w.get_value(), b.get_value()
print "target values for D"
print("target values for D")
print D[1]
print(D[1])
print("prediction on D")
print(predict(D[0]))
.. testoutput::
:hide:
:options: +ELLIPSIS
Used the cpu
targe values for D
...
prediction on D
...
.. code-block:: none
Used the cpu
target values for D
[ 0. 0. 1. 0. 1. 1. 0. 1. 0. 1. 0. 1. 0. 0. 0. 0. 1. 0.
1. 0. 1. 1. 0. 1. 0. 0. 1. 1. 1. 0. 1. 0. 0. 1. 1. 1.
0. 0. 0. 0. 0. 1. 1. 1. 0. 0. 1. 1. 1. 1. 1. 0. 0. 1.
0. 1. 0. 0. 1. 1. 0. 1. 1. 1. 1. 0. 0. 1. 1. 0. 1. 1.
1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.
1. 0. 1. 0. 1. 0. 0. 0. 1. 1. 0. 1. 0. 1. 0. 1. 0. 1.
0. 1. 0. 0. 0. 1. 0. 0. 1. 1. 1. 0. 1. 1. 0. 0. 1. 0.
1. 1. 1. 0. 1. 1. 0. 0. 1. 0. 1. 0. 0. 1. 0. 0. 0. 1.
0. 0. 0. 0. 0. 1. 1. 1. 1. 1. 1. 0. 0. 1. 1. 0. 1. 0.
0. 0. 0. 1. 1. 1. 0. 0. 0. 1. 1. 1. 0. 1. 0. 0. 0. 0.
1. 1. 1. 1. 1. 0. 1. 1. 0. 0. 0. 0. 0. 1. 1. 1. 1. 1.
0. 1. 1. 1. 0. 1. 1. 0. 0. 0. 1. 1. 1. 0. 0. 0. 1. 0.
0. 1. 0. 1. 1. 1. 0. 1. 1. 1. 0. 0. 0. 1. 1. 0. 1. 0.
0. 1. 1. 0. 1. 1. 1. 0. 0. 1. 1. 1. 0. 1. 1. 1. 1. 0.
1. 0. 1. 0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0 1 1 0 1
0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 0 1
1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0
0 1 1 1 0 1 1 0 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1]
print "prediction on D"
print predict(D[0])
Modify and execute this example to run on CPU (the default) with floatX=float32 and
Modify and execute this example to run on CPU (the default) with floatX=float32 and
time the execution using the command line ``time python file.py``. Save your code
time the execution using the command line ``time python file.py``. Save your code
as it will be useful later on.
as it will be useful later on.
...
@@ -215,7 +265,7 @@ cluster!).
...
@@ -215,7 +265,7 @@ cluster!).
DebugMode is used as follows:
DebugMode is used as follows:
..
code-block:: python
..
testcode::
x = T.dvector('x')
x = T.dvector('x')
...
@@ -311,7 +361,7 @@ regression example.
...
@@ -311,7 +361,7 @@ regression example.
Compiling the module with ``ProfileMode`` and calling ``profmode.print_summary()``
Compiling the module with ``ProfileMode`` and calling ``profmode.print_summary()``
generates the following output:
generates the following output:
..
code-block:: python
..
testcode::
"""
"""
ProfileMode.print_summary()
ProfileMode.print_summary()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论