Imported from https://github.com/revsic/tf-neural-process