Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b2f62a1e
提交
b2f62a1e
authored
8月 13, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix type conversion in TensorType and expand it to other similar types.
上级
682385f7
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
24 行增加
和
11 行删除
+24
-11
type.py
theano/gof/type.py
+5
-0
type.py
theano/sandbox/cuda/type.py
+8
-4
type.py
theano/sandbox/gpuarray/type.py
+8
-4
type.py
theano/tensor/type.py
+3
-3
没有找到文件。
theano/gof/type.py
浏览文件 @
b2f62a1e
...
@@ -277,6 +277,11 @@ class PureType(object):
...
@@ -277,6 +277,11 @@ class PureType(object):
# a Constant of the appropriate Type.
# a Constant of the appropriate Type.
other
=
self
.
Constant
(
type
=
self
,
data
=
other
)
other
=
self
.
Constant
(
type
=
self
,
data
=
other
)
if
other
.
type
!=
self
:
other2
=
self
.
convert_variable
(
other
)
if
other2
is
not
None
:
return
other2
if
other
.
type
!=
self
:
if
other
.
type
!=
self
:
raise
TypeError
(
raise
TypeError
(
'Cannot convert Type
%(othertype)
s '
'Cannot convert Type
%(othertype)
s '
...
...
theano/sandbox/cuda/type.py
浏览文件 @
b2f62a1e
...
@@ -146,10 +146,14 @@ class CudaNdarrayType(Type):
...
@@ -146,10 +146,14 @@ class CudaNdarrayType(Type):
raise
TypeError
(
'Incompatible number of dimensions.'
raise
TypeError
(
'Incompatible number of dimensions.'
' Expected
%
d, got
%
d.'
%
(
self
.
ndim
,
other
.
ndim
))
' Expected
%
d, got
%
d.'
%
(
self
.
ndim
,
other
.
ndim
))
if
other
.
type
.
broadcastable
!=
self
.
broadcastable
:
if
other
.
type
.
broadcastable
!=
self
.
broadcastable
:
raise
TypeError
(
'Incompatible broadcastable dimensions.'
type2
=
other
.
type
.
clone
(
broadcastable
=
self
.
broadcastable
)
' Expected
%
s, got
%
s.'
%
other2
=
type2
.
convert_variable
(
other
)
(
str
(
other
.
type
.
broadcastable
),
if
other2
is
None
:
str
(
self
.
broadcastable
)))
raise
TypeError
(
'Incompatible broadcastable dimensions.'
' Expected
%
s, got
%
s.'
%
(
str
(
other
.
type
.
broadcastable
),
str
(
self
.
broadcastable
)))
other
=
other2
return
theano
.
sandbox
.
cuda
.
basic_ops
.
GpuFromHost
()(
other
)
return
theano
.
sandbox
.
cuda
.
basic_ops
.
GpuFromHost
()(
other
)
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
b2f62a1e
...
@@ -108,10 +108,14 @@ class GpuArrayType(Type):
...
@@ -108,10 +108,14 @@ class GpuArrayType(Type):
raise
TypeError
(
'Incompatible number of dimensions.'
raise
TypeError
(
'Incompatible number of dimensions.'
' Expected
%
d, got
%
d.'
%
(
self
.
ndim
,
other
.
ndim
))
' Expected
%
d, got
%
d.'
%
(
self
.
ndim
,
other
.
ndim
))
if
other
.
type
.
broadcastable
!=
self
.
broadcastable
:
if
other
.
type
.
broadcastable
!=
self
.
broadcastable
:
raise
TypeError
(
'Incompatible broadcastable dimensions.'
type2
=
other
.
type
.
clone
(
broadcastable
=
self
.
broadcastable
)
' Expected
%
s, got
%
s.'
%
other2
=
type2
.
convert_variable
(
other
)
(
str
(
other
.
type
.
broadcastable
),
if
other2
is
None
:
str
(
self
.
broadcastable
)))
raise
TypeError
(
'Incompatible broadcastable dimensions.'
' Expected
%
s, got
%
s.'
%
(
str
(
other
.
type
.
broadcastable
),
str
(
self
.
broadcastable
)))
other
=
other2
return
theano
.
sandbox
.
gpuarray
.
basic_ops
.
gpu_from_host
(
other
)
return
theano
.
sandbox
.
gpuarray
.
basic_ops
.
gpu_from_host
(
other
)
...
...
theano/tensor/type.py
浏览文件 @
b2f62a1e
...
@@ -209,9 +209,9 @@ class TensorType(Type):
...
@@ -209,9 +209,9 @@ class TensorType(Type):
return
other
return
other
# Attempt safe broadcast conversion.
# Attempt safe broadcast conversion.
other
=
self
.
convert_variable
(
other
)
other
2
=
self
.
convert_variable
(
other
)
if
other
.
type
==
self
:
if
other
2
is
not
None
and
other2
.
type
==
self
:
return
other
return
other
2
raise
TypeError
(
raise
TypeError
(
'Cannot convert Type
%(othertype)
s '
'Cannot convert Type
%(othertype)
s '
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论