Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
99012e14
提交
99012e14
authored
10月 17, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Flake8 + review fixes.
上级
a476757a
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
8 行增加
和
11 行删除
+8
-11
gradient.py
theano/gradient.py
+1
-1
basic.py
theano/scalar/basic.py
+4
-8
basic.py
theano/tensor/basic.py
+1
-0
elemwise.py
theano/tensor/elemwise.py
+2
-2
没有找到文件。
theano/gradient.py
浏览文件 @
99012e14
...
...
@@ -1335,7 +1335,7 @@ def _float_ones_like(x):
floating point dtype """
dtype
=
x
.
type
.
dtype
if
'float'
not
in
dtype
:
if
dtype
not
in
tensor
.
float_dtypes
:
dtype
=
theano
.
config
.
floatX
return
tensor
.
ones_like
(
x
,
dtype
=
dtype
)
...
...
theano/scalar/basic.py
浏览文件 @
99012e14
...
...
@@ -288,7 +288,7 @@ class Scalar(Type):
if
'complex'
in
self
.
dtype
:
raise
NotImplementedError
(
"No literal for complex values."
)
if
self
.
dtype
==
'bool'
:
return
'1'
if
b
else
'0'
return
'1'
if
data
else
'0'
return
str
(
data
)
def
c_declare
(
self
,
name
,
sub
,
check_input
=
True
):
...
...
@@ -683,11 +683,6 @@ complexs64 = _multi(complex64)
complexs128
=
_multi
(
complex128
)
# Using a class instead of a function makes it possible to deep-copy it.
# Note that currently only a few functions use this mechanism, because
# it is enough to make the test-suite pass. However, it may prove
# necessary to use this same mechanism in other places as well in the
# future.
def
upcast_out
(
*
types
):
dtype
=
Scalar
.
upcast
(
*
types
)
return
get_scalar_type
(
dtype
),
...
...
@@ -698,7 +693,8 @@ def upgrade_to_float(*types):
Upgrade any int types to float32 or float64 to avoid losing precision.
"""
conv
=
{
int8
:
float32
,
conv
=
{
bool
:
float32
,
int8
:
float32
,
int16
:
float32
,
int32
:
float64
,
int64
:
float64
,
...
...
@@ -1265,7 +1261,7 @@ switch = Switch()
class
UnaryBitOp
(
UnaryScalarOp
):
def
output_types
(
self
,
*
input_types
):
for
i
in
input_types
[
0
]:
if
i
not
in
((
bool
,)
+
discrete_types
)
:
if
i
not
in
discrete_types
:
raise
TypeError
(
'input to a BitOp must have type (u)int8, '
'(u)int16, (u)int32 or (u)int64 or bool not
%
s'
%
i
)
return
upcast_out
(
*
input_types
[
0
])
...
...
theano/tensor/basic.py
浏览文件 @
99012e14
...
...
@@ -3182,6 +3182,7 @@ def mean(input, axis=None, dtype=None, op=False, keepdims=False,
for
i
in
axis
:
s
=
true_div
(
s
,
shp
[
i
])
# This can happen when axis is an empty list/tuple
if
s
.
dtype
!=
shp
.
dtype
and
s
.
dtype
in
discrete_dtypes
:
s
=
cast
(
s
,
shp
.
dtype
)
...
...
theano/tensor/elemwise.py
浏览文件 @
99012e14
...
...
@@ -1716,7 +1716,7 @@ class All(CAReduce):
def
make_node
(
self
,
input
):
input
=
as_tensor_variable
(
input
)
if
input
.
dtype
is
not
"bool"
:
if
input
.
dtype
!=
"bool"
:
input
=
theano
.
tensor
.
neq
(
input
,
0
)
ret
=
super
(
All
,
self
)
.
make_node
(
input
)
return
ret
...
...
@@ -1746,7 +1746,7 @@ class Any(CAReduce):
def
make_node
(
self
,
input
):
input
=
as_tensor_variable
(
input
)
if
input
.
dtype
is
not
"bool"
:
if
input
.
dtype
!=
"bool"
:
input
=
theano
.
tensor
.
neq
(
input
,
0
)
ret
=
super
(
Any
,
self
)
.
make_node
(
input
)
return
ret
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论