Writing Python code to express equations and crunch numbers is the foundation of many hot IT industry applications, including machine learning, data science and analytics. If you’re new to the ecosystem, as I am, you might be overwhelmed with the slew of libraries and approached one can take to get started. A great place to start, if you’re interested in Deep Learning especially, is PyTorch. PyTorch is seemingly destined to overtake TensorFlow as the most widely used training framework for neural networks, due largely to its ‘pythonic’ nature and expressiveness. Let’s take a 5 minute look at the key PyTorch statements and concepts one needs to know when it comes to working with tensors - arrays of numbers in arbitrary dimension (1d, 2d, Nd).
That’s it! Pretty simple. I feel that most of this code is unsurprising - which is a key property you want when a language or framework isn’t something you use all day - and therefore cannot memorize all the intricacies of.