neulab/docprompting-conala huggingface dataset:
tf.keras.layers.experimental.preprocessing.Normalization Feature-wise normalization of the data. Inherits From: PreprocessingLayer, Layer, Module 
tf.keras.layers.experimental.preprocessing.Normalization(
    axis=-1, dtype=None, mean=None, variance=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.keras.layers.experimental.preprocessing.PreprocessingLayer Base class for PreprocessingLayers. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.PreprocessingLayer  
tf.keras.layers.experimental.preprocessing.PreprocessingLayer(
    trainable=True, name=None, dtype=None, dynamic=False, **kwargs
)
 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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.RandomContrast Adjust the contrast of an image or images by a random factor. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.RandomContrast  
tf.keras.layers.experimental.preprocessing.RandomContrast(
    factor, seed=None, name=None, **kwargs
)
 Contrast is adjusted independently for each channel of each image during training. For each channel, this layer computes the mean of the image pixels in the channel and then adjusts each component x of each pixel to (x - mean) * contrast_factor + mean. Input shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'. Output shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'.
 


 Raise
  ValueError   if lower bound is not between [0, 1], or upper bound is negative.   
 


 Attributes
  factor   a positive float represented as fraction of value, or a tuple of size 2 representing lower and upper bound. When represented as a single float, lower = upper. The contrast factor will be randomly picked between [1.0 - lower, 1.0 + upper].  
  seed   Integer. Used to create a random seed.  
  name   A string, the name of the layer.    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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.RandomCrop Randomly crop the images to target height and width. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.RandomCrop  
tf.keras.layers.experimental.preprocessing.RandomCrop(
    height, width, seed=None, name=None, **kwargs
)
 This layer will crop all the images in the same batch to the same cropping location. By default, random cropping is only applied during training. At inference time, the images will be first rescaled to preserve the shorter side, and center cropped. If you need to apply random cropping at inference time, set training to True when calling the layer. Input shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'. Output shape: 4D tensor with shape: (samples, target_height, target_width, channels).
 


 Arguments
  height   Integer, the height of the output shape.  
  width   Integer, the width of the output shape.  
  seed   Integer. Used to create a random seed.  
  name   A string, the name of the layer.    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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.RandomFlip Randomly flip each image horizontally and vertically. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.RandomFlip  
tf.keras.layers.experimental.preprocessing.RandomFlip(
    mode=HORIZONTAL_AND_VERTICAL, seed=None, name=None, **kwargs
)
 This layer will flip the images based on the mode attribute. During inference time, the output will be identical to input. Call the layer with training=True to flip the input. Input shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'. Output shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'.
 


 Attributes
  mode   String indicating which flip mode to use. Can be "horizontal", "vertical", or "horizontal_and_vertical". Defaults to "horizontal_and_vertical". "horizontal" is a left-right flip and "vertical" is a top-bottom flip.  
  seed   Integer. Used to create a random seed.  
  name   A string, the name of the layer.    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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.RandomHeight Randomly vary the height of a batch of images during training. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.RandomHeight  
tf.keras.layers.experimental.preprocessing.RandomHeight(
    factor, interpolation='bilinear', seed=None, name=None, **kwargs
)
 Adjusts the height of a batch of images by a random factor. The input should be a 4-D tensor in the "channels_last" image data format. By default, this layer is inactive during inference.
 


 Arguments
  factor   A positive float (fraction of original height), or a tuple of size 2 representing lower and upper bound for resizing vertically. When represented as a single float, this value is used for both the upper and lower bound. For instance, factor=(0.2, 0.3) results in an output with height changed by a random amount in the range [20%, 30%]. factor=(-0.2, 0.3) results in an output with height changed by a random amount in the range [-20%, +30%].factor=0.2results in an output with height changed by a random amount in the range[-20%, +20%]. </td> </tr><tr> <td>interpolation</td> <td> String, the interpolation method. Defaults tobilinear. Supportsbilinear,nearest,bicubic,area,lanczos3,lanczos5,gaussian,mitchellcubic</td> </tr><tr> <td>seed</td> <td> Integer. Used to create a random seed. </td> </tr><tr> <td>name`   A string, the name of the layer.    Input shape: 4D tensor with shape: (samples, height, width, channels) (data_format='channels_last'). Output shape: 4D tensor with shape: (samples, random_height, width, channels). 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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.RandomRotation Randomly rotate each image. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.RandomRotation  
tf.keras.layers.experimental.preprocessing.RandomRotation(
    factor, fill_mode='reflect', interpolation='bilinear',
    seed=None, name=None, fill_value=0.0, **kwargs
)
 By default, random rotations are only applied during training. At inference time, the layer does nothing. If you need to apply random rotations at inference time, set training to True when calling the layer. Input shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'. Output shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'. Input shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'. Output shape: 4D tensor with shape: (samples, height, width, channels), data_format='channels_last'.
 


 Raise
  ValueError   if either bound is not between [0, 1], or upper bound is less than lower bound.   
 


 Attributes
  factor   a float represented as fraction of 2pi, or a tuple of size 2 representing lower and upper bound for rotating clockwise and counter-clockwise. A positive values means rotating counter clock-wise, while a negative value means clock-wise. When represented as a single float, this value is used for both the upper and lower bound. For instance, factor=(-0.2, 0.3) results in an output rotation by a random amount in the range [-20% * 2pi, 30% * 2pi]. factor=0.2 results in an output rotating by a random amount in the range [-20% * 2pi, 20% * 2pi].  
  fill_mode   Points outside the boundaries of the input are filled according to the given mode (one of {'constant', 'reflect', 'wrap', 'nearest'}).  
reflect: (d c b a | a b c d | d c b a) The input is extended by reflecting about the edge of the last pixel. 
constant: (k k k k | a b c d | k k k k) The input is extended by filling all values beyond the edge with the same constant value k = 0. 
wrap: (a b c d | a b c d | a b c d) The input is extended by wrapping around to the opposite edge. 
nearest: (a a a a | a b c d | d d d d) The input is extended by the nearest pixel. 

 
  interpolation   Interpolation mode. Supported values: "nearest", "bilinear".  
  seed   Integer. Used to create a random seed.  
  name   A string, the name of the layer.  
  fill_value   a float represents the value to be filled outside the boundaries when fill_mode is "constant".    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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.RandomWidth Randomly vary the width of a batch of images during training. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.RandomWidth  
tf.keras.layers.experimental.preprocessing.RandomWidth(
    factor, interpolation='bilinear', seed=None, name=None, **kwargs
)
 Adjusts the width of a batch of images by a random factor. The input should be a 4-D tensor in the "channels_last" image data format. By default, this layer is inactive during inference.
 


 Arguments
  factor   A positive float (fraction of original height), or a tuple of size 2 representing lower and upper bound for resizing vertically. When represented as a single float, this value is used for both the upper and lower bound. For instance, factor=(0.2, 0.3) results in an output with width changed by a random amount in the range [20%, 30%]. factor=(-0.2, 0.3) results in an output with width changed by a random amount in the range [-20%, +30%].factor=0.2results in an output with width changed by a random amount in the range[-20%, +20%]. </td> </tr><tr> <td>interpolation</td> <td> String, the interpolation method. Defaults tobilinear. Supportsbilinear,nearest,bicubic,area,lanczos3,lanczos5,gaussian,mitchellcubic</td> </tr><tr> <td>seed</td> <td> Integer. Used to create a random seed. </td> </tr><tr> <td>name`   A string, the name of the layer.    Input shape: 4D tensor with shape: (samples, height, width, channels) (data_format='channels_last'). Output shape: 4D tensor with shape: (samples, height, random_width, channels). 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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.Rescaling Multiply inputs by scale and adds offset. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.Rescaling  
tf.keras.layers.experimental.preprocessing.Rescaling(
    scale, offset=0.0, name=None, **kwargs
)
 For instance:  To rescale an input in the [0, 255] range to be in the [0, 1] range, you would pass scale=1./255. To rescale an input in the [0, 255] range to be in the [-1, 1] range, you would pass scale=1./127.5, offset=-1.  The rescaling is applied both during training and inference. Input shape: Arbitrary. Output shape: Same as input.
 


 Arguments
  scale   Float, the scale to apply to the inputs.  
  offset   Float, the offset to apply to the inputs.  
  name   A string, the name of the layer.    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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.experimental.preprocessing.Resizing Image resizing layer. Inherits From: PreprocessingLayer, Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.experimental.preprocessing.Resizing  
tf.keras.layers.experimental.preprocessing.Resizing(
    height, width, interpolation='bilinear', name=None, **kwargs
)
 Resize the batched image input to target height and width. The input should be a 4-D tensor in the format of NHWC.
 


 Arguments
  height   Integer, the height of the output shape.  
  width   Integer, the width of the output shape.  
  interpolation   String, the interpolation method. Defaults to bilinear. Supports bilinear, nearest, bicubic, area, lanczos3, lanczos5, gaussian, mitchellcubic  
  name   A string, the name of the layer.    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. This argument may not be relevant to all preprocessing layers: a subclass of PreprocessingLayer may choose to throw if 'reset_state' is set to False.
tf.keras.layers.Flatten     View source on GitHub    Flattens the input. Does not affect the batch size. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Flatten  
tf.keras.layers.Flatten(
    data_format=None, **kwargs
)
 
Note: If inputs are shaped (batch,) without a feature axis, then flattening adds an extra channel dimension and output shape is (batch, 1).

 


 Arguments
  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, ..., channels) while channels_first corresponds to inputs with shape (batch, channels, ...). It defaults to the image_data_format value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "channels_last".    Example: 
