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

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

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