提交 2232c5e7 authored 作者: Frederic's avatar Frederic

Fix some doctest

上级 fe574c1e
...@@ -8,11 +8,13 @@ Basic Tensor Functionality ...@@ -8,11 +8,13 @@ Basic Tensor Functionality
.. testsetup:: .. testsetup::
import theano
import theano.tensor as T import theano.tensor as T
from theano.tensor import scalar, iscalar, TensorType, dmatrix, ivector from theano.tensor import scalar, iscalar, TensorType, dmatrix, ivector
from theano.tensor import set_subtensor, inc_subtensor, batched_dot from theano.tensor import set_subtensor, inc_subtensor, batched_dot
from theano import shared from theano import shared
import numpy import numpy
import numpy as np
Theano supports any kind of Python object, but its focus is support for Theano supports any kind of Python object, but its focus is support for
symbolic matrix expressions. When you type, symbolic matrix expressions. When you type,
...@@ -1109,14 +1111,14 @@ Theano indexing with a "mask" (incorrect approach): ...@@ -1109,14 +1111,14 @@ Theano indexing with a "mask" (incorrect approach):
<BLANKLINE> <BLANKLINE>
[[3, 4, 5], [[3, 4, 5],
[3, 4, 5], [3, 4, 5],
[3, 4, 5]]], dtype=int8) [3, 4, 5]]])
Getting a Theano result like NumPy: Getting a Theano result like NumPy:
.. doctest:: indexing .. doctest:: indexing
>>> t[(t > 4).nonzero()].eval() >>> t[(t > 4).nonzero()].eval()
array([5, 6, 7, 8], dtype=int8) array([5, 6, 7, 8])
The gradient of Advanced indexing needs in many cases NumPy The gradient of Advanced indexing needs in many cases NumPy
1.8. It is not released yet as of April 30th, 2013. You can use NumPy 1.8. It is not released yet as of April 30th, 2013. You can use NumPy
...@@ -1743,13 +1745,13 @@ Linear Algebra ...@@ -1743,13 +1745,13 @@ Linear Algebra
[1, 1, 1], [1, 1, 1],
[2, 2, 2], [2, 2, 2],
[3, 3, 3], [3, 3, 3],
[4, 4, 4]], dtype=int8) [4, 4, 4]])
>>> a[1].eval() >>> a[1].eval()
array([[0, 1, 2], array([[0, 1, 2],
[0, 1, 2], [0, 1, 2],
[0, 1, 2], [0, 1, 2],
[0, 1, 2], [0, 1, 2],
[0, 1, 2]], dtype=int8) [0, 1, 2]])
.. function:: ogrid .. function:: ogrid
...@@ -1767,9 +1769,9 @@ Linear Algebra ...@@ -1767,9 +1769,9 @@ Linear Algebra
[1], [1],
[2], [2],
[3], [3],
[4]], dtype=int8) [4]])
>>> b[1].eval() >>> b[1].eval()
array([[0, 1, 2]], dtype=int8) array([[0, 1, 2]])
Gradient / Differentiation Gradient / Differentiation
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论