Thank you ptrblck, let me explain my question more clarify. I am implementing a GAN, in order to endure the generator output to be periodic. I want to add a “layer” as the last layer of generator to change x into (sin(x), cos(x)). I want this “layer” is part of of backprop as well. since the dimension is changed, so I use torch.cat to solve the problem:
    def forward(self, noise):
        angle = self.gen(noise)
        output = torch.cat((torch.sin(angle), torch.cos(angle)))
        return output

However there are two question:

if the torch.cat() function is allowed to do backprop? I find the value of grad_fn become to <CatBackward>

I checked the output of generator after adding the output line in forward function, but didn’t see any change. I must miss something about the forward function. could you please give me some guide (or a link) so I can figure it out.

Thank you very much !!