Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4d96e019
提交
4d96e019
authored
1月 18, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added classes to tensor/basic doc
上级
ebef8be1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
65 行增加
和
6 行删除
+65
-6
basic.txt
doc/library/tensor/basic.txt
+65
-6
没有找到文件。
doc/library/tensor/basic.txt
浏览文件 @
4d96e019
...
...
@@ -20,11 +20,61 @@ TensorType
TensorVariable
==============
.. class::
TensorVariable(_tensory_py_operators
)
.. class::
_tensor_py_operators(object
)
.. class:: TensorConstant(_tensory_py_operators)
This mix-in class adds convenient attributes, methods, and support for Python operators.
.. class:: TensorSharedVariable(_tensory_py_operators)
.. method:: reshape(shape, ndim=None)
Returns a view of this tensor that has been reshaped as in
numpy.reshape. If the shape is a Variable argument, then you might
need to use the optional `ndim` parameter to declare how many elements
the shape has, and therefore how many dimensions the reshaped Variable
will have.
See :func:`reshape`.
.. method:: dimshuffle(*pattern)
Returns a view of this tensor with permuted dimensions. Typically the
pattern will include the integers 0, 1, ... ndim-1, and any number of
'x' characters in dimensions where this tensor should be broadcasted.
See :func:`dimshuffle`.
.. method:: flatten(ndim=1)
Returns a view of this tensor with `ndim` dimensions, whose shape for the first
`ndim-1` dimensions will be the same as `self`, and shape in the
remaining dimension will be expanded to fit in all the data from self.
See :func:`flatten`.
.. attribute:: T
Transpose of this tensor.
>>> x = T.zmatrix()
>>> y = 3+.2j * x.T
.. note::
In numpy and in Theano, the transpose of a vector is exactly the
same vector! Use `reshape` or `dimshuffle` to turn your vector
into a row or column matrix.
.. class:: TensorVariable(Variable, _tensory_py_operators)
The result of symbolic operations typically have this type.
.. class:: TensorConstant(Variable, _tensory_py_operators)
Python and numpy numbers used in Theano graphs are wrapped in this type.
.. class:: TensorSharedVariable(Variable, _tensory_py_operators)
This type is returned by :func:`shared` when the initial value is a numpy
ndarray.
.. _libdoc_tensor_creation:
...
...
@@ -210,9 +260,11 @@ Shaping and Shuffling
Returns the symbolic shape vector of `x`
.. function:: reshape(x)
.. function:: reshape()
.. function:: dimshuffle()
.. function::
dimshuffle(x
)
.. function::
flatten(
)
Reductions
...
...
@@ -258,13 +310,20 @@ Operator Support
Python arithmetic operators are supported:
>>> a = T.itensor3()
>>> a, b = T.itensor3(), T.itensor3() # example inputs
>>>
>>> a + 3 # T.add(a, 3) -> itensor3
>>> 3 - a # T.sub(3, a)
>>> a * 3.5 # T.mul(a, 3.5) -> ftensor3 or dtensor3 (depending on autocasting)
>>> 2.2 / a # T.truediv(2.2, a)
>>> 2.2 // a # T.intdiv(2.2, a)
>>> 2.2**a # T.pow(2.2, a)
>>> b % a # T.mod(b, a)
>>>
>>> a & b # T.and_(a,b) bitwise and
>>> a ^ 1 # T.xor(a,1) bitwise xor
>>> a | b # T.or_(a,b) bitwise or
>>> ~a # T.invert(a) bitwise invert
.. note::
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论