I am working to understand Erik Linder-Norén's implementation of the Categorical GAN model, and am confused by the generator in that model:
def build_generator(self):
model = Sequential()
# ...some lines removed...
model.add(Dense(np.prod(self.img_shape), activation='tanh'))
model.add(Reshape(self.img_shape))
model.summary()
noise = Input(shape=(self.latent_dim,))
label = Input(shape=(1,), dtype='int32')
label_embedding = Flatten()(Embedding(self.num_classes, self.latent_dim)(label))
model_input = multiply([noise, label_embedding])
img = model(model_input)
return Model([noise, label], img)
My question is: How does the Embedding()
layer work here?
I know that noise
is a vector that has length 100, and label
is an integer, but I don't understand what the label_embedding
object contains or how it functions here.
I tried printing the shape of label_embedding
to try and figure out what's going on in that Embedding()
line but that returns (?,?)
.
If anyone could help me understand how the Embedding()
lines here work, I'd be very grateful for their assistance!