diff --git a/pytensor/scalar/basic.py b/pytensor/scalar/basic.py index e59aaf3d2f..3204439fdc 100644 --- a/pytensor/scalar/basic.py +++ b/pytensor/scalar/basic.py @@ -1145,7 +1145,7 @@ def _cast_scalar(x, dtype): if hasattr(x, "astype"): return x.astype(dtype) else: - return x + return getattr(np, dtype)(x) def perform(self, node, inputs, output_storage): if self.nout == 1: