October 2018
Intermediate to advanced
472 pages
10h 57m
English
Now let's define the CNN encoder that will be the single, fully connected layer followed by the ReLU activation:
class CNN_Encoder(tf.keras.Model): # Since we have already extracted the features and dumped it using pickle # This encoder passes those features through a Fully connected layer def __init__(self, embedding_dim): super(CNN_Encoder, self).__init__() # shape after fc == (batch_size, 64, embedding_dim) self.fc = tf.keras.layers.Dense(embedding_dim) def call(self, x): x = self.fc(x) x = tf.nn.relu(x) return x
Read now
Unlock full access