Module: tf.contrib.layers

Ops for building neural network layers, regularizers, summaries, etc.

Modules

feature_column module: This API defines FeatureColumn abstraction.

summaries module: Utility functions for summary creation.

Classes

class GDN: Generalized divisive normalization layer.

class RevBlock: Block of reversible layers. See rev_block.

Functions

apply_regularization(...): Returns the summed penalty by applying regularizer to the weights_list.

avg_pool2d(...): Adds a 2D average pooling op.

avg_pool3d(...): Adds a 3D average pooling op.

batch_norm(...): Adds a Batch Normalization layer from http://arxiv.org/abs/1502.03167

bias_add(...): Adds a bias to the inputs.

bow_encoder(...): Maps a sequence of symbols to a vector per example by averaging embeddings.

bucketized_column(...): Creates a _BucketizedColumn for discretizing dense input.

check_feature_columns(...): Checks the validity of the set of FeatureColumns.

conv1d(...): Adds an N-D convolution followed by an optional batch_norm layer.

conv2d(...): Adds an N-D convolution followed by an optional batch_norm layer.

conv2d_in_plane(...): Performs the same in-plane convolution to each channel independently.

conv2d_transpose(...): Adds a convolution2d_transpose with an optional batch normalization layer.

conv3d(...): Adds an N-D convolution followed by an optional batch_norm layer.

conv3d_transpose(...): Adds a convolution3d_transpose with an optional batch normalization layer.

convolution(...): Adds an N-D convolution followed by an optional batch_norm layer.

convolution1d(...): Adds an N-D convolution followed by an optional batch_norm layer.

convolution2d(...): Adds an N-D convolution followed by an optional batch_norm layer.

convolution2d_in_plane(...): Performs the same in-plane convolution to each channel independently.

convolution2d_transpose(...): Adds a convolution2d_transpose with an optional batch normalization layer.

convolution3d(...): Adds an N-D convolution followed by an optional batch_norm layer.

convolution3d_transpose(...): Adds a convolution3d_transpose with an optional batch normalization layer.

create_feature_spec_for_parsing(...): Helper that prepares features config from input feature_columns.

crossed_column(...): Creates a _CrossedColumn for performing feature crosses.

dense_to_sparse(...): Converts a dense tensor into a sparse tensor.

dropout(...): Returns a dropout op applied to the input.

elu(...): partial(func, *args, **keywords) - new function with partial application

embed_sequence(...): Maps a sequence of symbols to a sequence of embeddings.

embedding_column(...): Creates an _EmbeddingColumn for feeding sparse data into a DNN.

embedding_lookup_unique(...): Version of embedding_lookup that avoids duplicate lookups.

flatten(...): Flattens the input while maintaining the batch_size.

fully_connected(...): Adds a fully connected layer.

gdn(...): Functional interface for GDN layer.

group_norm(...): Functional interface for the group normalization layer.

images_to_sequence(...): Convert a batch of images into a batch of sequences.

infer_real_valued_columns(...)

input_from_feature_columns(...): A tf.contrib.layers style input layer builder based on FeatureColumns.

instance_norm(...): Functional interface for the instance normalization layer.

joint_weighted_sum_from_feature_columns(...): A restricted linear prediction builder based on FeatureColumns.

l1_l2_regularizer(...): Returns a function that can be used to apply L1 L2 regularizations.

l1_regularizer(...): Returns a function that can be used to apply L1 regularization to weights.

l2_regularizer(...): Returns a function that can be used to apply L2 regularization to weights.

layer_norm(...): Adds a Layer Normalization layer.

legacy_fully_connected(...): Adds the parameters for a fully connected layer and returns the output.

legacy_linear(...): partial(func, *args, **keywords) - new function with partial application

legacy_relu(...): partial(func, *args, **keywords) - new function with partial application

linear(...): partial(func, *args, **keywords) - new function with partial application

