neulab/docprompting-conala huggingface dataset:
tf.compat.v1.keras.layers.DenseFeatures A layer that produces a dense Tensor based on given feature_columns. Inherits From: Layer, Module 
tf.compat.v1.keras.layers.DenseFeatures(
    feature_columns, trainable=True, name=None, partitioner=None, **kwargs
)
 Generally a single example in training data is described with FeatureColumns. At the first layer of the model, this column-oriented data should be converted to a single Tensor. This layer can be called multiple times with different features. This is the V1 version of this layer that uses variable_scope's or partitioner to create variables which works well with PartitionedVariables. Variable scopes are deprecated in V2, so the V2 version uses name_scopes instead. But currently that lacks support for partitioned variables. Use this if you need partitioned variables. Use the partitioner argument if you have a Keras model and uses tf.compat.v1.keras.estimator.model_to_estimator for training. Example: price = tf.feature_column.numeric_column('price')
keywords_embedded = tf.feature_column.embedding_column(
    tf.feature_column.categorical_column_with_hash_bucket("keywords", 10K),
    dimension=16)
columns = [price, keywords_embedded, ...]
partitioner = tf.compat.v1.fixed_size_partitioner(num_shards=4)
feature_layer = tf.compat.v1.keras.layers.DenseFeatures(
    feature_columns=columns, partitioner=partitioner)

features = tf.io.parse_example(
    ..., features=tf.feature_column.make_parse_example_spec(columns))
dense_tensor = feature_layer(features)
for units in [128, 64, 32]:
  dense_tensor = tf.compat.v1.keras.layers.Dense(
                     units, activation='relu')(dense_tensor)
prediction = tf.compat.v1.keras.layers.Dense(1)(dense_tensor)

 


 Args
  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.  
  trainable   Boolean, whether the layer's variables will be updated via gradient descent during training.  
  name   Name to give to the DenseFeatures.  
  partitioner   Partitioner for input layer. Defaults to None.  
  **kwargs   Keyword arguments to construct a layer.   
 


 Raises
  ValueError   if an item in feature_columns is not a DenseColumn.
tf.compat.v1.keras.layers.disable_v2_dtype_behavior Disables the V2 dtype behavior for Keras layers. 
tf.compat.v1.keras.layers.disable_v2_dtype_behavior()
 See tf.compat.v1.keras.layers.enable_v2_dtype_behavior.
tf.compat.v1.keras.layers.enable_v2_dtype_behavior Enable the V2 dtype behavior for Keras layers. 
tf.compat.v1.keras.layers.enable_v2_dtype_behavior()
 By default, the V2 dtype behavior is enabled in TensorFlow 2, so this function is only useful if tf.compat.v1.disable_v2_behavior has been called. Since mixed precision requires V2 dtype behavior to be enabled, this function allows you to use mixed precision in Keras layers if disable_v2_behavior has been called. When enabled, the dtype of Keras layers defaults to floatx (which is typically float32) instead of None. In addition, layers will automatically cast floating-point inputs to the layer's dtype. 
x = tf.ones((4, 4, 4, 4), dtype='float64')
layer = tf.keras.layers.Conv2D(filters=4, kernel_size=2)
print(layer.dtype)  # float32 since V2 dtype behavior is enabled
float32
y = layer(x)  # Layer casts inputs since V2 dtype behavior is enabled
print(y.dtype.name)
float32
 A layer author can opt-out their layer from the automatic input casting by passing autocast=False to the base Layer's constructor. This disables the autocasting part of the V2 behavior for that layer, but not the defaulting to floatx part of the V2 behavior. When a global tf.keras.mixed_precision.Policy is set, a Keras layer's dtype will default to the global policy instead of floatx. Layers will automatically cast inputs to the policy's compute_dtype.
