提交 9b24aa75 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Typo fixes

上级 6421efb0
...@@ -241,34 +241,34 @@ Variable (``x``) is guaranteed to be a constant, and if so, what constant. ...@@ -241,34 +241,34 @@ Variable (``x``) is guaranteed to be a constant, and if so, what constant.
Test the optimization Test the optimization
===================== =====================
Here is some code that test the optimization is applied only when needed. Here is some code to test that the optimization is applied only when needed.
.. code-block:: python .. code-block:: python
# Test it don't apply when not needed # Test it does not apply when not needed
x = T.dvector() x = T.dvector()
f = function([x], fibby(x)) f = function([x], fibby(x))
#theano.printing.debugprint(f) #theano.printing.debugprint(f)
#We call the function to make sure it run. # We call the function to make sure it runs.
#If you run in DebugMode, it will compare the C and Python output # If you run in DebugMode, it will compare the C and Python outputs.
f(numpy.random.rand(5)) f(numpy.random.rand(5))
topo = f.maker.fgraph.toposort() topo = f.maker.fgraph.toposort()
assert len(topo) == 1 assert len(topo) == 1
assert isinstance(topo[0].op, Fibby) assert isinstance(topo[0].op, Fibby)
# Test that the optimization get applied # Test that the optimization gets applied.
f_zero = function([], fibby(T.zeros([5]))) f_zero = function([], fibby(T.zeros([5])))
#theano.printing.debugprint(f_zero) #theano.printing.debugprint(f_zero)
#If you run in DebugMode, it will compare the output before # If you run in DebugMode, it will compare the output before
# and after the optimization # and after the optimization.
f_zero() f_zero()
#Check that the optimization remove the Fibby Op. # Check that the optimization removes the Fibby Op.
#For security, the Theano memory interface make that the output # For security, the Theano memory interface ensures that the output
#of the function is always memory not aliaced to the input. # of the function is always memory not aliased to the input.
#That is why there is a DeepCopyOp op. # That is why there is a DeepCopyOp op.
topo = f_zero.maker.fgraph.toposort() topo = f_zero.maker.fgraph.toposort()
assert len(topo) == 1 assert len(topo) == 1
assert isinstance(topo[0].op, theano.compile.ops.DeepCopyOp) assert isinstance(topo[0].op, theano.compile.ops.DeepCopyOp)
...@@ -950,30 +950,30 @@ class T_fibby(unittest.TestCase): ...@@ -950,30 +950,30 @@ class T_fibby(unittest.TestCase):
except NotScalarConstantError: except NotScalarConstantError:
pass pass
# Test it don't apply when not needed # Test it does not apply when not needed
x = T.dvector() x = T.dvector()
f = function([x], fibby(x)) f = function([x], fibby(x))
#theano.printing.debugprint(f) #theano.printing.debugprint(f)
#We call the function to make sure it run. # We call the function to make sure it runs.
#If you run in DebugMode, it will compare the C and Python output # If you run in DebugMode, it will compare the C and Python outputs.
f(numpy.random.rand(5)) f(numpy.random.rand(5))
topo = f.maker.fgraph.toposort() topo = f.maker.fgraph.toposort()
assert len(topo) == 1 assert len(topo) == 1
assert isinstance(topo[0].op, Fibby) assert isinstance(topo[0].op, Fibby)
# Test that the optimization get applied # Test that the optimization gets applied.
f_zero = function([], fibby(T.zeros([5]))) f_zero = function([], fibby(T.zeros([5])))
#theano.printing.debugprint(f_zero) #theano.printing.debugprint(f_zero)
#If you run in DebugMode, it will compare the output before # If you run in DebugMode, it will compare the output before
# and after the optimization # and after the optimization.
f_zero() f_zero()
#Check that the optimization remove the Fibby Op. # Check that the optimization removes the Fibby Op.
#For security, the Theano memory interface make that the output # For security, the Theano memory interface ensures that the output
#of the function is always memory not aliaced to the input. # of the function is always memory not aliased to the input.
#That is why there is a DeepCopyOp op. # That is why there is a DeepCopyOp op.
topo = f_zero.maker.fgraph.toposort() topo = f_zero.maker.fgraph.toposort()
assert len(topo) == 1 assert len(topo) == 1
assert isinstance(topo[0].op, theano.compile.ops.DeepCopyOp) assert isinstance(topo[0].op, theano.compile.ops.DeepCopyOp)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论