CINXE.COM

Keras layers API

<!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/layers/" /> <!-- Social --> <meta property="og:title" content="Keras documentation: Keras layers API"> <meta property="og:image" content="https://keras.io/img/logo-k-keras-wb.png"> <meta name="twitter:title" content="Keras documentation: Keras layers API"> <meta name="twitter:image" content="https://keras.io/img/k-keras-social.png"> <meta name="twitter:card" content="summary"> <title>Keras layers API</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 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 active" href="/api/layers/">Layers API</a> <a class="nav-sublink2" href="/api/layers/base_layer/">The base Layer class</a> <a class="nav-sublink2" href="/api/layers/activations/">Layer activations</a> <a class="nav-sublink2" href="/api/layers/initializers/">Layer weight initializers</a> <a class="nav-sublink2" href="/api/layers/regularizers/">Layer weight regularizers</a> <a class="nav-sublink2" href="/api/layers/constraints/">Layer weight constraints</a> <a class="nav-sublink2" href="/api/layers/core_layers/">Core layers</a> <a class="nav-sublink2" href="/api/layers/convolution_layers/">Convolution layers</a> <a class="nav-sublink2" href="/api/layers/pooling_layers/">Pooling layers</a> <a class="nav-sublink2" href="/api/layers/recurrent_layers/">Recurrent layers</a> <a class="nav-sublink2" href="/api/layers/preprocessing_layers/">Preprocessing layers</a> <a class="nav-sublink2" href="/api/layers/normalization_layers/">Normalization layers</a> <a class="nav-sublink2" href="/api/layers/regularization_layers/">Regularization layers</a> <a class="nav-sublink2" href="/api/layers/attention_layers/">Attention layers</a> <a class="nav-sublink2" href="/api/layers/reshaping_layers/">Reshaping layers</a> <a class="nav-sublink2" href="/api/layers/merging_layers/">Merging layers</a> <a class="nav-sublink2" href="/api/layers/activation_layers/">Activation layers</a> <a class="nav-sublink2" href="/api/layers/backend_specific_layers/">Backend-specific layers</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-sublink" href="/api/keras_tuner/">KerasTuner</a> <a class="nav-sublink" href="/api/keras_cv/">KerasCV</a> <a class="nav-sublink" href="/api/keras_nlp/">KerasNLP</a> <a class="nav-sublink" href="/api/keras_hub/">KerasHub</a> <a class="nav-link" href="/2.18/api/" role="tab" aria-selected="">Keras 2 API documentation</a> <a class="nav-link" href="/examples/" role="tab" aria-selected="">Code examples</a> <a class="nav-link" href="/keras_tuner/" role="tab" aria-selected="">KerasTuner: Hyperparameter Tuning</a> <a class="nav-link" href="/keras_hub/" role="tab" aria-selected="">KerasHub: Pretrained Models</a> <a class="nav-link" href="/keras_cv/" role="tab" aria-selected="">KerasCV: Computer Vision Workflows</a> <a class="nav-link" href="/keras_nlp/" role="tab" aria-selected="">KerasNLP: Natural Language Workflows</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> <a href='/api/'>Keras 3 API documentation</a> / Keras layers API </div> <div class='k-content'> <h1 id="keras-layers-api">Keras layers API</h1> <p>Layers are the basic building blocks of neural networks in Keras. A layer consists of a tensor-in tensor-out computation function (the layer's <code>call</code> method) and some state, held in TensorFlow variables (the layer's <em>weights</em>).</p> <p>A Layer instance is callable, much like a function:</p> <div class="codehilite"><pre><span></span><code><span class="kn">import</span> <span class="nn">keras</span> <span class="kn">from</span> <span class="nn">keras</span> <span class="kn">import</span> <span class="n">layers</span> <span class="n">layer</span> <span class="o">=</span> <span class="n">layers</span><span class="o">.</span><span class="n">Dense</span><span class="p">(</span><span class="mi">32</span><span class="p">,</span> <span class="n">activation</span><span class="o">=</span><span class="s1">&#39;relu&#39;</span><span class="p">)</span> <span class="n">inputs</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span> <span class="n">outputs</span> <span class="o">=</span> <span class="n">layer</span><span class="p">(</span><span class="n">inputs</span><span class="p">)</span> </code></pre></div> <p>Unlike a function, though, layers maintain a state, updated when the layer receives data during training, and stored in <code>layer.weights</code>:</p> <div class="codehilite"><pre><span></span><code><span class="o">&gt;&gt;&gt;</span> <span class="n">layer</span><span class="o">.</span><span class="n">weights</span> <span class="p">[</span><span class="o">&lt;</span><span class="n">KerasVariable</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">32</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="n">dense</span><span class="o">/</span><span class="n">kernel</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">KerasVariable</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">32</span><span class="p">,),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">float32</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="n">dense</span><span class="o">/</span><span class="n">bias</span><span class="o">&gt;</span><span class="p">]</span> </code></pre></div> <hr /> <h2 id="creating-custom-layers">Creating custom layers</h2> <p>While Keras offers a wide range of built-in layers, they don't cover ever possible use case. Creating custom layers is very common, and very easy.</p> <p>See the guide <a href="/guides/making_new_layers_and_models_via_subclassing">Making new layers and models via subclassing</a> for an extensive overview, and refer to the documentation for <a href="base_layer">the base <code>Layer</code> class</a>.</p> <hr /> <h2 id="layers-api-overview">Layers API overview</h2> <h3 id="the-base-layer-class"><a href="/api/layers/base_layer/">The base Layer class</a></h3> <ul> <li><a href="/api/layers/base_layer/#layer-class">Layer class</a></li> <li><a href="/api/layers/base_layer/#weights-property">weights property</a></li> <li><a href="/api/layers/base_layer/#trainable_weights-property">trainable_weights property</a></li> <li><a href="/api/layers/base_layer/#non_trainable_weights-property">non_trainable_weights property</a></li> <li><a href="/api/layers/base_layer/#add_weight-method">add_weight method</a></li> <li><a href="/api/layers/base_layer/#trainable-property">trainable property</a></li> <li><a href="/api/layers/base_layer/#get_weights-method">get_weights method</a></li> <li><a href="/api/layers/base_layer/#set_weights-method">set_weights method</a></li> <li><a href="/api/layers/base_layer/#get_config-method">get_config method</a></li> <li><a href="/api/layers/base_layer/#add_loss-method">add_loss method</a></li> <li><a href="/api/layers/base_layer/#losses-property">losses property</a></li> </ul> <h3 id="layer-activations"><a href="/api/layers/activations/">Layer activations</a></h3> <ul> <li><a href="/api/layers/activations/#relu-function">relu function</a></li> <li><a href="/api/layers/activations/#sigmoid-function">sigmoid function</a></li> <li><a href="/api/layers/activations/#softmax-function">softmax function</a></li> <li><a href="/api/layers/activations/#softplus-function">softplus function</a></li> <li><a href="/api/layers/activations/#softsign-function">softsign function</a></li> <li><a href="/api/layers/activations/#tanh-function">tanh function</a></li> <li><a href="/api/layers/activations/#selu-function">selu function</a></li> <li><a href="/api/layers/activations/#elu-function">elu function</a></li> <li><a href="/api/layers/activations/#exponential-function">exponential function</a></li> <li><a href="/api/layers/activations/#leaky_relu-function">leaky_relu function</a></li> <li><a href="/api/layers/activations/#relu6-function">relu6 function</a></li> <li><a href="/api/layers/activations/#silu-function">silu function</a></li> <li><a href="/api/layers/activations/#hard_silu-function">hard_silu function</a></li> <li><a href="/api/layers/activations/#gelu-function">gelu function</a></li> <li><a href="/api/layers/activations/#hard_sigmoid-function">hard_sigmoid function</a></li> <li><a href="/api/layers/activations/#linear-function">linear function</a></li> <li><a href="/api/layers/activations/#mish-function">mish function</a></li> <li><a href="/api/layers/activations/#log_softmax-function">log_softmax function</a></li> </ul> <h3 id="layer-weight-initializers"><a href="/api/layers/initializers/">Layer weight initializers</a></h3> <ul> <li><a href="/api/layers/initializers/#randomnormal-class">RandomNormal class</a></li> <li><a href="/api/layers/initializers/#randomuniform-class">RandomUniform class</a></li> <li><a href="/api/layers/initializers/#truncatednormal-class">TruncatedNormal class</a></li> <li><a href="/api/layers/initializers/#zeros-class">Zeros class</a></li> <li><a href="/api/layers/initializers/#ones-class">Ones class</a></li> <li><a href="/api/layers/initializers/#glorotnormal-class">GlorotNormal class</a></li> <li><a href="/api/layers/initializers/#glorotuniform-class">GlorotUniform class</a></li> <li><a href="/api/layers/initializers/#henormal-class">HeNormal class</a></li> <li><a href="/api/layers/initializers/#heuniform-class">HeUniform class</a></li> <li><a href="/api/layers/initializers/#orthogonalinitializer-class">Orthogonal class</a></li> <li><a href="/api/layers/initializers/#constant-class">Constant class</a></li> <li><a href="/api/layers/initializers/#variancescaling-class">VarianceScaling class</a></li> <li><a href="/api/layers/initializers/#lecunnormal-class">LecunNormal class</a></li> <li><a href="/api/layers/initializers/#lecununiform-class">LecunUniform class</a></li> <li><a href="/api/layers/initializers/#identity-class">IdentityInitializer class</a></li> </ul> <h3 id="layer-weight-regularizers"><a href="/api/layers/regularizers/">Layer weight regularizers</a></h3> <ul> <li><a href="/api/layers/regularizers/#regularizer-class">Regularizer class</a></li> <li><a href="/api/layers/regularizers/#l1-class">L1 class</a></li> <li><a href="/api/layers/regularizers/#l2-class">L2 class</a></li> <li><a href="/api/layers/regularizers/#l1l2-class">L1L2 class</a></li> <li><a href="/api/layers/regularizers/#orthogonalregularizer-class">OrthogonalRegularizer class</a></li> </ul> <h3 id="layer-weight-constraints"><a href="/api/layers/constraints/">Layer weight constraints</a></h3> <ul> <li><a href="/api/layers/constraints/#constraint-class">Constraint class</a></li> <li><a href="/api/layers/constraints/#maxnorm-class">MaxNorm class</a></li> <li><a href="/api/layers/constraints/#minmaxnorm-class">MinMaxNorm class</a></li> <li><a href="/api/layers/constraints/#nonneg-class">NonNeg class</a></li> <li><a href="/api/layers/constraints/#unitnorm-class">UnitNorm class</a></li> </ul> <h3 id="core-layers"><a href="/api/layers/core_layers/">Core layers</a></h3> <ul> <li><a href="/api/layers/core_layers/input">Input object</a></li> <li><a href="/api/layers/core_layers/input_spec">InputSpec object</a></li> <li><a href="/api/layers/core_layers/dense">Dense layer</a></li> <li><a href="/api/layers/core_layers/einsum_dense">EinsumDense layer</a></li> <li><a href="/api/layers/core_layers/activation">Activation layer</a></li> <li><a href="/api/layers/core_layers/embedding">Embedding layer</a></li> <li><a href="/api/layers/core_layers/masking">Masking layer</a></li> <li><a href="/api/layers/core_layers/lambda">Lambda layer</a></li> <li><a href="/api/layers/core_layers/identity">Identity layer</a></li> </ul> <h3 id="convolution-layers"><a href="/api/layers/convolution_layers/">Convolution layers</a></h3> <ul> <li><a href="/api/layers/convolution_layers/convolution1d">Conv1D layer</a></li> <li><a href="/api/layers/convolution_layers/convolution2d">Conv2D layer</a></li> <li><a href="/api/layers/convolution_layers/convolution3d">Conv3D layer</a></li> <li><a href="/api/layers/convolution_layers/separable_convolution1d">SeparableConv1D layer</a></li> <li><a href="/api/layers/convolution_layers/separable_convolution2d">SeparableConv2D layer</a></li> <li><a href="/api/layers/convolution_layers/depthwise_convolution1d">DepthwiseConv1D layer</a></li> <li><a href="/api/layers/convolution_layers/depthwise_convolution2d">DepthwiseConv2D layer</a></li> <li><a href="/api/layers/convolution_layers/convolution1d_transpose">Conv1DTranspose layer</a></li> <li><a href="/api/layers/convolution_layers/convolution2d_transpose">Conv2DTranspose layer</a></li> <li><a href="/api/layers/convolution_layers/convolution3d_transpose">Conv3DTranspose layer</a></li> </ul> <h3 id="pooling-layers"><a href="/api/layers/pooling_layers/">Pooling layers</a></h3> <ul> <li><a href="/api/layers/pooling_layers/max_pooling1d">MaxPooling1D layer</a></li> <li><a href="/api/layers/pooling_layers/max_pooling2d">MaxPooling2D layer</a></li> <li><a href="/api/layers/pooling_layers/max_pooling3d">MaxPooling3D layer</a></li> <li><a href="/api/layers/pooling_layers/average_pooling1d">AveragePooling1D layer</a></li> <li><a href="/api/layers/pooling_layers/average_pooling2d">AveragePooling2D layer</a></li> <li><a href="/api/layers/pooling_layers/average_pooling3d">AveragePooling3D layer</a></li> <li><a href="/api/layers/pooling_layers/global_max_pooling1d">GlobalMaxPooling1D layer</a></li> <li><a href="/api/layers/pooling_layers/global_max_pooling2d">GlobalMaxPooling2D layer</a></li> <li><a href="/api/layers/pooling_layers/global_max_pooling3d">GlobalMaxPooling3D layer</a></li> <li><a href="/api/layers/pooling_layers/global_average_pooling1d">GlobalAveragePooling1D layer</a></li> <li><a href="/api/layers/pooling_layers/global_average_pooling2d">GlobalAveragePooling2D layer</a></li> <li><a href="/api/layers/pooling_layers/global_average_pooling3d">GlobalAveragePooling3D layer</a></li> </ul> <h3 id="recurrent-layers"><a href="/api/layers/recurrent_layers/">Recurrent layers</a></h3> <ul> <li><a href="/api/layers/recurrent_layers/lstm">LSTM layer</a></li> <li><a href="/api/layers/recurrent_layers/lstm_cell">LSTM cell layer</a></li> <li><a href="/api/layers/recurrent_layers/gru">GRU layer</a></li> <li><a href="/api/layers/recurrent_layers/gru_cell">GRU Cell layer</a></li> <li><a href="/api/layers/recurrent_layers/simple_rnn">SimpleRNN layer</a></li> <li><a href="/api/layers/recurrent_layers/time_distributed">TimeDistributed layer</a></li> <li><a href="/api/layers/recurrent_layers/bidirectional">Bidirectional layer</a></li> <li><a href="/api/layers/recurrent_layers/conv_lstm1d">ConvLSTM1D layer</a></li> <li><a href="/api/layers/recurrent_layers/conv_lstm2d">ConvLSTM2D layer</a></li> <li><a href="/api/layers/recurrent_layers/conv_lstm3d">ConvLSTM3D layer</a></li> <li><a href="/api/layers/recurrent_layers/rnn">Base RNN layer</a></li> <li><a href="/api/layers/recurrent_layers/simple_rnn_cell">Simple RNN cell layer</a></li> <li><a href="/api/layers/recurrent_layers/stacked_rnn_cell">Stacked RNN cell layer</a></li> </ul> <h3 id="preprocessing-layers"><a href="/api/layers/preprocessing_layers/">Preprocessing layers</a></h3> <ul> <li><a href="/api/layers/preprocessing_layers/text/">Text preprocessing</a></li> <li><a href="/api/layers/preprocessing_layers/numerical/">Numerical features preprocessing layers</a></li> <li><a href="/api/layers/preprocessing_layers/categorical/">Categorical features preprocessing layers</a></li> <li><a href="/api/layers/preprocessing_layers/image_preprocessing/">Image preprocessing layers</a></li> <li><a href="/api/layers/preprocessing_layers/image_augmentation/">Image augmentation layers</a></li> <li><a href="/api/layers/preprocessing_layers/audio_preprocessing/">Audio preprocessing layers</a></li> </ul> <h3 id="normalization-layers"><a href="/api/layers/normalization_layers/">Normalization layers</a></h3> <ul> <li><a href="/api/layers/normalization_layers/batch_normalization">BatchNormalization layer</a></li> <li><a href="/api/layers/normalization_layers/layer_normalization">LayerNormalization layer</a></li> <li><a href="/api/layers/normalization_layers/unit_normalization">UnitNormalization layer</a></li> <li><a href="/api/layers/normalization_layers/group_normalization">GroupNormalization layer</a></li> </ul> <h3 id="regularization-layers"><a href="/api/layers/regularization_layers/">Regularization layers</a></h3> <ul> <li><a href="/api/layers/regularization_layers/dropout">Dropout layer</a></li> <li><a href="/api/layers/regularization_layers/spatial_dropout1d">SpatialDropout1D layer</a></li> <li><a href="/api/layers/regularization_layers/spatial_dropout2d">SpatialDropout2D layer</a></li> <li><a href="/api/layers/regularization_layers/spatial_dropout3d">SpatialDropout3D layer</a></li> <li><a href="/api/layers/regularization_layers/gaussian_dropout">GaussianDropout layer</a></li> <li><a href="/api/layers/regularization_layers/alpha_dropout">AlphaDropout layer</a></li> <li><a href="/api/layers/regularization_layers/gaussian_noise">GaussianNoise layer</a></li> <li><a href="/api/layers/regularization_layers/activity_regularization">ActivityRegularization layer</a></li> </ul> <h3 id="attention-layers"><a href="/api/layers/attention_layers/">Attention layers</a></h3> <ul> <li><a href="/api/layers/attention_layers/group_query_attention">GroupQueryAttention</a></li> <li><a href="/api/layers/attention_layers/multi_head_attention">MultiHeadAttention layer</a></li> <li><a href="/api/layers/attention_layers/attention">Attention layer</a></li> <li><a href="/api/layers/attention_layers/additive_attention">AdditiveAttention layer</a></li> </ul> <h3 id="reshaping-layers"><a href="/api/layers/reshaping_layers/">Reshaping layers</a></h3> <ul> <li><a href="/api/layers/reshaping_layers/reshape">Reshape layer</a></li> <li><a href="/api/layers/reshaping_layers/flatten">Flatten layer</a></li> <li><a href="/api/layers/reshaping_layers/repeat_vector">RepeatVector layer</a></li> <li><a href="/api/layers/reshaping_layers/permute">Permute layer</a></li> <li><a href="/api/layers/reshaping_layers/cropping1d">Cropping1D layer</a></li> <li><a href="/api/layers/reshaping_layers/cropping2d">Cropping2D layer</a></li> <li><a href="/api/layers/reshaping_layers/cropping3d">Cropping3D layer</a></li> <li><a href="/api/layers/reshaping_layers/up_sampling1d">UpSampling1D layer</a></li> <li><a href="/api/layers/reshaping_layers/up_sampling2d">UpSampling2D layer</a></li> <li><a href="/api/layers/reshaping_layers/up_sampling3d">UpSampling3D layer</a></li> <li><a href="/api/layers/reshaping_layers/zero_padding1d">ZeroPadding1D layer</a></li> <li><a href="/api/layers/reshaping_layers/zero_padding2d">ZeroPadding2D layer</a></li> <li><a href="/api/layers/reshaping_layers/zero_padding3d">ZeroPadding3D layer</a></li> </ul> <h3 id="merging-layers"><a href="/api/layers/merging_layers/">Merging layers</a></h3> <ul> <li><a href="/api/layers/merging_layers/concatenate">Concatenate layer</a></li> <li><a href="/api/layers/merging_layers/average">Average layer</a></li> <li><a href="/api/layers/merging_layers/maximum">Maximum layer</a></li> <li><a href="/api/layers/merging_layers/minimum">Minimum layer</a></li> <li><a href="/api/layers/merging_layers/add">Add layer</a></li> <li><a href="/api/layers/merging_layers/subtract">Subtract layer</a></li> <li><a href="/api/layers/merging_layers/multiply">Multiply layer</a></li> <li><a href="/api/layers/merging_layers/dot">Dot layer</a></li> </ul> <h3 id="activation-layers"><a href="/api/layers/activation_layers/">Activation layers</a></h3> <ul> <li><a href="/api/layers/activation_layers/relu">ReLU layer</a></li> <li><a href="/api/layers/activation_layers/softmax">Softmax layer</a></li> <li><a href="/api/layers/activation_layers/leaky_relu">LeakyReLU layer</a></li> <li><a href="/api/layers/activation_layers/prelu">PReLU layer</a></li> <li><a href="/api/layers/activation_layers/elu">ELU layer</a></li> </ul> <h3 id="backendspecific-layers"><a href="/api/layers/backend_specific_layers/">Backend-specific layers</a></h3> <ul> <li><a href="/api/layers/backend_specific_layers/torch_module_wrapper">TorchModuleWrapper layer</a></li> <li><a href="/api/layers/backend_specific_layers/tfsm_layer">Tensorflow SavedModel layer</a></li> <li><a href="/api/layers/backend_specific_layers/jax_layer">JaxLayer</a></li> <li><a href="/api/layers/backend_specific_layers/flax_layer">FlaxLayer</a></li> </ul> </div> <div class='k-outline'> <div class='k-outline-depth-1'> <a href='#keras-layers-api'>Keras layers API</a> </div> <div class='k-outline-depth-2'> ◆ <a href='#creating-custom-layers'>Creating custom layers</a> </div> <div class='k-outline-depth-2'> ◆ <a href='#layers-api-overview'>Layers API overview</a> </div> <div class='k-outline-depth-3'> <a href='#the-base-layer-class'>The base Layer class</a> </div> <div class='k-outline-depth-3'> <a href='#layer-activations'>Layer activations</a> </div> <div class='k-outline-depth-3'> <a href='#layer-weight-initializers'>Layer weight initializers</a> </div> <div class='k-outline-depth-3'> <a href='#layer-weight-regularizers'>Layer weight regularizers</a> </div> <div class='k-outline-depth-3'> <a href='#layer-weight-constraints'>Layer weight constraints</a> </div> <div class='k-outline-depth-3'> <a href='#core-layers'>Core layers</a> </div> <div class='k-outline-depth-3'> <a href='#convolution-layers'>Convolution layers</a> </div> <div class='k-outline-depth-3'> <a href='#pooling-layers'>Pooling layers</a> </div> <div class='k-outline-depth-3'> <a href='#recurrent-layers'>Recurrent layers</a> </div> <div class='k-outline-depth-3'> <a href='#preprocessing-layers'>Preprocessing layers</a> </div> <div class='k-outline-depth-3'> <a href='#normalization-layers'>Normalization layers</a> </div> <div class='k-outline-depth-3'> <a href='#regularization-layers'>Regularization layers</a> </div> <div class='k-outline-depth-3'> <a href='#attention-layers'>Attention layers</a> </div> <div class='k-outline-depth-3'> <a href='#reshaping-layers'>Reshaping layers</a> </div> <div class='k-outline-depth-3'> <a href='#merging-layers'>Merging layers</a> </div> <div class='k-outline-depth-3'> <a href='#activation-layers'>Activation layers</a> </div> <div class='k-outline-depth-3'> <a href='#backendspecific-layers'>Backend-specific layers</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