Module: tf.compat.v1.keras.layers.experimental Public API for tf.keras.layers.experimental namespace. Modules preprocessing module: Public API for tf.keras.layers.experimental.preprocessing namespace. Classes class EinsumDense: A layer that uses tf.einsum as the backing computation. class RandomFourierFeatures: Layer that projects its inputs into a random feature space.
Module: tf.compat.v1.keras.layers.experimental.preprocessing Public API for tf.keras.layers.experimental.preprocessing namespace. Classes class CategoryCrossing: Category crossing layer. class CategoryEncoding: CategoryEncoding layer. class CenterCrop: Crop the central portion of the images to target height and width. class Discretization: Buckets data into discrete ranges. class Hashing: Implements categorical feature hashing, also known as "hashing trick". class IntegerLookup: Maps integers from a vocabulary to integer indices. class Normalization: Feature-wise normalization of the data. class PreprocessingLayer: Base class for PreprocessingLayers. class RandomContrast: Adjust the contrast of an image or images by a random factor. class RandomCrop: Randomly crop the images to target height and width. class RandomFlip: Randomly flip each image horizontally and vertically. class RandomHeight: Randomly vary the height of a batch of images during training. class RandomRotation: Randomly rotate each image. class RandomTranslation: Randomly translate each image during training. class RandomWidth: Randomly vary the width of a batch of images during training. class RandomZoom: Randomly zoom each image during training. class Rescaling: Multiply inputs by scale and adds offset. class Resizing: Image resizing layer. class StringLookup: Maps strings from a vocabulary to integer indices. class TextVectorization: Text vectorization layer.
tf.compat.v1.keras.layers.experimental.preprocessing.IntegerLookup Maps integers from a vocabulary to integer indices. Inherits From: IntegerLookup, PreprocessingLayer, Layer, Module 
tf.compat.v1.keras.layers.experimental.preprocessing.IntegerLookup(
    max_values=None, num_oov_indices=1, mask_value=0, oov_value=-1, vocabulary=None,
    invert=False, **kwargs
)
 Methods adapt View source 
adapt(
    data, reset_state=True
)
 Fits the state of the preprocessing layer to the dataset. Overrides the default adapt method to apply relevant preprocessing to the inputs before passing to the combiner.
 


 Arguments
  data   The data to train on. It can be passed either as a tf.data Dataset, or as a numpy array.  
  reset_state   Optional argument specifying whether to clear the state of the layer at the start of the call to adapt. This must be True for this layer, which does not support repeated calls to adapt.    get_vocabulary View source 
get_vocabulary()
 set_vocabulary View source 
set_vocabulary(
    vocab
)
 Sets vocabulary data for this layer with inverse=False. This method sets the vocabulary for this layer directly, instead of analyzing a dataset through 'adapt'. It should be used whenever the vocab information is already known. If vocabulary data is already present in the layer, this method will either replace it
 


 Arguments
  vocab   An array of string tokens.   
 


 Raises
  ValueError   If there are too many inputs, the inputs do not match, or input data is missing.    vocab_size View source 
vocab_size()
tf.compat.v1.keras.layers.experimental.preprocessing.Normalization Feature-wise normalization of the data. Inherits From: Normalization, PreprocessingLayer, Layer, Module 
tf.compat.v1.keras.layers.experimental.preprocessing.Normalization(
    axis=-1, dtype=None, **kwargs
)
 This layer will coerce its inputs into a distribution centered around 0 with standard deviation 1. It accomplishes this by precomputing the mean and variance of the data, and calling (input-mean)/sqrt(var) at runtime. What happens in adapt: Compute mean and variance of the data and store them as the layer's weights. adapt should be called before fit, evaluate, or predict. Examples: Calculate the mean and variance by analyzing the dataset in adapt. 
adapt_data = np.array([[1.], [2.], [3.], [4.], [5.]], dtype=np.float32)
input_data = np.array([[1.], [2.], [3.]], np.float32)
layer = Normalization()
layer.adapt(adapt_data)
layer(input_data)
<tf.Tensor: shape=(3, 1), dtype=float32, numpy=
array([[-1.4142135 ],
       [-0.70710677],
       [ 0.        ]], dtype=float32)>
 Pass the mean and variance directly. 
input_data = np.array([[1.], [2.], [3.]], np.float32)
layer = Normalization(mean=3., variance=2.)
layer(input_data)
<tf.Tensor: shape=(3, 1), dtype=float32, numpy=
array([[-1.4142135 ],
       [-0.70710677],
       [ 0.        ]], dtype=float32)>

 


 Attributes
  axis   Integer or tuple of integers, the axis or axes that should be "kept". These axes are not be summed over when calculating the normalization statistics. By default the last axis, the features axis is kept and any space or time axes are summed. Each element in the the axes that are kept is normalized independently. If axis is set to 'None', the layer will perform scalar normalization (dividing the input by a single scalar value). The batch axis, 0, is always summed over (axis=0 is not allowed).  
  mean   The mean value(s) to use during normalization. The passed value(s) will be broadcast to the shape of the kept axes above; if the value(s) cannot be broadcast, an error will be raised when this layer's build() method is called.  
  variance   The variance value(s) to use during normalization. The passed value(s) will be broadcast to the shape of the kept axes above; if the value(s)cannot be broadcast, an error will be raised when this layer's build() method is called.    Methods adapt View source 
