CINXE.COM

Keras 3 API documentation

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="Keras documentation"> <meta name="author" content="Keras Team"> <link rel="shortcut icon" href="https://keras.io/img/favicon.ico"> <link rel="canonical" href="https://keras.io/api/" /> <!-- Social --> <meta property="og:title" content="Keras documentation: Keras 3 API documentation"> <meta property="og:image" content="https://keras.io/img/logo-k-keras-wb.png"> <meta name="twitter:title" content="Keras documentation: Keras 3 API documentation"> <meta name="twitter:image" content="https://keras.io/img/k-keras-social.png"> <meta name="twitter:card" content="summary"> <title>Keras 3 API documentation</title> <!-- Bootstrap core CSS --> <link href="/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom fonts for this template --> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700;800&display=swap" rel="stylesheet"> <!-- Custom styles for this template --> <link href="/css/docs.css" rel="stylesheet"> <link href="/css/monokai.css" rel="stylesheet"> <!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-5DNGF4N'); </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-175165319-128', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Tag Manager --> <script async defer src="https://buttons.github.io/buttons.js"></script> </head> <body> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5DNGF4N" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <div class='k-page'> <div class="k-nav" id="nav-menu"> <a href='/'><img src='/img/logo-small.png' class='logo-small' /></a> <div class="nav flex-column nav-pills" role="tablist" aria-orientation="vertical"> <a class="nav-link" href="/about/" role="tab" aria-selected="">About Keras</a> <a class="nav-link" href="/getting_started/" role="tab" aria-selected="">Getting started</a> <a class="nav-link" href="/guides/" role="tab" aria-selected="">Developer guides</a> <a class="nav-link" href="/examples/" role="tab" aria-selected="">Code examples</a> <a class="nav-link active" href="/api/" role="tab" aria-selected="">Keras 3 API documentation</a> <a class="nav-sublink" href="/api/models/">Models API</a> <a class="nav-sublink" href="/api/layers/">Layers API</a> <a class="nav-sublink" href="/api/callbacks/">Callbacks API</a> <a class="nav-sublink" href="/api/ops/">Ops API</a> <a class="nav-sublink" href="/api/optimizers/">Optimizers</a> <a class="nav-sublink" href="/api/metrics/">Metrics</a> <a class="nav-sublink" href="/api/losses/">Losses</a> <a class="nav-sublink" href="/api/data_loading/">Data loading</a> <a class="nav-sublink" href="/api/datasets/">Built-in small datasets</a> <a class="nav-sublink" href="/api/applications/">Keras Applications</a> <a class="nav-sublink" href="/api/mixed_precision/">Mixed precision</a> <a class="nav-sublink" href="/api/distribution/">Multi-device distribution</a> <a class="nav-sublink" href="/api/random/">RNG API</a> <a class="nav-sublink" href="/api/utils/">Utilities</a> <a class="nav-link" href="/2.18/api/" role="tab" aria-selected="">Keras 2 API documentation</a> <a class="nav-link" href="/keras_tuner/" role="tab" aria-selected="">KerasTuner: Hyperparam Tuning</a> <a class="nav-link" href="/keras_hub/" role="tab" aria-selected="">KerasHub: Pretrained Models</a> </div> </div> <div class='k-main'> <div class='k-main-top'> <script> function displayDropdownMenu() { e = document.getElementById("nav-menu"); if (e.style.display == "block") { e.style.display = "none"; } else { e.style.display = "block"; document.getElementById("dropdown-nav").style.display = "block"; } } function resetMobileUI() { if (window.innerWidth <= 840) { document.getElementById("nav-menu").style.display = "none"; document.getElementById("dropdown-nav").style.display = "block"; } else { document.getElementById("nav-menu").style.display = "block"; document.getElementById("dropdown-nav").style.display = "none"; } var navmenu = document.getElementById("nav-menu"); var menuheight = navmenu.clientHeight; var kmain = document.getElementById("k-main-id"); kmain.style.minHeight = (menuheight + 100) + 'px'; } window.onresize = resetMobileUI; window.addEventListener("load", (event) => { resetMobileUI() }); </script> <div id='dropdown-nav' onclick="displayDropdownMenu();"> <svg viewBox="-20 -20 120 120" width="60" height="60"> <rect width="100" height="20"></rect> <rect y="30" width="100" height="20"></rect> <rect y="60" width="100" height="20"></rect> </svg> </div> <form class="bd-search d-flex align-items-center k-search-form" id="search-form"> <input type="search" class="k-search-input" id="search-input" placeholder="Search Keras documentation..." aria-label="Search Keras documentation..." autocomplete="off"> <button class="k-search-btn"> <svg width="13" height="13" viewBox="0 0 13 13"><title>search</title><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"></path></svg> </button> </form> <script> var form = document.getElementById('search-form'); form.onsubmit = function(e) { e.preventDefault(); var query = document.getElementById('search-input').value; window.location.href = '/search.html?query=' + query; return False } </script> </div> <div class='k-main-inner' id='k-main-id'> <div class='k-location-slug'> <span class="k-location-slug-pointer">►</span> Keras 3 API documentation </div> <div class='k-content'> <h1 id="keras-3-api-documentation">Keras 3 API documentation</h1> <h3 id="models-api"><a href="/api/models/">Models API</a></h3> <ul> <li><a href="/api/models/model">The Model class</a></li> <li><a href="/api/models/sequential">The Sequential class</a></li> <li><a href="/api/models/model_training_apis">Model training APIs</a></li> <li><a href="/api/models/model_saving_apis/">Saving &amp; serialization</a></li> </ul> <h3 id="layers-api"><a href="/api/layers/">Layers API</a></h3> <ul> <li><a href="/api/layers/base_layer">The base Layer class</a></li> <li><a href="/api/layers/activations">Layer activations</a></li> <li><a href="/api/layers/initializers">Layer weight initializers</a></li> <li><a href="/api/layers/regularizers">Layer weight regularizers</a></li> <li><a href="/api/layers/constraints">Layer weight constraints</a></li> <li><a href="/api/layers/core_layers/">Core layers</a></li> <li><a href="/api/layers/convolution_layers/">Convolution layers</a></li> <li><a href="/api/layers/pooling_layers/">Pooling layers</a></li> <li><a href="/api/layers/recurrent_layers/">Recurrent layers</a></li> <li><a href="/api/layers/preprocessing_layers/">Preprocessing layers</a></li> <li><a href="/api/layers/normalization_layers/">Normalization layers</a></li> <li><a href="/api/layers/regularization_layers/">Regularization layers</a></li> <li><a href="/api/layers/attention_layers/">Attention layers</a></li> <li><a href="/api/layers/reshaping_layers/">Reshaping layers</a></li> <li><a href="/api/layers/merging_layers/">Merging layers</a></li> <li><a href="/api/layers/activation_layers/">Activation layers</a></li> <li><a href="/api/layers/backend_specific_layers/">Backend-specific layers</a></li> </ul> <h3 id="callbacks-api"><a href="/api/callbacks/">Callbacks API</a></h3> <ul> <li><a href="/api/callbacks/base_callback">Base Callback class</a></li> <li><a href="/api/callbacks/model_checkpoint">ModelCheckpoint</a></li> <li><a href="/api/callbacks/backup_and_restore">BackupAndRestore</a></li> <li><a href="/api/callbacks/tensorboard">TensorBoard</a></li> <li><a href="/api/callbacks/early_stopping">EarlyStopping</a></li> <li><a href="/api/callbacks/learning_rate_scheduler">LearningRateScheduler</a></li> <li><a href="/api/callbacks/reduce_lr_on_plateau">ReduceLROnPlateau</a></li> <li><a href="/api/callbacks/remote_monitor">RemoteMonitor</a></li> <li><a href="/api/callbacks/lambda_callback">LambdaCallback</a></li> <li><a href="/api/callbacks/terminate_on_nan">TerminateOnNaN</a></li> <li><a href="/api/callbacks/csv_logger">CSVLogger</a></li> <li><a href="/api/callbacks/progbar_logger">ProgbarLogger</a></li> <li><a href="/api/callbacks/swap_ema_weights">SwapEMAWeights</a></li> </ul> <h3 id="ops-api"><a href="/api/ops/">Ops API</a></h3> <ul> <li><a href="/api/ops/numpy/">NumPy ops</a></li> <li><a href="/api/ops/nn/">NN ops</a></li> <li><a href="/api/ops/linalg/">Linear algebra ops</a></li> <li><a href="/api/ops/core/">Core ops</a></li> <li><a href="/api/ops/image/">Image ops</a></li> <li><a href="/api/ops/fft/">FFT ops</a></li> </ul> <h3 id="optimizers"><a href="/api/optimizers/">Optimizers</a></h3> <ul> <li><a href="/api/optimizers/sgd">SGD</a></li> <li><a href="/api/optimizers/rmsprop">RMSprop</a></li> <li><a href="/api/optimizers/adam">Adam</a></li> <li><a href="/api/optimizers/adamw">AdamW</a></li> <li><a href="/api/optimizers/adadelta">Adadelta</a></li> <li><a href="/api/optimizers/adagrad">Adagrad</a></li> <li><a href="/api/optimizers/adamax">Adamax</a></li> <li><a href="/api/optimizers/adafactor">Adafactor</a></li> <li><a href="/api/optimizers/Nadam">Nadam</a></li> <li><a href="/api/optimizers/ftrl">Ftrl</a></li> <li><a href="/api/optimizers/lion">Lion</a></li> <li><a href="/api/optimizers/lamb">Lamb</a></li> <li><a href="/api/optimizers/loss_scale_optimizer">Loss Scale Optimizer</a></li> </ul> <h3 id="metrics"><a href="/api/metrics/">Metrics</a></h3> <ul> <li><a href="/api/metrics/base_metric">Base Metric class</a></li> <li><a href="/api/metrics/accuracy_metrics">Accuracy metrics</a></li> <li><a href="/api/metrics/probabilistic_metrics">Probabilistic metrics</a></li> <li><a href="/api/metrics/regression_metrics">Regression metrics</a></li> <li><a href="/api/metrics/classification_metrics">Classification metrics based on True/False positives &amp; negatives</a></li> <li><a href="/api/metrics/segmentation_metrics">Image segmentation metrics</a></li> <li><a href="/api/metrics/hinge_metrics">Hinge metrics for "maximum-margin" classification</a></li> <li><a href="/api/metrics/metrics_wrappers">Metric wrappers and reduction metrics</a></li> </ul> <h3 id="losses"><a href="/api/losses/">Losses</a></h3> <ul> <li><a href="/api/losses/probabilistic_losses">Probabilistic losses</a></li> <li><a href="/api/losses/regression_losses">Regression losses</a></li> <li><a href="/api/losses/hinge_losses">Hinge losses for "maximum-margin" classification</a></li> </ul> <h3 id="data-loading"><a href="/api/data_loading/">Data loading</a></h3> <ul> <li><a href="/api/data_loading/image">Image data loading</a></li> <li><a href="/api/data_loading/timeseries">Timeseries data loading</a></li> <li><a href="/api/data_loading/text">Text data loading</a></li> <li><a href="/api/data_loading/audio">Audio data loading</a></li> </ul> <h3 id="builtin-small-datasets"><a href="/api/datasets/">Built-in small datasets</a></h3> <ul> <li><a href="/api/datasets/mnist">MNIST digits classification dataset</a></li> <li><a href="/api/datasets/cifar10">CIFAR10 small images classification dataset</a></li> <li><a href="/api/datasets/cifar100">CIFAR100 small images classification dataset</a></li> <li><a href="/api/datasets/imdb">IMDB movie review sentiment classification dataset</a></li> <li><a href="/api/datasets/reuters">Reuters newswire classification dataset</a></li> <li><a href="/api/datasets/fashion_mnist">Fashion MNIST dataset, an alternative to MNIST</a></li> <li><a href="/api/datasets/california_housing">California Housing price regression dataset</a></li> </ul> <h3 id="keras-applications"><a href="/api/applications/">Keras Applications</a></h3> <ul> <li><a href="/api/applications/xception">Xception</a></li> <li><a href="/api/applications/efficientnet">EfficientNet B0 to B7</a></li> <li><a href="/api/applications/efficientnet_v2">EfficientNetV2 B0 to B3 and S, M, L</a></li> <li><a href="/api/applications/convnext">ConvNeXt Tiny, Small, Base, Large, XLarge</a></li> <li><a href="/api/applications/vgg">VGG16 and VGG19</a></li> <li><a href="/api/applications/resnet">ResNet and ResNetV2</a></li> <li><a href="/api/applications/mobilenet">MobileNet, MobileNetV2, and MobileNetV3</a></li> <li><a href="/api/applications/densenet">DenseNet</a></li> <li><a href="/api/applications/nasnet">NasNetLarge and NasNetMobile</a></li> <li><a href="/api/applications/inceptionv3">InceptionV3</a></li> <li><a href="/api/applications/inceptionresnetv2">InceptionResNetV2</a></li> </ul> <h3 id="mixed-precision"><a href="/api/mixed_precision/">Mixed precision</a></h3> <ul> <li><a href="/api/mixed_precision/policy">Mixed precision policy API</a></li> </ul> <h3 id="multidevice-distribution"><a href="/api/distribution/">Multi-device distribution</a></h3> <ul> <li><a href="/api/distribution/layout_map">LayoutMap API</a></li> <li><a href="/api/distribution/data_parallel">DataParallel API</a></li> <li><a href="/api/distribution/model_parallel">ModelParallel API</a></li> <li><a href="/api/distribution/model_parallel">ModelParallel API</a></li> <li><a href="/api/distribution/distribution_utils">Distribution utilities</a></li> </ul> <h3 id="rng-api"><a href="/api/random/">RNG API</a></h3> <ul> <li><a href="/api/random/seed_generator">SeedGenerator class</a></li> <li><a href="/api/random/random_ops">Random operations</a></li> </ul> <h3 id="utilities"><a href="/api/utils/">Utilities</a></h3> <ul> <li><a href="/api/utils/experiment_management_utils">Experiment management utilities</a></li> <li><a href="/api/utils/model_plotting_utils">Model plotting utilities</a></li> <li><a href="/api/utils/feature_space">Structured data preprocessing utilities</a></li> <li><a href="/api/utils/tensor_utils">Tensor utilities</a></li> <li><a href="/api/utils/python_utils">Python &amp; NumPy utilities</a></li> <li><a href="/api/utils/config_utils">Keras configuration utilities</a></li> </ul> </div> <div class='k-outline'> <div class='k-outline-depth-1'> <a href='#keras-3-api-documentation'>Keras 3 API documentation</a> </div> <div class='k-outline-depth-3'> <a href='#models-api'>Models API</a> </div> <div class='k-outline-depth-3'> <a href='#layers-api'>Layers API</a> </div> <div class='k-outline-depth-3'> <a href='#callbacks-api'>Callbacks API</a> </div> <div class='k-outline-depth-3'> <a href='#ops-api'>Ops API</a> </div> <div class='k-outline-depth-3'> <a href='#optimizers'>Optimizers</a> </div> <div class='k-outline-depth-3'> <a href='#metrics'>Metrics</a> </div> <div class='k-outline-depth-3'> <a href='#losses'>Losses</a> </div> <div class='k-outline-depth-3'> <a href='#data-loading'>Data loading</a> </div> <div class='k-outline-depth-3'> <a href='#builtin-small-datasets'>Built-in small datasets</a> </div> <div class='k-outline-depth-3'> <a href='#keras-applications'>Keras Applications</a> </div> <div class='k-outline-depth-3'> <a href='#mixed-precision'>Mixed precision</a> </div> <div class='k-outline-depth-3'> <a href='#multidevice-distribution'>Multi-device distribution</a> </div> <div class='k-outline-depth-3'> <a href='#rng-api'>RNG API</a> </div> <div class='k-outline-depth-3'> <a href='#utilities'>Utilities</a> </div> </div> </div> </div> </div> </body> <footer style="float: left; width: 100%; padding: 1em; border-top: solid 1px #bbb;"> <a href="https://policies.google.com/terms">Terms</a> | <a href="https://policies.google.com/privacy">Privacy</a> </footer> </html>

Pages: 1 2 3 4 5 6 7 8 9 10