LostTech.TensorFlow : API Documentation

Type feature_column

Namespace tensorflow.python.tpu.feature_column

Public static methods

_TPUEmbeddingColumn embedding_column(IdentityCategoricalColumn categorical_column, int dimension, string combiner, Initializer initializer, int max_sequence_length, PythonFunctionContainer learning_rate_fn)

_TPUEmbeddingColumn embedding_column(IdentityCategoricalColumn categorical_column, int dimension, string combiner, object initializer, int max_sequence_length, PythonFunctionContainer learning_rate_fn)

object embedding_column_dyn(object categorical_column, object dimension, ImplicitContainer<T> combiner, object initializer, ImplicitContainer<T> max_sequence_length, object learning_rate_fn)

TPU version of `tf.compat.v1.feature_column.embedding_column`.

Note that the interface for tf.tpu.experimental.embedding_column is different from that of `tf.compat.v1.feature_column.embedding_column`: The following arguments are NOT supported: `ckpt_to_load_from`, `tensor_name_in_ckpt`, `max_norm` and `trainable`.

Use this function in place of `tf.compat.v1.feature_column.embedding_column` when you want to use the TPU to accelerate your embedding lookups via TPU embeddings.

``` column = tf.feature_column.categorical_column_with_identity(...) tpu_column = tf.tpu.experimental.embedding_column(column, 10) ... def model_fn(features): dense_feature = tf.keras.layers.DenseFeature(tpu_column) embedded_feature = dense_feature(features) ...

estimator = tf.estimator.tpu.TPUEstimator( model_fn=model_fn, ... embedding_config_spec=tf.estimator.tpu.experimental.EmbeddingConfigSpec( column=[tpu_column], ...)) ```
Parameters
object categorical_column
A categorical column returned from `categorical_column_with_identity`, `weighted_categorical_column`, `categorical_column_with_vocabulary_file`, `categorical_column_with_vocabulary_list`, `sequence_categorical_column_with_identity`, `sequence_categorical_column_with_vocabulary_file`, `sequence_categorical_column_with_vocabulary_list`
object dimension
An integer specifying dimension of the embedding, must be > 0.
ImplicitContainer<T> combiner
A string specifying how to reduce if there are multiple entries in a single row for a non-sequence column. For more information, see tf.feature_column.embedding_column.
object initializer
A variable initializer function to be used in embedding variable initialization. If not specified, defaults to `tf.compat.v1.truncated_normal_initializer` with mean `0.0` and standard deviation `1/sqrt(dimension)`.
ImplicitContainer<T> max_sequence_length
An non-negative integer specifying the max sequence length. Any sequence shorter then this will be padded with 0 embeddings and any sequence longer will be truncated. This must be positive for sequence features and 0 for non-sequence features.
object learning_rate_fn
A function that takes global step and returns learning rate for the embedding table.
Returns
object
A `_TPUEmbeddingColumnV2`.

string get_sequence_length_feature_key_name_from_feature_key_name(object feature_name)

object get_sequence_length_feature_key_name_from_feature_key_name_dyn(object feature_name)

IList<_TPUSharedEmbeddingColumn> shared_embedding_columns(IEnumerable<IdentityCategoricalColumn> categorical_columns, int dimension, string combiner, object initializer, string shared_embedding_collection_name, object max_sequence_lengths, PythonFunctionContainer learning_rate_fn)

object shared_embedding_columns_dyn(object categorical_columns, object dimension, ImplicitContainer<T> combiner, object initializer, object shared_embedding_collection_name, object max_sequence_lengths, object learning_rate_fn)

TPU version of `tf.compat.v1.feature_column.shared_embedding_columns`.

Note that the interface for tf.tpu.experimental.shared_embedding_columns is different from that of `tf.compat.v1.feature_column.shared_embedding_columns`: The following arguments are NOT supported: `ckpt_to_load_from`, `tensor_name_in_ckpt`, `max_norm` and `trainable`.

Use this function in place of tf.compat.v1.feature_column.shared_embedding_columns` when you want to use the TPU to accelerate your embedding lookups via TPU embeddings.

``` column_a = tf.feature_column.categorical_column_with_identity(...) column_b = tf.feature_column.categorical_column_with_identity(...) tpu_columns = tf.tpu.experimental.shared_embedding_columns( [column_a, column_b], 10) ... def model_fn(features): dense_feature = tf.keras.layers.DenseFeature(tpu_columns) embedded_feature = dense_feature(features) ...

estimator = tf.estimator.tpu.TPUEstimator( model_fn=model_fn, ... embedding_config_spec=tf.estimator.tpu.experimental.EmbeddingConfigSpec( column=tpu_columns, ...)) ```
Parameters
object categorical_columns
A list of categorical columns returned from `categorical_column_with_identity`, `weighted_categorical_column`, `categorical_column_with_vocabulary_file`, `categorical_column_with_vocabulary_list`, `sequence_categorical_column_with_identity`, `sequence_categorical_column_with_vocabulary_file`, `sequence_categorical_column_with_vocabulary_list`
object dimension
An integer specifying dimension of the embedding, must be > 0.
ImplicitContainer<T> combiner
A string specifying how to reduce if there are multiple entries in a single row for a non-sequence column. For more information, see tf.feature_column.embedding_column.
object initializer
A variable initializer function to be used in embedding variable initialization. If not specified, defaults to tf.truncated_normal_initializer with mean `0.0` and standard deviation `1/sqrt(dimension)`.
object shared_embedding_collection_name
Optional name of the collection where shared embedding weights are added. If not given, a reasonable name will be chosen based on the names of `categorical_columns`. This is also used in `variable_scope` when creating shared embedding weights.
object max_sequence_lengths
An list of non-negative integers, either None or empty or the same length as the argument categorical_columns. Entries corresponding to non-sequence columns must be 0 and entries corresponding to sequence columns specify the max sequence length for the column. Any sequence shorter then this will be padded with 0 embeddings and any sequence longer will be truncated.
object learning_rate_fn
A function that takes global step and returns learning rate for the embedding table.
Returns
object
A list of `_TPUSharedEmbeddingColumnV2`.

ValueTuple<IList<object>, object> split_sequence_columns(object feature_columns)

object split_sequence_columns_dyn(object feature_columns)

Public properties

PythonFunctionContainer _TPUBaseEmbeddingColumn_fn get;

PythonFunctionContainer _TPUEmbeddingColumn_fn get;

PythonFunctionContainer _TPUSharedEmbeddingColumn_fn get;

PythonFunctionContainer embedding_column_fn get;

PythonFunctionContainer get_sequence_length_feature_key_name_from_feature_key_name_fn get;

PythonFunctionContainer shared_embedding_columns_fn get;

PythonFunctionContainer split_sequence_columns_fn get;