Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
249591b5
提交
249591b5
authored
3月 02, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
3月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename Type.Variable and Type.Constant to Type.variable_type and Type.constant_type
上级
c3f16b6d
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
24 行增加
和
24 行删除
+24
-24
type.py
aesara/gpuarray/type.py
+3
-3
type.py
aesara/graph/type.py
+9
-9
basic.py
aesara/scalar/basic.py
+2
-2
basic.py
aesara/sparse/basic.py
+2
-2
type.py
aesara/sparse/type.py
+2
-2
type.py
aesara/tensor/type.py
+1
-1
type_other.py
aesara/tensor/type_other.py
+1
-1
var.py
aesara/tensor/var.py
+2
-2
basic.py
aesara/typed_list/basic.py
+2
-2
没有找到文件。
aesara/gpuarray/type.py
浏览文件 @
249591b5
...
@@ -351,7 +351,7 @@ class GpuArrayType(CType):
...
@@ -351,7 +351,7 @@ class GpuArrayType(CType):
other
=
other
.
_as_GpuArrayVariable
(
self
.
context_name
)
other
=
other
.
_as_GpuArrayVariable
(
self
.
context_name
)
if
not
isinstance
(
other
,
Variable
):
if
not
isinstance
(
other
,
Variable
):
other
=
self
.
Constant
(
type
=
self
,
data
=
other
)
other
=
self
.
constant_type
(
type
=
self
,
data
=
other
)
if
other
.
type
==
self
:
if
other
.
type
==
self
:
return
other
return
other
...
@@ -677,7 +677,7 @@ class GpuArrayVariable(_operators, Variable):
...
@@ -677,7 +677,7 @@ class GpuArrayVariable(_operators, Variable):
return
repr
(
np
.
array
(
aesara
.
graph
.
op
.
get_test_value
(
self
)))
return
repr
(
np
.
array
(
aesara
.
graph
.
op
.
get_test_value
(
self
)))
GpuArrayType
.
Variabl
e
=
GpuArrayVariable
GpuArrayType
.
variable_typ
e
=
GpuArrayVariable
class
GpuArraySignature
(
TensorConstantSignature
):
class
GpuArraySignature
(
TensorConstantSignature
):
...
@@ -715,7 +715,7 @@ class GpuArrayConstant(_operators, Constant):
...
@@ -715,7 +715,7 @@ class GpuArrayConstant(_operators, Constant):
return
"GpuArrayConstant{
%
s}"
%
np_data
return
"GpuArrayConstant{
%
s}"
%
np_data
GpuArrayType
.
Constant
=
GpuArrayConstant
GpuArrayType
.
constant_type
=
GpuArrayConstant
class
GpuArraySharedVariable
(
_operators
,
SharedVariable
):
class
GpuArraySharedVariable
(
_operators
,
SharedVariable
):
...
...
aesara/graph/type.py
浏览文件 @
249591b5
...
@@ -35,12 +35,12 @@ class Type(MetaObject):
...
@@ -35,12 +35,12 @@ class Type(MetaObject):
"""
"""
Variabl
e
:
TypeAlias
=
Variable
variable_typ
e
:
TypeAlias
=
Variable
"""
"""
The `Type` that will be created by a call to `Type.make_variable`.
The `Type` that will be created by a call to `Type.make_variable`.
"""
"""
Constant
:
TypeAlias
=
Constant
constant_type
:
TypeAlias
=
Constant
"""
"""
The `Type` that will be created by a call to `Type.make_constant`.
The `Type` that will be created by a call to `Type.make_constant`.
"""
"""
...
@@ -136,7 +136,7 @@ class Type(MetaObject):
...
@@ -136,7 +136,7 @@ class Type(MetaObject):
def
filter_variable
(
def
filter_variable
(
self
,
other
:
Union
[
Variable
,
D
],
allow_convert
:
bool
=
True
self
,
other
:
Union
[
Variable
,
D
],
allow_convert
:
bool
=
True
)
->
Variabl
e
:
)
->
variable_typ
e
:
r"""Convert a `other` into a `Variable` with a `Type` that's compatible with `self`.
r"""Convert a `other` into a `Variable` with a `Type` that's compatible with `self`.
If the involved `Type`\s are not compatible, a `TypeError` will be raised.
If the involved `Type`\s are not compatible, a `TypeError` will be raised.
...
@@ -144,7 +144,7 @@ class Type(MetaObject):
...
@@ -144,7 +144,7 @@ class Type(MetaObject):
if
not
isinstance
(
other
,
Variable
):
if
not
isinstance
(
other
,
Variable
):
# The value is not a Variable: we cast it into
# The value is not a Variable: we cast it into
# a Constant of the appropriate Type.
# a Constant of the appropriate Type.
other
=
self
.
Constant
(
type
=
self
,
data
=
other
)
other
=
self
.
constant_type
(
type
=
self
,
data
=
other
)
if
other
.
type
!=
self
and
allow_convert
:
if
other
.
type
!=
self
and
allow_convert
:
other2
=
self
.
convert_variable
(
other
)
other2
=
self
.
convert_variable
(
other
)
...
@@ -193,7 +193,7 @@ class Type(MetaObject):
...
@@ -193,7 +193,7 @@ class Type(MetaObject):
except
(
TypeError
,
ValueError
):
except
(
TypeError
,
ValueError
):
return
False
return
False
def
make_variable
(
self
,
name
:
Optional
[
Text
]
=
None
)
->
Variabl
e
:
def
make_variable
(
self
,
name
:
Optional
[
Text
]
=
None
)
->
variable_typ
e
:
"""Return a new `Variable` instance of this `Type`.
"""Return a new `Variable` instance of this `Type`.
Parameters
Parameters
...
@@ -202,9 +202,9 @@ class Type(MetaObject):
...
@@ -202,9 +202,9 @@ class Type(MetaObject):
A pretty string for printing and debugging.
A pretty string for printing and debugging.
"""
"""
return
self
.
Variabl
e
(
self
,
name
=
name
)
return
self
.
variable_typ
e
(
self
,
name
=
name
)
def
make_constant
(
self
,
value
:
D
,
name
:
Optional
[
Text
]
=
None
)
->
Constant
:
def
make_constant
(
self
,
value
:
D
,
name
:
Optional
[
Text
]
=
None
)
->
constant_type
:
"""Return a new `Constant` instance of this `Type`.
"""Return a new `Constant` instance of this `Type`.
Parameters
Parameters
...
@@ -215,13 +215,13 @@ class Type(MetaObject):
...
@@ -215,13 +215,13 @@ class Type(MetaObject):
A pretty string for printing and debugging.
A pretty string for printing and debugging.
"""
"""
return
self
.
Constant
(
type
=
self
,
data
=
value
,
name
=
name
)
return
self
.
constant_type
(
type
=
self
,
data
=
value
,
name
=
name
)
def
clone
(
self
,
*
args
,
**
kwargs
):
def
clone
(
self
,
*
args
,
**
kwargs
):
"""Clone a copy of this type with the given arguments/keyword values, if any."""
"""Clone a copy of this type with the given arguments/keyword values, if any."""
return
type
(
self
)(
*
args
,
**
kwargs
)
return
type
(
self
)(
*
args
,
**
kwargs
)
def
__call__
(
self
,
name
:
Optional
[
Text
]
=
None
)
->
Variabl
e
:
def
__call__
(
self
,
name
:
Optional
[
Text
]
=
None
)
->
variable_typ
e
:
"""Return a new `Variable` instance of Type `self`.
"""Return a new `Variable` instance of Type `self`.
Parameters
Parameters
...
...
aesara/scalar/basic.py
浏览文件 @
249591b5
...
@@ -843,7 +843,7 @@ class ScalarVariable(_scalar_py_operators, Variable):
...
@@ -843,7 +843,7 @@ class ScalarVariable(_scalar_py_operators, Variable):
pass
pass
Scalar
.
Variabl
e
=
ScalarVariable
Scalar
.
variable_typ
e
=
ScalarVariable
class
ScalarConstant
(
ScalarVariable
,
Constant
):
class
ScalarConstant
(
ScalarVariable
,
Constant
):
...
@@ -852,7 +852,7 @@ class ScalarConstant(ScalarVariable, Constant):
...
@@ -852,7 +852,7 @@ class ScalarConstant(ScalarVariable, Constant):
# Register ScalarConstant as the type of Constant corresponding to Scalar
# Register ScalarConstant as the type of Constant corresponding to Scalar
Scalar
.
Constant
=
ScalarConstant
Scalar
.
constant_type
=
ScalarConstant
def
constant
(
x
,
name
=
None
,
dtype
=
None
)
->
ScalarConstant
:
def
constant
(
x
,
name
=
None
,
dtype
=
None
)
->
ScalarConstant
:
...
...
aesara/sparse/basic.py
浏览文件 @
249591b5
...
@@ -415,8 +415,8 @@ class SparseConstant(Constant, _sparse_py_operators):
...
@@ -415,8 +415,8 @@ class SparseConstant(Constant, _sparse_py_operators):
return
str
(
self
)
return
str
(
self
)
SparseType
.
Variabl
e
=
SparseVariable
SparseType
.
variable_typ
e
=
SparseVariable
SparseType
.
Constant
=
SparseConstant
SparseType
.
constant_type
=
SparseConstant
# for more dtypes, call SparseType(format, dtype)
# for more dtypes, call SparseType(format, dtype)
...
...
aesara/sparse/type.py
浏览文件 @
249591b5
...
@@ -69,7 +69,7 @@ class SparseType(Type, HasDataType):
...
@@ -69,7 +69,7 @@ class SparseType(Type, HasDataType):
ndim
=
2
ndim
=
2
# Will be set to SparseVariable SparseConstant later.
# Will be set to SparseVariable SparseConstant later.
Variabl
e
=
None
variable_typ
e
=
None
Constant
=
None
Constant
=
None
def
__init__
(
self
,
format
,
dtype
,
shape
=
None
):
def
__init__
(
self
,
format
,
dtype
,
shape
=
None
):
...
@@ -151,7 +151,7 @@ class SparseType(Type, HasDataType):
...
@@ -151,7 +151,7 @@ class SparseType(Type, HasDataType):
return
False
return
False
def
make_variable
(
self
,
name
=
None
):
def
make_variable
(
self
,
name
=
None
):
return
self
.
Variabl
e
(
self
,
name
=
name
)
return
self
.
variable_typ
e
(
self
,
name
=
name
)
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
return
(
return
(
...
...
aesara/tensor/type.py
浏览文件 @
249591b5
...
@@ -245,7 +245,7 @@ class TensorType(CType, HasDataType):
...
@@ -245,7 +245,7 @@ class TensorType(CType, HasDataType):
if
not
isinstance
(
other
,
Variable
):
if
not
isinstance
(
other
,
Variable
):
# The value is not a Variable: we cast it into
# The value is not a Variable: we cast it into
# a Constant of the appropriate Type.
# a Constant of the appropriate Type.
other
=
self
.
Constant
(
type
=
self
,
data
=
other
)
other
=
self
.
constant_type
(
type
=
self
,
data
=
other
)
if
other
.
type
==
self
:
if
other
.
type
==
self
:
return
other
return
other
...
...
aesara/tensor/type_other.py
浏览文件 @
249591b5
...
@@ -109,7 +109,7 @@ class SliceConstant(Constant):
...
@@ -109,7 +109,7 @@ class SliceConstant(Constant):
)
)
SliceType
.
Constant
=
SliceConstant
SliceType
.
constant_type
=
SliceConstant
@_as_symbolic.register
(
slice
)
@_as_symbolic.register
(
slice
)
...
...
aesara/tensor/var.py
浏览文件 @
249591b5
...
@@ -861,7 +861,7 @@ def _get_vector_length_TensorVariable(op_or_var, var):
...
@@ -861,7 +861,7 @@ def _get_vector_length_TensorVariable(op_or_var, var):
return
var
.
type
.
shape
[
0
]
return
var
.
type
.
shape
[
0
]
TensorType
.
Variabl
e
=
TensorVariable
TensorType
.
variable_typ
e
=
TensorVariable
class
TensorConstantSignature
(
tuple
):
class
TensorConstantSignature
(
tuple
):
...
@@ -1039,4 +1039,4 @@ class TensorConstant(TensorVariable, Constant):
...
@@ -1039,4 +1039,4 @@ class TensorConstant(TensorVariable, Constant):
)
)
TensorType
.
Constant
=
TensorConstant
TensorType
.
constant_type
=
TensorConstant
aesara/typed_list/basic.py
浏览文件 @
249591b5
...
@@ -53,7 +53,7 @@ class TypedListVariable(_typed_list_py_operators, Variable):
...
@@ -53,7 +53,7 @@ class TypedListVariable(_typed_list_py_operators, Variable):
"""
"""
TypedListType
.
Variabl
e
=
TypedListVariable
TypedListType
.
variable_typ
e
=
TypedListVariable
class
TypedListConstant
(
_typed_list_py_operators
,
Constant
):
class
TypedListConstant
(
_typed_list_py_operators
,
Constant
):
...
@@ -63,7 +63,7 @@ class TypedListConstant(_typed_list_py_operators, Constant):
...
@@ -63,7 +63,7 @@ class TypedListConstant(_typed_list_py_operators, Constant):
"""
"""
TypedListType
.
Constant
=
TypedListConstant
TypedListType
.
constant_type
=
TypedListConstant
class
GetItem
(
COp
):
class
GetItem
(
COp
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论