提交 9fc1f281 authored 作者: AlexLamb's avatar AlexLamb

Added documentation on output_keys argument. Switched str to basestring

上级 d50d1e2c
......@@ -2196,6 +2196,10 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
:param on_unused_input: What to do if a variable in the 'inputs' list is
not used in the graph. Possible values are 'raise', 'warn', and 'ignore'.
:param output_keys: If the outputs argument for theano.function was a
list, then output_keys is None. If the outputs argument was a dict,
then output_keys is a sorted list of the keys from that dict.
:note: this function sets TensorType.filter_checks_isfinite
when `mode.check_isfinite` is True
......
......@@ -49,7 +49,8 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
:param inputs: function parameters, these are not allowed to be shared
variables
:type outputs: list of Variables or Out instances
:type outputs: list or dict of Variables or Out instances. If it is a
dict, the keys must be strings
:param outputs: expressions to compute
:type mode: string or `Mode` instance.
......@@ -193,7 +194,7 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
output_keys = []
outputs = []
for pair in output_items_sorted:
assert isinstance(pair[0], str)
assert isinstance(pair[0], basestring)
output_keys.append(pair[0])
outputs.append(pair[1])
......
......@@ -1442,6 +1442,11 @@ def orig_function(inputs, outputs, mode=None, accept_inplace=False,
:param on_unused_input: What to do if a variable in the 'inputs' list is
not used in the graph. Possible values are 'raise', 'warn', 'ignore'
and None
:param output_keys: If the outputs were provided to theano.function as a
list, then output_keys is None. Otherwise, if outputs were provided
as a dict, output_keys is the sorted list of keys from the outputs
"""
# Every element of the input list will be upgraded to an `In` instance if
......
......@@ -506,7 +506,7 @@ def pfunc(params, outputs=None, mode=None, updates=None, givens=None,
mutable=False, borrow=True, shared=True)
inputs.append(si)
return orig_function(inputs, cloned_outputs, mode,
return orig_function(inputs, cloned_outputs, mode,
accept_inplace=accept_inplace, name=name, profile=profile,
on_unused_input=on_unused_input, output_keys=output_keys)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论