I wanted to rewrite the create_model function into Keras Functional API. Running it on TPU though when I translate it gives me an error about using a Placeholder in create_method function. In the original example the author didn't put an explicit Placeholder into the create_method function. I am using the Keras Input function since I need to instantiate a Keras tensor to get started, obviously this is a place holder. Is there a way to get rid of the Placeholder inside my create_method function?
Here is my snippet of my code:
def create_model(data_format):
if data_format == 'channels_first':
input_shape = [1, 28, 28]
else:
assert data_format == 'channels_last'
input_shape = [28, 28, 1]
l = tf.keras.layers
m = tf.keras.models
b = tf.keras.backend
v = tf.contrib.layers
# The model consists of a sequential chain of layers, so tf.keras.Sequential
# (a subclass of tf.keras.Model) makes for a compact description.
input = l.Input(shape=(28, 28, 1))
visible = l.Reshape(target_shape=input_shape, input_shape=(28*28,))(input)
When I create it from the provided MNIST TPU Code I get the error
placeholder outside of the infeed
But I also cant run it without the Placeholder as in the Sequential Code or is there a way to do this?