Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pytensor/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,7 @@ def _is_zero(x):

class ZeroGrad(ViewOp):
def grad(self, args, g_outs):
return [g_out.zeros_like(g_out) for g_out in g_outs]
return [g_out.zeros_like() for g_out in g_outs]

def R_op(self, inputs, eval_points):
if eval_points[0] is None:
Expand Down
18 changes: 9 additions & 9 deletions pytensor/scalar/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3237,7 +3237,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz * exp2(x) * log(np.array(2, dtype=x.type)),)
return (gz * exp2(x) * log(np.array(2, dtype=x.dtype)),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3376,7 +3376,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz * np.array(np.pi / 180, dtype=gz.type),)
return (gz * np.array(np.pi / 180, dtype=gz.dtype),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3411,7 +3411,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz * np.array(180.0 / np.pi, dtype=gz.type),)
return (gz * np.array(180.0 / np.pi, dtype=gz.dtype),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3484,7 +3484,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (-gz / sqrt(np.array(1, dtype=x.type) - sqr(x)),)
return (-gz / sqrt(np.array(1, dtype=x.dtype) - sqr(x)),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3558,7 +3558,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz / sqrt(np.array(1, dtype=x.type) - sqr(x)),)
return (gz / sqrt(np.array(1, dtype=x.dtype) - sqr(x)),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3630,7 +3630,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz / (np.array(1, dtype=x.type) + sqr(x)),)
return (gz / (np.array(1, dtype=x.dtype) + sqr(x)),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3753,7 +3753,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz / sqrt(sqr(x) - np.array(1, dtype=x.type)),)
return (gz / sqrt(sqr(x) - np.array(1, dtype=x.dtype)),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3830,7 +3830,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz / sqrt(sqr(x) + np.array(1, dtype=x.type)),)
return (gz / sqrt(sqr(x) + np.array(1, dtype=x.dtype)),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down Expand Up @@ -3908,7 +3908,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz / (np.array(1, dtype=x.type) - sqr(x)),)
return (gz / (np.array(1, dtype=x.dtype) - sqr(x)),)

def c_code(self, node, name, inputs, outputs, sub):
(x,) = inputs
Expand Down
2 changes: 1 addition & 1 deletion pytensor/sparse/rewriting.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def c_code_cache_version(self):
def local_inplace_addsd_ccode(fgraph, node):
"""Rewrite to insert inplace versions of `AddSD`."""
if isinstance(node.op, sparse.AddSD) and config.cxx:
out_dtype = ps.upcast(*node.inputs)
out_dtype = ps.upcast(*[inp.type.dtype for inp in node.inputs])
if out_dtype != node.inputs[1].dtype:
return
new_node = AddSD_ccode(format=node.inputs[0].type.format, inplace=True)(
Expand Down