Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5cbd3dfa
提交
5cbd3dfa
authored
6月 05, 2024
作者:
Virgile Andreani
提交者:
Ricardo Vieira
6月 06, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix more double negatives
上级
f9f930c3
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
14 行增加
和
14 行删除
+14
-14
compiledir.py
pytensor/compile/compiledir.py
+1
-1
debugmode.py
pytensor/compile/debugmode.py
+1
-1
basic.py
pytensor/graph/rewriting/basic.py
+2
-2
basic.py
pytensor/link/basic.py
+1
-1
cmodule.py
pytensor/link/c/cmodule.py
+1
-1
may_share_memory.py
pytensor/misc/may_share_memory.py
+1
-1
printing.py
pytensor/printing.py
+2
-2
type.py
pytensor/sparse/type.py
+1
-1
blas_headers.py
pytensor/tensor/blas_headers.py
+1
-1
math.py
pytensor/tensor/rewriting/math.py
+1
-1
shape.py
pytensor/tensor/shape.py
+1
-1
test_basic.py
tests/sparse/test_basic.py
+1
-1
没有找到文件。
pytensor/compile/compiledir.py
浏览文件 @
5cbd3dfa
...
@@ -65,7 +65,7 @@ def cleanup():
...
@@ -65,7 +65,7 @@ def cleanup():
have_npy_abi_version
=
False
have_npy_abi_version
=
False
break
break
if
not
have_npy_abi_version
or
not
have_c_compiler
:
if
not
(
have_npy_abi_version
and
have_c_compiler
)
:
try
:
try
:
# This can happen when we move the compiledir.
# This can happen when we move the compiledir.
if
keydata
.
key_pkl
!=
filename
:
if
keydata
.
key_pkl
!=
filename
:
...
...
pytensor/compile/debugmode.py
浏览文件 @
5cbd3dfa
...
@@ -980,7 +980,7 @@ def _check_preallocated_output(
...
@@ -980,7 +980,7 @@ def _check_preallocated_output(
changed_inner_mode
=
False
changed_inner_mode
=
False
if
isinstance
(
getattr
(
node
,
"op"
,
None
),
HasInnerGraph
):
if
isinstance
(
getattr
(
node
,
"op"
,
None
),
HasInnerGraph
):
fn
=
node
.
op
.
fn
fn
=
node
.
op
.
fn
if
not
fn
or
not
hasattr
(
fn
,
"maker"
)
or
not
hasattr
(
fn
.
maker
,
"mode"
):
if
not
(
fn
and
hasattr
(
fn
,
"maker"
)
and
hasattr
(
fn
.
maker
,
"mode"
)
):
_logger
.
warning
(
f
"Expected pytensor function not found in {node.op}.fn"
)
_logger
.
warning
(
f
"Expected pytensor function not found in {node.op}.fn"
)
else
:
else
:
if
isinstance
(
fn
.
maker
.
mode
,
DebugMode
):
if
isinstance
(
fn
.
maker
.
mode
,
DebugMode
):
...
...
pytensor/graph/rewriting/basic.py
浏览文件 @
5cbd3dfa
...
@@ -3073,7 +3073,7 @@ def check_stack_trace(f_or_fgraph, ops_to_check="last", bug_print="raise"):
...
@@ -3073,7 +3073,7 @@ def check_stack_trace(f_or_fgraph, ops_to_check="last", bug_print="raise"):
for
node
in
apply_nodes_to_check
:
for
node
in
apply_nodes_to_check
:
for
output
in
node
.
outputs
:
for
output
in
node
.
outputs
:
if
not
hasattr
(
output
.
tag
,
"trace"
)
or
not
output
.
tag
.
trace
:
if
not
(
hasattr
(
output
.
tag
,
"trace"
)
and
output
.
tag
.
trace
)
:
return
False
return
False
return
True
return
True
...
@@ -3092,7 +3092,7 @@ class CheckStackTraceFeature(Feature):
...
@@ -3092,7 +3092,7 @@ class CheckStackTraceFeature(Feature):
apply_nodes_to_check
=
fgraph
.
apply_nodes
apply_nodes_to_check
=
fgraph
.
apply_nodes
for
node
in
apply_nodes_to_check
:
for
node
in
apply_nodes_to_check
:
for
output
in
node
.
outputs
:
for
output
in
node
.
outputs
:
if
not
hasattr
(
output
.
tag
,
"trace"
)
or
not
output
.
tag
.
trace
:
if
not
(
hasattr
(
output
.
tag
,
"trace"
)
and
output
.
tag
.
trace
)
:
output
.
tag
.
trace
=
[
output
.
tag
.
trace
=
[
[
[
(
(
...
...
pytensor/link/basic.py
浏览文件 @
5cbd3dfa
...
@@ -62,7 +62,7 @@ class Container:
...
@@ -62,7 +62,7 @@ class Container:
allow_downcast
:
bool
|
None
=
None
,
allow_downcast
:
bool
|
None
=
None
,
name
:
str
|
None
=
None
,
name
:
str
|
None
=
None
,
)
->
None
:
)
->
None
:
if
not
isinstance
(
storage
,
list
)
or
not
len
(
storage
)
>=
1
:
if
not
(
isinstance
(
storage
,
list
)
and
len
(
storage
)
>=
1
)
:
raise
TypeError
(
"storage must be a list of length at least one"
)
raise
TypeError
(
"storage must be a list of length at least one"
)
if
isinstance
(
r
,
Variable
):
if
isinstance
(
r
,
Variable
):
self
.
type
=
r
.
type
self
.
type
=
r
.
type
...
...
pytensor/link/c/cmodule.py
浏览文件 @
5cbd3dfa
...
@@ -2288,7 +2288,7 @@ class GCC_compiler(Compiler):
...
@@ -2288,7 +2288,7 @@ class GCC_compiler(Compiler):
default_compilation_result
,
default_execution_result
=
try_march_flag
(
default_compilation_result
,
default_execution_result
=
try_march_flag
(
GCC_compiler
.
march_flags
GCC_compiler
.
march_flags
)
)
if
not
default_compilation_result
or
not
default_execution_result
:
if
not
(
default_compilation_result
and
default_execution_result
)
:
march_success
=
False
march_success
=
False
march_ind
=
None
march_ind
=
None
mtune_ind
=
None
mtune_ind
=
None
...
...
pytensor/misc/may_share_memory.py
浏览文件 @
5cbd3dfa
...
@@ -30,7 +30,7 @@ def may_share_memory(a, b, raise_other_type=True):
...
@@ -30,7 +30,7 @@ def may_share_memory(a, b, raise_other_type=True):
a_sparse
=
_is_sparse
(
a
)
a_sparse
=
_is_sparse
(
a
)
b_sparse
=
_is_sparse
(
b
)
b_sparse
=
_is_sparse
(
b
)
if
not
(
a_ndarray
or
a_sparse
)
or
not
(
b_ndarray
or
b_sparse
):
if
not
(
(
a_ndarray
or
a_sparse
)
and
(
b_ndarray
or
b_sparse
)
):
if
raise_other_type
:
if
raise_other_type
:
raise
TypeError
(
"may_share_memory support only ndarray and scipy.sparse"
)
raise
TypeError
(
"may_share_memory support only ndarray and scipy.sparse"
)
return
False
return
False
...
...
pytensor/printing.py
浏览文件 @
5cbd3dfa
...
@@ -653,8 +653,8 @@ def _debugprint(
...
@@ -653,8 +653,8 @@ def _debugprint(
else
:
else
:
print
(
var_output
,
file
=
file
)
print
(
var_output
,
file
=
file
)
if
not
already_done
and
(
if
not
already_done
and
not
(
not
stop_on_name
or
not
(
hasattr
(
var
,
"name"
)
and
var
.
name
is
not
None
)
stop_on_name
and
hasattr
(
var
,
"name"
)
and
var
.
name
is
not
None
):
):
new_prefix
=
prefix_child
+
" ├─ "
new_prefix
=
prefix_child
+
" ├─ "
new_prefix_child
=
prefix_child
+
" │ "
new_prefix_child
=
prefix_child
+
" │ "
...
...
pytensor/sparse/type.py
浏览文件 @
5cbd3dfa
...
@@ -187,7 +187,7 @@ class SparseTensorType(TensorType, HasDataType):
...
@@ -187,7 +187,7 @@ class SparseTensorType(TensorType, HasDataType):
# WARNING: equality comparison of sparse matrices is not fast or easy
# WARNING: equality comparison of sparse matrices is not fast or easy
# we definitely do not want to be doing this un-necessarily during
# we definitely do not want to be doing this un-necessarily during
# a FAST_RUN computation..
# a FAST_RUN computation..
if
not
scipy
.
sparse
.
issparse
(
a
)
or
not
scipy
.
sparse
.
issparse
(
b
):
if
not
(
scipy
.
sparse
.
issparse
(
a
)
and
scipy
.
sparse
.
issparse
(
b
)
):
return
False
return
False
diff
=
abs
(
a
-
b
)
diff
=
abs
(
a
-
b
)
if
diff
.
nnz
==
0
:
if
diff
.
nnz
==
0
:
...
...
pytensor/tensor/blas_headers.py
浏览文件 @
5cbd3dfa
...
@@ -769,7 +769,7 @@ def blas_header_text():
...
@@ -769,7 +769,7 @@ def blas_header_text():
"npy_float"
:
"NPY_FLOAT64"
,
"npy_float"
:
"NPY_FLOAT64"
,
"precision"
:
"d"
,
"precision"
:
"d"
,
}
}
if
not
common_code
or
not
template_code
:
if
not
(
common_code
and
template_code
)
:
raise
OSError
(
raise
OSError
(
"Unable to load NumPy implementation of BLAS functions from C source files."
"Unable to load NumPy implementation of BLAS functions from C source files."
)
)
...
...
pytensor/tensor/rewriting/math.py
浏览文件 @
5cbd3dfa
...
@@ -1016,7 +1016,7 @@ class AlgebraicCanonizer(NodeRewriter):
...
@@ -1016,7 +1016,7 @@ class AlgebraicCanonizer(NodeRewriter):
for
v
in
inter
:
for
v
in
inter
:
num
.
remove
(
v
)
num
.
remove
(
v
)
denum
.
remove
(
v
)
denum
.
remove
(
v
)
if
not
redo
or
not
inter
:
if
not
(
redo
and
inter
)
:
break
break
else
:
else
:
for
v
in
list
(
num
):
for
v
in
list
(
num
):
...
...
pytensor/tensor/shape.py
浏览文件 @
5cbd3dfa
...
@@ -246,7 +246,7 @@ class Shape_i(COp):
...
@@ -246,7 +246,7 @@ class Shape_i(COp):
return
"
%
s{
%
i}"
%
(
self
.
__class__
.
__name__
,
self
.
i
)
return
"
%
s{
%
i}"
%
(
self
.
__class__
.
__name__
,
self
.
i
)
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
if
not
isinstance
(
x
,
Variable
)
or
not
hasattr
(
x
.
type
,
"ndim"
):
if
not
(
isinstance
(
x
,
Variable
)
and
hasattr
(
x
.
type
,
"ndim"
)
):
raise
TypeError
(
raise
TypeError
(
f
"{x} must be `Variable` with a `Type` having an ndim attribute"
f
"{x} must be `Variable` with a `Type` having an ndim attribute"
)
)
...
...
tests/sparse/test_basic.py
浏览文件 @
5cbd3dfa
...
@@ -2274,7 +2274,7 @@ class TestRemove0(utt.InferShapeTester):
...
@@ -2274,7 +2274,7 @@ class TestRemove0(utt.InferShapeTester):
unsorted_indices
=
unsor
,
unsorted_indices
=
unsor
,
)
)
assert
0
in
mat
.
data
or
not
zero
assert
0
in
mat
.
data
or
not
zero
assert
not
mat
.
has_sorted_indices
or
not
unsor
assert
not
(
mat
.
has_sorted_indices
and
unsor
)
# the In thingy has to be there because pytensor has as rule not
# the In thingy has to be there because pytensor has as rule not
# to optimize inputs
# to optimize inputs
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论