metarl.tf.embeddings.encoder module¶
Encoders in TensorFlow.
-
class
Encoder(name)[source]¶ Bases:
metarl.np.embeddings.encoder.Encoder,metarl.tf.models.module.ModuleBase class for encoders in TensorFlow.
-
clone(name)[source]¶ Return a clone of the encoder.
It only copies the configuration of the primitive, not the parameters.
Parameters: name (str) – Name of the newly created encoder. It has to be different from source encoder if cloned under the same computational graph. Returns: Newly cloned encoder. Return type: metarl.tf.embeddings.encoder.Encoder
-
get_latent(input_value)[source]¶ Get a sample of embedding for the given input.
Parameters: input_value (numpy.ndarray) – Tensor to encode. Returns: An embedding sampled from embedding distribution. dict: Embedding distribution information. Return type: numpy.ndarray Note
It returns an embedding and a dict, with keys - mean (numpy.ndarray): Mean of the distribution. - log_std (numpy.ndarray): Log standard deviation of the
distribution.
-
get_latents(input_values)[source]¶ Get samples of embedding for the given inputs.
Parameters: input_values (numpy.ndarray) – Tensors to encode. Returns: Embeddings sampled from embedding distribution. dict: Embedding distribution information. Return type: numpy.ndarray Note
It returns an embedding and a dict, with keys - mean (list[numpy.ndarray]): Means of the distribution. - log_std (list[numpy.ndarray]): Log standard deviations of the
distribution.
-
-
class
StochasticEncoder(name)[source]¶ Bases:
metarl.np.embeddings.encoder.StochasticEncoder,metarl.tf.models.module.StochasticModuleBase class for stochastic encoders in TensorFlow.