Difference Between Namespaces and Modules in TypeScript

Namespaces and Modules in TypeScript

While building an online shopping app in TypeScript, you first use namespaces to group code like Customer, Product, and Order in one file. It works fine for small projects. However, as the app grows, you can switch to modules to split code into separate files using export and import, making it easier to manage. TypeScript, … Read more >>

Convert PyTorch Tensor to Numpy

torch tensor to numpy

In my decade-plus career as a Python developer, I’ve found that converting PyTorch tensors to NumPy arrays is a fundamental skill when working with deep learning projects. This conversion is crucial for leveraging PyTorch’s computational power and NumPy’s data manipulation capabilities. In this article, I’ll share various methods to convert PyTorch tensors to NumPy arrays, … Read more >>

How to Load PyTorch Models?

pytorch model load

Recently, I worked on a deep learning project that required me to deploy a pre-trained PyTorch model in a production environment. I encountered challenges loading the PyTorch models correctly, especially when dealing with various model architectures and saving formats. In this tutorial, I will cover multiple ways to load PyTorch models (using torch.load, state dictionaries, … Read more >>

PyTorch Batch Normalization

pytorch batch normalization

Recently, I was working on a deep learning project, and my model was taking an excessively long time to converge. The training process was frustratingly slow, and the accuracy wasn’t improving as I had hoped. That’s when I decided to implement Batch Normalization, a technique that significantly enhanced my model’s performance and reduced training time. … Read more >>

PyTorch nn.Linear

nn.linear

Recently, I worked on a deep learning project that involved implementing a neural network for image classification. One of the fundamental components I needed was the linear layer in PyTorch. This module is essential for creating fully connected layers in neural networks, but many beginners find it challenging to implement correctly. In this guide, I’ll … Read more >>

Adam Optimizer in PyTorch with Examples

pytorch adam optimizer 1

Throughout my more than ten years as a Python developer, I have worked with various optimization algorithms for deep learning models. Among these, Adam has consistently been one of my preferred choices due to its efficiency and reliability. Adam (short for Adaptive Moment Estimation) combines the best aspects of other popular optimizers like AdaGrad and … Read more >>

Cross Entropy Loss in PyTorch

crossentropy_loss

Recently, I was working on a deep learning project where I needed to train a neural network for image classification. When selecting a loss function, I found that Cross Entropy Loss was recommended for multi-class classification problems, but I wasn’t entirely clear on how to implement it properly in PyTorch. Cross-entropy loss is a widely … Read more >>

Modulenotfounderror: no module named ‘tensorflow.contrib’

no module named 'tensorflow.contrib'

While working on a deep learning project, I used some code from an older TensorFlow tutorial. However, when I attempted to run the code, I encountered an error: ModuleNotFoundError: No module named ‘tensorflow.contrib’.The issue is that the contrib module was removed in TensorFlow 2.0 and above. In this article, I will explain why this error occurs … Read more >>

TypeScript Enum Reverse Mapping

Reverse Enum Strings in Typescript

While working on a TypeScript project, I got a requirement to map enum values back to their corresponding names, essentially the reverse of how enums are typically used. With numeric enums, TypeScript handles this automatically. But when it came to string enums, I had to implement a custom solution to make reverse mapping work. In … Read more >>

Check If Object Is Undefined in TypeScript

Check if Object is Undefined Using TypeScript

You may have faced some issues where your code breaks because an object is undefined. For example, you’re trying to access a property of an object, but that object was never assigned a value. In such cases, checking if the object is undefined helps prevent runtime errors and keeps your code safe. In this tutorial, … Read more >>

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.