翻篇收录说明
翻篇网页快照

Keras: The multi-backend deep learning library

https://keras.io/

最近抓取:2026-12-02 15:46:56(北京时间)

最近内容变化:2026-11-30 04:16:54(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Keras is a deep learning library with pluggable backends. Write models once and run them on JAX, PyTorch, TensorFlow, and more, from laptop to TPU.

正文摘录

NEW: GEMMA 4 NOW IN KERASHUB A superpower for ML developers Keras 3 is the high-level API for building, training, and shipping models on the backend of your choice: JAX, PyTorch, MLX, and more. GET STARTED TRY GEMMA IN KERASHUB API DOCS Copied inputs = keras.Input(shape=(32, 32, 3)) x = layers.Conv2D(32, 3, activation="relu")(inputs) x = layers.Conv2D(64, 3, activation="relu")(x) residual = x = layers.MaxPooling2D(3)(x) x = layers.Conv2D(64, 3, padding="same")(x) x = layers.Activation("relu")(x) x = layers.Conv2D(64, 3, padding="same")(x) x = layers.Activation("relu")(x) x = x + residual x = layers.Conv2D(64, 3, activation="relu")(x) x = layers.GlobalAveragePooling2D()(x) outputs = layers.Dense(10, activation="softmax")(x) model = keras.Model(inputs, outputs, name="mini_resnet") keras.utils.plot_model(model, "mini_resnet.png") model.fit(dataset, epochs=10) Run quickstart Copied causal_lm = keras_hub.models.CausalLM.from_preset( "gemma4_instruct_2b", dtype="bfloat16", ) prompt = """<|turn>user Write python code to print the first 100 primes.<turn|> <|turn>model """ text_output = causal_lm.generate(prompt, max_length=512) text_to_image = keras_hub.models.TextToImage.from_preset( "stable_diffusion_3_medium", dtype="float16", ) prompt = "Astronaut in a jungle, detailed" image_output = text_to_image.generate(prompt) Run quickstart Welcome to multi-framework machine learning With its multi-backend approach, Keras gives you the freedom to work with JAX, TensorFlow, and PyTorch. Build models that can move seamlessly across these frameworks and leverage the strengths of each ecosystem. GET STARTED Developer Guides VIEW ALL Copied inputs = keras.Input(shape=(28, 28, 1)) x = inputs x = layers.Conv2D(16, 3, activation="relu")(x) x = layers.Conv2D(32, 3, activation="relu")(x) x = layers.MaxPooling2D(3)(x) x = layers.Conv2D(32, 3, activation="relu")(x) x = layers.Conv2D(16, 3, activation="relu")(x) x = layers.GlobalMaxPooling2D()(x) x = layers.Dropout(0.5)(x) outputs = layers.Dense(10)(x) model = keras.Model(inputs, outputs) model.summary() The Functional API Starting from the beginning and learn how to build models using the functional building pattern. VIEW GUIDE Copied model.compile( optimizer="rmsprop", loss="categorical_crossentropy", metrics=["accuracy"], ) history = model.fit( x_train, y_train, batch_size=64, epochs=2, validation_data=(x_val, y_val), ) Training & evaluation with the built-in methods Train and evaluate your model using model.fit(...). VIEW GUIDE Copied class MLPBlock(keras.layers.Layer): def __init__(self): super().__init__() self.dense_1 = layers.Dense(32) self.dense_2 = layers.Dense(32) self.dense_3 = layers.Dense(1) def call(self, inputs): x = self.dense_1(inputs) x = keras.activations.relu(x) x = self.dense_2(x) x = keras.activations.relu(x) return self.dense_3(x) Making new layers and models via subclassing Learn how to customize your model via subclassing Keras layers. VIEW GUIDE VIEW ALL KerasHub The KerasHub library provides Keras 3 implementations of popular model architectures, paired with a collection of pretrained checkpoints available on Kaggle Models. Models can be used for both training and inference, on any of the TensorFlow, JAX, and PyTorch backends. SEE ALL GEMMA 4 Google’s family of open multimodal and agentic models built from the same research and technology used to create Gemini. VIEW DOCUMENTATION KAGGLE DETAILS QWEN 3.8 Alibaba’s flagship open-weight multimodal and reasoning models, excelling at coding, math, and agentic workflows. VIEW DOCUMENTATION KAGGLE DETAILS GPT-OSS OpenAI’s open-weight Mixture-of-Experts reasoning models built for high-efficiency text generation across 128k context. VIEW DOCUMENTATION KAGGLE DETAILS MISTRAL Open-weight generative language models from the French company Mistral AI, making frontier models accessible to all. VIEW DOCUMENTATION KAGGLE DETAILS SEE ALL Code examples VIEW ALL Computer vision Take a look at our examples for doing image classification, object detection, video processing, and more. SEE EXAMPLE Natural Language Processing We also have many guides for doing NLP including text classification, machine translation, and language modeling. SEE EXAMPLE Generative Deep Learning Get started with generative deep learning with our wealth of guides involving state-of-the-art diffusion models, GANs, and transformer models. SEE EXAMPLE VIEW ALL Trusted for research and production Keras is used by CERN, NASA, NIH, and many more scientific organizations around the world (and yes, Keras is used at the Large Hadron Collider). Keras is used by Waymo to power self-driving vehicles. Keras partners with Kaggle and HuggingFace to meet ML developers in the tools they use daily. Stay in touch Sign up to our mailing list for regular updates and discussions about the Keras ecosystem. Listen in at our community meetings, and follow us on social media! JOIN GOOGLE GROUP JOIN COMMUNITY MEETING DISCORD GOOGLE AI FORUM Contributions welcome! We welcome your code, ideas, and feedback as we continue to grow. Visit our roadmap, contribution guide or GitHub for more information. VIEW ROADMAP CONTRIBUTION GUIDE GITHUB