Category: 04. Ops API

  • 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…