提交 d10856f6 authored 作者: Iban Harlouchet's avatar Iban Harlouchet

numpydoc for theano/compile/builders.py

上级 0a7415d7
...@@ -10,10 +10,11 @@ from functools import reduce ...@@ -10,10 +10,11 @@ from functools import reduce
class OpFromGraph(gof.Op): class OpFromGraph(gof.Op):
"""This creates an `Op` from inputs and outputs lists of variables. """
This creates an `Op` from inputs and outputs lists of variables.
The signature is similar to theano.function() and the resulting The signature is similar to theano.function() and the resulting
`Op`'s perform will do the same operation as:: `Op`'s perform will do the same operation as:
orig_function(inputs, outputs, **kwargs) orig_function(inputs, outputs, **kwargs)
...@@ -31,12 +32,16 @@ class OpFromGraph(gof.Op): ...@@ -31,12 +32,16 @@ class OpFromGraph(gof.Op):
- Add support to pickle this Op. - Add support to pickle this Op.
- Add support/test with random generator - Add support/test with random generator
:note: Notes
-----
- We support shared variables in the inner graph. This is automatic and - We support shared variables in the inner graph. This is automatic and
invisible to the user. They can be as input to the node or in the invisible to the user. They can be as input to the node or in the
inner graph. inner graph.
- We support unused inputs. This is needed for the grad. - We support unused inputs. This is needed for the grad.
Examples
--------
Example 1: Example 1:
.. code-block:: python .. code-block:: python
...@@ -49,8 +54,6 @@ class OpFromGraph(gof.Op): ...@@ -49,8 +54,6 @@ class OpFromGraph(gof.Op):
e2 = op(x, y, z) + op(z, y, x) e2 = op(x, y, z) + op(z, y, x)
fn = function([x, y, z], [e2]) fn = function([x, y, z], [e2])
Example 2 with shared variable: Example 2 with shared variable:
.. code-block:: python .. code-block:: python
...@@ -139,7 +142,8 @@ class OpFromGraph(gof.Op): ...@@ -139,7 +142,8 @@ class OpFromGraph(gof.Op):
def connection_pattern(self, node): def connection_pattern(self, node):
""" """
Return connection pattern of subfgraph defined by inputs and outputs Return connection pattern of subfgraph defined by inputs and outputs.
""" """
return io_connection_pattern(self.new_inputs, self.new_outputs) return io_connection_pattern(self.new_inputs, self.new_outputs)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论