model = tf.keras.Sequential()
model.add(tf.keras.layers.Conv2D(64, 3, 3, input_shape=(3, 32, 32)))
model.output_shape
(None, 1, 10, 64)
 
model.add(Flatten())
model.output_shape
(None, 640)
tf.keras.layers.GaussianDropout     View source on GitHub    Apply multiplicative 1-centered Gaussian noise. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.GaussianDropout  
tf.keras.layers.GaussianDropout(
    rate, **kwargs
)
 As it is a regularization layer, it is only active at training time.
 


 Arguments
  rate   Float, drop probability (as with Dropout). The multiplicative noise will have standard deviation sqrt(rate / (1 - rate)).    Call arguments:  
inputs: Input tensor (of any rank). 
training: Python boolean indicating whether the layer should behave in training mode (adding dropout) or in inference mode (doing nothing).  Input shape: Arbitrary. Use the keyword argument input_shape (tuple of integers, does not include the samples axis) when using this layer as the first layer in a model. Output shape: Same shape as input.
tf.keras.layers.GaussianNoise     View source on GitHub    Apply additive zero-centered Gaussian noise. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.GaussianNoise  
tf.keras.layers.GaussianNoise(
    stddev, **kwargs
)
 This is useful to mitigate overfitting (you could see it as a form of random data augmentation). Gaussian Noise (GS) is a natural choice as corruption process for real valued inputs. As it is a regularization layer, it is only active at training time.
 


 Arguments
  stddev   Float, standard deviation of the noise distribution.    Call arguments:  
