Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ae9825c5
提交
ae9825c5
authored
11月 16, 2010
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed trailing spaces
上级
af0fbb52
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
15 行删除
+15
-15
io.py
theano/compile/io.py
+7
-7
basic.py
theano/sparse/basic.py
+0
-0
basic.py
theano/tensor/basic.py
+8
-8
没有找到文件。
theano/compile/io.py
浏览文件 @
ae9825c5
...
@@ -8,11 +8,11 @@ class SymbolicInput(object):
...
@@ -8,11 +8,11 @@ class SymbolicInput(object):
"""
"""
Represents a symbolic input for use with function or FunctionMaker.
Represents a symbolic input for use with function or FunctionMaker.
variable: a Variable instance.
variable: a Variable instance.
This will be assigned a value before running the function,
This will be assigned a value before running the function,
not computed from its owner.
not computed from its owner.
name: Any type. (If autoname=True, defaults to variable.name).
name: Any type. (If autoname=True, defaults to variable.name).
If name is a valid Python identifier, this input can be set by kwarg, and its value
If name is a valid Python identifier, this input can be set by kwarg, and its value
can be accessed by self.<name>.
can be accessed by self.<name>.
...
@@ -41,9 +41,9 @@ class SymbolicInput(object):
...
@@ -41,9 +41,9 @@ class SymbolicInput(object):
assert
implicit
is
not
None
# Safety check.
assert
implicit
is
not
None
# Safety check.
self
.
variable
=
variable
self
.
variable
=
variable
if
(
autoname
and
name
is
None
):
if
(
autoname
and
name
is
None
):
self
.
name
=
variable
.
name
self
.
name
=
variable
.
name
else
:
else
:
self
.
name
=
name
self
.
name
=
name
#backport
#backport
#self.name = variable.name if (autoname and name is None) else name
#self.name = variable.name if (autoname and name is None) else name
...
@@ -131,11 +131,11 @@ class In(SymbolicInput):
...
@@ -131,11 +131,11 @@ class In(SymbolicInput):
"""
"""
Represents a symbolic input for use with function or FunctionMaker.
Represents a symbolic input for use with function or FunctionMaker.
variable: a Variable instance.
variable: a Variable instance.
This will be assigned a value before running the function,
This will be assigned a value before running the function,
not computed from its owner.
not computed from its owner.
name: Any type. (If autoname=True, defaults to variable.name).
name: Any type. (If autoname=True, defaults to variable.name).
If name is a valid Python identifier, this input can be set by kwarg, and its value
If name is a valid Python identifier, this input can be set by kwarg, and its value
can be accessed by self.<name>.
can be accessed by self.<name>.
...
@@ -194,7 +194,7 @@ class SymbolicOutput(object):
...
@@ -194,7 +194,7 @@ class SymbolicOutput(object):
returned for this output might be clobbered by running
returned for this output might be clobbered by running
the function again, but the function might be faster.
the function again, but the function might be faster.
"""
"""
def
__init__
(
self
,
variable
,
borrow
=
False
):
def
__init__
(
self
,
variable
,
borrow
=
False
):
self
.
variable
=
variable
self
.
variable
=
variable
self
.
borrow
=
borrow
self
.
borrow
=
borrow
...
...
theano/sparse/basic.py
浏览文件 @
ae9825c5
差异被折叠。
点击展开。
theano/tensor/basic.py
浏览文件 @
ae9825c5
...
@@ -898,24 +898,24 @@ class _tensor_py_operators:
...
@@ -898,24 +898,24 @@ class _tensor_py_operators:
#COMPARISONS
#COMPARISONS
_is_nonzero
=
True
_is_nonzero
=
True
def
__lt__
(
self
,
other
):
def
__lt__
(
self
,
other
):
rval
=
lt
(
self
,
other
)
rval
=
lt
(
self
,
other
)
rval
.
_is_nonzero
=
False
rval
.
_is_nonzero
=
False
return
rval
return
rval
def
__le__
(
self
,
other
):
def
__le__
(
self
,
other
):
rval
=
le
(
self
,
other
)
rval
=
le
(
self
,
other
)
rval
.
_is_nonzero
=
False
rval
.
_is_nonzero
=
False
return
rval
return
rval
def
__gt__
(
self
,
other
):
def
__gt__
(
self
,
other
):
rval
=
gt
(
self
,
other
)
rval
=
gt
(
self
,
other
)
rval
.
_is_nonzero
=
False
rval
.
_is_nonzero
=
False
return
rval
return
rval
def
__ge__
(
self
,
other
):
def
__ge__
(
self
,
other
):
rval
=
ge
(
self
,
other
)
rval
=
ge
(
self
,
other
)
rval
.
_is_nonzero
=
False
rval
.
_is_nonzero
=
False
return
rval
return
rval
def
__nonzero__
(
self
):
def
__nonzero__
(
self
):
# This is meant to prohibit stuff like a < b < c, which is internally implemented as
# This is meant to prohibit stuff like a < b < c, which is internally implemented as
# (a < b) and (b < c). The trouble with this is the side-effect that checking for a
# (a < b) and (b < c). The trouble with this is the side-effect that checking for a
# non-NULL a by typing "if a: ..." uses the same __nonzero__ method. We want these
# non-NULL a by typing "if a: ..." uses the same __nonzero__ method. We want these
# both to work, but it seems impossible. Currently, all vars evaluate to nonzero
# both to work, but it seems impossible. Currently, all vars evaluate to nonzero
...
@@ -3962,7 +3962,7 @@ def tensordot(x, y, axes=2):
...
@@ -3962,7 +3962,7 @@ def tensordot(x, y, axes=2):
raise
ValueError
(
'Cannot perform tensordot of 0-d inputs.'
)
raise
ValueError
(
'Cannot perform tensordot of 0-d inputs.'
)
axes
=
TensorDot
.
parse_axes
(
axes
)
axes
=
TensorDot
.
parse_axes
(
axes
)
# check whether axes is valid given the dimensions of x and y
# check whether axes is valid given the dimensions of x and y
if
numpy
.
isscalar
(
axes
):
if
numpy
.
isscalar
(
axes
):
if
axes
>=
x
.
ndim
or
axes
>=
y
.
ndim
:
if
axes
>=
x
.
ndim
or
axes
>=
y
.
ndim
:
...
@@ -3979,12 +3979,12 @@ def tensordot(x, y, axes=2):
...
@@ -3979,12 +3979,12 @@ def tensordot(x, y, axes=2):
if
isinstance
(
axes
[
1
],(
list
,
tuple
))
and
\
if
isinstance
(
axes
[
1
],(
list
,
tuple
))
and
\
(
len
(
axes
[
1
])
>
y
.
ndim
or
(
numpy
.
array
(
axes
[
1
])
>=
y
.
ndim
)
.
any
()):
(
len
(
axes
[
1
])
>
y
.
ndim
or
(
numpy
.
array
(
axes
[
1
])
>=
y
.
ndim
)
.
any
()):
raise
ValueError
(
'axes[1] should be array_like, of length smaller'
\
raise
ValueError
(
'axes[1] should be array_like, of length smaller'
\
'than the dimension of y (y.ndim=
%
i, len(axes[1])=
%
i).'
%
'than the dimension of y (y.ndim=
%
i, len(axes[1])=
%
i).'
%
(
y
.
ndim
,
len
(
axes
[
1
])))
(
y
.
ndim
,
len
(
axes
[
1
])))
if
not
hasattr
(
tensordot
,
'op'
):
if
not
hasattr
(
tensordot
,
'op'
):
tensordot
.
op
=
{}
tensordot
.
op
=
{}
if
axes
not
in
tensordot
.
op
:
if
axes
not
in
tensordot
.
op
:
tensordot
.
op
[
axes
]
=
TensorDot
(
axes
)
tensordot
.
op
[
axes
]
=
TensorDot
(
axes
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论