keras/src/backend/common/variables.py/AutocastScope/maybe_cast
class AutocastScope:    def maybe_cast(self, value):
        from keras.src import backend

        if self.dtype is not None and is_float_dtype(value.dtype):
            return backend.cast(value, dtype=self.dtype)
        return value