Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f9032d6a
提交
f9032d6a
authored
9月 25, 2008
作者:
Olivier Breuleux
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed tests
上级
9c7acee5
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
11 行增加
和
10 行删除
+11
-10
_test_tensor.py
_test_tensor.py
+1
-1
_test_tensor_opt.py
_test_tensor_opt.py
+4
-4
_test_tensor_random.py
_test_tensor_random.py
+3
-1
_test_destroyhandler.py
gof/_test_destroyhandler.py
+0
-1
scalar.py
scalar.py
+3
-3
没有找到文件。
_test_tensor.py
浏览文件 @
f9032d6a
...
@@ -635,7 +635,7 @@ class T_Cast(unittest.TestCase):
...
@@ -635,7 +635,7 @@ class T_Cast(unittest.TestCase):
[
convert_to_int8
,
convert_to_int16
,
convert_to_int32
,
convert_to_int64
,
[
convert_to_int8
,
convert_to_int16
,
convert_to_int32
,
convert_to_int64
,
convert_to_float32
,
convert_to_float64
]):
convert_to_float32
,
convert_to_float64
]):
y
=
converter
(
x
)
y
=
converter
(
x
)
f
=
function
([
x
],
y
,
strict
=
True
,
mode
=
default_mode
)
f
=
function
([
compile
.
In
(
x
,
strict
=
True
)],
y
,
mode
=
default_mode
)
a
=
numpy
.
arange
(
10
,
dtype
=
type1
)
a
=
numpy
.
arange
(
10
,
dtype
=
type1
)
b
=
f
(
a
)
b
=
f
(
a
)
self
.
failUnless
(
numpy
.
all
(
b
==
numpy
.
arange
(
10
,
dtype
=
type2
)))
self
.
failUnless
(
numpy
.
all
(
b
==
numpy
.
arange
(
10
,
dtype
=
type2
)))
...
...
_test_tensor_opt.py
浏览文件 @
f9032d6a
...
@@ -107,11 +107,11 @@ class _test_greedy_distribute(unittest.TestCase):
...
@@ -107,11 +107,11 @@ class _test_greedy_distribute(unittest.TestCase):
a
,
b
,
c
,
d
,
x
,
y
,
z
=
matrices
(
'abcdxyz'
)
a
,
b
,
c
,
d
,
x
,
y
,
z
=
matrices
(
'abcdxyz'
)
e
=
(
a
/
z
+
b
/
x
)
*
x
*
z
e
=
(
a
/
z
+
b
/
x
)
*
x
*
z
g
=
Env
([
a
,
b
,
c
,
d
,
x
,
y
,
z
],
[
e
])
g
=
Env
([
a
,
b
,
c
,
d
,
x
,
y
,
z
],
[
e
])
print
pprint
.
pp
.
process
(
g
.
outputs
[
0
])
##
print pprint.pp.process(g.outputs[0])
mul_canonizer
.
optimize
(
g
)
mul_canonizer
.
optimize
(
g
)
gof
.
TopoOptimizer
(
gof
.
LocalOptGroup
(
local_fill_cut
,
local_fill_lift
),
order
=
'out_to_in'
)
.
optimize
(
g
)
gof
.
TopoOptimizer
(
gof
.
LocalOptGroup
(
local_fill_cut
,
local_fill_lift
),
order
=
'out_to_in'
)
.
optimize
(
g
)
gof
.
TopoOptimizer
(
gof
.
LocalOptGroup
(
local_greedy_distributor
),
order
=
'out_to_in'
)
.
optimize
(
g
)
gof
.
TopoOptimizer
(
gof
.
LocalOptGroup
(
local_greedy_distributor
),
order
=
'out_to_in'
)
.
optimize
(
g
)
print
pprint
.
pp
.
process
(
g
.
outputs
[
0
])
##
print pprint.pp.process(g.outputs[0])
...
@@ -131,10 +131,10 @@ class _test_canonize(unittest.TestCase):
...
@@ -131,10 +131,10 @@ class _test_canonize(unittest.TestCase):
# e = x / y / x
# e = x / y / x
e
=
(
x
/
x
)
*
(
y
/
y
)
e
=
(
x
/
x
)
*
(
y
/
y
)
g
=
Env
([
x
,
y
,
z
,
a
,
b
,
c
,
d
],
[
e
])
g
=
Env
([
x
,
y
,
z
,
a
,
b
,
c
,
d
],
[
e
])
print
pprint
.
pp
.
process
(
g
.
outputs
[
0
])
##
print pprint.pp.process(g.outputs[0])
mul_canonizer
.
optimize
(
g
)
mul_canonizer
.
optimize
(
g
)
gof
.
TopoOptimizer
(
gof
.
LocalOptGroup
(
local_fill_cut
,
local_fill_lift
),
order
=
'out_to_in'
)
.
optimize
(
g
)
gof
.
TopoOptimizer
(
gof
.
LocalOptGroup
(
local_fill_cut
,
local_fill_lift
),
order
=
'out_to_in'
)
.
optimize
(
g
)
print
pprint
.
pp
.
process
(
g
.
outputs
[
0
])
##
print pprint.pp.process(g.outputs[0])
# def test_plusmin(self):
# def test_plusmin(self):
# x, y, z = inputs()
# x, y, z = inputs()
...
...
_test_tensor_random.py
浏览文件 @
f9032d6a
## TODO: REDO THESE TESTS
import
unittest
import
unittest
from
tensor_random
import
*
from
tensor_random
import
*
...
@@ -7,7 +9,7 @@ import compile
...
@@ -7,7 +9,7 @@ import compile
def
Uniform
(
s
,
n
):
def
Uniform
(
s
,
n
):
return
NumpyGenerator
(
s
,
n
,
numpy
.
random
.
RandomState
.
uniform
)
return
NumpyGenerator
(
s
,
n
,
numpy
.
random
.
RandomState
.
uniform
)
class
T_Random
(
unittest
.
TestCase
):
class
T_Random
:
#
(unittest.TestCase):
def
test0
(
self
):
def
test0
(
self
):
rng
=
Uniform
(
12345
,
2
)
rng
=
Uniform
(
12345
,
2
)
...
...
gof/_test_destroyhandler.py
浏览文件 @
f9032d6a
...
@@ -7,7 +7,6 @@ from graph import Result, Apply
...
@@ -7,7 +7,6 @@ from graph import Result, Apply
from
op
import
Op
from
op
import
Op
from
opt
import
*
from
opt
import
*
from
ext
import
*
import
destroyhandler
import
destroyhandler
from
env
import
Env
,
InconsistencyError
from
env
import
Env
,
InconsistencyError
from
toolbox
import
ReplaceValidate
from
toolbox
import
ReplaceValidate
...
...
scalar.py
浏览文件 @
f9032d6a
...
@@ -86,7 +86,7 @@ class Scalar(Type):
...
@@ -86,7 +86,7 @@ class Scalar(Type):
return
str
(
self
.
dtype
)
return
str
(
self
.
dtype
)
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"Scalar
{
%
s}
"
%
self
.
dtype
return
"Scalar
(
%
s)
"
%
self
.
dtype
def
c_literal
(
self
,
data
):
def
c_literal
(
self
,
data
):
if
'complex'
in
self
.
dtype
:
if
'complex'
in
self
.
dtype
:
...
@@ -257,7 +257,7 @@ class transfer_type:
...
@@ -257,7 +257,7 @@ class transfer_type:
assert
type
(
i
)
==
int
assert
type
(
i
)
==
int
self
.
i
=
i
self
.
i
=
i
def
__call__
(
self
,
*
types
):
def
__call__
(
self
,
*
types
):
return
types
[
self
.
i
]
return
types
[
self
.
i
]
,
class
specific_out
:
class
specific_out
:
def
__init__
(
self
,
*
spec
):
def
__init__
(
self
,
*
spec
):
self
.
spec
=
spec
self
.
spec
=
spec
...
@@ -284,7 +284,7 @@ class ScalarOp(Op):
...
@@ -284,7 +284,7 @@ class ScalarOp(Op):
self
.
name
=
name
self
.
name
=
name
if
output_types_preference
is
not
None
:
if
output_types_preference
is
not
None
:
if
not
callable
(
output_types_preference
):
if
not
callable
(
output_types_preference
):
raise
TypeError
(
"Expected a callable for the 'output_types_preference' argument to
%
s.
"
%
self
.
__class__
)
raise
TypeError
(
"Expected a callable for the 'output_types_preference' argument to
%
s.
(got:
%
s)"
%
(
self
.
__class__
,
output_types_preference
)
)
self
.
output_types_preference
=
output_types_preference
self
.
output_types_preference
=
output_types_preference
def
make_node
(
self
,
*
inputs
):
def
make_node
(
self
,
*
inputs
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论