- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Shahid Akhtar Khan has Published 216 Articles
Shahid Akhtar Khan
321 Views
To create a tensor whose elements are sampled from a Poisson distribution, we apply the torch.poisson() method. This method takes a tensor whose elements are rate parameters as input tensor. It returns a tensor whose elements are sampled from a Poisson distribution with the rate parameter.Syntaxtorch.poisson(rates)where the parameter rates is ... Read More
Shahid Akhtar Khan
260 Views
To compute the Heaviside step function for each element in the input tensor, we use the torch.heaviside() method. It accepts two parameters − input and values. It returns a new tensor with a computed heaviside step function.The value of heaviside function is the same as values if input=0. The value ... Read More
Shahid Akhtar Khan
1K+ Views
To draw binary random numbers (0 or 1) from a Bernoulli distribution, we apply the torch.bernoulli() method. The input to this method is a torch tensor containing the probabilities of drawing 1. These probabilities are used to draw binary random numbers (0 or 1).As the input tensor contains the probabilities, ... Read More
Shahid Akhtar Khan
1K+ Views
To create a tensor of random numbers drawn from separate normal distributions whose mean and std are given, we apply the torch.normal() method. This method takes two input parameters − mean and std.mean is a tensor with the mean of each output element’s normal distribution, andstd is a tensor with ... Read More
Shahid Akhtar Khan
331 Views
With given absolute values and angles, we can construct a complex number in PyTorch using torch.polar() method. The absolute value and angles must be float or double. Both the absolute value and the angle must be of the same type.If abs is a float, then angle must also be float.If ... Read More
Shahid Akhtar Khan
948 Views
The hessian() function computes the Hessian of a given function. The hessian() function can be accessed from the torch.autograd.functional module. The function whose Hessian is being computed takes a tensor as the input and returns a tuple of tensors or a tensor. The hessian() function returns a tensor with the ... Read More
Shahid Akhtar Khan
3K+ Views
The jacobian() function computes the Jacobian of a given function. The jacobian() function can be accessed from the torch.autograd.functional module. The function whose Jacobian is being computed takes a tensor as the input and returns a tuple of tensors or a tensor. The jacobian() function returns a tensor with Jacobian ... Read More
Shahid Akhtar Khan
1K+ Views
To adjust the sharpness of an image, we apply adjust_sharpness(). It's one of the functional transforms provided by the torchvision.transforms module. adjust_sharpness() transformation accepts both PIL and tensor images.A tensor image is a PyTorch tensor with shape [C, H, W], where C is number of channels, H is image height, ... Read More
Shahid Akhtar Khan
1K+ Views
With given real and imaginary parts, we can construct a complex number in PyTorch using torch.complex() method. The real and imaginary parts must be float or double. Both the real and imaginary parts must be of the same type. If the real part is float, then the imaginary must also ... Read More
Shahid Akhtar Khan
268 Views
To define a simple convolutional neural network (CNN), we could use the following steps −StepsFirst we import the important libraries and packages. We try to implement a simple CNN in PyTorch. In all the following examples, the required Python library is torch. Make sure you have already installed it.import torch ... Read More
To Continue Learning Please Login
Login with Google