neulab/docprompting-conala huggingface dataset:
tf.keras.layers.GlobalAveragePooling2D     View source on GitHub    Global average pooling operation for spatial data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.GlobalAvgPool2D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.GlobalAveragePooling2D, tf.compat.v1.keras.layers.GlobalAvgPool2D  
tf.keras.layers.GlobalAveragePooling2D(
    data_format=None, **kwargs
)
 Examples: 
input_shape = (2, 4, 5, 3)
x = tf.random.normal(input_shape)
y = tf.keras.layers.GlobalAveragePooling2D()(x)
print(y.shape)
(2, 3)

 


 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, height, width, channels) while channels_first corresponds to inputs with shape (batch, channels, height, width). 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".    Input shape:  If data_format='channels_last': 4D tensor with shape (batch_size, rows, cols, channels). If data_format='channels_first': 4D tensor with shape (batch_size, channels, rows, cols).  Output shape: 2D tensor with shape (batch_size, channels).
tf.keras.layers.GlobalAveragePooling3D     View source on GitHub    Global Average pooling operation for 3D data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.GlobalAvgPool3D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.GlobalAveragePooling3D, tf.compat.v1.keras.layers.GlobalAvgPool3D  
tf.keras.layers.GlobalAveragePooling3D(
    data_format=None, **kwargs
)

 


 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, spatial_dim1, spatial_dim2, spatial_dim3, channels) while channels_first corresponds to inputs with shape (batch, channels, spatial_dim1, spatial_dim2, spatial_dim3). 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".    Input shape:  If data_format='channels_last': 5D tensor with shape: (batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)
 If data_format='channels_first': 5D tensor with shape: (batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)
  Output shape: 2D tensor with shape (batch_size, channels).
tf.keras.layers.GlobalMaxPool1D     View source on GitHub    Global max pooling operation for 1D temporal data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.GlobalMaxPooling1D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.GlobalMaxPool1D, tf.compat.v1.keras.layers.GlobalMaxPooling1D  
tf.keras.layers.GlobalMaxPool1D(
    data_format='channels_last', **kwargs
)
 Downsamples the input representation by taking the maximum value over the time dimension. For example: 
x = tf.constant([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]])
x = tf.reshape(x, [3, 3, 1])
x
<tf.Tensor: shape=(3, 3, 1), dtype=float32, numpy=
array([[[1.], [2.], [3.]],
       [[4.], [5.], [6.]],
       [[7.], [8.], [9.]]], dtype=float32)>
max_pool_1d = tf.keras.layers.GlobalMaxPooling1D()
max_pool_1d(x)
<tf.Tensor: shape=(3, 1), dtype=float32, numpy=
array([[3.],
       [6.],
       [9.], dtype=float32)>

 


 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).    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).
tf.keras.layers.GlobalMaxPool2D     View source on GitHub    Global max pooling operation for spatial data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.GlobalMaxPooling2D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.GlobalMaxPool2D, tf.compat.v1.keras.layers.GlobalMaxPooling2D  
tf.keras.layers.GlobalMaxPool2D(
    data_format=None, **kwargs
)
 Examples: 
input_shape = (2, 4, 5, 3)
x = tf.random.normal(input_shape)
y = tf.keras.layers.GlobalMaxPool2D()(x)
print(y.shape)
(2, 3)

 


 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, height, width, channels) while channels_first corresponds to inputs with shape (batch, channels, height, width). 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".    Input shape:  If data_format='channels_last': 4D tensor with shape (batch_size, rows, cols, channels). If data_format='channels_first': 4D tensor with shape (batch_size, channels, rows, cols).  Output shape: 2D tensor with shape (batch_size, channels).
tf.keras.layers.GlobalMaxPool3D     View source on GitHub    Global Max pooling operation for 3D data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.GlobalMaxPooling3D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.GlobalMaxPool3D, tf.compat.v1.keras.layers.GlobalMaxPooling3D  
tf.keras.layers.GlobalMaxPool3D(
    data_format=None, **kwargs
)

 


 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, spatial_dim1, spatial_dim2, spatial_dim3, channels) while channels_first corresponds to inputs with shape (batch, channels, spatial_dim1, spatial_dim2, spatial_dim3). 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".    Input shape:  If data_format='channels_last': 5D tensor with shape: (batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)
 If data_format='channels_first': 5D tensor with shape: (batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)
  Output shape: 2D tensor with shape (batch_size, channels).
