tf.Tensor | tf.Tensor is TensorFlow’s immutable, multidimensional array type. Its elements share one dtype, and the tensor carries a shape for use in eager or graph-based computation. |
tf.Variable | tf.Variable represents mutable TensorFlow state backed by a tensor. Its initial value establishes the variable's dtype and shape, and assign methods update its value. |
Dataset | tf.data.Dataset represents a collection of elements and a pipeline of transformations. Build one from input data, transform it with operations such as map or batch, and iterate over the resulting elements. |
GradientTape | Class |
Sequential | tf.keras.Sequential groups an ordered, linear stack of Keras layers into a Model. It is designed for straightforward one-input, one-output layer pipelines. |
Dense | A fully connected neural-network layer that transforms the last input dimension into units. It can add a bias and apply an optional element-wise activation. |
Conv2D | tf.keras.layers.Conv2D is a 2D convolution layer that learns spatial filters and produces a configurable number of output channels. Padding, strides, dilation, groups, bias, initialization, regularization, constraints, and activation control its behavior. |
layers.Dense | A standard fully connected neural-network layer. It applies a learned affine projection to the final input dimension and then an optional activation, producing the requested number of output units. |
layers.Conv2D | A Keras layer that applies learned two-dimensional convolution filters to inputs. It can add bias and an activation while configurable padding, strides, dilation, layout, and groups determine the resulting feature maps. |
layers.Conv1D | A Keras layer that performs one-dimensional convolution over spatial or temporal sequences. It transforms sliding input windows into a configurable number of output channels. |
layers.MaxPooling2D | MaxPooling2D downsamples 2D spatial data by taking the maximum in sliding windows independently for each channel. Configure its window, stride, padding mode, and tensor data layout. |
layers.AveragePooling2D | AveragePooling2D downsamples 2D spatial data by taking windowed means independently for each channel. Its pool size, stride, padding, and channel layout determine the resulting feature-map dimensions. |
layers.GlobalAveragePooling2D | A Keras layer that averages each channel across the height and width of 2D feature maps. It can either remove those spatial axes or preserve them as size-one dimensions. |
layers.Flatten | tf.keras.layers.Flatten turns each sample’s non-batch dimensions into one feature axis. It preserves the batch size and supports channels-last or channels-first dimension ordering. |
layers.Dropout | Applies dropout regularization by randomly zeroing input units during training and rescaling the units that remain. During inference, it leaves the input unchanged. |
layers.BatchNormalization | BatchNormalization normalizes layer inputs toward zero mean and unit standard deviation. It uses current-batch statistics during training and moving statistics during inference. |
layers.LayerNormalization | tf.keras.layers.LayerNormalization normalizes activations independently for each example across selected axes, typically the feature axis. It can optionally apply trainable scaling and centering after normalization. |
layers.LSTM | A Long Short-Term Memory layer for processing sequence data. It can return the final output, the full output sequence, and optionally its recurrent states. |
layers.GRU | tf.keras.layers.GRU is a gated recurrent layer for sequence data. It can return the final timestep output or the complete output sequence, and can optionally expose its recurrent state. |
layers.SimpleRNN | tf.keras.layers.SimpleRNN is a fully connected recurrent layer that feeds each output back into the next timestep. It can emit the final output, the full sequence, and optionally the final recurrent state. |
layers.Bidirectional | Class |
layers.Embedding | Class |
layers.Attention | A Keras layer implementing Luong-style attention. It scores query-key pairs, normalizes them with softmax, and returns weighted value combinations. |
layers.MultiHeadAttention | Class |
layers.Concatenate | Class |
layers.Add | tf.keras.layers.Add performs elementwise addition over a list of same-shaped tensors and returns one tensor with that shape. It is commonly used to merge branches in a Keras model. |
layers.Activation | A Keras layer that applies a chosen activation function to its input. The activation can be specified by supported name or passed as a callable. |
layers.ReLU | A configurable Keras layer implementing rectified linear activation. Adjust its slope, threshold, and optional upper bound to obtain standard, leaky, thresholded, or capped ReLU behavior. |
layers.Softmax | A Keras layer that converts logits into normalized softmax probabilities. It defaults to the last axis and can optionally ignore masked positions. |
layers.Reshape | tf.keras.layers.Reshape changes each input sample to a specified target shape while preserving the batch dimension. It requires fixed input dimensions and can infer one target dimension with -1. |
layers.TextVectorization | A Keras preprocessing layer that turns batches of strings into token IDs or dense text vectors. It can learn its vocabulary from data with adapt() or use one supplied at construction. |
layers.Normalization | A Keras preprocessing layer that standardizes continuous features using stored mean and variance. Statistics can be supplied at construction or learned with adapt(). |
keras.Model | tf.keras.Model groups layers into a callable object with training and inference features. Create it with the Functional API or by subclassing it. |
keras.Sequential | tf.keras.Sequential creates a Model from a linear stack of Keras layers. Layers can be supplied at construction or appended incrementally with add(). |
optimizers.Adam | Adam is a Keras optimizer that adaptively estimates first- and second-order gradient moments to update model variables. Its API includes controls for learning rates, AMSGrad, decay, clipping, moving averages, loss scaling, and gradient accumulation. |
optimizers.SGD | tf.keras.optimizers.SGD performs gradient descent with an optional momentum accumulator. It supports configurable learning rates, Nesterov momentum, gradient clipping, weight decay, EMA, and gradient accumulation. |
optimizers.RMSprop | TensorFlow's RMSprop optimizer adapts parameter updates using a discounted moving average of squared gradients. It supports momentum, centered variance normalization, clipping, weight decay, EMA, and gradient accumulation. |
optimizers.AdamW | AdamW is a Keras optimizer that combines Adam’s adaptive moment estimation with weight decay. It supports configurable learning rates, moment coefficients, clipping, EMA, loss scaling, and gradient accumulation. |
optimizers.Nadam | Nadam is a Keras optimizer that combines Adam-style adaptive moment estimates with Nesterov momentum. It also supports clipping, weight decay, EMA, loss scaling, and gradient accumulation. |
losses.BinaryCrossentropy | BinaryCrossentropy is a Keras loss class for binary classification. It compares binary targets with predicted probabilities or logits and supports label smoothing, axis selection, and configurable reduction. |
losses.CategoricalCrossentropy | Computes categorical crossentropy between one-hot labels and predictions for multiclass classification. Predictions may be probabilities or logits, with optional label smoothing, feature-axis selection, and configurable reduction. |
losses.SparseCategoricalCrossentropy | Class |
losses.MeanSquaredError | Computes the average squared difference between labels and predictions. It is a configurable Keras Loss object with selectable reduction behavior. |
losses.Huber | tf.keras.losses.Huber computes a robust regression loss between true and predicted values. It uses a quadratic penalty for small errors and a linear penalty for errors beyond delta. |
metrics.Accuracy | Calculates how often predictions equal labels. It accumulates matches and evaluated values across updates, then returns their ratio. |
metrics.Precision | Computes the fraction of predicted positives that are correct. It supports threshold-based binary evaluation, top-k multiclass evaluation, and restricting measurement to one class. |
metrics.Recall | Computes recall from accumulated true positives and false negatives. It supports threshold-based, top-k, and class-specific evaluation. |
metrics.AUC | A stateful Keras metric that approximates ROC AUC or precision-recall AUC from predictions accumulated across batches. It supports configurable thresholds, summation, multilabel evaluation, label weighting, and logits. |
tf.GradientTape | Records operations performed in a context so TensorFlow can compute gradients automatically. It watches trainable variables by default and supports manual watching, persistent tapes, and higher-order derivatives. |
tf.data.Dataset | tf.data.Dataset represents a potentially large sequence of elements and provides composable operations for building TensorFlow input pipelines. Data is commonly sourced, transformed, and then consumed by iteration. |
callbacks.EarlyStopping | Stops Keras training when a monitored metric no longer improves. It can require a minimum improvement, tolerate a configured number of stalled epochs, use a baseline or warm-up period, and restore the best weights. |
callbacks.ModelCheckpoint | Class |
callbacks.ReduceLROnPlateau | Class |
callbacks.TensorBoard | Logs Keras training information for visualization in TensorBoard. It can record metrics, the graph, weight histograms, throughput, profiling data, and embeddings. |
callbacks.LearningRateScheduler | A Keras callback that changes the optimizer's learning rate from a user-supplied function. The function is evaluated at the start of each epoch using the epoch index and current rate. |
layers.LSTMCell | An LSTM cell that performs one timestep of recurrent computation. Wrap it in keras.layers.RNN to apply it across complete input sequences. |
layers.GRUCell | tf.keras.layers.GRUCell implements one timestep of a gated recurrent unit. Wrap it with tf.keras.layers.RNN when a sequence-level recurrent layer is needed. |
layers.Conv2DTranspose | Class |
layers.DepthwiseConv2D | Class |
layers.GlobalMaxPooling2D | GlobalMaxPooling2D reduces each 2D feature map to its maximum value, retaining one value per channel and batch item. Use data_format to select channel ordering and keepdims to preserve singleton spatial axes. |
layers.SpatialDropout2D | SpatialDropout2D regularizes convolutional feature maps by dropping complete 2D maps instead of individual elements. It is designed for inputs whose neighboring pixels are strongly correlated. |
layers.GaussianNoise | A Keras regularization layer that adds zero-centered Gaussian noise to inputs during training. It can help mitigate overfitting, while inference leaves the input unchanged. |
layers.RandomFlip | A Keras preprocessing layer that randomly flips channels-last images horizontally, vertically, or both during training. It leaves images unchanged during inference and supports integer or floating-point pixel inputs. |
layers.Resizing | A Keras preprocessing layer that resizes individual images or batches to a chosen height and width. It supports several interpolation methods and optional aspect-ratio-preserving cropping or padding. |
layers.Rescaling | A Keras preprocessing layer that converts every input value with input * scale + offset. It is commonly used to normalize image pixels, such as mapping [0, 255] to [0, 1] or [-1, 1]. |