ptrblck:

If I understand the code correctly, get_dis_xy will return two tensors, which were not created by the generator


I think the first half of x contains the transformations of source embeddings produced by the generator. As I understand it, the original source embeddings are retrieved from the source embeddings-set in line 69 and the translation of these original source embeddings into the target space is done by the generator self.mapping in line 71. Then, the translated source embeddings and the target embeddings get concatenated in line 75 and jointly returned in tensor x in line 81 for classification of both generator-generated translations and target data by the discriminator in line 117. In the next line, the loss is then computed on both the generator-generated translations and the pure target data.
But I understand now that gradients will only be computed for a module with respect to a loss if the loss has directly been caused by the given module. Thank you very much for the clarification!