make_place_holder_tensors_for_base_features(...): Returns placeholder tensors for inference.

max_pool2d(...): Adds a 2D Max Pooling op.

max_pool3d(...): Adds a 3D Max Pooling op.

maxout(...): Adds a maxout op from https://arxiv.org/abs/1302.4389

multi_class_target(...): Creates a _TargetColumn for multi class single label classification. (deprecated)

one_hot_column(...): Creates an _OneHotColumn for a one-hot or multi-hot repr in a DNN.

one_hot_encoding(...): Transform numeric labels into onehot_labels using tf.one_hot.

optimize_loss(...): Given loss and parameters for optimizer, returns a training op.

parse_feature_columns_from_examples(...): Parses tf.Examples to extract tensors for given feature_columns.

parse_feature_columns_from_sequence_examples(...): Parses tf.SequenceExamples to extract tensors for given FeatureColumns.

real_valued_column(...): Creates a _RealValuedColumn for dense numeric data.

recompute_grad(...): Decorator that recomputes the function on the backwards pass.

regression_target(...): Creates a _TargetColumn for linear regression. (deprecated)

relu(...): partial(func, *args, **keywords) - new function with partial application

relu6(...): partial(func, *args, **keywords) - new function with partial application

repeat(...): Applies the same layer with the same arguments repeatedly.

rev_block(...): A block of reversible residual layers.

safe_embedding_lookup_sparse(...): Lookup embedding results, accounting for invalid IDs and empty features.

scale_gradient(...): _OverloadedFunction encapsulates an overloaded function.

scattered_embedding_column(...): Creates an embedding column of a sparse feature using parameter hashing.

separable_conv2d(...): Adds a depth-separable 2D convolution with optional batch_norm layer.

separable_convolution2d(...): Adds a depth-separable 2D convolution with optional batch_norm layer.

sequence_input_from_feature_columns(...): Builds inputs for sequence models from FeatureColumns. (experimental)

sequence_to_images(...): Convert a batch of sequences into a batch of images.

shared_embedding_columns(...): Creates a list of _EmbeddingColumn sharing the same embedding.

softmax(...): Performs softmax on Nth dimension of N-dimensional logit tensor.

sparse_column_with_hash_bucket(...): Creates a _SparseColumn with hashed bucket configuration.

sparse_column_with_integerized_feature(...): Creates an integerized _SparseColumn.

sparse_column_with_keys(...): Creates a _SparseColumn with keys.

sparse_column_with_vocabulary_file(...): Creates a _SparseColumn with vocabulary file configuration.

spatial_softmax(...): Computes the spatial softmax of a convolutional feature map.

stack(...): Builds a stack of layers by applying layer repeatedly using stack_args.

sum_regularizer(...): Returns a function that applies the sum of multiple regularizers.

summarize_activation(...): Summarize an activation.

summarize_activations(...): Summarize activations, using summarize_activation to summarize.

summarize_collection(...): Summarize a graph collection of tensors, possibly filtered by name.

summarize_tensor(...): Summarize a tensor using a suitable summary type.

summarize_tensors(...): Summarize a set of tensors.

transform_features(...): Returns transformed features based on features columns passed in.

unit_norm(...): Normalizes the given input across the specified dimension to unit length.

variance_scaling_initializer(...): Returns an initializer that generates tensors without scaling variance.

weighted_sparse_column(...): Creates a _SparseColumn by combining sparse_id_column with a weight column.

weighted_sum_from_feature_columns(...): A tf.contrib.layers style linear prediction builder based on FeatureColumn.

xavier_initializer(...): Returns an initializer performing "Xavier" initialization for weights.

xavier_initializer_conv2d(...): Returns an initializer performing "Xavier" initialization for weights.

Other Members

  • OPTIMIZER_CLS_NAMES
  • OPTIMIZER_SUMMARIES
  • SPARSE_FEATURE_CROSS_DEFAULT_HASH_KEY = 956888297470

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/layers