Imported from https://github.com/rosinality/adaptive-softmax-pytorch