neulab/docprompting-conala huggingface dataset:
tf.keras.initializers.VarianceScaling Initializer capable of adapting its scale to the shape of weights tensors. Inherits From: Initializer  View aliases  Main aliases 
tf.initializers.VarianceScaling, tf.initializers.variance_scaling, tf.keras.initializers.variance_scaling  
tf.keras.initializers.VarianceScaling(
    scale=1.0, mode='fan_in', distribution='truncated_normal',
    seed=None
)
 Also available via the shortcut function tf.keras.initializers.variance_scaling. With distribution="truncated_normal" or "untruncated_normal", samples are drawn from a truncated/untruncated normal distribution with a mean of zero and a standard deviation (after truncation, if used) stddev = sqrt(scale / n), where n is:  number of input units in the weight tensor, if mode="fan_in"
 number of output units, if mode="fan_out"
 average of the numbers of input and output units, if mode="fan_avg"
  With distribution="uniform", samples are drawn from a uniform distribution within [-limit, limit], where limit = sqrt(3 * scale / n). Examples: 
# Standalone usage:
initializer = tf.keras.initializers.VarianceScaling(
scale=0.1, mode='fan_in', distribution='uniform')
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.VarianceScaling(
scale=0.1, mode='fan_in', distribution='uniform')
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

 


 Args
  scale   Scaling factor (positive float).  
  mode   One of "fan_in", "fan_out", "fan_avg".  
  distribution   Random distribution to use. One of "truncated_normal", "untruncated_normal" and "uniform".  
  seed   A Python integer. An initializer created with a given seed will always produce the same random tensor for a given shape and dtype.    Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only floating point types are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype))  
  **kwargs   Additional keyword arguments.
tf.keras.initializers.Zeros Initializer that generates tensors initialized to 0. Inherits From: zeros_initializer, Initializer  View aliases  Main aliases 
tf.initializers.Zeros, tf.initializers.zeros, tf.keras.initializers.zeros  Also available via the shortcut function tf.keras.initializers.zeros. Examples: 
# Standalone usage:
initializer = tf.keras.initializers.Zeros()
values = initializer(shape=(2, 2))
 
# Usage in a Keras layer:
initializer = tf.keras.initializers.Zeros()
layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)
 Methods from_config View source 
@classmethod
from_config(
    config
)
 Instantiates an initializer from a configuration dictionary. Example: initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

 


 Args
  config   A Python dictionary. It will typically be the output of get_config.   
 


 Returns   An Initializer instance.  
 get_config View source 
get_config()
 Returns the configuration of the initializer as a JSON-serializable dict.
 


 Returns   A JSON-serializable Python dict.  
 __call__ View source 
__call__(
    shape, dtype=None, **kwargs
)
 Returns a tensor object initialized as specified by the initializer.
 


 Args
  shape   Shape of the tensor.  
  dtype   Optional dtype of the tensor. Only numeric or boolean dtypes are supported. If not specified, tf.keras.backend.floatx() is used, which default to float32 unless you configured it otherwise (via tf.keras.backend.set_floatx(float_dtype)).  
  **kwargs   Additional keyword arguments.
tf.keras.Input     View source on GitHub    Input() is used to instantiate a Keras tensor.  View aliases  Main aliases 
tf.keras.layers.Input Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.Input, tf.compat.v1.keras.layers.Input  
tf.keras.Input(
    shape=None, batch_size=None, name=None, dtype=None, sparse=False, tensor=None,
    ragged=False, **kwargs
)
 A Keras tensor is a TensorFlow symbolic tensor object, which we augment with certain attributes that allow us to build a Keras model just by knowing the inputs and outputs of the model. For instance, if a, b and c are Keras tensors, it becomes possible to do: model = Model(input=[a, b], output=c)
 


 Arguments
  shape   A shape tuple (integers), not including the batch size. For instance, shape=(32,) indicates that the expected input will be batches of 32-dimensional vectors. Elements of this tuple can be None; 'None' elements represent dimensions where the shape is not known.  
  batch_size   optional static batch size (integer).  
  name   An optional name string for the layer. Should be unique in a model (do not reuse the same name twice). It will be autogenerated if it isn't provided.  
  dtype   The data type expected by the input, as a string (float32, float64, int32...)  
  sparse   A boolean specifying whether the placeholder to be created is sparse. Only one of 'ragged' and 'sparse' can be True. Note that, if sparse is False, sparse tensors can still be passed into the input - they will be densified with a default value of 0.  
  tensor   Optional existing tensor to wrap into the Input layer. If set, the layer will use the tf.TypeSpec of this tensor rather than creating a new placeholder tensor.  
  ragged   A boolean specifying whether the placeholder to be created is ragged. Only one of 'ragged' and 'sparse' can be True. In this case, values of 'None' in the 'shape' argument represent ragged dimensions. For more information about RaggedTensors, see this guide.  
  **kwargs   deprecated arguments support. Supports batch_shape and batch_input_shape.   
 


 Returns   A tensor.  
 Example: # this is a logistic regression in Keras
