Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
47874eb9
提交
47874eb9
authored
4月 05, 2024
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
5月 29, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt Numba vectorize iterator for RandomVariables
Co-authored-by:
Jesse Grabowski
<
48652735+jessegrabowski@users.noreply.github.com
>
Co-authored-by:
Adrian Seyboldt
<
aseyboldt@users.noreply.github.com
>
上级
38c04c96
全部展开
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
18 行增加
和
3 行删除
+18
-3
basic.py
pytensor/link/numba/dispatch/basic.py
+8
-2
elemwise.py
pytensor/link/numba/dispatch/elemwise.py
+10
-1
vectorize_codegen.py
pytensor/link/numba/dispatch/vectorize_codegen.py
+0
-0
没有找到文件。
pytensor/link/numba/dispatch/basic.py
浏览文件 @
47874eb9
...
@@ -62,10 +62,16 @@ def numba_njit(*args, **kwargs):
...
@@ -62,10 +62,16 @@ def numba_njit(*args, **kwargs):
kwargs
.
setdefault
(
"no_cpython_wrapper"
,
True
)
kwargs
.
setdefault
(
"no_cpython_wrapper"
,
True
)
kwargs
.
setdefault
(
"no_cfunc_wrapper"
,
True
)
kwargs
.
setdefault
(
"no_cfunc_wrapper"
,
True
)
# Supress caching warnings
# Suppress cache warning for internal functions
# We have to add an ansi escape code for optional bold text by numba
warnings
.
filterwarnings
(
warnings
.
filterwarnings
(
"ignore"
,
"ignore"
,
message
=
'Cannot cache compiled function "numba_funcified_fgraph" as it uses dynamic globals'
,
message
=
(
"(
\x1b\\
[1m)*"
# ansi escape code for bold text
"Cannot cache compiled function "
'"(numba_funcified_fgraph|store_core_outputs)" '
"as it uses dynamic globals"
),
category
=
NumbaWarning
,
category
=
NumbaWarning
,
)
)
...
...
pytensor/link/numba/dispatch/elemwise.py
浏览文件 @
47874eb9
...
@@ -24,6 +24,7 @@ from pytensor.link.numba.dispatch.vectorize_codegen import (
...
@@ -24,6 +24,7 @@ from pytensor.link.numba.dispatch.vectorize_codegen import (
_jit_options
,
_jit_options
,
_vectorized
,
_vectorized
,
encode_literals
,
encode_literals
,
store_core_outputs
,
)
)
from
pytensor.link.utils
import
compile_function_src
,
get_name_for_object
from
pytensor.link.utils
import
compile_function_src
,
get_name_for_object
from
pytensor.scalar.basic
import
(
from
pytensor.scalar.basic
import
(
...
@@ -480,10 +481,15 @@ def numba_funcify_Elemwise(op, node, **kwargs):
...
@@ -480,10 +481,15 @@ def numba_funcify_Elemwise(op, node, **kwargs):
**
kwargs
,
**
kwargs
,
)
)
nin
=
len
(
node
.
inputs
)
nout
=
len
(
node
.
outputs
)
core_op_fn
=
store_core_outputs
(
scalar_op_fn
,
nin
=
nin
,
nout
=
nout
)
input_bc_patterns
=
tuple
([
inp
.
type
.
broadcastable
for
inp
in
node
.
inputs
])
input_bc_patterns
=
tuple
([
inp
.
type
.
broadcastable
for
inp
in
node
.
inputs
])
output_bc_patterns
=
tuple
([
out
.
type
.
broadcastable
for
out
in
node
.
outputs
])
output_bc_patterns
=
tuple
([
out
.
type
.
broadcastable
for
out
in
node
.
outputs
])
output_dtypes
=
tuple
(
out
.
type
.
dtype
for
out
in
node
.
outputs
)
output_dtypes
=
tuple
(
out
.
type
.
dtype
for
out
in
node
.
outputs
)
inplace_pattern
=
tuple
(
op
.
inplace_pattern
.
items
())
inplace_pattern
=
tuple
(
op
.
inplace_pattern
.
items
())
core_output_shapes
=
tuple
(()
for
_
in
range
(
nout
))
# numba doesn't support nested literals right now...
# numba doesn't support nested literals right now...
input_bc_patterns_enc
=
encode_literals
(
input_bc_patterns
)
input_bc_patterns_enc
=
encode_literals
(
input_bc_patterns
)
...
@@ -493,12 +499,15 @@ def numba_funcify_Elemwise(op, node, **kwargs):
...
@@ -493,12 +499,15 @@ def numba_funcify_Elemwise(op, node, **kwargs):
def
elemwise_wrapper
(
*
inputs
):
def
elemwise_wrapper
(
*
inputs
):
return
_vectorized
(
return
_vectorized
(
scalar
_op_fn
,
core
_op_fn
,
input_bc_patterns_enc
,
input_bc_patterns_enc
,
output_bc_patterns_enc
,
output_bc_patterns_enc
,
output_dtypes_enc
,
output_dtypes_enc
,
inplace_pattern_enc
,
inplace_pattern_enc
,
(),
# constant_inputs
inputs
,
inputs
,
core_output_shapes
,
# core_shapes
None
,
# size
)
)
# Pure python implementation, that will be used in tests
# Pure python implementation, that will be used in tests
...
...
pytensor/link/numba/dispatch/vectorize_codegen.py
浏览文件 @
47874eb9
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论