utils/data_utils.py
def compute_image_grad(img):
    """
    Function to get the gradient of an image using Sobel filters
    :param img: CxHxW Tensor
    :return: Cx2xHxW Tensor
    """
    img = spatial_gradient(img.unsqueeze(0), normalized=False)  # adding 1 dimension required by kornia library
    return img[0]

    Function to get the gradient of an image using Sobel filters
    :param img: CxHxW Tensor
    :return: Cx2xHxW Tensor
    
Function to get the gradient of an image using Sobel filters
Function to get the gradient of an image using Sobel filters
def compute_image_grad(img):
    img = spatial_gradient(img.unsqueeze(0), normalized=False)  
    return img[0]
def compute_image_grad ( img ) : img = spatial_gradient ( img . unsqueeze ( 0 ) , normalized = False ) return img [ 0 ]
Function to get the gradient of an image using Sobel filters
Function to get the gradient of an image using Sobel filters
"""
    Function to get the gradient of an image using Sobel filters
    :param img: CxHxW Tensor
    :return: Cx2xHxW Tensor
    """ # adding 1 dimension required by kornia library
None
img
None