Imported from https://github.com/neuroailab/tnn