x = Input(shape=(32,))
y = Dense(16, activation='softmax')(x)
model = Model(x, y)
 Note that even if eager execution is enabled, Input produces a symbolic tensor (i.e. a placeholder). This symbolic tensor can be used with other TensorFlow ops, as such: x = Input(shape=(32,))
y = tf.square(x)

 


 Raises
  ValueError   If both sparse and ragged are provided.  
  ValueError   If both shape and (batch_input_shape or batch_shape) are provided.  
  ValueError   If both shape and tensor are None.  
  ValueError   if any unrecognized parameters are provided.
tf.keras.layers.AbstractRNNCell     View source on GitHub    Abstract object representing an RNN cell. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.AbstractRNNCell  
tf.keras.layers.AbstractRNNCell(
    trainable=True, name=None, dtype=None, dynamic=False, **kwargs
)
 See the Keras RNN API guide for details about the usage of RNN API. This is the base class for implementing RNN cells with custom behavior. Every RNNCell must have the properties below and implement call with the signature (output, next_state) = call(input, state). Examples: class MinimalRNNCell(AbstractRNNCell):

  def __init__(self, units, **kwargs):
    self.units = units
    super(MinimalRNNCell, self).__init__(**kwargs)

  @property
  def state_size(self):
    return self.units

  def build(self, input_shape):
    self.kernel = self.add_weight(shape=(input_shape[-1], self.units),
                                  initializer='uniform',
                                  name='kernel')
    self.recurrent_kernel = self.add_weight(
        shape=(self.units, self.units),
        initializer='uniform',
        name='recurrent_kernel')
    self.built = True

  def call(self, inputs, states):
    prev_output = states[0]
    h = K.dot(inputs, self.kernel)
    output = h + K.dot(prev_output, self.recurrent_kernel)
    return output, output
 This definition of cell differs from the definition used in the literature. In the literature, 'cell' refers to an object with a single scalar output. This definition refers to a horizontal array of such units. An RNN cell, in the most abstract setting, is anything that has a state and performs some operation that takes a matrix of inputs. This operation results in an output matrix with self.output_size columns. If self.state_size is an integer, this operation also results in a new state matrix with self.state_size columns. If self.state_size is a (possibly nested tuple of) TensorShape object(s), then it should return a matching structure of Tensors having shape [batch_size].concatenate(s) for each s in self.batch_size.
 


 Attributes
  output_size   Integer or TensorShape: size of outputs produced by this cell.  
  state_size   size(s) of state(s) used by this cell. It can be represented by an Integer, a TensorShape or a tuple of Integers or TensorShapes. 
   Methods get_initial_state View source 
get_initial_state(
    inputs=None, batch_size=None, dtype=None
)
tf.keras.layers.Activation     View source on GitHub    Applies an activation function to an output. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Activation  
tf.keras.layers.Activation(
    activation, **kwargs
)

 


 Arguments
  activation   Activation function, such as tf.nn.relu, or string name of built-in activation function, such as "relu".    Usage: 
