Error while building the Angular project: Issue: You might be using the following import in your imports: The solution is to import the Router from @angular/router:More
The best programming blog.
Covering a wide array of programming topics.
WordPress php local The requested resource / was not found on this server
Error while running php -S localhost:9000 while running WordPress site locally: The requested resource / was not found on this server. The solution is to make sure that you have index.php at the root of your site and you are running php -S localhost:9000 at the location where the index.php page is, sometimes the terminal is at…More
Git You have divergent branches
Git issue while taking Pull: Solution: Run the following command to fix it:More
PyTorch How to create a tensor with one values
Below is the code which can be used to create a tensor with one values: Example: With the above example, we created a tensor of 4×2 size with one values. Complete sample code: Output:More
PyTorch How to create a tensor with zero values
Below is the code which can be used to create a tensor with zero values: Example: With the above example, we created a tensor of 3×3 size with zero values. Complete sample code: Output:More
PyCharm How to increase the font size of Project explorer
Below are the steps to increase the size of Project explorer in PyCharm. Go to Preferences of PyCharm. Go to Appearance & Behavior >> Appearance. Check the Use custom font checkbox and increase the size value to increase the font size of the Project explorer. Save the settings modal and restart the PyCharm editor. The…More
PyTorch Get the shape of a tensor
The shape of a tensor signifies the number of elements (length) in each of the axes of a tensor. The length (number of elements) of each of the axes or shape of a tensor can be fetched like this: Complete code: Output: Above, the tensor in the example is of shape [2, 6] i.e it…More
PyTorch torch.Size object is not callable
Error while calling .shape on a tensor: Issue: The reason that error is coming is because shape is an attribute and not a function. The solution is to call it like this: i.e to call it like property instead of as an object.More
npm ERR! ENOTEMPTY: directory not empty
Error while running npm install The solution is to delete the node modules folder and re-install the node modules by running npm i command:More
PyTorch Get the size of a tensor
We can use the tensor.size() to get the rank of a tensor, below is the code to get the same: Complete code: Output: Above, the tensor in the example is of size 2, 6.More