I can confirm that’s a bug. Now tracked at: `local_add_neg_to_sub` rewrite gives wrong results with negative constants · Issue #584 · pymc-devs/pytensor · GitHub
It shouldn’t affect the correctness of your code, because PyTensor is correctly rejecting the rewrite suggestion (while also being verbose about having found a bug in the codebase, not in your graph)