Lets say I have a simple neural network with an input layer and a single convolution layer programmed in tensorflow:
# Input Layer
input_layer = tf.reshape(features["x"], [-1, 28, 28, 1])
# Convolutional Layer #1
conv1 = tf.layers.conv2d(
inputs=input_layer,
filters=32,
kernel_size=[5, 5],
padding="same",
activation=tf.nn.relu)
I leave out any further parts of the network definitions for the features
.
If I wanted to add an LSTM Layer after this convolution layer, I would have to make the convolution layer TimeDistributed (in the language of keras) and then put the output of the TimeDistributed layer into the LSTM.
Tensorflow offers access to the keras layers in tf.keras.layers. Can I use the keras layers directly in the tensorflow code? If so, how? Could I also use the tf.keras.layers.lstm for the implementation of the LSTM Layer?
So in general: Is a mixture of pure tensorflow code and keras code possible and can I use the tf.keras.layers?