Remove duplicate implementation of the
solveop inmath. (#22347)
solveis declared in https://github.com/keras-team/keras/blob/master/keras/src/ops/linalg.py#L487-L488 asops.linalg.solve.The backend specific duplicates in
**/math.pyare just dead code because there is no such op in https://github.com/keras-team/keras/blob/master/keras/src/ops/math.py
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Keras 3: Deep Learning for Humans
Keras 3 is a multi-backend deep learning framework, with support for JAX, TensorFlow, PyTorch, and OpenVINO (for inference-only). Effortlessly build and train models for computer vision, natural language processing, audio processing, timeseries forecasting, recommender systems, etc.
Join nearly three million developers, from burgeoning startups to global enterprises, in harnessing the power of Keras 3.
Installation
Install with pip
Keras 3 is available on PyPI as
keras. Note that Keras 2 remains available as thetf-keraspackage.keras:To use
keras, you should also install the backend of choice:tensorflow,jax, ortorch. Additionally, Theopenvinobackend is available with support for model inference only.Local installation
Minimal installation
Keras 3 is compatible with Linux and macOS systems. For Windows users, we recommend using WSL2 to run Keras. To install a local development version:
keras_exportpublic APIs:Backend Compatibility Table
The following table lists the minimum supported versions of each backend for the latest stable release of Keras (v3.x):
Adding GPU support
The
requirements.txtfile will install a CPU-only version of TensorFlow, JAX, and PyTorch. For GPU support, we also provide a separaterequirements-{backend}-cuda.txtfor TensorFlow, JAX, and PyTorch. These install all CUDA dependencies viapipand expect a NVIDIA driver to be pre-installed. We recommend a clean Python environment for each backend to avoid CUDA version mismatches. As an example, here is how to create a JAX GPU environment withconda:Configuring your backend
You can export the environment variable
KERAS_BACKENDor you can edit your local config file at~/.keras/keras.jsonto configure your backend. Available backend options are:"tensorflow","jax","torch","openvino". Example:In Colab, you can do:
Note: The backend must be configured before importing
keras, and the backend cannot be changed after the package has been imported.Note: The OpenVINO backend is an inference-only backend, meaning it is designed only for running model predictions using
model.predict()method.Backwards compatibility
Keras 3 is intended to work as a drop-in replacement for
tf.keras(when using the TensorFlow backend). Just take your existingtf.kerascode, make sure that your calls tomodel.save()are using the up-to-date.kerasformat, and you’re done.If your
tf.kerasmodel does not include custom components, you can start running it on top of JAX or PyTorch immediately.If it does include custom components (e.g. custom layers or a custom
train_step()), it is usually possible to convert it to a backend-agnostic implementation in just a few minutes.In addition, Keras models can consume datasets in any format, regardless of the backend you’re using: you can train your models with your existing
tf.data.Datasetpipelines or PyTorchDataLoaders.Why use Keras 3?
Moduleor as part of a JAX-native model function.Read more in the Keras 3 release announcement.