Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f9a54210
提交
f9a54210
authored
1月 01, 2021
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
1月 01, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove theano.gof.utils.hashtype
上级
e1d46639
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
19 行增加
和
38 行删除
+19
-38
__init__.py
theano/gof/__init__.py
+1
-1
utils.py
theano/gof/utils.py
+1
-7
subtensor.py
theano/tensor/subtensor.py
+5
-19
type.py
theano/tensor/type.py
+3
-3
type_other.py
theano/tensor/type_other.py
+4
-2
var.py
theano/tensor/var.py
+1
-2
type.py
theano/typed_list/type.py
+4
-4
没有找到文件。
theano/gof/__init__.py
浏览文件 @
f9a54210
...
@@ -43,4 +43,4 @@ from theano.gof.toolbox import (
...
@@ -43,4 +43,4 @@ from theano.gof.toolbox import (
Validator
,
Validator
,
)
)
from
theano.gof.type
import
CEnumType
,
EnumList
,
EnumType
,
Generic
,
Type
,
generic
from
theano.gof.type
import
CEnumType
,
EnumList
,
EnumType
,
Generic
,
Type
,
generic
from
theano.gof.utils
import
MethodNotDefined
,
hashtype
,
object2
from
theano.gof.utils
import
MethodNotDefined
,
object2
theano/gof/utils.py
浏览文件 @
f9a54210
...
@@ -69,8 +69,7 @@ def simple_extract_stack(f=None, limit=None, skips=None):
...
@@ -69,8 +69,7 @@ def simple_extract_stack(f=None, limit=None, skips=None):
def
add_tag_trace
(
thing
,
user_line
=
None
):
def
add_tag_trace
(
thing
,
user_line
=
None
):
"""
"""Add tag.trace to a node or variable.
Add tag.trace to an node or variable.
The argument is returned after being affected (inplace).
The argument is returned after being affected (inplace).
...
@@ -145,11 +144,6 @@ def get_variable_trace_string(v):
...
@@ -145,11 +144,6 @@ def get_variable_trace_string(v):
return
sio
.
getvalue
()
return
sio
.
getvalue
()
def
hashtype
(
self
):
t
=
type
(
self
)
return
hash
(
t
.
__name__
)
^
hash
(
t
.
__module__
)
# Object to mark that a parameter is undefined (useful in cases where
# Object to mark that a parameter is undefined (useful in cases where
# None is a valid value with defined semantics)
# None is a valid value with defined semantics)
undef
=
object
()
undef
=
object
()
...
...
theano/tensor/subtensor.py
浏览文件 @
f9a54210
...
@@ -10,7 +10,7 @@ import theano
...
@@ -10,7 +10,7 @@ import theano
from
theano
import
gof
from
theano
import
gof
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
theano.configdefaults
import
config
from
theano.configdefaults
import
config
from
theano.gof
import
MethodNotDefined
,
ParamsType
,
hashtype
from
theano.gof
import
MethodNotDefined
,
ParamsType
from
theano.gof.graph
import
Apply
from
theano.gof.graph
import
Apply
from
theano.gof.op
import
COp
,
Op
from
theano.gof.op
import
COp
,
Op
from
theano.gof.type
import
Type
from
theano.gof.type
import
Type
...
@@ -1422,25 +1422,11 @@ class IncSubtensor(COp):
...
@@ -1422,25 +1422,11 @@ class IncSubtensor(COp):
self
.
set_instead_of_inc
=
set_instead_of_inc
self
.
set_instead_of_inc
=
set_instead_of_inc
def
__hash__
(
self
):
def
__hash__
(
self
):
msg
=
[]
idx_list
=
tuple
(
for
entry
in
self
.
idx_list
:
(
entry
.
start
,
entry
.
stop
,
entry
.
step
)
if
isinstance
(
entry
,
slice
)
else
entry
if
isinstance
(
entry
,
slice
):
for
entry
in
self
.
idx_list
msg
+=
[(
entry
.
start
,
entry
.
stop
,
entry
.
step
)]
else
:
msg
+=
[
entry
]
idx_list
=
tuple
(
msg
)
# backport
# idx_list = tuple((entry.start, entry.stop, entry.step)
# if isinstance(entry, slice)
# else entry
# for entry in self.idx_list)
return
(
hashtype
(
self
)
^
hash
(
idx_list
)
^
hash
(
self
.
inplace
)
^
hash
(
self
.
set_instead_of_inc
)
)
)
return
hash
((
type
(
self
),
idx_list
,
self
.
inplace
,
self
.
set_instead_of_inc
))
def
__str__
(
self
):
def
__str__
(
self
):
indices
=
[]
indices
=
[]
...
...
theano/tensor/type.py
浏览文件 @
f9a54210
...
@@ -6,7 +6,8 @@ import numpy as np
...
@@ -6,7 +6,8 @@ import numpy as np
import
theano
import
theano
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
theano.configdefaults
import
config
from
theano.configdefaults
import
config
from
theano.gof
import
Type
,
Variable
,
hashtype
from
theano.gof.graph
import
Variable
from
theano.gof.type
import
Type
from
theano.misc.safe_asarray
import
_asarray
from
theano.misc.safe_asarray
import
_asarray
...
@@ -343,8 +344,7 @@ class TensorType(Type):
...
@@ -343,8 +344,7 @@ class TensorType(Type):
return
values_eq_approx
(
a
,
b
,
allow_remove_inf
,
allow_remove_nan
,
rtol
,
atol
)
return
values_eq_approx
(
a
,
b
,
allow_remove_inf
,
allow_remove_nan
,
rtol
,
atol
)
def
__hash__
(
self
):
def
__hash__
(
self
):
"""Hash equal for same kinds of TensorType"""
return
hash
((
type
(
self
),
self
.
dtype
,
self
.
broadcastable
))
return
hashtype
(
self
)
^
hash
(
self
.
dtype
)
^
hash
(
self
.
broadcastable
)
ndim
=
property
(
lambda
self
:
len
(
self
.
broadcastable
),
doc
=
"number of dimensions"
)
ndim
=
property
(
lambda
self
:
len
(
self
.
broadcastable
),
doc
=
"number of dimensions"
)
"""
"""
...
...
theano/tensor/type_other.py
浏览文件 @
f9a54210
...
@@ -5,7 +5,9 @@
...
@@ -5,7 +5,9 @@
import
numpy
as
np
import
numpy
as
np
import
theano
import
theano
from
theano.gof
import
Apply
,
Constant
,
Generic
,
Op
,
Type
,
hashtype
from
theano.gof.graph
import
Apply
,
Constant
from
theano.gof.op
import
Op
from
theano.gof.type
import
Generic
,
Type
from
theano.gradient
import
DisconnectedType
from
theano.gradient
import
DisconnectedType
...
@@ -61,7 +63,7 @@ class SliceType(Type):
...
@@ -61,7 +63,7 @@ class SliceType(Type):
return
type
(
self
)
==
type
(
other
)
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
def
__hash__
(
self
):
return
hash
type
(
self
)
return
hash
(
type
(
self
)
)
@staticmethod
@staticmethod
def
may_share_memory
(
a
,
b
):
def
may_share_memory
(
a
,
b
):
...
...
theano/tensor/var.py
浏览文件 @
f9a54210
...
@@ -8,7 +8,6 @@ import numpy as np
...
@@ -8,7 +8,6 @@ import numpy as np
import
theano
import
theano
from
theano.configdefaults
import
config
from
theano.configdefaults
import
config
from
theano.gof
import
Constant
,
Variable
from
theano.gof
import
Constant
,
Variable
from
theano.gof.utils
import
hashtype
from
theano.scalar
import
ComplexError
,
IntegerDivisionError
from
theano.scalar
import
ComplexError
,
IntegerDivisionError
from
theano.tensor.type
import
TensorType
from
theano.tensor.type
import
TensorType
from
theano.tensor.utils
import
hash_from_ndarray
from
theano.tensor.utils
import
hash_from_ndarray
...
@@ -923,7 +922,7 @@ class TensorConstantSignature(tuple):
...
@@ -923,7 +922,7 @@ class TensorConstantSignature(tuple):
def
__hash__
(
self
):
def
__hash__
(
self
):
t
,
d
=
self
t
,
d
=
self
return
hash
type
(
self
)
^
hash
(
t
)
^
hash
(
d
.
shape
)
^
hash
(
self
.
sum
)
return
hash
((
type
(
self
),
t
,
d
.
shape
,
self
.
sum
)
)
def
theano_hash
(
self
):
def
theano_hash
(
self
):
_
,
d
=
self
_
,
d
=
self
...
...
theano/typed_list/type.py
浏览文件 @
f9a54210
from
theano
import
gof
from
theano
.gof.type
import
Type
class
TypedListType
(
gof
.
Type
):
class
TypedListType
(
Type
):
"""
"""
Parameters
Parameters
...
@@ -18,7 +18,7 @@ class TypedListType(gof.Type):
...
@@ -18,7 +18,7 @@ class TypedListType(gof.Type):
if
depth
<
0
:
if
depth
<
0
:
raise
ValueError
(
"Please specify a depth superior or"
"equal to 0"
)
raise
ValueError
(
"Please specify a depth superior or"
"equal to 0"
)
if
not
isinstance
(
ttype
,
gof
.
Type
):
if
not
isinstance
(
ttype
,
Type
):
raise
TypeError
(
"Expected a Theano Type"
)
raise
TypeError
(
"Expected a Theano Type"
)
if
depth
==
0
:
if
depth
==
0
:
...
@@ -59,7 +59,7 @@ class TypedListType(gof.Type):
...
@@ -59,7 +59,7 @@ class TypedListType(gof.Type):
return
type
(
self
)
==
type
(
other
)
and
self
.
ttype
==
other
.
ttype
return
type
(
self
)
==
type
(
other
)
and
self
.
ttype
==
other
.
ttype
def
__hash__
(
self
):
def
__hash__
(
self
):
return
gof
.
hashtype
(
self
)
^
hash
(
self
.
ttype
)
return
hash
((
type
(
self
),
self
.
ttype
)
)
def
__str__
(
self
):
def
__str__
(
self
):
return
"TypedList <"
+
str
(
self
.
ttype
)
+
">"
return
"TypedList <"
+
str
(
self
.
ttype
)
+
">"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论