Shahid Akhtar Khan has Published 216 Articles

How to draw bounding boxes on an image in PyTorch?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 20-Jan-2022 06:35:33

6K+ Views

The torchvision.utils package provides the draw_bounding_boxes() function to draw bounding boxes on an image. It supports images of type torch Tensor with shape (C x H x W) where C is the number of channels, and W and H are the width and height of the image, respectively.If we read ... Read More

How to read a JPEG or PNG image in PyTorch?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 20-Jan-2022 06:20:33

6K+ Views

Reading the images is a very important part in image processing or computer vision related tasks. The torchvision.io package provides functions to perform different IO operations. To read an image, torchvision.io package provides the image_read() function. This function reads JPEG and PNG images. It returns a 3D RGB or Grayscale Tensor.The ... Read More

PyTorch – torch.linalg.cond()

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:30:16

194 Views

To compute the condition number of a matrix with respect to a matrix norm, we could apply torch.linalg.cond() method. It returns a new tensor with computed condition number. It accepts a matrix, a batch of matrices and also batches of matrices. A matrix is a 2D torch Tensor. It supports ... Read More

PyTorch – How to compute the pseudoinverse of a matrix?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:26:38

512 Views

To compute the pseudoinverse of a square matrix, we could apply torch.linalg.pinv() method. It returns a new tensor with pseudoinverse of the given matrix. It accepts a matrix, a batch of matrices and also batches of matrices. A matrix is a 2D torch Tensor. It supports input of float, double, ... Read More

PyTorch – How to compute the inverse of a square matrix?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:21:14

831 Views

To compute the inverse of a square matrix, we could apply torch.linalg.inv() method. It returns a new tensor with inverse of the given matrix. It accepts a square matrix, a batch of square matrices, and also batches of square matrices.A matrix is a 2D torch Tensor. It supports input of ... Read More

PyTorch – How to compute the norm of a vector or matrix?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:16:07

986 Views

To compute the norm of a vector or a matrix, we could apply torch.linalg.norm() method. It returns a new tensor with computed norm. It accepts a vector, matrix, a batch of matrices and also batches of matrices.A vector is a 1D torch Tensor where a matrix is a 2D torch ... Read More

PyTorch – torch.linalg.solve() Method

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:15:03

640 Views

To solve a square system of linear equations with unique solution, we could apply the torch.linalg.solve() method. This method takes two parameters −first, the coefficient matrix A, andsecond, the right-hand tensor b.Where A is a square matrix and b is a vector. The solution is unique if A invertible. We ... Read More

PyTorch – How to compute the determinant of a square matrix?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:14:10

787 Views

To compute the determinant of a square matrix, we could apply torch.linalg.det() method. It returns a new tensor with computed determinant. It accepts a square matrix, a batch of square matrices and also batches of square matrices. It supports matrix of float, double, cfloat, and cdouble data types.We could also ... Read More

PyTorch – How to compute the logistic sigmoid function of tensor elements?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:12:35

904 Views

To compute the logistic function of elements of a tensor, we use torch.special.expit() method. It returns a new tensor with computed logistic function element-wise. It accepts torch tensor of any dimension. We could also apply torch.sigmoid() method to compute the logistic function of elements of the tensor. It is an ... Read More

PyTorch – How to compute QR decomposition of a matrix?

Shahid Akhtar Khan

Shahid Akhtar Khan

Updated on 07-Jan-2022 06:10:48

268 Views

torch.linalg.qr() computes the QR decomposition of a matrix or a batch of matrices. It accepts matrix and batch of matrices of float, double, cfloat and cdouble data types.It returns a named tuple (Q, R). Q is orthogonal when the matrix is real valued and unitary when matrix is complex valued. ... Read More

Advertisements