Author: Awais Farooq

  • AdamW

    AdamW class Optimizer that implements the AdamW algorithm. AdamW optimization is a stochastic gradient descent method that is based on adaptive estimation of first-order and second-order moments with an added method to decay weights per the techniques discussed in the paper, ‘Decoupled Weight Decay Regularization’ by Loshchilov, Hutter et al., 2019. According to Kingma et al., 2014, the…

  • Adam

    Adam class Optimizer that implements the Adam algorithm. Adam optimization is a stochastic gradient descent method that is based on adaptive estimation of first-order and second-order moments. According to Kingma et al., 2014, the method is “computationally efficient, has little memory requirement, invariant to diagonal rescaling of gradients, and is well suited for problems that are large…

  • RMSprop

    RMSprop class Optimizer that implements the RMSprop algorithm. The gist of RMSprop is to: This implementation of RMSprop uses plain momentum, not Nesterov momentum. The centered version additionally maintains a moving average of the gradients, and uses that average to estimate the variance. Arguments Example

  • SGD

    SGD class Gradient descent (with momentum) optimizer. Update rule for parameter w with gradient g when momentum is 0: Update rule when momentum is larger than 0: When nesterov=True, this rule becomes: Arguments

  • FFT ops

    fft function Computes the Fast Fourier Transform along last axis of input. Arguments Returns A tuple containing two tensors – the real and imaginary parts of the output tensor. Example fft2 function Computes the 2D Fast Fourier Transform along the last two axes of input. Arguments Returns A tuple containing two tensors – the real and imaginary…

  • Image ops

    affine_transform function Applies the given transform(s) to the image(s). Arguments Returns Applied affine transform image or batch of images. Examples crop_images function Crop images to a specified height and width. Arguments Returns If images were 4D, a 4D float Tensor of shape (batch, target_height, target_width, channels) If images were 3D, a 3D float Tensor of shape (target_height, target_width, channels) Example extract_patches function Extracts patches from the image(s). Arguments Returns Extracted…

  • Core ops

    Cast a tensor to the desired dtype. Arguments Returns A tensor of the specified dtype. Example cond function Conditionally applies true_fn or false_fn. Arguments Returns The output of either true_fn or false_fn depending on pred. convert_to_numpy function Convert a tensor to a NumPy array. Arguments Returns A NumPy array. convert_to_tensor function Convert a NumPy array to a tensor. Arguments Returns A tensor of the specified dtype. Example…

  • Linear algebra ops

    cholesky function Computes the Cholesky decomposition of a positive semi-definite matrix. Arguments Returns A tensor of shape (…, M, M) representing the lower triangular Cholesky factor of x. det function Computes the determinant of a square tensor. Arguments Returns A tensor of shape (…,) represeting the determinant of x. eig function Computes the eigenvalues and eigenvectors of a square matrix. Arguments Returns inv function Computes…

  • NN ops

    average_pool function Average pooling operation. Arguments Returns A tensor of rank N+2, the result of the average pooling operation. batch_normalization function Normalizes x by mean and variance. This op is typically used by the batch normalization step in a neural network. It normalizes the input tensor along the given axis. Arguments Returns The normalized tensor. Example binary_crossentropy function Computes binary cross-entropy loss between…

  • NumPy ops

    Compute the absolute value element-wise. keras.ops.abs is a shorthand for this function. Arguments Returns An array containing the absolute value of each element in x. Example add function Add arguments element-wise. Arguments Returns The tensor containing the element-wise sum of x1 and x2. Examples keras.ops.add also broadcasts shapes: all function Test whether all array elements along a given axis evaluate to True. Arguments Returns…