Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
aa7a7fdc
提交
aa7a7fdc
authored
12月 09, 2012
作者:
abalkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reuse advanced_subtensor1 in all cases.
上级
11603832
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
7 行增加
和
42 行删除
+7
-42
basic.py
theano/tensor/basic.py
+7
-42
没有找到文件。
theano/tensor/basic.py
浏览文件 @
aa7a7fdc
...
@@ -6814,47 +6814,6 @@ class AdvancedIncSubtensor(Op):
...
@@ -6814,47 +6814,6 @@ class AdvancedIncSubtensor(Op):
*
inputs
[
2
:])
.
outputs
*
inputs
[
2
:])
.
outputs
advanced_inc_subtensor
=
AdvancedIncSubtensor
()
advanced_inc_subtensor
=
AdvancedIncSubtensor
()
class
Take
(
Op
):
"""
Take elements from an array along an axis.
"""
def
__init__
(
self
,
axis
,
mode
):
self
.
axis
=
axis
self
.
mode
=
mode
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
)
and
self
.
axis
==
other
.
axis
and
self
.
mode
==
other
.
mode
)
def
__hash__
(
self
):
return
hash
((
type
(
self
),
self
.
axis
,
self
.
mode
))
def
make_node
(
self
,
a
,
indices
):
a
=
as_tensor_variable
(
a
)
indices
=
as_tensor_variable
(
indices
)
if
self
.
axis
is
None
:
broadcastable
=
[
False
]
else
:
broadcastable
=
(
a
.
broadcastable
[:
self
.
axis
]
+
indices
.
broadcastable
+
a
.
broadcastable
[
self
.
axis
+
1
:])
return
gof
.
Apply
(
self
,
(
a
,
indices
),
[
TensorType
(
a
.
dtype
,
broadcastable
)()])
def
perform
(
self
,
node
,
inputs
,
outputs
):
a
,
indices
=
inputs
out
,
=
outputs
out
[
0
]
=
a
.
take
(
indices
,
axis
=
self
.
axis
,
mode
=
self
.
mode
)
def
infer_shape
(
self
,
node
,
input_shapes
):
a_shape
,
indices_shape
=
input_shapes
if
self
.
axis
is
None
:
shape
=
indices_shape
else
:
shape
=
a_shape
[:
self
.
axis
]
+
indices_shape
+
a_shape
[
self
.
axis
+
1
:]
return
[
shape
]
def
take
(
a
,
indices
,
axis
=
None
,
mode
=
'raise'
):
def
take
(
a
,
indices
,
axis
=
None
,
mode
=
'raise'
):
a
=
as_tensor_variable
(
a
)
a
=
as_tensor_variable
(
a
)
indices
=
as_tensor_variable
(
indices
)
indices
=
as_tensor_variable
(
indices
)
...
@@ -6877,7 +6836,13 @@ def take(a, indices, axis=None, mode='raise'):
...
@@ -6877,7 +6836,13 @@ def take(a, indices, axis=None, mode='raise'):
shuffle
[
axis
]
=
0
shuffle
[
axis
]
=
0
return
advanced_subtensor1
(
return
advanced_subtensor1
(
a
.
dimshuffle
(
shuffle
),
indices
)
.
dimshuffle
(
shuffle
)
a
.
dimshuffle
(
shuffle
),
indices
)
.
dimshuffle
(
shuffle
)
return
Take
(
axis
,
mode
)(
a
,
indices
)
if
axis
is
None
:
shape
=
indices
.
shape
ndim
=
indices
.
ndim
else
:
shape
=
concatenate
([
a
.
shape
[:
axis
],
indices
.
shape
,
a
.
shape
[
axis
+
1
:]])
ndim
=
a
.
ndim
+
indices
.
ndim
-
1
return
take
(
a
,
indices
.
flatten
(),
axis
,
mode
)
.
reshape
(
shape
,
ndim
)
#########################
#########################
# Linalg : Dot
# Linalg : Dot
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论