tf.keras.layers.InputLayer     View source on GitHub    Layer to be used as an entry point into a Network (a graph of layers). Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.InputLayer  
tf.keras.layers.InputLayer(
    input_shape=None, batch_size=None, dtype=None, input_tensor=None, sparse=False,
    name=None, ragged=False, **kwargs
)
 It can either wrap an existing tensor (pass an input_tensor argument) or create a placeholder tensor (pass arguments input_shape, and optionally, dtype). It is generally recommend to use the functional layer API via Input, (which creates an InputLayer) without directly using InputLayer. When using InputLayer with Keras Sequential model, it can be skipped by moving the input_shape parameter to the first layer after the InputLayer. This class can create placeholders for tf.Tensors, tf.SparseTensors, and tf.RaggedTensors by choosing 'sparse=True' or 'ragged=True'. Note that 'sparse' and 'ragged' can't be configured to True at same time. Usage: # With explicit InputLayer.
model = tf.keras.Sequential([
  tf.keras.layers.InputLayer(input_shape=(4,)),
  tf.keras.layers.Dense(8)])
model.compile(tf.optimizers.RMSprop(0.001), loss='mse')
model.fit(np.zeros((10, 4)),
          np.ones((10, 8)))

# Without InputLayer and let the first layer to have the input_shape.
# Keras will add a input for the model behind the scene.
model = tf.keras.Sequential([
  tf.keras.layers.Dense(8, input_shape=(4,))])
model.compile(tf.optimizers.RMSprop(0.001), loss='mse')
model.fit(np.zeros((10, 4)),
          np.ones((10, 8)))

 


 Arguments
  input_shape   Shape tuple (not including the batch axis), or TensorShape instance (not including the batch axis).  
  batch_size   Optional input batch size (integer or None).  
  dtype   Optional datatype of the input. When not provided, the Keras default float type will be used.  
  input_tensor   Optional tensor to use as layer input. If set, the layer will use the tf.TypeSpec of this tensor rather than creating a new placeholder tensor.  
  sparse   Boolean, whether the placeholder created is meant to be sparse. Default to False.  
  ragged   Boolean, whether the placeholder created is meant to be ragged. In this case, values of 'None' in the 'shape' argument represent ragged dimensions. For more information about RaggedTensors, see this guide. Default to False.  
  name   Optional name of the layer (string).
tf.keras.layers.InputSpec Specifies the rank, dtype and shape of every input to a layer.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.InputSpec, tf.compat.v1.layers.InputSpec  
tf.keras.layers.InputSpec(
    dtype=None, shape=None, ndim=None, max_ndim=None, min_ndim=None, axes=None,
    allow_last_axis_squeeze=False, name=None
)
 Layers can expose (if appropriate) an input_spec attribute: an instance of InputSpec, or a nested structure of InputSpec instances (one per input tensor). These objects enable the layer to run input compatibility checks for input structure, input rank, input shape, and input dtype. A None entry in a shape is compatible with any dimension, a None shape is compatible with any shape.
 


 Arguments
  dtype   Expected DataType of the input.  
  shape   Shape tuple, expected shape of the input (may include None for unchecked axes). Includes the batch size.  
  ndim   Integer, expected rank of the input.  
  max_ndim   Integer, maximum rank of the input.  
  min_ndim   Integer, minimum rank of the input.  
  axes   Dictionary mapping integer axes to a specific dimension value.  
  allow_last_axis_squeeze   If True, then allow inputs of rank N+1 as long as the last axis of the input is 1, as well as inputs of rank N-1 as long as the last axis of the spec is 1.  
  name   Expected key corresponding to this input when passing data as a dictionary.    Example: class MyLayer(Layer):
    def __init__(self):
        super(MyLayer, self).__init__()
        # The layer will accept inputs with shape (?, 28, 28) & (?, 28, 28, 1)
        # and raise an appropriate error message otherwise.
        self.input_spec = InputSpec(
            shape=(None, 28, 28, 1),
            allow_last_axis_squeeze=True)
 Methods from_config View source 
@classmethod
from_config(
    config
)
 get_config View source 
get_config()
tf.keras.layers.LeakyReLU     View source on GitHub    Leaky version of a Rectified Linear Unit. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.LeakyReLU  
tf.keras.layers.LeakyReLU(
    alpha=0.3, **kwargs
)
 It allows a small gradient when the unit is not active: f(x) = alpha * x if x < 0
f(x) = x if x >= 0
 Usage: 
layer = tf.keras.layers.LeakyReLU()
output = layer([-3.0, -1.0, 0.0, 2.0])
list(output.numpy())
[-0.9, -0.3, 0.0, 2.0]
layer = tf.keras.layers.LeakyReLU(alpha=0.1)
output = layer([-3.0, -1.0, 0.0, 2.0])
list(output.numpy())
[-0.3, -0.1, 0.0, 2.0]
 Input shape: Arbitrary. Use the keyword argument input_shape (tuple of integers, does not include the batch axis) when using this layer as the first layer in a model. Output shape: Same shape as the input.
 


 Arguments
  alpha   Float >= 0. Negative slope coefficient. Default to 0.3.
