Message Boards Message Boards

Implement a GAN (generative adversarial network)?


Hello everyone,

I am trying to code a generative adversarial network using Mathematica's neural networks but I have a few questions still.

  1. Since I am no computer scientist (yet) I intend on taking the structure of a GAN and implementing it into Mathematica. However I have trouble finding Fractionally-Strided Convolution layers. Is that the same as Deconvolution layers in Mathematica or should I use some other layers ?

  2. Is there a specific encoder for text ? Since my input will be a piece of text describing the output image, a built in encoder might help greatly.

  3. And finally, since GANs are composed of a generator and a discriminator battling each other, how do I, in Mathematica, implement this back and forth battle between the two nets ?

I really am a beginner in using neural networks so any help is greatly appreciated. Because of that, I am fully aware that entire swathes of computer science might have to been explained to me, however a quick direction towards the important topics can help me direct my research. Thank you for your answers !

POSTED BY: Luca Montanelli
26 days ago

Hello Luca,

A1: yes, it's the same

A2: yes again

Characters encoder:

Words (tokens) encoder:

If you need an additional text preprocessing (delete stopwords, reduce words to their stems etc), you can find useful functions here:

And don't forget about EmbeddingLayer and UnitVectorLayer. One of them should be the first layer in your network when you work with text (choice of the layer depends of your architecture). Examples in attachment.



POSTED BY: Alexey Golyshev
25 days ago

I'm sorry for the very late reply, I forgot a bit and am only coming back to it now. Thank you very much for your answer ! I had already seen the link to the stackexchange question and their notebooks did not work for me. I'll be sure to check the reason why and look into the other things you linked aswell. Again, thank you !

POSTED BY: Luca Montanelli
1 day ago

Group Abstract Group Abstract