Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
253b3856
提交
253b3856
authored
6月 26, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flake8 for tensor/xlogx.py
上级
a4f0dced
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
1 行删除
+8
-1
xlogx.py
theano/tensor/xlogx.py
+8
-0
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/tensor/xlogx.py
浏览文件 @
253b3856
...
@@ -13,12 +13,15 @@ class XlogX(scalar.UnaryScalarOp):
...
@@ -13,12 +13,15 @@ class XlogX(scalar.UnaryScalarOp):
if
x
==
0.0
:
if
x
==
0.0
:
return
0.0
return
0.0
return
x
*
numpy
.
log
(
x
)
return
x
*
numpy
.
log
(
x
)
def
impl
(
self
,
x
):
def
impl
(
self
,
x
):
return
XlogX
.
st_impl
(
x
)
return
XlogX
.
st_impl
(
x
)
def
grad
(
self
,
inputs
,
grads
):
def
grad
(
self
,
inputs
,
grads
):
x
,
=
inputs
x
,
=
inputs
gz
,
=
grads
gz
,
=
grads
return
[
gz
*
(
1
+
scalar
.
log
(
x
))]
return
[
gz
*
(
1
+
scalar
.
log
(
x
))]
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
x
,
=
inputs
x
,
=
inputs
z
,
=
outputs
z
,
=
outputs
...
@@ -28,6 +31,7 @@ class XlogX(scalar.UnaryScalarOp):
...
@@ -28,6 +31,7 @@ class XlogX(scalar.UnaryScalarOp):
? 0.0
? 0.0
:
%(x)
s * log(
%(x)
s);"""
%
locals
()
:
%(x)
s * log(
%(x)
s);"""
%
locals
()
raise
NotImplementedError
(
'only floatingpoint is implemented'
)
raise
NotImplementedError
(
'only floatingpoint is implemented'
)
scalar_xlogx
=
XlogX
(
scalar
.
upgrade_to_float
,
name
=
'scalar_xlogx'
)
scalar_xlogx
=
XlogX
(
scalar
.
upgrade_to_float
,
name
=
'scalar_xlogx'
)
xlogx
=
Elemwise
(
scalar_xlogx
,
name
=
'xlogx'
)
xlogx
=
Elemwise
(
scalar_xlogx
,
name
=
'xlogx'
)
...
@@ -41,12 +45,15 @@ class XlogY0(scalar.BinaryScalarOp):
...
@@ -41,12 +45,15 @@ class XlogY0(scalar.BinaryScalarOp):
if
x
==
0.0
:
if
x
==
0.0
:
return
0.0
return
0.0
return
x
*
numpy
.
log
(
y
)
return
x
*
numpy
.
log
(
y
)
def
impl
(
self
,
x
,
y
):
def
impl
(
self
,
x
,
y
):
return
XlogY0
.
st_impl
(
x
,
y
)
return
XlogY0
.
st_impl
(
x
,
y
)
def
grad
(
self
,
inputs
,
grads
):
def
grad
(
self
,
inputs
,
grads
):
x
,
y
=
inputs
x
,
y
=
inputs
gz
,
=
grads
gz
,
=
grads
return
[
gz
*
scalar
.
log
(
y
),
gz
*
x
/
y
]
return
[
gz
*
scalar
.
log
(
y
),
gz
*
x
/
y
]
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
x
,
y
=
inputs
x
,
y
=
inputs
z
,
=
outputs
z
,
=
outputs
...
@@ -56,5 +63,6 @@ class XlogY0(scalar.BinaryScalarOp):
...
@@ -56,5 +63,6 @@ class XlogY0(scalar.BinaryScalarOp):
? 0.0
? 0.0
:
%(x)
s * log(
%(y)
s);"""
%
locals
()
:
%(x)
s * log(
%(y)
s);"""
%
locals
()
raise
NotImplementedError
(
'only floatingpoint is implemented'
)
raise
NotImplementedError
(
'only floatingpoint is implemented'
)
scalar_xlogy0
=
XlogY0
(
scalar
.
upgrade_to_float
,
name
=
'scalar_xlogy0'
)
scalar_xlogy0
=
XlogY0
(
scalar
.
upgrade_to_float
,
name
=
'scalar_xlogy0'
)
xlogy0
=
Elemwise
(
scalar_xlogy0
,
name
=
'xlogy0'
)
xlogy0
=
Elemwise
(
scalar_xlogy0
,
name
=
'xlogy0'
)
theano/tests/test_flake8.py
浏览文件 @
253b3856
...
@@ -57,7 +57,6 @@ whitelist_flake8 = [
...
@@ -57,7 +57,6 @@ whitelist_flake8 = [
"typed_list/tests/test_type.py"
,
"typed_list/tests/test_type.py"
,
"typed_list/tests/test_opt.py"
,
"typed_list/tests/test_opt.py"
,
"typed_list/tests/test_basic.py"
,
"typed_list/tests/test_basic.py"
,
"tensor/xlogx.py"
,
"tensor/blas_headers.py"
,
"tensor/blas_headers.py"
,
"tensor/utils.py"
,
"tensor/utils.py"
,
"tensor/type.py"
,
"tensor/type.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论