tf.keras.layers.Masking     View source on GitHub    Masks a sequence by using a mask value to skip timesteps. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Masking  
tf.keras.layers.Masking(
    mask_value=0.0, **kwargs
)
 For each timestep in the input tensor (dimension #1 in the tensor), if all values in the input tensor at that timestep are equal to mask_value, then the timestep will be masked (skipped) in all downstream layers (as long as they support masking). If any downstream layer does not support masking yet receives such an input mask, an exception will be raised. Example: Consider a Numpy data array x of shape (samples, timesteps, features), to be fed to an LSTM layer. You want to mask timestep #3 and #5 because you lack data for these timesteps. You can:  Set x[:, 3, :] = 0. and x[:, 5, :] = 0.
 Insert a Masking layer with mask_value=0. before the LSTM layer:  samples, timesteps, features = 32, 10, 8
inputs = np.random.random([samples, timesteps, features]).astype(np.float32)
inputs[:, 3, :] = 0.
inputs[:, 5, :] = 0.

model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Masking(mask_value=0.,
                                  input_shape=(timesteps, features)))
model.add(tf.keras.layers.LSTM(32))

output = model(inputs)
# The time step 3 and 5 will be skipped from LSTM calculation.
 See the masking and padding guide for more details.
tf.keras.layers.Maximum     View source on GitHub    Layer that computes the maximum (element-wise) a list of inputs. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Maximum  
tf.keras.layers.Maximum(
    **kwargs
)
 It takes as input a list of tensors, all of the same shape, and returns a single tensor (also of the same shape). 
tf.keras.layers.Maximum()([np.arange(5).reshape(5, 1),
                           np.arange(5, 10).reshape(5, 1)])
<tf.Tensor: shape=(5, 1), dtype=int64, numpy=
array([[5],
     [6],
     [7],
     [8],
     [9]])>
 
x1 = tf.keras.layers.Dense(8)(np.arange(10).reshape(5, 2))
x2 = tf.keras.layers.Dense(8)(np.arange(10, 20).reshape(5, 2))
maxed = tf.keras.layers.Maximum()([x1, x2])
maxed.shape
TensorShape([5, 8])

 


 Arguments
  **kwargs   standard layer keyword arguments.
tf.keras.layers.MaxPool1D     View source on GitHub    Max pooling operation for 1D temporal data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.MaxPooling1D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.MaxPool1D, tf.compat.v1.keras.layers.MaxPooling1D  
tf.keras.layers.MaxPool1D(
    pool_size=2, strides=None, padding='valid',
    data_format='channels_last', **kwargs
)
 Downsamples the input representation by taking the maximum value over the window defined by pool_size. The window is shifted by strides. The resulting output when using "valid" padding option has a shape of: output_shape = (input_shape - pool_size + 1) / strides) The resulting output shape when using the "same" padding option is: output_shape = input_shape / strides For example, for strides=1 and padding="valid": 
x = tf.constant([1., 2., 3., 4., 5.])
x = tf.reshape(x, [1, 5, 1])
max_pool_1d = tf.keras.layers.MaxPooling1D(pool_size=2,
   strides=1, padding='valid')
max_pool_1d(x)
<tf.Tensor: shape=(1, 4, 1), dtype=float32, numpy=
array([[[2.],
        [3.],
        [4.],
        [5.]]], dtype=float32)>
 For example, for strides=2 and padding="valid": 
x = tf.constant([1., 2., 3., 4., 5.])
x = tf.reshape(x, [1, 5, 1])
max_pool_1d = tf.keras.layers.MaxPooling1D(pool_size=2,
   strides=2, padding='valid')
max_pool_1d(x)
<tf.Tensor: shape=(1, 2, 1), dtype=float32, numpy=
array([[[2.],
        [4.]]], dtype=float32)>
 For example, for strides=1 and padding="same": 
x = tf.constant([1., 2., 3., 4., 5.])
x = tf.reshape(x, [1, 5, 1])
max_pool_1d = tf.keras.layers.MaxPooling1D(pool_size=2,
   strides=1, padding='same')
max_pool_1d(x)
<tf.Tensor: shape=(1, 5, 1), dtype=float32, numpy=
array([[[2.],
        [3.],
        [4.],
        [5.],
        [5.]]], dtype=float32)>

 


 Arguments
  pool_size   Integer, size of the max pooling window.  
  strides   Integer, or None. Specifies how much the pooling window moves for each pooling step. If None, it will default to pool_size.  
  padding   One of "valid" or "same" (case-insensitive). "valid" means no padding. "same" results in padding evenly to the left/right or up/down of the input such that output has the same height/width dimension as the input.  
  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).    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:  If data_format='channels_last': 3D tensor with shape (batch_size, downsampled_steps, features). If data_format='channels_first': 3D tensor with shape (batch_size, features, downsampled_steps).
