Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
94bdc43c
提交
94bdc43c
authored
7月 10, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flake8 of theano/scalar/basic_sympy.py
上级
2b73732a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
5 行增加
和
8 行删除
+5
-8
basic_sympy.py
theano/scalar/basic_sympy.py
+5
-7
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/scalar/basic_sympy.py
浏览文件 @
94bdc43c
import
numpy
as
np
import
itertools
as
it
from
theano.scalar.basic
import
Apply
,
ScalarOp
,
as_scalar
,
float64
,
float32
,
int64
from
theano.scalar.basic
import
Apply
,
ScalarOp
,
as_scalar
,
float64
,
float32
,
int64
from
theano.gof.utils
import
remove
from
theano.gof.utils
import
remove
imported_sympy
=
False
imported_sympy
=
False
try
:
try
:
import
sympy
from
sympy.utilities.codegen
import
get_default_datatype
,
codegen
from
sympy.utilities.codegen
import
get_default_datatype
,
codegen
imported_sympy
=
True
imported_sympy
=
True
except
ImportError
:
except
ImportError
:
pass
pass
import
itertools
as
it
names
=
(
"sympy_func_
%
d"
%
i
for
i
in
it
.
count
(
0
))
names
=
(
"sympy_func_
%
d"
%
i
for
i
in
it
.
count
(
0
))
def
include_line
(
line
):
def
include_line
(
line
):
...
@@ -64,8 +62,8 @@ class SymPyCCode(ScalarOp):
...
@@ -64,8 +62,8 @@ class SymPyCCode(ScalarOp):
def
c_headers
(
self
):
def
c_headers
(
self
):
c_code
=
self
.
_sympy_c_code
()
c_code
=
self
.
_sympy_c_code
()
return
[
line
.
replace
(
"#include"
,
""
)
.
strip
()
for
line
in
return
[
line
.
replace
(
"#include"
,
""
)
.
strip
()
for
line
in
c_code
.
split
(
'
\n
'
)
if
include_line
(
line
)
c_code
.
split
(
'
\n
'
)
if
include_line
(
line
)
and
and
not
'project_name'
in
line
]
'project_name'
not
in
line
]
def
c_code
(
self
,
node
,
name
,
input_names
,
output_names
,
sub
):
def
c_code
(
self
,
node
,
name
,
input_names
,
output_names
,
sub
):
y
,
=
output_names
y
,
=
output_names
...
@@ -92,7 +90,7 @@ class SymPyCCode(ScalarOp):
...
@@ -92,7 +90,7 @@ class SymPyCCode(ScalarOp):
def
grad
(
self
,
inputs
,
output_grads
):
def
grad
(
self
,
inputs
,
output_grads
):
return
[
SymPyCCode
(
self
.
inputs
,
return
[
SymPyCCode
(
self
.
inputs
,
self
.
expr
.
diff
(
inp
),
self
.
expr
.
diff
(
inp
),
name
=
self
.
name
+
"_grad_
%
d"
%
i
)(
*
inputs
)
name
=
self
.
name
+
"_grad_
%
d"
%
i
)(
*
inputs
)
for
i
,
inp
in
enumerate
(
self
.
inputs
)]
for
i
,
inp
in
enumerate
(
self
.
inputs
)]
def
_info
(
self
):
def
_info
(
self
):
...
...
theano/tests/test_flake8.py
浏览文件 @
94bdc43c
...
@@ -114,7 +114,6 @@ whitelist_flake8 = [
...
@@ -114,7 +114,6 @@ whitelist_flake8 = [
"tensor/nnet/tests/test_conv3d.py"
,
"tensor/nnet/tests/test_conv3d.py"
,
"tensor/nnet/tests/speed_test_conv.py"
,
"tensor/nnet/tests/speed_test_conv.py"
,
"tensor/nnet/tests/test_sigm.py"
,
"tensor/nnet/tests/test_sigm.py"
,
"scalar/basic_sympy.py"
,
"scalar/__init__.py"
,
"scalar/__init__.py"
,
"scalar/tests/test_basic.py"
,
"scalar/tests/test_basic.py"
,
"sandbox/test_theano_object.py"
,
"sandbox/test_theano_object.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论