提交 113c22ef authored 作者: James Bergstra's avatar James Bergstra

Put function documentation of theano.function() up to date.

上级 8e25c2f3
...@@ -832,7 +832,7 @@ def register_checker(checker): ...@@ -832,7 +832,7 @@ def register_checker(checker):
def function(inputs, outputs, mode=None, accept_inplace = False): def function(inputs, outputs, mode=None, accept_inplace = False):
""" """
Return a function calculating the outputs from the inputs. Return a Function that will calculate the outputs from the inputs.
:param inputs: list of `SymbolicInput` or `In` instances :param inputs: list of `SymbolicInput` or `In` instances
...@@ -845,42 +845,25 @@ def function(inputs, outputs, mode=None, accept_inplace = False): ...@@ -845,42 +845,25 @@ def function(inputs, outputs, mode=None, accept_inplace = False):
Currently, the library provides the following mode strings: Currently, the library provides the following mode strings:
- SANITY_CHECK TODO: NotImplemented
- FAST_COMPILE (apply only optimization that are fast to apply)
- FAST_RUN (default) (optimize without too much time) - FAST_RUN (default) (optimize without too much time)
- EXPENSIVE_OPTIMIZATION TODO: NotImplemented - FAST_COMPILE (minimal optimization)
- PROFILE_MODE : allow to print a profile mode with mode.print_summary - PROFILE_MODE : allow to print a profile mode with mode.print_summary
- DEBUG_MODE : make all the check that we taught of(compare python and c,...) - DEBUG_MODE : verify many internal conditions that are normally assumed (SLOW)
:param accept_inplace: True iff the graph can contain inplace operations prior to the :param accept_inplace: True iff the graph can contain inplace operations prior to the
optimization phase (default is False) optimization phase (default is False)
Every element of the input list will be upgraded to an `In` instance if necessary, """
using the rules implemented by the `convert_function_input` function.
Similarly, every element of the output list will be upgraded to an
`Out` instance if necessary:
* a `Variable` instance r will be upgraded like `Out`(r)
Random Numbers
--------------
If your computation involves random numbers, then you have to pass the `RandomKit` as an
input argument. That RandomKit must have a name to be able to seed the generator. To seed
the generator, use the `__setitem__` method:
..code-block: python #Every element of the input list will be upgraded to an `In` instance if necessary,
#using the rules implemented by the `convert_function_input` function.
f[<kitname>] = seed #re-seed the elements of a RandomKit #Similarly, every element of the output list will be upgraded to an
#`Out` instance if necessary:
"""
t1 = time.time() t1 = time.time()
if mode is None: if mode is None:
mode = mode_module.default_mode mode = mode_module.default_mode
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论