inputs: Input tensor (of any rank). 
training: Python boolean indicating whether the layer should behave in training mode (adding noise) or in inference mode (doing nothing).  Input shape: Arbitrary. Use the keyword argument input_shape (tuple of integers, does not include the samples axis) when using this layer as the first layer in a model. Output shape: Same shape as input.
tf.keras.layers.GlobalAveragePooling1D     View source on GitHub    Global average pooling operation for temporal data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.GlobalAvgPool1D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.GlobalAveragePooling1D, tf.compat.v1.keras.layers.GlobalAvgPool1D  
tf.keras.layers.GlobalAveragePooling1D(
    data_format='channels_last', **kwargs
)
 Examples: 
input_shape = (2, 3, 4)
x = tf.random.normal(input_shape)
y = tf.keras.layers.GlobalAveragePooling1D()(x)
print(y.shape)
(2, 4)

 


 Arguments
  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, steps, features) while channels_first corresponds to inputs with shape (batch, features, steps).    Call arguments:  
inputs: A 3D tensor. 
mask: Binary tensor of shape (batch_size, steps) indicating whether a given step should be masked (excluded from the average).  Input shape:  If data_format='channels_last': 3D tensor with shape: (batch_size, steps, features)
 If data_format='channels_first': 3D tensor with shape: (batch_size, features, steps)
  Output shape: 2D tensor with shape (batch_size, features).