Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9438d632
提交
9438d632
authored
9月 27, 2012
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
doc
上级
fe2f6fc5
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
27 行增加
和
11 行删除
+27
-11
basic.py
theano/tensor/basic.py
+27
-11
没有找到文件。
theano/tensor/basic.py
浏览文件 @
9438d632
...
...
@@ -3698,21 +3698,28 @@ class AdvancedIndexingError(TypeError):
class
Subtensor
(
Op
):
"""Return a subtensor view
This class uses a relatively complex internal representation of the inputs
to remember how the input tensor x should be sliced. The instance variable
idx_list is a list whose elements are either integers, or slices. The
integers are indexes into the inputs array, and the start/stop/step members
of each slice are also integer indexes into the inputs array (or None).
The inputs array is the tensor x, followed by scalar integer variables.
TODO: WRITEME: how are the scalar integer variables formatted?
This class uses a relatively complex internal representation of the inputs
to remember how the input tensor x should be sliced.
idx_list: instance variable TODO: WRITEME: is this a list or a tuple?
(old docstring gives two conflicting
descriptions)
elements are either integers, theano scalars, or slices.
one element per "explicitly named dimension"
TODO: WRITEME: what is an "explicitly named dimension" ?
if integer:
indexes into the inputs array
if slice:
start/stop/step members of each slice are integer indices
into the inputs array or None
integer indices be actual integers or theano scalars
@todo: add support for advanced tensor indexing (in Subtensor_dx too).
The idx_list is a tuple similar in structure to the sort of key you might
expect in numpy's basic indexing mode. It has one element for each
explicitly named dimension. In numpy, the elements can be either integers
or slices containing integers and None. In Subtensor, each element can
additionally be a Scalar instance, and slice components can also be Scalar
instances too.
"""
e_invalid
=
(
'The index list is longer (size
%
d) than the number of '
'dimensions of the tensor(namely
%
d). You are asking for '
...
...
@@ -3810,6 +3817,10 @@ class Subtensor(Op):
return
scal
.
as_scalar
(
a
)
def
make_node
(
self
,
x
,
*
inputs
):
"""
x: the tensor to take a subtensor of
inputs: a list of theano Scalars
"""
x
=
as_tensor_variable
(
x
)
inputs
=
tuple
(
self
.
my_as_scalar
(
a
)
for
a
in
inputs
)
...
...
@@ -4440,6 +4451,11 @@ class IncSubtensor(Op):
", "
.
join
(
indices
))
def
make_node
(
self
,
x
,
y
,
*
inputs
):
"""
x: the tensor to increment
y: the value to increment by
inputs: TODO WRITEME
"""
x
,
y
=
map
(
as_tensor_variable
,
[
x
,
y
])
inputs
=
tuple
(
map
(
Subtensor
.
my_as_scalar
,
inputs
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论