Notjeffjeff•

Using the MNIST example, what would you change if you wanted to make is to that you could enter a number into the decoder and get an image output?

1
afagarapOP•

Hi, @Notjeffjeff. For that matter, we can turn to Conditional VAE. I think this blog by Agustinus Kristiadi is a nice resource on the matter.

2
begooboi•

Thank you for the tutorial,I know keras but I am new to tensorflow keras can you please explain what is happening in this encoder model.

class Encoder(tf.keras.layers.Layer):
  def __init__(self, intermediate_dim):
    super(Encoder, self).__init__()
    self.hidden_layer = tf.keras.layers.Dense(units=intermediate_dim, activation=tf.nn.relu)
    self.output_layer = tf.keras.layers.Dense(units=intermediate_dim, activation=tf.nn.relu)
    
  def call(self, input_features):
    activation = self.hidden_layer(input_features)
    return self.output_layer(activation)

1.what is the shape of this enoder model? How many inputs and hidden nodes?

2.What is a call function? Where do it get input_features?

3.What is difference between intermediate_dim in hidden_layer = tf.keras.layers.Dense(units=intermediate_dim, activation=tf.nn.relu) and input_features in self.hidden_layer(input_features)?

1
afagarapOP•

Thank you for reading the tutorial.

  1. The shape of the encoder layer is the shape of the input given to it, this is its default behavior. Specifying the `input_shape` is optional when subclassing as specified in the docs. The number of units in its hidden layer is given by `intermediate_dim`, and it's going to be the reduced size of the data. In the blog post, it was from 784 dimensions to 64 dimensions (this also answers your third question).
  2. The call function is the one being called when you use the model or layer, hence its name. So, if you use the encoder layer, e.g. `code = self.encoder(input_features)` at line 54 in the full source code, the `input_features` is passed onto the function body.
  3. In case I wasn't able to explain it more clearly in the first answer, the `intermediate_dim` will be the size of the code for the `input_features` when you pass it to the autoencoder.

I hope I was able to satisfy your questions. :)

1
begooboi•

Thank you for the clarification, you tutorial are a good help for me to learn tf.keras. Can you add GANs also to the tutorials?

1
afagarapOP•

You're welcome.

I'll see what I can do. :) Though the official tutorial in the TensorFlow website is already good.

2
begooboi•

Not the sequential or functional api but like how you made a model with class.

1
[deleted]•

[deleted]

1