adapt(
    data, reset_state=True
)
 Fits the state of the preprocessing layer to the data being passed.
 


 Arguments
  data   The data to train on. It can be passed either as a tf.data Dataset, or as a numpy array.  
  reset_state   Optional argument specifying whether to clear the state of the layer at the start of the call to adapt, or whether to start from the existing state. Subclasses may choose to throw if reset_state is set to 'False'.
tf.compat.v1.keras.layers.experimental.preprocessing.StringLookup Maps strings from a vocabulary to integer indices. Inherits From: StringLookup, PreprocessingLayer, Layer, Module 
tf.compat.v1.keras.layers.experimental.preprocessing.StringLookup(
    max_tokens=None, num_oov_indices=1, mask_token='',
    oov_token='[UNK]', vocabulary=None, encoding=None, invert=False,
    **kwargs
)
 Methods adapt View source 
adapt(
    data, reset_state=True
)
 Fits the state of the preprocessing layer to the dataset. Overrides the default adapt method to apply relevant preprocessing to the inputs before passing to the combiner.
 


 Arguments
  data   The data to train on. It can be passed either as a tf.data Dataset, or as a numpy array.  
  reset_state   Optional argument specifying whether to clear the state of the layer at the start of the call to adapt. This must be True for this layer, which does not support repeated calls to adapt.    get_vocabulary View source 
get_vocabulary()
 set_vocabulary View source 
set_vocabulary(
    vocab
)
 Sets vocabulary data for this layer with inverse=False. This method sets the vocabulary for this layer directly, instead of analyzing a dataset through 'adapt'. It should be used whenever the vocab information is already known. If vocabulary data is already present in the layer, this method will either replace it
 


 Arguments
  vocab   An array of string tokens.   
 


 Raises
  ValueError   If there are too many inputs, the inputs do not match, or input data is missing.    vocab_size View source 
