@@ -114,7 +114,7 @@ possibilities you may encounter or need. For that refer to
114114 def R_op(self, inputs, eval_points):
115115 pass
116116
117- def infer_shape(node, input_shapes):
117+ def infer_shape(self, fgraph, node, input_shapes):
118118 pass
119119
120120An op has to implement some methods defined in the the interface of
@@ -237,9 +237,9 @@ There are other methods that can be optionally defined by the op:
237237 :attr:`__props__` will also generate a suitable :func:`__str__` for your op.
238238 This requires development version after September 1st, 2014 or version 0.7.
239239
240- The :func:`infer_shape` method allows to infer the shape of the op
241- output variables, without actually computing the outputs .
242- It takes as input ``node``, a reference to the op Apply node,
240+ The :func:`infer_shape` method allows an `Op` to infer the shape of its
241+ output variables without actually computing them .
242+ It takes as input ``fgraph``, a `FunctionGraph`; `` node``, a reference to the op Apply node;
243243 and a list of Theano symbolic Varables (``i0_shape``, ``i1_shape``, ...)
244244 which are the shape of the op input Variables.
245245 :func:`infer_shape` returns a list where each element is a tuple representing
@@ -302,7 +302,7 @@ Example: Op definition
302302 z = output_storage[0]
303303 z[0] = x * 2
304304
305- def infer_shape(self, node, i0_shapes):
305+ def infer_shape(self, fgraph, node, i0_shapes):
306306 return i0_shapes
307307
308308 def grad(self, inputs, output_grads):
@@ -333,7 +333,7 @@ Example: Op definition
333333 z = output_storage[0]
334334 z[0] = x * 2
335335
336- def infer_shape(self, node, i0_shapes):
336+ def infer_shape(self, fgraph, node, i0_shapes):
337337 return i0_shapes
338338
339339 def grad(self, inputs, output_grads):
@@ -508,7 +508,7 @@ and ``b`` are equal.
508508 z = output_storage[0]
509509 z[0] = self.a * x + self.b
510510
511- def infer_shape(self, node, i0_shapes):
511+ def infer_shape(self, fgraph, node, i0_shapes):
512512 return i0_shapes
513513
514514 def grad(self, inputs, output_grads):
@@ -750,12 +750,13 @@ signature:
750750
751751.. code-block:: none
752752
753- def infer_shape(node, input_shapes):
753+ def infer_shape(fgraph, node, input_shapes):
754754 # ...
755755 return output_shapes
756756
757757 - `input_shapes` and `output_shapes` are lists of tuples that
758- represent the shape of the corresponding inputs/outputs.
758+ represent the shape of the corresponding inputs/outputs, and `fgraph`
759+ is a `FunctionGraph`.
759760
760761.. note::
761762
@@ -788,7 +789,7 @@ as_op Example
788789 from theano import function
789790 from theano.compile.ops import as_op
790791
791- def infer_shape_numpy_dot(node, input_shapes):
792+ def infer_shape_numpy_dot(fgraph, node, input_shapes):
792793 ashp, bshp = input_shapes
793794 return [ashp[:-1] + bshp[-1:]]
794795
0 commit comments