Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6da774d1
提交
6da774d1
authored
5月 01, 2014
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Following a change in pygpu to raise a ValueError instead of a GpuArrayException…
Following a change in pygpu to raise a ValueError instead of a GpuArrayException on GA_VALUE_ERROR we can remove workaround code.
上级
4bacd641
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
0 行增加
和
46 行删除
+0
-46
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+0
-46
没有找到文件。
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
6da774d1
...
@@ -734,53 +734,10 @@ class GpuJoin(HideC, Join):
...
@@ -734,53 +734,10 @@ class GpuJoin(HideC, Join):
[
GpuArrayType
(
broadcastable
=
node
.
outputs
[
0
]
.
broadcastable
,
[
GpuArrayType
(
broadcastable
=
node
.
outputs
[
0
]
.
broadcastable
,
dtype
=
node
.
outputs
[
0
]
.
dtype
)()])
dtype
=
node
.
outputs
[
0
]
.
dtype
)()])
def
_need_broadcast
(
self
,
node
):
p_broadcastable
=
node
.
inputs
[
1
]
.
broadcastable
need_b
=
[
any
(
t
.
broadcastable
[
i
]
!=
p_broadcastable
[
i
]
for
t
in
node
.
inputs
[
2
:])
for
i
in
range
(
node
.
inputs
[
1
]
.
ndim
)]
try
:
# We never need to broadcast on the join axis
axis_v
=
int
(
tensor
.
basic
.
get_scalar_constant_value
(
node
.
inputs
[
0
]))
need_b
[
axis_v
]
=
False
except
tensor
.
basic
.
NotScalarConstantError
:
pass
return
any
(
need_b
)
def
perform
(
self
,
node
,
axis_and_tensors
,
out_
):
def
perform
(
self
,
node
,
axis_and_tensors
,
out_
):
out
,
=
out_
out
,
=
out_
axis
=
int
(
axis_and_tensors
[
0
])
axis
=
int
(
axis_and_tensors
[
0
])
tensors
=
axis_and_tensors
[
1
:]
tensors
=
axis_and_tensors
[
1
:]
if
not
hasattr
(
node
,
'_need_broadcast'
):
node
.
_need_broadcast
=
self
.
_need_broadcast
(
node
)
if
node
.
_need_broadcast
:
width_sum
=
0
template_shape
=
list
(
tensors
[
0
]
.
shape
)
for
t
in
tensors
:
width_sum
+=
t
.
shape
[
axis
]
tmp_shape
=
list
(
t
.
shape
)
tmp_shape
[
axis
]
=
template_shape
[
axis
]
if
tmp_shape
!=
template_shape
:
raise
ValueError
(
"Shape of input GpuArrays must"
" agree except for the 'axis' dimension"
)
template_shape
[
axis
]
=
width_sum
rval
=
pygpu
.
zeros
(
template_shape
,
dtype
=
node
.
outputs
[
0
]
.
dtype
)
curpos
=
0
def
construct_slices
(
curlen
):
slices
=
[
slice
(
None
,
None
,
None
)
for
i
in
\
range
(
len
(
template_shape
))]
slices
[
axis
]
=
slice
(
curpos
,
curpos
+
curlen
,
None
)
return
tuple
(
slices
)
for
t
in
tensors
:
curlen
=
t
.
shape
[
axis
]
rval
.
__setitem__
(
construct_slices
(
curlen
),
t
)
curpos
+=
curlen
out
[
0
]
=
rval
else
:
out
[
0
]
=
pygpu
.
concatenate
(
tensors
,
axis
=
axis
)
.
astype
(
out
[
0
]
=
pygpu
.
concatenate
(
tensors
,
axis
=
axis
)
.
astype
(
node
.
outputs
[
0
]
.
dtype
)
node
.
outputs
[
0
]
.
dtype
)
...
@@ -788,9 +745,6 @@ class GpuJoin(HideC, Join):
...
@@ -788,9 +745,6 @@ class GpuJoin(HideC, Join):
return
(
1
,)
return
(
1
,)
def
c_code
(
self
,
node
,
name
,
inputs
,
out_
,
sub
):
def
c_code
(
self
,
node
,
name
,
inputs
,
out_
,
sub
):
if
self
.
_need_broadcast
(
node
):
node
.
_need_broadcast
=
True
raise
MethodNotDefined
,
'broadcast not supported'
copy_to_list
=
[]
copy_to_list
=
[]
restype
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
restype
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
for
i
,
inp
in
enumerate
(
inputs
[
1
:]):
for
i
,
inp
in
enumerate
(
inputs
[
1
:]):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论