tf.keras.layers.MaxPool3D     View source on GitHub    Max pooling operation for 3D data (spatial or spatio-temporal). Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.MaxPooling3D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.MaxPool3D, tf.compat.v1.keras.layers.MaxPooling3D  
tf.keras.layers.MaxPool3D(
    pool_size=(2, 2, 2), strides=None, padding='valid', data_format=None,
    **kwargs
)

 


 Arguments
  pool_size   Tuple of 3 integers, factors by which to downscale (dim1, dim2, dim3). (2, 2, 2) will halve the size of the 3D input in each dimension.  
  strides   tuple of 3 integers, or None. Strides values.  
  padding   One of "valid" or "same" (case-insensitive). "valid" means no padding. "same" results in padding evenly to the left/right or up/down of the input such that output has the same height/width dimension as the input.  
  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, spatial_dim1, spatial_dim2, spatial_dim3, channels) while channels_first corresponds to inputs with shape (batch, channels, spatial_dim1, spatial_dim2, spatial_dim3). 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".    Input shape:  If data_format='channels_last': 5D tensor with shape: (batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)
 If data_format='channels_first': 5D tensor with shape: (batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)
  Output shape:  If data_format='channels_last': 5D tensor with shape: (batch_size, pooled_dim1, pooled_dim2, pooled_dim3, channels)
 If data_format='channels_first': 5D tensor with shape: (batch_size, channels, pooled_dim1, pooled_dim2, pooled_dim3)
tf.keras.layers.Minimum     View source on GitHub    Layer that computes the minimum (element-wise) a list of inputs. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Minimum  
tf.keras.layers.Minimum(
    **kwargs
)
 It takes as input a list of tensors, all of the same shape, and returns a single tensor (also of the same shape). 
tf.keras.layers.Minimum()([np.arange(5).reshape(5, 1),
                           np.arange(5, 10).reshape(5, 1)])
<tf.Tensor: shape=(5, 1), dtype=int64, numpy=
array([[0],
     [1],
     [2],
     [3],
     [4]])>
 
x1 = tf.keras.layers.Dense(8)(np.arange(10).reshape(5, 2))
x2 = tf.keras.layers.Dense(8)(np.arange(10, 20).reshape(5, 2))
minned = tf.keras.layers.Minimum()([x1, x2])
minned.shape
TensorShape([5, 8])

 


 Arguments
  **kwargs   standard layer keyword arguments.
tf.keras.layers.Multiply     View source on GitHub    Layer that multiplies (element-wise) a list of inputs. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Multiply  
tf.keras.layers.Multiply(
    **kwargs
)
 It takes as input a list of tensors, all of the same shape, and returns a single tensor (also of the same shape). 
tf.keras.layers.Multiply()([np.arange(5).reshape(5, 1),
                            np.arange(5, 10).reshape(5, 1)])
<tf.Tensor: shape=(5, 1), dtype=int64, numpy=
array([[ 0],
     [ 6],
     [14],
     [24],
     [36]])>
 
x1 = tf.keras.layers.Dense(8)(np.arange(10).reshape(5, 2))
x2 = tf.keras.layers.Dense(8)(np.arange(10, 20).reshape(5, 2))
multiplied = tf.keras.layers.Multiply()([x1, x2])
multiplied.shape
TensorShape([5, 8])

 


 Arguments
  **kwargs   standard layer keyword arguments.
tf.keras.layers.Permute     View source on GitHub    Permutes the dimensions of the input according to a given pattern. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Permute  
tf.keras.layers.Permute(
    dims, **kwargs
)
 Useful e.g. connecting RNNs and convnets. Example: model = Sequential()
model.add(Permute((2, 1), input_shape=(10, 64)))
# now: model.output_shape == (None, 64, 10)
# note: `None` is the batch dimension

 


 Arguments
  dims   Tuple of integers. Permutation pattern does not include the samples dimension. Indexing starts at 1. For instance, (2, 1) permutes the first and second dimensions of the input.    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 as the input shape, but with the dimensions re-ordered according to the specified pattern.
tf.keras.layers.PReLU     View source on GitHub    Parametric Rectified Linear Unit. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.PReLU  
tf.keras.layers.PReLU(
    alpha_initializer='zeros', alpha_regularizer=None,
    alpha_constraint=None, shared_axes=None, **kwargs
)
 It follows: f(x) = alpha * x for x < 0
f(x) = x for x >= 0
 where alpha is a learned array with the same shape as x. 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 the input.
 


 Arguments
  alpha_initializer   Initializer function for the weights.  
  alpha_regularizer   Regularizer for the weights.  
  alpha_constraint   Constraint for the weights.  
  shared_axes   The axes along which to share learnable parameters for the activation function. For example, if the incoming feature maps are from a 2D convolution with output shape (batch, height, width, channels), and you wish to share parameters across space so that each filter only has one set of parameters, set shared_axes=[1, 2].