提交 d15f4723 authored 作者: Frederic Bastien's avatar Frederic Bastien

Document that the CPU and GPU order isn't the same and small doc typo fixes.

上级 741ae918
...@@ -287,8 +287,7 @@ def _topk_py_impl(op, x, k, axis, idx_dtype): ...@@ -287,8 +287,7 @@ def _topk_py_impl(op, x, k, axis, idx_dtype):
class TopKOp(theano.Op): class TopKOp(theano.Op):
""" """Operations related to finding k-largest elements.
Operations related to finding k-largest elements.
Parameters Parameters
---------- ----------
...@@ -309,14 +308,19 @@ class TopKOp(theano.Op): ...@@ -309,14 +308,19 @@ class TopKOp(theano.Op):
Notes Notes
----- -----
- By default, this Op give two outputs: values and indices. However optimizer may - The CPU and GPU op have a different order of the elements. This is
remove a certain output if not needed. currently expected.
- The output order is not guaranteed. On the CPU, we use
- Computing gradient is only possible when both values and indices are computed in ``np.partition`` and ``np.argpartition`` that only make sure the
k-th element is the correct one and that the other
elements are on the correct side. On the GPU, they
look sorted, but we do not test the correctness of this behavior.
- By default, this Op gives two outputs: values and indices. However
optimizers may remove a certain output if not needed.
- Computing the gradient requests the computation of the indices in
forward pass. forward pass.
- If the top-k-th value is not unique, we cannot guarantee the
- If the top-k-th value is not unique, we cannot guarantee the output indices being output indices being deterministically chosen.
deterministically chosen.
See Also See Also
-------- --------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论