Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4dd2d1ba
提交
4dd2d1ba
authored
4月 30, 2013
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Document that we now support Integer advanced indexing (not boolean mask).
上级
97fff534
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
8 行删除
+22
-8
basic.txt
doc/library/tensor/basic.txt
+22
-8
没有找到文件。
doc/library/tensor/basic.txt
浏览文件 @
4dd2d1ba
...
@@ -897,17 +897,31 @@ Reductions
...
@@ -897,17 +897,31 @@ Reductions
Indexing
Indexing
========
========
Like
nump
y, Theano distinguishes between *basic* and *advanced* indexing.
Like
NumP
y, Theano distinguishes between *basic* and *advanced* indexing.
Theano fully supports basic indexing
Theano fully supports basic indexing
(see `
numpy's basic
indexing <http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html>`_).
(see `
NumPy's
indexing <http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html>`_).
Advanced indexing is almost entirely unsupported (for now).
`Integer advanced indexing
The one sort of advanced indexing that is supported is the retrieval of the c[i]'th element of each
<http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#integer>`_
row of a matrix x:
will be supported in 0.6rc4 (or the development version). We do not
support boolean masks, as Theano do not have a boolean type (we use
int8 for the output of logic operator). To imitate boolean advanced
indexing, you can do::
>>> x = T.fmatrix()
# NumPy indexing with a mask
>>> c = T.lvector()
n = np.arange(9).reshape(3,3)
>>> x[T.arange(c.shape[0]), c]
n[n>4] # array([5, 6, 7, 8])
# Theano indexing with a "mask"
t = tt.arange(9).reshape((3,3))
t[t>4].eval() # an array with shape (3, 3, 3)
# getting a Theano result like NumPy
t[(t>4).nonzero()].eval() # array([5, 6, 7, 8])
The gradient of Advanced indexing need in many cases NumPy
1.8. It isn't released as of April 30, 2013. You can use NumPy
development version to have this feature now.
Index-assignment is *not* supported. If you want to do something like ``a[5]
Index-assignment is *not* supported. If you want to do something like ``a[5]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论