vocab_size()
Module: tf.compat.v1.keras.mixed_precision Keras mixed precision API. See the mixed precision guide to learn how to use the API. Modules experimental module: Public API for tf.keras.mixed_precision.experimental namespace. Classes class LossScaleOptimizer: An optimizer that applies loss scaling to prevent numeric underflow.
Module: tf.compat.v1.keras.mixed_precision.experimental Public API for tf.keras.mixed_precision.experimental namespace. Classes class LossScaleOptimizer: An deprecated optimizer that applies loss scaling.
Module: tf.compat.v1.keras.models Code for model cloning, plus model-related API entries. Classes class Model: Model groups layers into an object with training and inference features. class Sequential: Sequential groups a linear stack of layers into a tf.keras.Model. Functions clone_model(...): Clone any Model instance. load_model(...): Loads a model saved via model.save(). model_from_config(...): Instantiates a Keras model from its config. model_from_json(...): Parses a JSON model configuration string and returns a model instance. model_from_yaml(...): Parses a yaml model configuration file and returns a model instance. save_model(...): Saves a model as a TensorFlow SavedModel or HDF5 file.
Module: tf.compat.v1.keras.optimizers Built-in optimizer classes. For more examples see the base class tf.keras.optimizers.Optimizer. Modules schedules module: Public API for tf.keras.optimizers.schedules namespace. Classes class Adadelta: Optimizer that implements the Adadelta algorithm. class Adagrad: Optimizer that implements the Adagrad algorithm. class Adam: Optimizer that implements the Adam algorithm. class Adamax: Optimizer that implements the Adamax algorithm. class Ftrl: Optimizer that implements the FTRL algorithm. class Nadam: Optimizer that implements the NAdam algorithm. class Optimizer: Base class for Keras optimizers. class RMSprop: Optimizer that implements the RMSprop algorithm. class SGD: Gradient descent (with momentum) optimizer. Functions deserialize(...): Inverse of the serialize function. get(...): Retrieves a Keras Optimizer instance. serialize(...)
Module: tf.compat.v1.keras.optimizers.schedules Public API for tf.keras.optimizers.schedules namespace. Classes class ExponentialDecay: A LearningRateSchedule that uses an exponential decay schedule. class InverseTimeDecay: A LearningRateSchedule that uses an inverse time decay schedule. class LearningRateSchedule: A serializable learning rate decay schedule. class PiecewiseConstantDecay: A LearningRateSchedule that uses a piecewise constant decay schedule. class PolynomialDecay: A LearningRateSchedule that uses a polynomial decay schedule. Functions deserialize(...) serialize(...)
Module: tf.compat.v1.keras.preprocessing Keras data preprocessing utils. Modules image module: Set of tools for real-time data augmentation on image data. sequence module: Utilities for preprocessing sequence data. text module: Utilities for text input preprocessing.
Module: tf.compat.v1.keras.preprocessing.image Set of tools for real-time data augmentation on image data. Classes class DirectoryIterator: Iterator capable of reading images from a directory on disk. class ImageDataGenerator: Generate batches of tensor image data with real-time data augmentation. class Iterator: Base class for image data iterators. class NumpyArrayIterator: Iterator yielding data from a Numpy array. Functions apply_affine_transform(...): Applies an affine transformation specified by the parameters given. apply_brightness_shift(...): Performs a brightness shift. apply_channel_shift(...): Performs a channel shift. array_to_img(...): Converts a 3D Numpy array to a PIL Image instance. img_to_array(...): Converts a PIL Image instance to a Numpy array. load_img(...): Loads an image into PIL format. random_brightness(...): Performs a random brightness shift. random_channel_shift(...): Performs a random channel shift. random_rotation(...): Performs a random rotation of a Numpy image tensor. random_shear(...): Performs a random spatial shear of a Numpy image tensor. random_shift(...): Performs a random spatial shift of a Numpy image tensor. random_zoom(...): Performs a random spatial zoom of a Numpy image tensor. save_img(...): Saves an image stored as a Numpy array to a path or file object.
Module: tf.compat.v1.keras.preprocessing.sequence Utilities for preprocessing sequence data. Classes class TimeseriesGenerator: Utility class for generating batches of temporal data. Functions make_sampling_table(...): Generates a word rank-based probabilistic sampling table. pad_sequences(...): Pads sequences to the same length. skipgrams(...): Generates skipgram word pairs.
Module: tf.compat.v1.keras.preprocessing.text Utilities for text input preprocessing. Classes class Tokenizer: Text tokenization utility class. Functions hashing_trick(...): Converts a text to a sequence of indexes in a fixed-size hashing space. one_hot(...): One-hot encodes a text into a list of word indexes of size n. text_to_word_sequence(...): Converts a text to a sequence of words (or tokens). tokenizer_from_json(...): Parses a JSON tokenizer configuration file and returns a
Module: tf.compat.v1.keras.regularizers Built-in regularizers. Classes class L1: A regularizer that applies a L1 regularization penalty. class L1L2: A regularizer that applies both L1 and L2 regularization penalties. class L2: A regularizer that applies a L2 regularization penalty. class Regularizer: Regularizer base class. class l1: A regularizer that applies a L1 regularization penalty. class l2: A regularizer that applies a L2 regularization penalty. Functions deserialize(...) get(...): Retrieve a regularizer instance from a config or identifier. l1_l2(...): Create a regularizer that applies both L1 and L2 penalties. serialize(...)
Module: tf.compat.v1.keras.utils Public API for tf.keras.utils namespace. Classes class CustomObjectScope: Exposes custom classes/functions to Keras deserialization internals. class GeneratorEnqueuer: Builds a queue out of a data generator. class OrderedEnqueuer: Builds a Enqueuer from a Sequence. class Progbar: Displays a progress bar. class Sequence: Base object for fitting to a sequence of data, such as a dataset. class SequenceEnqueuer: Base class to enqueue inputs. class custom_object_scope: Exposes custom classes/functions to Keras deserialization internals. Functions deserialize_keras_object(...): Turns the serialized form of a Keras object back into an actual object. get_custom_objects(...): Retrieves a live reference to the global dictionary of custom objects. get_file(...): Downloads a file from a URL if it not already in the cache. get_registered_name(...): Returns the name registered to an object within the Keras framework. get_registered_object(...): Returns the class associated with name if it is registered with Keras. get_source_inputs(...): Returns the list of input tensors necessary to compute tensor. model_to_dot(...): Convert a Keras model to dot format. normalize(...): Normalizes a Numpy array. plot_model(...): Converts a Keras model to dot format and save to a file. register_keras_serializable(...): Registers an object with the Keras serialization framework. serialize_keras_object(...): Serialize a Keras object into a JSON-compatible representation. to_categorical(...): Converts a class vector (integers) to binary class matrix.
Module: tf.compat.v1.keras.wrappers Public API for tf.keras.wrappers namespace. Modules scikit_learn module: Wrapper for using the Scikit-Learn API with Keras models.
Module: tf.compat.v1.keras.wrappers.scikit_learn Wrapper for using the Scikit-Learn API with Keras models. Classes class KerasClassifier: Implementation of the scikit-learn classifier API for Keras. class KerasRegressor: Implementation of the scikit-learn regressor API for Keras.
Module: tf.compat.v1.layers Public API for tf.layers namespace. Modules experimental module: Public API for tf.layers.experimental namespace. Classes class AveragePooling1D: Average Pooling layer for 1D inputs. class AveragePooling2D: Average pooling layer for 2D inputs (e.g. images). class AveragePooling3D: Average pooling layer for 3D inputs (e.g. volumes). class BatchNormalization: Batch Normalization layer from (Ioffe et al., 2015). class Conv1D: 1D convolution layer (e.g. temporal convolution). class Conv2D: 2D convolution layer (e.g. spatial convolution over images). class Conv2DTranspose: Transposed 2D convolution layer (sometimes called 2D Deconvolution). class Conv3D: 3D convolution layer (e.g. spatial convolution over volumes). class Conv3DTranspose: Transposed 3D convolution layer (sometimes called 3D Deconvolution). class Dense: Densely-connected layer class. class Dropout: Applies Dropout to the input. class Flatten: Flattens an input tensor while preserving the batch axis (axis 0). class InputSpec: Specifies the rank, dtype and shape of every input to a layer. class Layer: Base layer class. class MaxPooling1D: Max Pooling layer for 1D inputs. class MaxPooling2D: Max pooling layer for 2D inputs (e.g. images). class MaxPooling3D: Max pooling layer for 3D inputs (e.g. volumes). class SeparableConv1D: Depthwise separable 1D convolution. class SeparableConv2D: Depthwise separable 2D convolution. Functions average_pooling1d(...): Average Pooling layer for 1D inputs. average_pooling2d(...): Average pooling layer for 2D inputs (e.g. images). average_pooling3d(...): Average pooling layer for 3D inputs (e.g. volumes). batch_normalization(...): Functional interface for the batch normalization layer from_config(Ioffe et al., 2015). conv1d(...): Functional interface for 1D convolution layer (e.g. temporal convolution). conv2d(...): Functional interface for the 2D convolution layer. conv2d_transpose(...): Functional interface for transposed 2D convolution layer. conv3d(...): Functional interface for the 3D convolution layer. conv3d_transpose(...): Functional interface for transposed 3D convolution layer. dense(...): Functional interface for the densely-connected layer. dropout(...): Applies Dropout to the input. flatten(...): Flattens an input tensor while preserving the batch axis (axis 0). max_pooling1d(...): Max Pooling layer for 1D inputs. max_pooling2d(...): Max pooling layer for 2D inputs (e.g. images). max_pooling3d(...): Max pooling layer for 3D inputs (e.g. separable_conv1d(...): Functional interface for the depthwise separable 1D convolution layer. separable_conv2d(...): Functional interface for the depthwise separable 2D convolution layer.
tf.compat.v1.layers.AveragePooling1D Average Pooling layer for 1D inputs. Inherits From: AveragePooling1D, Layer, Layer, Module 
tf.compat.v1.layers.AveragePooling1D(
    pool_size, strides, padding='valid',
    data_format='channels_last', name=None, **kwargs
)

 


 Arguments
  pool_size   An integer or tuple/list of a single integer, representing the size of the pooling window.  
  strides   An integer or tuple/list of a single integer, specifying the strides of the pooling operation.  
  padding   A string. The padding method, either 'valid' or 'same'. Case-insensitive.  
  data_format   A string, one of channels_last (default) or channels_first. The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch, length, channels) while channels_first corresponds to inputs with shape (batch, channels, length).  
  name   A string, the name of the layer.   
 


 Attributes
  graph  
 
  scope_name
tf.compat.v1.layers.AveragePooling2D Average pooling layer for 2D inputs (e.g. images). Inherits From: AveragePooling2D, Layer, Layer, Module 
tf.compat.v1.layers.AveragePooling2D(
    pool_size, strides, padding='valid',
    data_format='channels_last', name=None, **kwargs
)

 


 Arguments
  pool_size   An integer or tuple/list of 2 integers: (pool_height, pool_width) specifying the size of the pooling window. Can be a single integer to specify the same value for all spatial dimensions.  
  strides   An integer or tuple/list of 2 integers, specifying the strides of the pooling operation. Can be a single integer to specify the same value for all spatial dimensions.  
  padding   A string. The padding method, either 'valid' or 'same'. Case-insensitive.  
  data_format   A string. The ordering of the dimensions in the inputs. channels_last (default) and channels_first are supported. channels_last corresponds to inputs with shape (batch, height, width, channels) while channels_first corresponds to inputs with shape (batch, channels, height, width).  
  name   A string, the name of the layer.   
 


 Attributes
  graph  
 
  scope_name