Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2b73732a
提交
2b73732a
authored
7月 10, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flake8 of theano/scalar/basic.py
上级
62c810f3
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
19 行删除
+17
-19
basic.py
theano/scalar/basic.py
+17
-18
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/scalar/basic.py
浏览文件 @
2b73732a
...
@@ -247,8 +247,7 @@ class Scalar(Type):
...
@@ -247,8 +247,7 @@ class Scalar(Type):
'float64'
:
(
numpy
.
float64
,
'npy_float64'
,
'Float64'
),
'float64'
:
(
numpy
.
float64
,
'npy_float64'
,
'Float64'
),
'complex128'
:
(
numpy
.
complex128
,
'theano_complex128'
,
'complex128'
:
(
numpy
.
complex128
,
'theano_complex128'
,
'Complex128'
),
'Complex128'
),
'complex64'
:
(
numpy
.
complex64
,
'theano_complex64'
,
'complex64'
:
(
numpy
.
complex64
,
'theano_complex64'
,
'Complex64'
),
'Complex64'
),
'uint8'
:
(
numpy
.
uint8
,
'npy_uint8'
,
'UInt8'
),
'uint8'
:
(
numpy
.
uint8
,
'npy_uint8'
,
'UInt8'
),
'int8'
:
(
numpy
.
int8
,
'npy_int8'
,
'Int8'
),
'int8'
:
(
numpy
.
int8
,
'npy_int8'
,
'Int8'
),
'uint16'
:
(
numpy
.
uint16
,
'npy_uint16'
,
'UInt16'
),
'uint16'
:
(
numpy
.
uint16
,
'npy_uint16'
,
'UInt16'
),
...
@@ -544,9 +543,9 @@ class _scalar_py_operators:
...
@@ -544,9 +543,9 @@ class _scalar_py_operators:
return
neg
(
self
)
return
neg
(
self
)
# CASTS
# CASTS
#def __int__(self): return AsInt(self).out
#
def __int__(self): return AsInt(self).out
#def __float__(self): return AsDouble(self).out
#
def __float__(self): return AsDouble(self).out
#def __complex__(self): return AsComplex(self).out
#
def __complex__(self): return AsComplex(self).out
# BITWISE
# BITWISE
def
__invert__
(
self
):
def
__invert__
(
self
):
...
@@ -583,7 +582,7 @@ class _scalar_py_operators:
...
@@ -583,7 +582,7 @@ class _scalar_py_operators:
def
__ge__
(
self
,
other
):
def
__ge__
(
self
,
other
):
return
ge
(
self
,
other
)
return
ge
(
self
,
other
)
#ARITHMETIC - NORMAL
#
ARITHMETIC - NORMAL
def
__add__
(
self
,
other
):
def
__add__
(
self
,
other
):
return
add
(
self
,
other
)
return
add
(
self
,
other
)
...
@@ -609,7 +608,7 @@ class _scalar_py_operators:
...
@@ -609,7 +608,7 @@ class _scalar_py_operators:
def
__pow__
(
self
,
other
):
def
__pow__
(
self
,
other
):
return
pow
(
self
,
other
)
return
pow
(
self
,
other
)
#ARITHMETIC - RIGHT-OPERAND
#
ARITHMETIC - RIGHT-OPERAND
def
__radd__
(
self
,
other
):
def
__radd__
(
self
,
other
):
return
add
(
other
,
self
)
return
add
(
other
,
self
)
...
@@ -1176,7 +1175,7 @@ class InRange(LogicalComparison):
...
@@ -1176,7 +1175,7 @@ class InRange(LogicalComparison):
cmp1
=
'>='
cmp1
=
'>='
# backport
# backport
#cmp1 = '>' if self.openlow else '>='
#
cmp1 = '>' if self.openlow else '>='
if
self
.
openhi
:
if
self
.
openhi
:
cmp2
=
'<'
cmp2
=
'<'
...
@@ -1184,7 +1183,7 @@ class InRange(LogicalComparison):
...
@@ -1184,7 +1183,7 @@ class InRange(LogicalComparison):
cmp2
=
'<='
cmp2
=
'<='
# backport
# backport
#cmp2 = '<' if self.openhi else '<='
#
cmp2 = '<' if self.openhi else '<='
return
(
"
%(z)
s =
%(x)
s
%(cmp1)
s
%(low)
s &&"
return
(
"
%(z)
s =
%(x)
s
%(cmp1)
s
%(low)
s &&"
"
%(x)
s
%(cmp2)
s
%(hi)
s;"
%
locals
())
"
%(x)
s
%(cmp2)
s
%(hi)
s;"
%
locals
())
...
@@ -1473,7 +1472,7 @@ class Mul(ScalarOp):
...
@@ -1473,7 +1472,7 @@ class Mul(ScalarOp):
# output is complex. The rest of this function make this supposition.
# output is complex. The rest of this function make this supposition.
output_type
=
self
.
output_types
([
i
.
type
for
i
in
inputs
])[
0
]
output_type
=
self
.
output_types
([
i
.
type
for
i
in
inputs
])[
0
]
if
output_type
in
complex_types
:
if
output_type
in
complex_types
:
if
not
gz
.
type
in
complex_types
:
if
gz
.
type
not
in
complex_types
:
raise
TypeError
(
raise
TypeError
(
'Mul with output_type '
+
str
(
output_type
)
+
'Mul with output_type '
+
str
(
output_type
)
+
' expected gz type to be complex, got gz with type '
+
' expected gz type to be complex, got gz with type '
+
...
@@ -2201,7 +2200,7 @@ class RoundHalfToEven(UnaryScalarOp):
...
@@ -2201,7 +2200,7 @@ class RoundHalfToEven(UnaryScalarOp):
(
x
,)
=
inputs
(
x
,)
=
inputs
(
z
,)
=
outputs
(
z
,)
=
outputs
typ
=
node
.
outputs
[
0
]
.
type
.
dtype
typ
=
node
.
outputs
[
0
]
.
type
.
dtype
if
not
typ
in
[
'float32'
,
'float64'
]:
if
typ
not
in
[
'float32'
,
'float64'
]:
Exception
(
"The output should be float32 or float64"
)
Exception
(
"The output should be float32 or float64"
)
return
dedent
(
"""
return
dedent
(
"""
...
@@ -3326,12 +3325,12 @@ class Composite(ScalarOp):
...
@@ -3326,12 +3325,12 @@ class Composite(ScalarOp):
subd
[
output
]
=
name
subd
[
output
]
=
name
_c_code
+=
"
%
s
%
s;
\n
"
%
(
_c_code
+=
"
%
s
%
s;
\n
"
%
(
output
.
type
.
dtype_specs
()[
1
],
name
)
output
.
type
.
dtype_specs
()[
1
],
name
)
s
=
node
.
op
.
c_code
(
node
,
s
=
node
.
op
.
c_code
(
node
,
self
.
nodenames
[
j
],
self
.
nodenames
[
j
],
[
subd
[
input
]
for
input
in
node
.
inputs
],
[
subd
[
input
]
for
input
in
node
.
inputs
],
[
subd
[
output
]
for
output
in
node
.
outputs
],
[
subd
[
output
]
for
output
in
node
.
outputs
],
dict
(
fail
=
"
%(fail)
s"
,
dict
(
fail
=
"
%(fail)
s"
,
id
=
"
%%(id)
s_
%
i"
%
j
))
id
=
"
%%(id)
s_
%
i"
%
j
))
_c_code
+=
s
_c_code
+=
s
_c_code
+=
"
\n
"
_c_code
+=
"
\n
"
_c_code
+=
"}
\n
"
_c_code
+=
"}
\n
"
...
@@ -3489,7 +3488,7 @@ class Composite(ScalarOp):
...
@@ -3489,7 +3488,7 @@ class Composite(ScalarOp):
izip
((
"o
%
i"
%
i
for
i
in
xrange
(
len
(
onames
))),
izip
((
"o
%
i"
%
i
for
i
in
xrange
(
len
(
onames
))),
onames
)),
**
sub
)
onames
)),
**
sub
)
d
[
'nodename'
]
=
nodename
d
[
'nodename'
]
=
nodename
if
not
'id'
in
sub
:
if
'id'
not
in
sub
:
# The use of a dummy id is safe as the code is in a separate block.
# The use of a dummy id is safe as the code is in a separate block.
# It won't generate conflicting variable name.
# It won't generate conflicting variable name.
d
[
'id'
]
=
'_DUMMY_ID_'
d
[
'id'
]
=
'_DUMMY_ID_'
...
@@ -3536,9 +3535,9 @@ class Composite(ScalarOp):
...
@@ -3536,9 +3535,9 @@ class Composite(ScalarOp):
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
if
self
is
other
:
if
self
is
other
:
return
True
return
True
if
(
type
(
self
)
!=
type
(
other
)
if
(
type
(
self
)
!=
type
(
other
)
or
or
self
.
nin
!=
other
.
nin
self
.
nin
!=
other
.
nin
or
or
self
.
nout
!=
other
.
nout
):
self
.
nout
!=
other
.
nout
):
return
False
return
False
# see __hash__ for comment on why there is no mention of fgraph
# see __hash__ for comment on why there is no mention of fgraph
# or module cache key here.
# or module cache key here.
...
...
theano/tests/test_flake8.py
浏览文件 @
2b73732a
...
@@ -116,7 +116,6 @@ whitelist_flake8 = [
...
@@ -116,7 +116,6 @@ whitelist_flake8 = [
"tensor/nnet/tests/test_sigm.py"
,
"tensor/nnet/tests/test_sigm.py"
,
"scalar/basic_sympy.py"
,
"scalar/basic_sympy.py"
,
"scalar/__init__.py"
,
"scalar/__init__.py"
,
"scalar/basic.py"
,
"scalar/tests/test_basic.py"
,
"scalar/tests/test_basic.py"
,
"sandbox/test_theano_object.py"
,
"sandbox/test_theano_object.py"
,
"sandbox/test_scan.py"
,
"sandbox/test_scan.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论