This is almost certainly false. Derivative work is a category of copyrightable material where an existing work was further creatively transformed in order to create said derivative work. For example painting a moustache on the Mona Lisa.
That creates a derivative work, which has a separate copyright on the creative addition (the moustache).
Training an AI has been found to be not creative work. The AI weights, as a result, are not a derivative work, and likely cannot be copyrighted.
Your GPL example is an unexpectedly poignant one, as well, though it will be to your chagrin.
If you publish your GPL code, and I learn from it and produce code that does the same thing, that is not restricted by copyright. Furthermore, if it's found that the expression of the code itself cannot be separated from the function, the expression is not copyrightable in the first place, and the GPL is redundant.
It's only in the instance that I reproduce your code exactly and the function is separable from the creative expression that your copyright is valid.
Regarding your JPEG compression, it's possible that a ML model will produce outputs that, of themselves, are copyright infringement. A recognizable picture of Ariel, for example. That doesn't mean that the training, the model, or anything else it produces is infringing.