Imported from https://github.com/jvanvugt/pytorch-domain-adaptation