Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e1be4e66
提交
e1be4e66
authored
4月 16, 2008
作者:
bergstrj@iro.umontreal.ca
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added trig functions, untested
上级
e412894e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
53 行增加
和
0 行删除
+53
-0
scalar.py
scalar.py
+47
-0
tensor.py
tensor.py
+6
-0
没有找到文件。
scalar.py
浏览文件 @
e1be4e66
...
@@ -388,6 +388,53 @@ class Sqrt(UnaryScalarOp):
...
@@ -388,6 +388,53 @@ class Sqrt(UnaryScalarOp):
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
return
"
%(z)
s = sqrt(
%(x)
s);"
%
locals
()
return
"
%(z)
s = sqrt(
%(x)
s);"
%
locals
()
class
Cos
(
UnaryScalarOp
):
def
impl
(
self
,
x
):
return
math
.
cos
(
x
)
def
grad
(
self
,
(
x
,
),
(
gz
,
)):
return
gz
*
sin
(
x
),
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
return
"
%(z)
s = cos(
%(x)
s);"
%
locals
()
class
Sin
(
UnaryScalarOp
):
def
impl
(
self
,
x
):
return
math
.
sin
(
x
)
def
grad
(
self
,
(
x
,
),
(
gz
,
)):
return
-
gz
*
cos
(
x
),
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
return
"
%(z)
s = sin(
%(x)
s);"
%
locals
()
class
Tan
(
UnaryScalarOp
):
def
impl
(
self
,
x
):
return
math
.
tan
(
x
)
def
grad
(
self
,
(
x
,
),
(
gz
,
)):
raise
NotImplementedError
(
'lazy'
)
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
return
"
%(z)
s = tan(
%(x)
s);"
%
locals
()
class
Cosh
(
UnaryScalarOp
):
def
impl
(
self
,
x
):
return
math
.
cosh
(
x
)
def
grad
(
self
,
(
x
,
),
(
gz
,
)):
raise
NotImplementedError
()
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
return
"
%(z)
s = cosh(
%(x)
s);"
%
locals
()
class
Sinh
(
UnaryScalarOp
):
def
impl
(
self
,
x
):
return
math
.
sin
(
x
)
def
grad
(
self
,
(
x
,
),
(
gz
,
)):
return
-
gz
*
cos
(
x
),
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
return
"
%(z)
s = sin(
%(x)
s);"
%
locals
()
class
Tanh
(
UnaryScalarOp
):
def
impl
(
self
,
x
):
return
math
.
tanh
(
x
)
def
grad
(
self
,
(
x
,
),
(
gz
,
)):
return
gz
*
(
1
-
tanh
(
x
))
**
2
def
c_code
(
self
,
(
x
,
),
(
z
,
),
sub
):
return
"
%(z)
s = tanh(
%(x)
s);"
%
locals
()
#NOTE WELL!!!
#NOTE WELL!!!
...
...
tensor.py
浏览文件 @
e1be4e66
...
@@ -216,6 +216,12 @@ Log2, log2, Log2Inplace, log2_inplace = broadcast(scal.Log2, 'Log2')
...
@@ -216,6 +216,12 @@ Log2, log2, Log2Inplace, log2_inplace = broadcast(scal.Log2, 'Log2')
Sgn
,
sgn
,
SgnInplace
,
sgn_inplace
=
broadcast
(
scal
.
Sgn
,
'Sgn'
)
Sgn
,
sgn
,
SgnInplace
,
sgn_inplace
=
broadcast
(
scal
.
Sgn
,
'Sgn'
)
Sqr
,
sqr
,
SqrInplace
,
sqr_inplace
=
broadcast
(
scal
.
Sqr
,
'Sqr'
)
Sqr
,
sqr
,
SqrInplace
,
sqr_inplace
=
broadcast
(
scal
.
Sqr
,
'Sqr'
)
Sqrt
,
sqrt
,
SqrtInplace
,
sqrt_inplace
=
broadcast
(
scal
.
Sqrt
,
'Sqrt'
)
Sqrt
,
sqrt
,
SqrtInplace
,
sqrt_inplace
=
broadcast
(
scal
.
Sqrt
,
'Sqrt'
)
Cos
,
cos
,
CosInplace
,
cos_inplace
=
broadcast
(
scal
.
Cos
,
'Cos'
)
Sin
,
sin
,
SinInplace
,
sin_inplace
=
broadcast
(
scal
.
Sin
,
'Sin'
)
Tan
,
tan
,
TanInplace
,
tan_inplace
=
broadcast
(
scal
.
Tan
,
'Tan'
)
Cosh
,
cosh
,
CoshInplace
,
cosh_inplace
=
broadcast
(
scal
.
Cosh
,
'Cosh'
)
Sinh
,
sinh
,
SinhInplace
,
sinh_inplace
=
broadcast
(
scal
.
Sinh
,
'Sinh'
)
Tanh
,
tanh
,
TanhInplace
,
tanh_inplace
=
broadcast
(
scal
.
Tanh
,
'Tanh'
)
Sum
=
s2t
.
Sum
Sum
=
s2t
.
Sum
sum
=
gof
.
op
.
constructor
(
Sum
)
sum
=
gof
.
op
.
constructor
(
Sum
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论