The error is raised, because you are assigning intermediate tensors to self.approx and self.details here:
for i in range(self.levels):
    ...
    self.approxs[:, :, int(pos):int(pos+len)] = approx
    self.details[:, :, int(pos):int(pos+len)] = detail

and use them later in:
energy_coeffs = torch.cat((self.details, self.approxs[:, :, -int(self.data_length/(2**self.levels)):]), 2)

Both tensors would thus contain the previously assigned tensors (from the first iteration) and the backward pass would try to backpropagate through them as well.
I’m not familiar with your use case and don’t know how this model exactly works, but you might want to detach() the assignment to the tensors in the first loop (unsure if this works for you) or don’t store them in the self.approxs and self.details tensors.