Python Conditional Timeit Decorator

Introduction

The conditional timeit decorator will provide a convient way to measure the time spent on individual functions. The behavior of the timer will depend on the verbosity flag such that:

Read More

Guides On Choosing Deep Learning Server

Introduction

Choosing the right GPU server for deep learning is the first problem presented to the research teams among industry and academia. This article is to introduce a few tips in picking the right hardware for your team.

Read More

C++ Enum Pattern

Introduction

Very often we want to define a set of items to choose from, for example, a set of colors. In C++, we usually can declare enum class Color { Red, Green, Blue }. However, besides using it in a switch statement, we can hardly use it for anything else. For example, if we want to print "Red" for Color::Red, we have to write another function using switch statement, somewhere else. When we want to add a new color, we have to change every places we are using switch. This is obviously an anti-pattern. Occasionally, we want to find how many colors in total, and maybe even want to iterate through them. None of these are supported by C++ enum. In this blog, I want to introduce the Enum Pattern in C++, which supports switch and constains encapsulated member functions, similar to the Enum Class in Java. The idea came from this stackoverflow post.

Read More

Object-Oriented Design Principles

Introduction

When I first learned the object-oriented programming (OOP), I was offered simple examples such as a Dog is an Animal and so does a Cat, or a Car has an Engine and four Wheelss, where the former is an is-a relationship indicating inheritance and the latter is a has-a relationship indicating composition. Although these are perfect examples for teaching OOP concepts, they are far from the principles of designing good OO system. The most important criterion of a good OO design is the flexibility: how troublesome, for example, the number of class files we need to touch, if we want to make a certain change. Object-oriented design principles are several guidelines to help us make our software flexible. In this blog, I would like to introduce several design principles I learned from this book.

Read More

Object-Oriented Analysis

Introduction

Object-oriented analysis is a systematic way to tackle real-world problems using a software solution. In this blog, I would like to introduce a step-by-step procedure on how to analyze a real world problem by understanding it, breaking it into small pieces and solving them one by one. I learned most of it from this book and I highly recommend it.

Read More

Learning PyTorch Part I

Introduction

Currently, I am participating the deep learning part1v2 course as an “international fellow”. This course is taught by Jeremy Howard from fast.ai. The course is not available to the public yet, but it will be in future. During the course, Jeremy introduced PyTorch and the fastai package built on top of PyTorch. Before this, I only used Tensorflow and Keras. PyTorch is quite different (in a good way). I am very impressed by the elegant and flexible design of PyTorch. I would like to introduce some features I think interesting.

Read More

How to Learn Programming

Recently, a graduate student asked me for advice on how to improve programming skills. My immediate response in my mind is that “You asked the wrong person a right question”. But I think he will feel bad if I do not try to respond. So, here it is… Note that, this guidance is biased toward to a scientific computing rather than general software engineering. But I think the basic things like data structures and algorithms are common.

Read More