提交 4c0014de authored 作者: Jakub Sygnowski's avatar Jakub Sygnowski

documentation of the update part of partial function evaluation

上级 7a9862b2
...@@ -735,9 +735,13 @@ class Function(object): ...@@ -735,9 +735,13 @@ class Function(object):
kwargs : dict kwargs : dict
The function inputs can be passed as keyword argument. For this, use The function inputs can be passed as keyword argument. For this, use
the name of the input or the input instance as the key. the name of the input or the input instance as the key.
Keyword argument ``output_subset`` is a list of either indices of the Keyword argument ``output_subset`` is a list of either indices of the
function's outputs or the keys belonging to the `output_keys` dict function's outputs or the keys belonging to the `output_keys` dict
and represent outputs that are requested to be calculated. and represent outputs that are requested to be calculated. Regardless
of the presence of ``output_subset``, the updates are always calculated
and processed. To disable the updates, you should use the ``copy``
method with ``delete_updates=False``.
Returns Returns
------- -------
......
...@@ -212,14 +212,18 @@ def test_partial_function(): ...@@ -212,14 +212,18 @@ def test_partial_function():
check_partial_function('cvm') check_partial_function('cvm')
# TODO: implement output_keys with CVM def test_partial_function_with_output_keys():
def test_partial_function_output_keys():
x = tensor.scalar('input') def check_partial_function_output_keys(linker_name):
y = 3 * x x = tensor.scalar('input')
f = theano.function([x], {'a': y * 5, 'b': y - 7}, mode=Mode( y = 3 * x
optimizer=None, linker=vm.VM_Linker(allow_partial_eval=True))) f = theano.function([x], {'a': y * 5, 'b': y - 7}, mode=Mode(
optimizer=None, linker=linker_name))
assert f(5, output_subset=['a'])['a'] == f(5)['a']
assert f(5, output_subset=['a'])['a'] == f(5)['a']
check_partial_function_output_keys(vm.VM_Linker(allow_partial_eval=True))
check_partial_function_output_keys('cvm')
def test_partial_function_with_updates(): def test_partial_function_with_updates():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论