code: def test_rebuild_dtype():
      n_steps = int64("n_steps")
      x0 = float64("x0")
      const = float64("const")
      x = x0 + const
      op = ScalarLoop(init=[x0], constant=[const], update=[x])
  
      # If x0 is float32 but const is still float64, the output type will not be able to match
      x0_float32 = float32("x0_float32")
      with pytest.raises(
          TypeError, match="Init and update types must be the same"
      ):
          op(n_steps, x0_float32, const)
  
      # Now it should be fine
      const_float32 = float32("const_float32")
      y = op(n_steps, x0_float32, const_float32)
      assert y.dtype == "float32"
  
imports: import re
  import numpy
  import pytest
  from pytensor import Mode, function
  from pytensor.scalar import Composite, as_scalar, cos, exp, float16, float32, float64, identity, int64, sin
  from pytensor.scalar.loop import ScalarLoop
  from pytensor.tensor import exp
label_desc: Use image node_id 7 for calling a global function with example usage: test_rebuild_dtype() without return types