layer = tf.keras.layers.Activation('relu')
output = layer([-3.0, -1.0, 0.0, 2.0])
list(output.numpy())
[0.0, 0.0, 0.0, 2.0]
layer = tf.keras.layers.Activation(tf.nn.relu)
output = layer([-3.0, -1.0, 0.0, 2.0])
list(output.numpy())
[0.0, 0.0, 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 input.
tf.keras.layers.ActivityRegularization     View source on GitHub    Layer that applies an update to the cost function based input activity. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.ActivityRegularization  
tf.keras.layers.ActivityRegularization(
    l1=0.0, l2=0.0, **kwargs
)

 


 Arguments
  l1   L1 regularization factor (positive float).  
  l2   L2 regularization factor (positive float).    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.Add     View source on GitHub    Layer that adds 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.Add  
tf.keras.layers.Add(
    **kwargs
)
 It takes as input a list of tensors, all of the same shape, and returns a single tensor (also of the same shape). Examples: 
input_shape = (2, 3, 4)
x1 = tf.random.normal(input_shape)
x2 = tf.random.normal(input_shape)
y = tf.keras.layers.Add()([x1, x2])
print(y.shape)
(2, 3, 4)
 Used in a functional model: 
input1 = tf.keras.layers.Input(shape=(16,))
x1 = tf.keras.layers.Dense(8, activation='relu')(input1)
input2 = tf.keras.layers.Input(shape=(32,))
x2 = tf.keras.layers.Dense(8, activation='relu')(input2)
# equivalent to `added = tf.keras.layers.add([x1, x2])`
added = tf.keras.layers.Add()([x1, x2])
out = tf.keras.layers.Dense(4)(added)
model = tf.keras.models.Model(inputs=[input1, input2], outputs=out)

 


 Arguments
  **kwargs   standard layer keyword arguments.
tf.keras.layers.AlphaDropout     View source on GitHub    Applies Alpha Dropout to the input. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.AlphaDropout  
tf.keras.layers.AlphaDropout(
    rate, noise_shape=None, seed=None, **kwargs
)
 Alpha Dropout is a Dropout that keeps mean and variance of inputs to their original values, in order to ensure the self-normalizing property even after this dropout. Alpha Dropout fits well to Scaled Exponential Linear Units by randomly setting activations to the negative saturation value.
 


 Arguments
  rate   float, drop probability (as with Dropout). The multiplicative noise will have standard deviation sqrt(rate / (1 - rate)).  
  seed   A Python integer to use as random seed.    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.Average     View source on GitHub    Layer that averages a list of inputs element-wise. Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Average  
tf.keras.layers.Average(
    **kwargs
)
 It takes as input a list of tensors, all of the same shape, and returns a single tensor (also of the same shape). Example: 
x1 = np.ones((2, 2))
x2 = np.zeros((2, 2))
y = tf.keras.layers.Average()([x1, x2])
y.numpy().tolist()
[[0.5, 0.5], [0.5, 0.5]]
 Usage in a functional model: 
input1 = tf.keras.layers.Input(shape=(16,))
x1 = tf.keras.layers.Dense(8, activation='relu')(input1)
input2 = tf.keras.layers.Input(shape=(32,))
x2 = tf.keras.layers.Dense(8, activation='relu')(input2)
avg = tf.keras.layers.Average()([x1, x2])
out = tf.keras.layers.Dense(4)(avg)
model = tf.keras.models.Model(inputs=[input1, input2], outputs=out)

 


 Raises
  ValueError   If there is a shape mismatch between the inputs and the shapes cannot be broadcasted to match.   
 


 Arguments
  **kwargs   standard layer keyword arguments.
tf.keras.layers.AveragePooling1D     View source on GitHub    Average pooling for temporal data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.AvgPool1D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.AveragePooling1D, tf.compat.v1.keras.layers.AvgPool1D  
tf.keras.layers.AveragePooling1D(
    pool_size=2, strides=None, padding='valid',
    data_format='channels_last', **kwargs
)

 


 Arguments
  pool_size   Integer, size of the average pooling windows.  
  strides   Integer, or None. Factor by which to downscale. E.g. 2 will halve the input. 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.AveragePooling2D     View source on GitHub    Average pooling operation for spatial data. Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.AvgPool2D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.AveragePooling2D, tf.compat.v1.keras.layers.AvgPool2D  
tf.keras.layers.AveragePooling2D(
    pool_size=(2, 2), strides=None, padding='valid', data_format=None,
    **kwargs
)

 


 Arguments
  pool_size   integer or tuple of 2 integers, factors by which to downscale (vertical, horizontal). (2, 2) will halve the input in both spatial dimension. If only one integer is specified, the same window length will be used for both dimensions.  
  strides   Integer, tuple of 2 integers, or None. Strides values. 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, 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:  If data_format='channels_last': 4D tensor with shape (batch_size, pooled_rows, pooled_cols, channels). If data_format='channels_first': 4D tensor with shape (batch_size, channels, pooled_rows, pooled_cols).
tf.keras.layers.AveragePooling3D     View source on GitHub    Average pooling operation for 3D data (spatial or spatio-temporal). Inherits From: Layer, Module  View aliases  Main aliases 
tf.keras.layers.AvgPool3D Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.layers.AveragePooling3D, tf.compat.v1.keras.layers.AvgPool3D  
tf.keras.layers.AveragePooling3D(
    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.Concatenate     View source on GitHub    Layer that concatenates 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.Concatenate  
tf.keras.layers.Concatenate(
    axis=-1, **kwargs
)
 It takes as input a list of tensors, all of the same shape except for the concatenation axis, and returns a single tensor that is the concatenation of all inputs. 
x = np.arange(20).reshape(2, 2, 5)
print(x)
[[[ 0  1  2  3  4]
  [ 5  6  7  8  9]]
 [[10 11 12 13 14]
  [15 16 17 18 19]]]
y = np.arange(20, 30).reshape(2, 1, 5)
print(y)
[[[20 21 22 23 24]]
 [[25 26 27 28 29]]]
tf.keras.layers.Concatenate(axis=1)([x, y])
<tf.Tensor: shape=(2, 3, 5), dtype=int64, numpy=
array([[[ 0,  1,  2,  3,  4],
        [ 5,  6,  7,  8,  9],
        [20, 21, 22, 23, 24]],
       [[10, 11, 12, 13, 14],
        [15, 16, 17, 18, 19],
        [25, 26, 27, 28, 29]]])>
 
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))
concatted = tf.keras.layers.Concatenate()([x1, x2])
concatted.shape
TensorShape([5, 16])

 


 Arguments
  axis   Axis along which to concatenate.  
  **kwargs   standard layer keyword arguments.
