Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6d93c2fc
提交
6d93c2fc
authored
1月 26, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
removed floatX module
上级
7b50faa0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
0 行增加
和
109 行删除
+0
-109
floatX.py
theano/floatX.py
+0
-33
test_floatX.py
theano/tests/test_floatX.py
+0
-76
没有找到文件。
theano/floatX.py
deleted
100644 → 0
浏览文件 @
7b50faa0
"""Provide xscalar, xvector, xmatrix, etc. pseudo-types
"""
if
0
:
from
.configparser
import
config
from
theano.scalar
import
float64
,
float32
from
theano.tensor
import
(
fscalar
,
fvector
,
fmatrix
,
frow
,
fcol
,
ftensor3
,
ftensor4
,
dscalar
,
dvector
,
dmatrix
,
drow
,
dcol
,
dtensor3
,
dtensor4
)
#
# !!! set_floatX adds symbols directly to the module's symbol table !!!
#
def
set_floatX
(
dtype
=
config
.
floatX
):
""" add the xmatrix, xvector, xscalar etc. aliases to theano.tensor
"""
config
.
floatX
=
dtype
if
dtype
==
'float32'
:
prefix
=
'f'
elif
dtype
==
'float64'
:
prefix
=
'd'
else
:
raise
Exception
(
"Bad param in set_floatX(
%
s). Only float32 and float64 are supported"
%
config
.
floatX
)
#tensor.scalar stuff
globals
()[
'floatX'
]
=
globals
()[
dtype
]
# convert_to_floatX = Cast(floatX, name='convert_to_floatX')
#tensor.tensor stuff
for
symbol
in
(
'scalar'
,
'vector'
,
'matrix'
,
'row'
,
'col'
,
'tensor3'
,
'tensor4'
):
globals
()[
'x'
+
symbol
]
=
globals
()[
prefix
+
symbol
]
#_convert_to_floatX = _conversion(elemwise.Elemwise(scal.convert_to_floatX), 'floatX')
theano/tests/test_floatX.py
deleted
100644 → 0
浏览文件 @
7b50faa0
from
theano.tensor
import
*
import
theano.config
as
config
from
theano
import
function
#from theano.floatx import set_floatX, xscalar, xmatrix, xrow, xcol, xvector, xtensor3, xtensor4
import
theano.floatX
as
FX
def
test_floatX
():
def
test
():
floatx
=
config
.
floatX
#TODO test other fct then ?vector
#float64 cast to float64 should not generate an op
x
=
dvector
(
'x'
)
f
=
function
([
x
],[
cast
(
x
,
'float64'
)])
# print f.maker.env.toposort()
assert
len
(
f
.
maker
.
env
.
toposort
())
==
0
#float32 cast to float32 should not generate an op
x
=
fvector
(
'x'
)
f
=
function
([
x
],[
cast
(
x
,
'float32'
)])
# print f.maker.env.toposort()
assert
len
(
f
.
maker
.
env
.
toposort
())
==
0
#floatX cast to float64
x
=
FX
.
xvector
(
'x'
)
f
=
function
([
x
],[
cast
(
x
,
'float64'
)])
# print f.maker.env.toposort()
if
floatx
==
'float64'
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
0
else
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
1
#floatX cast to float32
x
=
FX
.
xvector
(
'x'
)
f
=
function
([
x
],[
cast
(
x
,
'float32'
)])
# print f.maker.env.toposort()
if
floatx
==
'float32'
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
0
else
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
1
#float64 cast to floatX
x
=
dvector
(
'x'
)
f
=
function
([
x
],[
cast
(
x
,
'floatX'
)])
# print f.maker.env.toposort()
if
floatx
==
'float64'
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
0
else
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
1
#float32 cast to floatX
x
=
fvector
(
'x'
)
f
=
function
([
x
],[
cast
(
x
,
'floatX'
)])
# print f.maker.env.toposort()
if
floatx
==
'float32'
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
0
else
:
assert
len
(
f
.
maker
.
env
.
toposort
())
==
1
#floatX cast to floatX
x
=
FX
.
xvector
(
'x'
)
f
=
function
([
x
],[
cast
(
x
,
'floatX'
)])
# print f.maker.env.toposort()
assert
len
(
f
.
maker
.
env
.
toposort
())
==
0
orig_floatx
=
config
.
floatX
try
:
print
'float32'
FX
.
set_floatX
(
'float32'
)
test
()
print
'float64'
FX
.
set_floatX
(
'float64'
)
test
()
finally
:
pass
FX
.
set_floatX
(
orig_floatx
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论