import os import re os.environ["KERAS_BACKEND"] = "tensorflow" os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" import keras import numpy as np import tensorflow as tf class StringRoundTripModel(keras.Model): def call(self, inputs): text = tf.strings.as_string(inputs) return tf.strings.to_number(text) def summarize_error(error): message = str(error) if "AsString" in message and "XLA_CPU_JIT" in message: return f"{type(error).__name__}: unsupported operation on XLA_CPU_JIT (AsString)" detail = "XLA compile failure detected" for line in message.splitlines(): if "Detected unsupported operations" in line: detail = re.sub(r"__inference_[A-Za-z0-9_]+", "__inference_model_call", line.strip()) break return f"{type(error).__name__}: {detail}" x_predict = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], dtype="float32")