Type Embedding
Namespace tensorflow.keras.layers
Parent Layer
Interfaces IEmbedding
Turns positive integers (indexes) into dense vectors of fixed size. e.g. `[[4], [20]] -> [[0.25, 0.1], [0.6, -0.2]]` This layer can only be used as the first layer in a model. Example:
Show Example
model = Sequential() model.add(Embedding(1000, 64, input_length=10)) # the model will take as input an integer matrix of size (batch, # input_length). # the largest integer (i.e. word index) in the input should be no larger # than 999 (vocabulary size). # now model.output_shape == (None, 10, 64), where None is the batch # dimension. input_array = np.random.randint(1000, size=(32, 10)) model.compile('rmsprop', 'mse') output_array = model.predict(input_array) assert output_array.shape == (32, 10, 64)
Methods
Properties
- activity_regularizer
- activity_regularizer_dyn
- built
- dtype
- dtype_dyn
- dynamic
- dynamic_dyn
- embeddings
- embeddings_constraint
- embeddings_initializer
- embeddings_regularizer
- inbound_nodes
- inbound_nodes_dyn
- input
- input_dim
- input_dyn
- input_length
- input_mask
- input_mask_dyn
- input_shape
- input_shape_dyn
- input_spec
- input_spec_dyn
- losses
- losses_dyn
- mask_zero
- metrics
- metrics_dyn
- name
- name_dyn
- name_scope
- name_scope_dyn
- non_trainable_variables
- non_trainable_variables_dyn
- non_trainable_weights
- non_trainable_weights_dyn
- outbound_nodes
- outbound_nodes_dyn
- output
- output_dim
- output_dyn
- output_mask
- output_mask_dyn
- output_shape
- output_shape_dyn
- PythonObject
- stateful
- submodules
- submodules_dyn
- supports_masking
- trainable
- trainable_dyn
- trainable_variables
- trainable_variables_dyn
- trainable_weights
- trainable_weights_dyn
- updates
- updates_dyn
- variables
- variables_dyn
- weights
- weights_dyn
Public static methods
Embedding NewDyn(object input_dim, object output_dim, ImplicitContainer<T> embeddings_initializer, object embeddings_regularizer, object activity_regularizer, object embeddings_constraint, ImplicitContainer<T> mask_zero, object input_length, IDictionary<string, object> kwargs)
Public properties
object activity_regularizer get; set;
Optional regularizer function for the output of this layer.