tf.keras.layers.Cropping1D     View source on GitHub    Cropping layer for 1D input (e.g. temporal sequence). Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Cropping1D  
tf.keras.layers.Cropping1D(
    cropping=(1, 1), **kwargs
)
 It crops along the time dimension (axis 1). Examples: 
input_shape = (2, 3, 2)
x = np.arange(np.prod(input_shape)).reshape(input_shape)
print(x)
[[[ 0  1]
  [ 2  3]
  [ 4  5]]
 [[ 6  7]
  [ 8  9]
  [10 11]]]
y = tf.keras.layers.Cropping1D(cropping=1)(x)
print(y)
tf.Tensor(
  [[[2 3]]
   [[8 9]]], shape=(2, 1, 2), dtype=int64)

 


 Arguments
  cropping   Int or tuple of int (length 2) How many units should be trimmed off at the beginning and end of the cropping dimension (axis 1). If a single int is provided, the same value will be used for both.    Input shape: 3D tensor with shape (batch_size, axis_to_crop, features) Output shape: 3D tensor with shape (batch_size, cropped_axis, features)
tf.keras.layers.Cropping2D     View source on GitHub    Cropping layer for 2D input (e.g. picture). Inherits From: Layer, Module  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.keras.layers.Cropping2D  
tf.keras.layers.Cropping2D(
    cropping=((0, 0), (0, 0)), data_format=None, **kwargs
)
 It crops along spatial dimensions, i.e. height and width. Examples: 
input_shape = (2, 28, 28, 3)
x = np.arange(np.prod(input_shape)).reshape(input_shape)
y = tf.keras.layers.Cropping2D(cropping=((2, 2), (4, 4)))(x)
print(y.shape)
(2, 24, 20, 3)

 


 Arguments
  cropping   Int, or tuple of 2 ints, or tuple of 2 tuples of 2 ints.  If int: the same symmetric cropping is applied to height and width. If tuple of 2 ints: interpreted as two different symmetric cropping values for height and width: (symmetric_height_crop, symmetric_width_crop). If tuple of 2 tuples of 2 ints: interpreted as ((top_crop, bottom_crop), (left_crop, right_crop)) 

 
  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_size, height, width, channels) while channels_first corresponds to inputs with shape (batch_size, 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: 4D tensor with shape:  If data_format is "channels_last": (batch_size, rows, cols, channels)
 If data_format is "channels_first": (batch_size, channels, rows, cols)
  Output shape: 4D tensor with shape:  If data_format is "channels_last": (batch_size, cropped_rows, cropped_cols, channels)
 If data_format is "channels_first": (batch_size, channels, cropped_rows, cropped_cols)