-
Notifications
You must be signed in to change notification settings - Fork 143
Description
Description
params
are used to write C code that is shared among different parametrizations of the same Op class, such as an Op with self.inplace = True
vs False
: https://pytensor.readthedocs.io/en/latest/extending/using_params.html
They are also supposed to be passed to the python perform
method (for those Ops that implement it), which we forgot to do when we implemented Blockwise
. This seems unnecessary, and in fact many Ops just ignore params, and use node properties directly:
pytensor/pytensor/tensor/basic.py
Lines 3998 to 4002 in 9cf2d18
def perform(self, node, inputs, out_, params): | |
(out,) = out_ | |
sh = tuple([int(i) for i in inputs]) | |
if out[0] is None or out[0].shape != sh: | |
out[0] = np.empty(sh, dtype=self.dtype) |
I could only find 3 cases where it was being used, including:
pytensor/pytensor/tensor/blas.py
Lines 920 to 921 in 9cf2d18
if not params.inplace: | |
z = z.copy() # the original z will not be changed |
The complication of the signature doesn't seem justified, for something that is clearly focused on the C backend. There is even a warning in the docs linked above: