Added documentation for tensor elementwise bit-wise operators.

上级 64d74640
...@@ -339,6 +339,10 @@ Comparisons ...@@ -339,6 +339,10 @@ Comparisons
Returns a variable representing the result of logical inequality (a!=b). Returns a variable representing the result of logical inequality (a!=b).
Condition
---------
.. function:: switch(cond, ift, iff) .. function:: switch(cond, ift, iff)
Returns a variable representing a switch between ift (iftrue) and iff (iffalse) Returns a variable representing a switch between ift (iftrue) and iff (iffalse)
based on the condition cond. based on the condition cond.
...@@ -353,10 +357,50 @@ Comparisons ...@@ -353,10 +357,50 @@ Comparisons
x,y = T.dmatrices('x','y') x,y = T.dmatrices('x','y')
z = T.switch(T.lt(a,b), x, y) z = T.switch(T.lt(a,b), x, y)
Bit-wise
--------
.. note:: The bitwise operators must have an integer type as input.
The bitwise operators possess this interface:
:Parameter: *a* - symbolic Tensor of integer type.
:Parameter: *b* - symbolic Tensor of integer type.
.. note:: The bit-wise not (invert) does not have this second parameter.
:Return type: symbolic Tensor
.. function:: and_(a, b)
Returns a variable representing the result of the bitwise and.
.. function:: or_(a, b)
Returns a variable representing the result of the bitwise or.
.. function:: xor(a, b)
Returns a variable representing the result of the bitwise xor.
.. function:: invert(a)
Returns a variable representing the result of the bitwise not.
Here is an example using the bit-wise and_:
.. code-block:: python
import theano.tensor as T
x,y = T.imatrices('x','y')
z = T.and_(x,y)
Mathematical Mathematical
------------ ------------
.. _libdoc_tensor_broadcastable: .. _libdoc_tensor_broadcastable:
Broadcasting in Theano vs. Numpy Broadcasting in Theano vs. Numpy
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论