Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4feabe53
提交
4feabe53
authored
7月 21, 2014
作者:
Frederic
提交者:
Tanjay94
7月 21, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix import loop problem.
上级
47e43343
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
10 行增加
和
9 行删除
+10
-9
__init__.py
theano/__init__.py
+2
-1
__init__.py
theano/tensor/__init__.py
+2
-0
nlinalg.py
theano/tensor/nlinalg.py
+5
-6
var.py
theano/tensor/var.py
+1
-2
没有找到文件。
theano/__init__.py
浏览文件 @
4feabe53
...
@@ -69,6 +69,8 @@ FancyModule = Module
...
@@ -69,6 +69,8 @@ FancyModule = Module
from
theano.printing
import
pprint
,
pp
from
theano.printing
import
pprint
,
pp
from
theano
import
tensor
from
theano.scan_module
import
scan
,
map
,
reduce
,
foldl
,
foldr
,
clone
from
theano.scan_module
import
scan
,
map
,
reduce
,
foldl
,
foldr
,
clone
from
theano.updates
import
Updates
,
OrderedUpdates
from
theano.updates
import
Updates
,
OrderedUpdates
...
@@ -197,7 +199,6 @@ else:
...
@@ -197,7 +199,6 @@ else:
# This cannot be done in tensor/__init__.py due to a circular dependency -- randomstreams
# This cannot be done in tensor/__init__.py due to a circular dependency -- randomstreams
# depends on raw_random which depends on tensor. As a work-around, we import RandomStreams
# depends on raw_random which depends on tensor. As a work-around, we import RandomStreams
# here and inject an instance in tensor.
# here and inject an instance in tensor.
from
theano
import
tensor
from
theano.tensor.randomstreams
import
RandomStreams
from
theano.tensor.randomstreams
import
RandomStreams
# Imitate the numpy.random symbol with a tensor.random one
# Imitate the numpy.random symbol with a tensor.random one
tensor
.
random
=
RandomStreams
(
seed
=
0xBAD5EED
,
no_warn
=
True
)
tensor
.
random
=
RandomStreams
(
seed
=
0xBAD5EED
,
no_warn
=
True
)
...
...
theano/tensor/__init__.py
浏览文件 @
4feabe53
...
@@ -37,6 +37,8 @@ from theano.tensor import sharedvar # adds shared-variable constructors
...
@@ -37,6 +37,8 @@ from theano.tensor import sharedvar # adds shared-variable constructors
from
theano.tensor.sharedvar
import
tensor_constructor
as
_shared
from
theano.tensor.sharedvar
import
tensor_constructor
as
_shared
from
theano.tensor.io
import
*
from
theano.tensor.io
import
*
from
theano.tensor
import
nlinalg
def
shared
(
*
args
,
**
kw
):
def
shared
(
*
args
,
**
kw
):
"""
"""
...
...
theano/tensor/nlinalg.py
浏览文件 @
4feabe53
...
@@ -5,10 +5,9 @@ import numpy
...
@@ -5,10 +5,9 @@ import numpy
from
theano.gof
import
Op
,
Apply
from
theano.gof
import
Op
,
Apply
import
theano.tensor
from
theano.tensor
import
as_tensor_variable
,
dot
,
DimShuffle
,
Dot
from
theano.tensor
import
as_tensor_variable
,
dot
,
DimShuffle
,
Dot
from
theano.tensor.blas
import
Dot22
from
theano.tensor.blas
import
Dot22
from
theano
import
tensor
import
theano.tensor
from
theano.tensor.opt
import
(
register_stabilize
,
from
theano.tensor.opt
import
(
register_stabilize
,
register_specialize
,
register_canonicalize
)
register_specialize
,
register_canonicalize
)
from
theano.gof
import
local_optimizer
from
theano.gof
import
local_optimizer
...
@@ -170,7 +169,7 @@ class AllocDiag(Op):
...
@@ -170,7 +169,7 @@ class AllocDiag(Op):
x
=
as_tensor_variable
(
_x
)
x
=
as_tensor_variable
(
_x
)
if
x
.
type
.
ndim
!=
1
:
if
x
.
type
.
ndim
!=
1
:
raise
TypeError
(
'AllocDiag only works on vectors'
,
_x
)
raise
TypeError
(
'AllocDiag only works on vectors'
,
_x
)
return
Apply
(
self
,
[
x
],
[
tensor
.
matrix
(
dtype
=
x
.
type
.
dtype
)])
return
Apply
(
self
,
[
x
],
[
t
heano
.
t
ensor
.
matrix
(
dtype
=
x
.
type
.
dtype
)])
def
grad
(
self
,
inputs
,
g_outputs
):
def
grad
(
self
,
inputs
,
g_outputs
):
return
[
extract_diag
(
g_outputs
[
0
])]
return
[
extract_diag
(
g_outputs
[
0
])]
...
@@ -239,15 +238,15 @@ class ExtractDiag(Op):
...
@@ -239,15 +238,15 @@ class ExtractDiag(Op):
return
'ExtractDiag{view=
%
s}'
%
self
.
view
return
'ExtractDiag{view=
%
s}'
%
self
.
view
def
grad
(
self
,
inputs
,
g_outputs
):
def
grad
(
self
,
inputs
,
g_outputs
):
x
=
tensor
.
zeros_like
(
inputs
[
0
])
x
=
t
heano
.
t
ensor
.
zeros_like
(
inputs
[
0
])
xdiag
=
alloc_diag
(
g_outputs
[
0
])
xdiag
=
alloc_diag
(
g_outputs
[
0
])
return
[
tensor
.
set_subtensor
(
return
[
t
heano
.
t
ensor
.
set_subtensor
(
x
[:
xdiag
.
shape
[
0
],
:
xdiag
.
shape
[
1
]],
x
[:
xdiag
.
shape
[
0
],
:
xdiag
.
shape
[
1
]],
xdiag
)]
xdiag
)]
def
infer_shape
(
self
,
node
,
shapes
):
def
infer_shape
(
self
,
node
,
shapes
):
x_s
,
=
shapes
x_s
,
=
shapes
shp
=
tensor
.
min
(
node
.
inputs
[
0
]
.
shape
)
shp
=
t
heano
.
t
ensor
.
min
(
node
.
inputs
[
0
]
.
shape
)
return
[(
shp
,)]
return
[(
shp
,)]
extract_diag
=
ExtractDiag
()
extract_diag
=
ExtractDiag
()
...
...
theano/tensor/var.py
浏览文件 @
4feabe53
...
@@ -9,7 +9,6 @@ from theano.gof import Constant, Variable
...
@@ -9,7 +9,6 @@ from theano.gof import Constant, Variable
from
theano.gof.utils
import
hashtype
from
theano.gof.utils
import
hashtype
from
theano.tensor.utils
import
hash_from_ndarray
from
theano.tensor.utils
import
hash_from_ndarray
from
theano.tensor.type
import
TensorType
from
theano.tensor.type
import
TensorType
from
theano.tensor
import
nlinalg
class
AsTensorError
(
TypeError
):
class
AsTensorError
(
TypeError
):
...
@@ -536,7 +535,7 @@ class _tensor_py_operators:
...
@@ -536,7 +535,7 @@ class _tensor_py_operators:
return
theano
.
tensor
.
basic
.
round
(
self
,
mode
)
return
theano
.
tensor
.
basic
.
round
(
self
,
mode
)
def
trace
(
self
):
def
trace
(
self
):
return
theano
.
sandbox
.
linalg
.
ops
.
trace
(
self
)
return
theano
.
tensor
.
n
linalg
.
ops
.
trace
(
self
)
# TO TRUMP NUMPY OPERATORS
# TO TRUMP NUMPY OPERATORS
__array_priority__
=
1000
__array_priority__
=
1000
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论