LostTech.TensorFlow : API Documentation

Type SequenceFeatures

Namespace tensorflow.keras.experimental

Parent _BaseFeaturesLayer

Interfaces ISequenceFeatures

A layer for sequence input.

All `feature_columns` must be sequence dense columns with the same `sequence_length`. The output of this method can be fed into sequence networks, such as RNN.

The output of this method is a 3D `Tensor` of shape `[batch_size, T, D]`. `T` is the maximum sequence length for this batch, which could differ from batch to batch.

If multiple `feature_columns` are given with `Di` `num_elements` each, their outputs are concatenated. So, the final `Tensor` has shape `[batch_size, T, D0 + D1 +... + Dn]`.

Example:
Show Example
rating = sequence_numeric_column('rating')
            watches = sequence_categorical_column_with_identity(
                'watches', num_buckets=1000)
            watches_embedding = embedding_column(watches, dimension=10)
            columns = [rating, watches_embedding] 

sequence_input_layer = SequenceFeatures(columns) features = tf.io.parse_example(..., features=make_parse_example_spec(columns)) sequence_input, sequence_length = sequence_input_layer(features) sequence_length_mask = tf.sequence_mask(sequence_length)

rnn_cell = tf.keras.layers.SimpleRNNCell(hidden_size) rnn_layer = tf.keras.layers.RNN(rnn_cell) outputs, state = rnn_layer(sequence_input, mask=sequence_length_mask)

Methods

Properties

Public instance methods

Tensor call(PythonClassContainer features)

Tensor call(string features)

Tensor call(IndexedSlices features)

Public static methods

SequenceFeatures NewDyn(object feature_columns, ImplicitContainer<T> trainable, object name, IDictionary<string, object> kwargs)

Constructs a DenseFeatures layer.
Parameters
object feature_columns
An iterable containing the FeatureColumns to use as inputs to your model. All items should be instances of classes derived from `DenseColumn` such as `numeric_column`, `embedding_column`, `bucketized_column`, `indicator_column`. If you have categorical features, you can wrap them with an `embedding_column` or `indicator_column`.
ImplicitContainer<T> trainable
Boolean, whether the layer's variables will be updated via gradient descent during training.
object name
Name to give to the DenseFeatures.
IDictionary<string, object> kwargs
Keyword arguments to construct a layer.

Public properties

PythonFunctionContainer activity_regularizer get; set;

object activity_regularizer_dyn get; set;

bool built get; set;

object dtype get;

object dtype_dyn get;

bool dynamic get;

object dynamic_dyn get;

IList<Node> inbound_nodes get;

object inbound_nodes_dyn get;

IList<object> input get;

object input_dyn get;

object input_mask get;

object input_mask_dyn get;

IList<object> input_shape get;

object input_shape_dyn get;

object input_spec get; set;

object input_spec_dyn get; set;

IList<object> losses get;

object losses_dyn get;

IList<object> metrics get;

object metrics_dyn get;

object name get;

object name_dyn get;

object name_scope get;

object name_scope_dyn get;

IList<object> non_trainable_variables get;

object non_trainable_variables_dyn get;

IList<object> non_trainable_weights get;

object non_trainable_weights_dyn get;

IList<object> outbound_nodes get;

object outbound_nodes_dyn get;

IList<object> output get;

object output_dyn get;

object output_mask get;

object output_mask_dyn get;

object output_shape get;

object output_shape_dyn get;

object PythonObject get;

bool stateful get; set;

ValueTuple<object> submodules get;

object submodules_dyn get;

bool supports_masking get; set;

bool trainable get; set;

object trainable_dyn get; set;

object trainable_variables get;

object trainable_variables_dyn get;

IList<object> trainable_weights get;

object trainable_weights_dyn get;

IList<object> updates get;

object updates_dyn get;

object variables get;

object variables_dyn get;

IList<object> weights get;

object weights_dyn get;