提交 12ee12f4 authored 作者: Frederic's avatar Frederic

Doc Variable and Apply node correctly (for Variable.eval)

上级 ce2ceb7b
.. _libdoc_gof_graph:
==============================================
:mod:`graph` -- Interface for the Theano graph
==============================================
.. module:: graph
:platform: Unix, Windows
:synopsis: Interface for types of symbolic variables
.. moduleauthor:: LISA
---------
Reference
---------
.. automodule:: theano.gof.graph
:members:
......@@ -13,6 +13,7 @@
.. toctree::
:maxdepth: 1
graph
fgraph
toolbox
type
......
......@@ -4,7 +4,7 @@
:mod:`type` -- Interface for types of variables
================================================
.. module:: fgraph
.. module:: type
:platform: Unix, Windows
:synopsis: Interface for types of symbolic variables
.. moduleauthor:: LISA
......
......@@ -117,7 +117,8 @@ then be used like a normal Python function.
.. note::
As a shortcut, you can skip step 3, and just use a variable's
:func:`eval` method. The :func:`eval` method is not as flexible
:func:`eval <theano.gof.graph.Variable.eval>` method.
The :func:`eval` method is not as flexible
as :func:`function` but it can do everything we've covered in
the tutorial so far. It has the added benefit of not requiring
you to import :func:`function` . Here is how :func:`eval` works:
......
......@@ -451,6 +451,31 @@ class Variable(Node):
inputs_to_values
A dictionary mapping theano Variables to values.
Examples
--------
>>> import theano.tensor as T
>>> x = T.dscalar('x')
>>> y = T.dscalar('y')
>>> z = x + y
>>> z.eval({x : 16.3, y : 12.1})
array(28.4)
We passed :func:`eval` a dictionary mapping symbolic theano
variables to the values to substitute for them, and it returned
the numerical value of the expression.
Notes
-----
`eval` will be slow the first time you call it on a variable --
it needs to call :func:`function` to compile the expression behind
the scenes. Subsequent calls to :func:`eval` on that same variable
will be fast, because the variable caches the compiled function.
This way of computing have more overhead then a normal Theano
function, so don't use it too much in real script. But is
useful for interactive session and quick experiments.
"""
if inputs_to_values is None:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论