Lua Learning Notes

As a long time nvim user, I am learning Lua and slowly transition my nvim config to lua. In this script, I will share some tips and lessons I have learned the hard way.





Nonlinear Activations for Neural Networks

Non-linear activations are important in deep neural networks. It is important in the sense that without non-linear activation functions, even if you have many linear layers, the end results is like you have only one linear layer, and the approximation ability of the network is very limited1. Some of most commonly-used nonlinear activation functions are Sigmoid, ReLU and Tanh.

Accelerate Batched Image Inference in PyTorch

I have a web service where the images come in a batch so I have to do inference for several images in PIL format at a time. Initially, I use a naive approach and just transform the images one by one, then combine them to form a single tensor and do the inference. The inference becomes really slow when I have a batch with more than 30 images. The inference time is about 1-2 seconds per batch.

Define A String Variable in LaTeX

Like other programming languages, the best way to to use a value multiple times in LaTeX is to define a variable for it. Later when you want to change the value, you only need to change it once. Here is how to do it.

Merging Branches with Git Rebase

When merging branches, the most direct way we can use is to git merge. However, with git-merge, the commit history and graph will be messy if there are a lot of branches.

A Curated List of File Explorers for Nvim

File explorer is one of the most widely-used types of plugin for Vim/Nvim. Below are my curated list of file explorers for Nvim. Some of these plugins are specifically written for Nvim and will not work for Vim.


有个人 A 在 Vim tg 群,问了一个简单的 vim 问题,另外一位群友 B 给了间接的回答,告诉他应该多搜索一下。结果引发了大讨论,有人认为直接回答就好,没必要指教别人,没必要那么傲慢,居高临下,就炸锅了,引发了大讨论,还导致几个人退群。