Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a9d29a8a
提交
a9d29a8a
authored
2月 03, 2008
作者:
Olivier Breuleux
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
216fab0b
0d80e16f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
29 行增加
和
2 行删除
+29
-2
compile.py
compile.py
+1
-0
core.py
core.py
+14
-0
lib.py
gof/lib.py
+2
-2
link.py
gof/link.py
+12
-0
没有找到文件。
compile.py
浏览文件 @
a9d29a8a
...
@@ -45,6 +45,7 @@ def experimental_linker(env, target = None):
...
@@ -45,6 +45,7 @@ def experimental_linker(env, target = None):
else
:
else
:
raise
NotImplementedError
(
"Cannot write thunk representation to a file."
)
raise
NotImplementedError
(
"Cannot write thunk representation to a file."
)
# def experimental_linker(env, target = None):
# def experimental_linker(env, target = None):
# def fetch(op):
# def fetch(op):
# try:
# try:
...
...
core.py
浏览文件 @
a9d29a8a
...
@@ -882,6 +882,19 @@ class exp(elemwise):
...
@@ -882,6 +882,19 @@ class exp(elemwise):
impl
=
numpy
.
exp
impl
=
numpy
.
exp
def
c_foreach
((
x_i
,
),
(
z_i
,
)):
def
c_foreach
((
x_i
,
),
(
z_i
,
)):
return
"z_i = exp(x_i);"
return
"z_i = exp(x_i);"
## Logarithm ##
class
log
(
elemwise
):
impl
=
numpy
.
log
def
c_foreach
((
x_i
,
),
(
z_i
,
)):
return
"z_i = log(x_i);"
class
log2
(
elemwise
):
impl
=
numpy
.
log2
def
c_foreach
((
x_i
,
),
(
z_i
,
)):
return
"z_i = log(x_i);"
## Element-wise division ##
## Element-wise division ##
...
@@ -1109,6 +1122,7 @@ class dot(omega_op):
...
@@ -1109,6 +1122,7 @@ class dot(omega_op):
return
dot
(
gz
,
transpose
(
y
)),
dot
(
transpose
(
x
),
gz
)
return
dot
(
gz
,
transpose
(
y
)),
dot
(
transpose
(
x
),
gz
)
def
specs
(
x
,
y
):
def
specs
(
x
,
y
):
# todo: handle all tensors!
# todo: handle all tensors!
assert
x
[
2
][
1
]
==
y
[
2
][
0
]
shape
=
(
x
[
2
][
0
],
y
[
2
][
1
])
shape
=
(
x
[
2
][
0
],
y
[
2
][
1
])
return
(
numpy
.
ndarray
,
upcast
(
x
[
1
],
y
[
1
]),
shape
)
return
(
numpy
.
ndarray
,
upcast
(
x
[
1
],
y
[
1
]),
shape
)
def
c_headers
(
self
):
def
c_headers
(
self
):
...
...
gof/lib.py
浏览文件 @
a9d29a8a
...
@@ -220,8 +220,8 @@ class PythonOp(Op):
...
@@ -220,8 +220,8 @@ class PythonOp(Op):
def
_perform
(
self
):
def
_perform
(
self
):
results
=
self
.
_impl
()
results
=
self
.
_impl
()
if
self
.
nout
==
1
:
if
self
.
nout
==
1
:
#
self.out.set_value(results)
self
.
out
.
set_value
(
results
)
self
.
outputs
[
0
]
.
data
=
results
#
self.outputs[0].data = results
else
:
else
:
assert
self
.
nout
==
len
(
results
)
assert
self
.
nout
==
len
(
results
)
for
result
,
output
in
zip
(
results
,
self
.
outputs
):
for
result
,
output
in
zip
(
results
,
self
.
outputs
):
...
...
gof/link.py
浏览文件 @
a9d29a8a
def
perform_linker
(
env
,
target
=
None
):
def
perform_linker
(
env
,
target
=
None
):
order
=
env
.
toposort
()
thunks
=
[
op
.
perform
for
op
in
order
]
def
ret
():
for
thunk
in
thunks
:
thunk
()
if
not
target
:
return
ret
else
:
raise
NotImplementedError
(
"Cannot write thunk representation to a file."
)
def
perform_linker_nochecks
(
env
,
target
=
None
):
order
=
env
.
toposort
()
order
=
env
.
toposort
()
thunks
=
[
op
.
_perform
for
op
in
order
]
thunks
=
[
op
.
_perform
for
op
in
order
]
def
ret
():
def
ret
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论