Writing PyTorch Programs Using Visual Studio

When I write PyTorch neural code on a Windows platform, my preferred editor is Notepad. But I am just about the only person I know who uses this minimalist approach. All of my colleagues prefer more sophisticated development environments. One approach used by some of the guys I know is to develop Python/PyTorch programs using Visual Studio.

The image below illustrates four of the advantages of using VS. 1.) You can easily toggle the Python version (I’m using 3.7). 2.) You get nice language keyword coloring. 3.) You get powerful debugging capabilities with breakpoints and watch windows. 4.) You get IntelliSense that gives you properties of an object.



There are two main disadvantages of using VS. First, VS is a very complex tool and it has a steep learning curve. Second, VS has a lot of overhead and it creates additional files such as a project file and a solution file.

When using Notepad to write a Python/PyTorch program you have to do manual debugging by inserting print() statements into your program, possiblly followed by an input() statement to pause execution.

The left image below shows what you see if you try to create a Python program in VS but you don’t have the required libraries. The image on the right shows how to select the data science workload. After you install that workload you get a Python program template for new projects and backend plumbing for the editor coloring and debugging.


The moral of the story is that you can use a minimalist approach for developing PyTorch programs, but a more sophisticated approach is beneficial for most people.


Three examples of mid-century modern minimalist art. This type of art, by itself, doesn’t appeal to me much, but when placed in a room with mid-century modern architecture and design, I like this style of art a lot.

This entry was posted in PyTorch. Bookmark the permalink.