Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9ed5aead
提交
9ed5aead
authored
4月 10, 2008
作者:
turian@grenat.iro.umontreal.ca
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
a9a22e80
72144cf9
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
28 行增加
和
12 行删除
+28
-12
epydoc
epydoc
+2
-2
epydoc-fast
epydoc-fast
+2
-2
epydoc-fast.sh
epydoc-fast.sh
+1
-0
epydoc.sh
epydoc.sh
+1
-0
op.py
gof/op.py
+7
-7
sparse.py
sparse.py
+15
-1
没有找到文件。
epydoc
浏览文件 @
9ed5aead
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
# The list of objects to document. Objects can be named using
# The list of objects to document. Objects can be named using
# dotted names, module filenames, or package directory names.
# dotted names, module filenames, or package directory names.
# Alases for this option include "objects" and "values".
# Alases for this option include "objects" and "values".
modules: *.py, gof/*.py, scipy, numpy
modules: *.py, gof/*.py,
joseph/*.py, tlearn/*.py,
scipy, numpy
# The type of output that should be generated. Should be one
# The type of output that should be generated. Should be one
# of: html, text, latex, dvi, ps, pdf.
# of: html, text, latex, dvi, ps, pdf.
...
@@ -135,7 +135,7 @@ dotpath: /usr/bin/dot
...
@@ -135,7 +135,7 @@ dotpath: /usr/bin/dot
# The name of one or more pstat files (generated by the profile
# The name of one or more pstat files (generated by the profile
# or hotshot module). These are used to generate call graphs.
# or hotshot module). These are used to generate call graphs.
#pstat: sparse
.pstat
pstat: autotest
.pstat
# Specify the font used to generate Graphviz graphs.
# Specify the font used to generate Graphviz graphs.
# (e.g., helvetica or times).
# (e.g., helvetica or times).
...
...
epydoc-fast
浏览文件 @
9ed5aead
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
# The list of objects to document. Objects can be named using
# The list of objects to document. Objects can be named using
# dotted names, module filenames, or package directory names.
# dotted names, module filenames, or package directory names.
# Alases for this option include "objects" and "values".
# Alases for this option include "objects" and "values".
modules: *.py, gof/*.py
modules: *.py, gof/*.py
, joseph/*.py, tlearn/*.py
# The type of output that should be generated. Should be one
# The type of output that should be generated. Should be one
# of: html, text, latex, dvi, ps, pdf.
# of: html, text, latex, dvi, ps, pdf.
...
@@ -135,7 +135,7 @@ dotpath: /usr/bin/dot
...
@@ -135,7 +135,7 @@ dotpath: /usr/bin/dot
# The name of one or more pstat files (generated by the profile
# The name of one or more pstat files (generated by the profile
# or hotshot module). These are used to generate call graphs.
# or hotshot module). These are used to generate call graphs.
#pstat: sparse
.pstat
pstat: autotest
.pstat
# Specify the font used to generate Graphviz graphs.
# Specify the font used to generate Graphviz graphs.
# (e.g., helvetica or times).
# (e.g., helvetica or times).
...
...
epydoc-fast.sh
浏览文件 @
9ed5aead
#!/bin/sh
#!/bin/sh
# python -m profile -o autotest.pstat autotest.py
epydoc
--config
epydoc-fast
epydoc
--config
epydoc-fast
epydoc.sh
浏览文件 @
9ed5aead
#!/bin/sh
#!/bin/sh
python
-m
profile
-o
autotest.pstat autotest.py
epydoc
--config
epydoc
epydoc
--config
epydoc
gof/op.py
浏览文件 @
9ed5aead
...
@@ -17,7 +17,7 @@ __all__ = ['Op',
...
@@ -17,7 +17,7 @@ __all__ = ['Op',
def
constructor
(
op_cls
):
def
constructor
(
op_cls
):
"""Make an Op look like a
Result
-valued function."""
"""Make an Op look like a
L{Result}
-valued function."""
def
f
(
*
args
,
**
kwargs
):
def
f
(
*
args
,
**
kwargs
):
op
=
op_cls
(
*
args
,
**
kwargs
)
op
=
op_cls
(
*
args
,
**
kwargs
)
if
len
(
op
.
outputs
)
>
1
:
if
len
(
op
.
outputs
)
>
1
:
...
@@ -28,12 +28,12 @@ def constructor(op_cls):
...
@@ -28,12 +28,12 @@ def constructor(op_cls):
class
Op
(
object
):
class
Op
(
object
):
"""
"""
Op
represents a computation on the storage in its 'inputs' slot,
L{Op}
represents a computation on the storage in its 'inputs' slot,
the results of which are stored in the
Result
instances in the
the results of which are stored in the
L{Result}
instances in the
'outputs' slot. The owner of each
Result
in the outputs list must
'outputs' slot. The owner of each
L{Result}
in the outputs list must
be set to this
Op and thus any Result
instance is in the outputs
be set to this
L{Op} and thus any L{Result}
instance is in the outputs
list of at most one
Op
, its owner. It is the responsibility of the
list of at most one
L{Op}
, its owner. It is the responsibility of the
Op
to ensure that it owns its outputs and it is encouraged (though
L{Op}
to ensure that it owns its outputs and it is encouraged (though
not required) that it creates them.
not required) that it creates them.
"""
"""
...
...
sparse.py
浏览文件 @
9ed5aead
...
@@ -9,7 +9,12 @@ import tensor
...
@@ -9,7 +9,12 @@ import tensor
# Wrapper type
# Wrapper type
def
assparse
(
sp
,
**
kwargs
):
def
assparse
(
sp
,
**
kwargs
):
"""Return SparseR version of sp"""
"""
Wrapper around SparseR constructor.
@param sp: A sparse matrix. assparse reads dtype and format properties
out of this sparse matrix.
@return: SparseR version of sp.
"""
if
isinstance
(
sp
,
SparseR
):
if
isinstance
(
sp
,
SparseR
):
return
sp
return
sp
else
:
else
:
...
@@ -37,6 +42,13 @@ class SparseR(gof.result.ResultBase):
...
@@ -37,6 +42,13 @@ class SparseR(gof.result.ResultBase):
dtype_set
=
set
([
'int'
,
'int32'
,
'int64'
,
'float32'
,
'float64'
])
dtype_set
=
set
([
'int'
,
'int32'
,
'int64'
,
'float32'
,
'float64'
])
def
__init__
(
self
,
dtype
,
format
,
**
kwargs
):
def
__init__
(
self
,
dtype
,
format
,
**
kwargs
):
"""
Fundamental way to do create a sparse node.
@param dtype: Type of numbers in the matrix.
@param format: The sparse storage strategy.
@return An empty SparseR instance.
"""
gof
.
ResultBase
.
__init__
(
self
,
**
kwargs
)
gof
.
ResultBase
.
__init__
(
self
,
**
kwargs
)
if
dtype
in
SparseR
.
dtype_set
:
if
dtype
in
SparseR
.
dtype_set
:
self
.
_dtype
=
dtype
self
.
_dtype
=
dtype
...
@@ -165,8 +177,10 @@ if 0:
...
@@ -165,8 +177,10 @@ if 0:
def
gen_outputs
(
self
):
return
[
SparseR
()]
def
gen_outputs
(
self
):
return
[
SparseR
()]
def
impl
(
x
,
y
):
def
impl
(
x
,
y
):
if
hasattr
(
x
,
'getnnz'
):
if
hasattr
(
x
,
'getnnz'
):
# if x is sparse, then do this.
return
x
.
dot
(
y
)
return
x
.
dot
(
y
)
else
:
else
:
# if x is dense (and y is sparse), we do this
return
y
.
transpose
()
.
dot
(
x
.
transpose
())
.
transpose
()
return
y
.
transpose
()
.
dot
(
x
.
transpose
())
.
transpose
()
def
grad
(
self
,
x
,
y
,
gz
):
def
grad
(
self
,
x
,
y
,
gz
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论