May 2019
Intermediate to advanced
272 pages
7h 19m
English
The generator model consists of a dense layer followed by ResNet blocks and a 2D Convolution layer with the Softmax non-linearity. The Softmax non-linearity normalizes the logits of the last layer to a probability distribution. Remember that, during training, no sampling step is required and the Softmax output is passed directly to the Discriminator:
from keras.layers import Input, Activation, Softmaxfrom keras.layers import Dense, Conv2Dfrom keras.layers.core import Reshapefrom keras.models import Modeldef build_resnet_generator(input_shape, n_filters, n_residual_blocks, seq_len, vocabulary_size): inputs = Input(shape=input_shape) # Dense 1: 1 x seq_len x n_filters x = Dense(1 * seq_len * n_filters, input_shape=input_shape)(inputs) ...
Read now
Unlock full access