Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9089d1df
提交
9089d1df
authored
2月 18, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
2月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace use of deprecated ufunc sig argument with dtype
上级
74b1abaa
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
23 行删除
+23
-23
basic.py
aesara/scalar/basic.py
+23
-23
没有找到文件。
aesara/scalar/basic.py
浏览文件 @
9089d1df
...
@@ -2934,7 +2934,7 @@ class Log(UnaryScalarOp):
...
@@ -2934,7 +2934,7 @@ class Log(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
log
(
x
,
sig
=
"f"
)
return
np
.
log
(
x
,
dtype
=
np
.
float32
)
return
np
.
log
(
x
)
return
np
.
log
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -2980,7 +2980,7 @@ class Log2(UnaryScalarOp):
...
@@ -2980,7 +2980,7 @@ class Log2(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
log2
(
x
,
sig
=
"f"
)
return
np
.
log2
(
x
,
dtype
=
np
.
float32
)
return
np
.
log2
(
x
)
return
np
.
log2
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3023,7 +3023,7 @@ class Log10(UnaryScalarOp):
...
@@ -3023,7 +3023,7 @@ class Log10(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
log10
(
x
,
sig
=
"f"
)
return
np
.
log10
(
x
,
dtype
=
np
.
float32
)
return
np
.
log10
(
x
)
return
np
.
log10
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3064,7 +3064,7 @@ class Log1p(UnaryScalarOp):
...
@@ -3064,7 +3064,7 @@ class Log1p(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
log1p
(
x
,
sig
=
"f"
)
return
np
.
log1p
(
x
,
dtype
=
np
.
float32
)
return
np
.
log1p
(
x
)
return
np
.
log1p
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3102,7 +3102,7 @@ class Exp(UnaryScalarOp):
...
@@ -3102,7 +3102,7 @@ class Exp(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
exp
(
x
,
sig
=
"f"
)
return
np
.
exp
(
x
,
dtype
=
np
.
float32
)
return
np
.
exp
(
x
)
return
np
.
exp
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3138,7 +3138,7 @@ class Exp2(UnaryScalarOp):
...
@@ -3138,7 +3138,7 @@ class Exp2(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
exp2
(
x
,
sig
=
"f"
)
return
np
.
exp2
(
x
,
dtype
=
np
.
float32
)
return
np
.
exp2
(
x
)
return
np
.
exp2
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3174,7 +3174,7 @@ class Expm1(UnaryScalarOp):
...
@@ -3174,7 +3174,7 @@ class Expm1(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
expm1
(
x
,
sig
=
"f"
)
return
np
.
expm1
(
x
,
dtype
=
np
.
float32
)
return
np
.
expm1
(
x
)
return
np
.
expm1
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3241,7 +3241,7 @@ class Sqrt(UnaryScalarOp):
...
@@ -3241,7 +3241,7 @@ class Sqrt(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
sqrt
(
x
,
sig
=
"f"
)
return
np
.
sqrt
(
x
,
dtype
=
np
.
float32
)
return
np
.
sqrt
(
x
)
return
np
.
sqrt
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3277,7 +3277,7 @@ class Deg2Rad(UnaryScalarOp):
...
@@ -3277,7 +3277,7 @@ class Deg2Rad(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
deg2rad
(
x
,
sig
=
"f"
)
return
np
.
deg2rad
(
x
,
dtype
=
np
.
float32
)
return
np
.
deg2rad
(
x
)
return
np
.
deg2rad
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3312,7 +3312,7 @@ class Rad2Deg(UnaryScalarOp):
...
@@ -3312,7 +3312,7 @@ class Rad2Deg(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
rad2deg
(
x
,
sig
=
"f"
)
return
np
.
rad2deg
(
x
,
dtype
=
np
.
float32
)
return
np
.
rad2deg
(
x
)
return
np
.
rad2deg
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3349,7 +3349,7 @@ class Cos(UnaryScalarOp):
...
@@ -3349,7 +3349,7 @@ class Cos(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
cos
(
x
,
sig
=
"f"
)
return
np
.
cos
(
x
,
dtype
=
np
.
float32
)
return
np
.
cos
(
x
)
return
np
.
cos
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3385,7 +3385,7 @@ class ArcCos(UnaryScalarOp):
...
@@ -3385,7 +3385,7 @@ class ArcCos(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
arccos
(
x
,
sig
=
"f"
)
return
np
.
arccos
(
x
,
dtype
=
np
.
float32
)
return
np
.
arccos
(
x
)
return
np
.
arccos
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3423,7 +3423,7 @@ class Sin(UnaryScalarOp):
...
@@ -3423,7 +3423,7 @@ class Sin(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
sin
(
x
,
sig
=
"f"
)
return
np
.
sin
(
x
,
dtype
=
np
.
float32
)
return
np
.
sin
(
x
)
return
np
.
sin
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3459,7 +3459,7 @@ class ArcSin(UnaryScalarOp):
...
@@ -3459,7 +3459,7 @@ class ArcSin(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
arcsin
(
x
,
sig
=
"f"
)
return
np
.
arcsin
(
x
,
dtype
=
np
.
float32
)
return
np
.
arcsin
(
x
)
return
np
.
arcsin
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3495,7 +3495,7 @@ class Tan(UnaryScalarOp):
...
@@ -3495,7 +3495,7 @@ class Tan(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
tan
(
x
,
sig
=
"f"
)
return
np
.
tan
(
x
,
dtype
=
np
.
float32
)
return
np
.
tan
(
x
)
return
np
.
tan
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3531,7 +3531,7 @@ class ArcTan(UnaryScalarOp):
...
@@ -3531,7 +3531,7 @@ class ArcTan(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
arctan
(
x
,
sig
=
"f"
)
return
np
.
arctan
(
x
,
dtype
=
np
.
float32
)
return
np
.
arctan
(
x
)
return
np
.
arctan
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3569,7 +3569,7 @@ class ArcTan2(BinaryScalarOp):
...
@@ -3569,7 +3569,7 @@ class ArcTan2(BinaryScalarOp):
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
y_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
y_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
y_dtype
in
(
"int8"
,
"uint8"
):
if
y_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
arctan2
(
y
,
x
,
sig
=
"f"
)
return
np
.
arctan2
(
y
,
x
,
dtype
=
np
.
float32
)
return
np
.
arctan2
(
y
,
x
)
return
np
.
arctan2
(
y
,
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3618,7 +3618,7 @@ class Cosh(UnaryScalarOp):
...
@@ -3618,7 +3618,7 @@ class Cosh(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
cosh
(
x
,
sig
=
"f"
)
return
np
.
cosh
(
x
,
dtype
=
np
.
float32
)
return
np
.
cosh
(
x
)
return
np
.
cosh
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3654,7 +3654,7 @@ class ArcCosh(UnaryScalarOp):
...
@@ -3654,7 +3654,7 @@ class ArcCosh(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
arccosh
(
x
,
sig
=
"f"
)
return
np
.
arccosh
(
x
,
dtype
=
np
.
float32
)
return
np
.
arccosh
(
x
)
return
np
.
arccosh
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3695,7 +3695,7 @@ class Sinh(UnaryScalarOp):
...
@@ -3695,7 +3695,7 @@ class Sinh(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
sinh
(
x
,
sig
=
"f"
)
return
np
.
sinh
(
x
,
dtype
=
np
.
float32
)
return
np
.
sinh
(
x
)
return
np
.
sinh
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3731,7 +3731,7 @@ class ArcSinh(UnaryScalarOp):
...
@@ -3731,7 +3731,7 @@ class ArcSinh(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
arcsinh
(
x
,
sig
=
"f"
)
return
np
.
arcsinh
(
x
,
dtype
=
np
.
float32
)
return
np
.
arcsinh
(
x
)
return
np
.
arcsinh
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3773,7 +3773,7 @@ class Tanh(UnaryScalarOp):
...
@@ -3773,7 +3773,7 @@ class Tanh(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
tanh
(
x
,
sig
=
"f"
)
return
np
.
tanh
(
x
,
dtype
=
np
.
float32
)
return
np
.
tanh
(
x
)
return
np
.
tanh
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
@@ -3809,7 +3809,7 @@ class ArcTanh(UnaryScalarOp):
...
@@ -3809,7 +3809,7 @@ class ArcTanh(UnaryScalarOp):
# half-precision (float16), where we want float32.
# half-precision (float16), where we want float32.
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
x_dtype
=
str
(
getattr
(
x
,
"dtype"
,
""
))
if
x_dtype
in
(
"int8"
,
"uint8"
):
if
x_dtype
in
(
"int8"
,
"uint8"
):
return
np
.
arctanh
(
x
,
sig
=
"f"
)
return
np
.
arctanh
(
x
,
dtype
=
np
.
float32
)
return
np
.
arctanh
(
x
)
return
np
.
arctanh
(
x
)
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
def
L_op
(
self
,
inputs
,
outputs
,
gout
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论