neulab/docprompting-conala huggingface dataset:
tf.nn.depthwise_conv2d_backprop_filter     View source on GitHub    Computes the gradients of depthwise convolution with respect to the filter.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.depthwise_conv2d_backprop_filter, tf.compat.v1.nn.depthwise_conv2d_native_backprop_filter  
tf.nn.depthwise_conv2d_backprop_filter(
    input, filter_sizes, out_backprop, strides, padding,
    data_format='NHWC', dilations=[1, 1, 1, 1], name=None
)

 


 Args
  input   A Tensor. Must be one of the following types: half, bfloat16, float32, float64. 4-D with shape based on data_format. For example, if data_format is 'NHWC' then input is a 4-D [batch, in_height, in_width, in_channels] tensor.  
  filter_sizes   A Tensor of type int32. An integer vector representing the tensor shape of filter, where filter is a 4-D [filter_height, filter_width, in_channels, depthwise_multiplier] tensor.  
  out_backprop   A Tensor. Must have the same type as input. 4-D with shape based on data_format. For example, if data_format is 'NHWC' then out_backprop shape is [batch, out_height, out_width, out_channels]. Gradients w.r.t. the output of the convolution.  
  strides   A list of ints. The stride of the sliding window for each dimension of the input of the convolution.  
  padding   Controls how to pad the image before applying the convolution. Can be the string "SAME" or "VALID" indicating the type of padding algorithm to use, or a list indicating the explicit paddings at the start and end of each dimension. When explicit padding is used and data_format is "NHWC", this should be in the form [[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]]. When explicit padding used and data_format is "NCHW", this should be in the form [[0, 0], [0, 0], [pad_top, pad_bottom], [pad_left, pad_right]].  
  data_format   An optional string from: "NHWC", "NCHW". Defaults to "NHWC". Specify the data format of the input and output data. With the default format "NHWC", the data is stored in the order of: [batch, height, width, channels]. Alternatively, the format could be "NCHW", the data storage order of: [batch, channels, height, width].  
  dilations   An optional list of ints. Defaults to [1, 1, 1, 1]. 1-D tensor of length 4. The dilation factor for each dimension of input. If set to k > 1, there will be k-1 skipped cells between each filter element on that dimension. The dimension order is determined by the value of data_format, see above for details. Dilations in the batch and depth dimensions must be 1.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as input.
tf.nn.depthwise_conv2d_backprop_input     View source on GitHub    Computes the gradients of depthwise convolution with respect to the input.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.depthwise_conv2d_backprop_input, tf.compat.v1.nn.depthwise_conv2d_native_backprop_input  
tf.nn.depthwise_conv2d_backprop_input(
    input_sizes, filter, out_backprop, strides, padding,
    data_format='NHWC', dilations=[1, 1, 1, 1], name=None
)

 


 Args
  input_sizes   A Tensor of type int32. An integer vector representing the shape of input, based on data_format. For example, if data_format is 'NHWC' then input is a 4-D [batch, height, width, channels] tensor.  
  filter   A Tensor. Must be one of the following types: half, bfloat16, float32, float64. 4-D with shape [filter_height, filter_width, in_channels, depthwise_multiplier].  
  out_backprop   A Tensor. Must have the same type as filter. 4-D with shape based on data_format. For example, if data_format is 'NHWC' then out_backprop shape is [batch, out_height, out_width, out_channels]. Gradients w.r.t. the output of the convolution.  
  strides   A list of ints. The stride of the sliding window for each dimension of the input of the convolution.  
  padding   Controls how to pad the image before applying the convolution. Can be the string "SAME" or "VALID" indicating the type of padding algorithm to use, or a list indicating the explicit paddings at the start and end of each dimension. When explicit padding is used and data_format is "NHWC", this should be in the form [[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]]. When explicit padding used and data_format is "NCHW", this should be in the form [[0, 0], [0, 0], [pad_top, pad_bottom], [pad_left, pad_right]].  
  data_format   An optional string from: "NHWC", "NCHW". Defaults to "NHWC". Specify the data format of the input and output data. With the default format "NHWC", the data is stored in the order of: [batch, height, width, channels]. Alternatively, the format could be "NCHW", the data storage order of: [batch, channels, height, width].  
  dilations   An optional list of ints. Defaults to [1, 1, 1, 1]. 1-D tensor of length 4. The dilation factor for each dimension of input. If set to k > 1, there will be k-1 skipped cells between each filter element on that dimension. The dimension order is determined by the value of data_format, see above for details. Dilations in the batch and depth dimensions must be 1.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as filter.
tf.nn.dilation2d     View source on GitHub    Computes the grayscale dilation of 4-D input and 3-D filters tensors. 
tf.nn.dilation2d(
    input, filters, strides, padding, data_format, dilations, name=None
)
 The input tensor has shape [batch, in_height, in_width, depth] and the filters tensor has shape [filter_height, filter_width, depth], i.e., each input channel is processed independently of the others with its own structuring function. The output tensor has shape [batch, out_height, out_width, depth]. The spatial dimensions of the output tensor depend on the padding algorithm. We currently only support the default "NHWC" data_format. In detail, the grayscale morphological 2-D dilation is the max-sum correlation (for consistency with conv2d, we use unmirrored filters): output[b, y, x, c] =
   max_{dy, dx} input[b,
                      strides[1] * y + rates[1] * dy,
                      strides[2] * x + rates[2] * dx,
                      c] +
                filters[dy, dx, c]
 Max-pooling is a special case when the filter has size equal to the pooling kernel size and contains all zeros. Note on duality: The dilation of input by the filters is equal to the negation of the erosion of -input by the reflected filters.
 


 Args
  input   A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, half, uint32, uint64. 4-D with shape [batch, in_height, in_width, depth].  
  filters   A Tensor. Must have the same type as input. 3-D with shape [filter_height, filter_width, depth].  
  strides   A list of ints that has length >= 4. The stride of the sliding window for each dimension of the input tensor. Must be: [1, stride_height, stride_width, 1].  
  padding   A string from: "SAME", "VALID". The type of padding algorithm to use.  
  data_format   A string, only "NHWC" is currently supported.  
  dilations   A list of ints that has length >= 4. The input stride for atrous morphological dilation. Must be: [1, rate_height, rate_width, 1].  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as input.
tf.nn.dropout     View source on GitHub    Computes dropout: randomly sets elements to zero to prevent overfitting. 
tf.nn.dropout(
    x, rate, noise_shape=None, seed=None, name=None
)
 
Note: The behavior of dropout has changed between TensorFlow 1.x and 2.x. When converting 1.x code, please use named arguments to ensure behavior stays consistent.
 See also: tf.keras.layers.Dropout for a dropout layer. Dropout is useful for regularizing DNN models. Inputs elements are randomly set to zero (and the other elements are rescaled). This encourages each node to be independently useful, as it cannot rely on the output of other nodes. More precisely: With probability rate elements of x are set to 0. The remaining elements are scaled up by 1.0 / (1 - rate), so that the expected value is preserved. 
tf.random.set_seed(0)
x = tf.ones([3,5])
tf.nn.dropout(x, rate = 0.5, seed = 1).numpy()
array([[2., 0., 0., 2., 2.],
     [2., 2., 2., 2., 2.],
     [2., 0., 2., 0., 2.]], dtype=float32)
 
tf.random.set_seed(0)
x = tf.ones([3,5])
tf.nn.dropout(x, rate = 0.8, seed = 1).numpy()
array([[0., 0., 0., 5., 5.],
     [0., 5., 0., 5., 0.],
     [5., 0., 5., 0., 5.]], dtype=float32)
 
tf.nn.dropout(x, rate = 0.0) == x
<tf.Tensor: shape=(3, 5), dtype=bool, numpy=
  array([[ True,  True,  True,  True,  True],
         [ True,  True,  True,  True,  True],
         [ True,  True,  True,  True,  True]])>
 By default, each element is kept or dropped independently. If noise_shape is specified, it must be broadcastable to the shape of x, and only dimensions with noise_shape[i] == shape(x)[i] will make independent decisions. This is useful for dropping whole channels from an image or sequence. For example: 
tf.random.set_seed(0)
x = tf.ones([3,10])
tf.nn.dropout(x, rate = 2/3, noise_shape=[1,10], seed=1).numpy()
array([[0., 0., 0., 3., 3., 0., 3., 3., 3., 0.],
     [0., 0., 0., 3., 3., 0., 3., 3., 3., 0.],
     [0., 0., 0., 3., 3., 0., 3., 3., 3., 0.]], dtype=float32)

 


 Args
  x   A floating point tensor.  
  rate   A scalar Tensor with the same type as x. The probability that each element is dropped. For example, setting rate=0.1 would drop 10% of input elements.  
  noise_shape   A 1-D Tensor of type int32, representing the shape for randomly generated keep/drop flags.  
  seed   A Python integer. Used to create random seeds. See tf.random.set_seed for behavior.  
  name   A name for this operation (optional).   
 


 Returns   A Tensor of the same shape of x.  

 


 Raises
  ValueError   If rate is not in [0, 1) or if x is not a floating point tensor. rate=1 is disallowed, because the output would be all zeros, which is likely not what was intended.
tf.nn.elu Computes exponential linear: exp(features) - 1 if < 0, features otherwise.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.elu  
tf.nn.elu(
    features, name=None
)
 See Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs) 
 


 Args
  features   A Tensor. Must be one of the following types: half, bfloat16, float32, float64.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as features.
tf.nn.embedding_lookup     View source on GitHub    Looks up embeddings for the given ids from a list of tensors. 
tf.nn.embedding_lookup(
    params, ids, max_norm=None, name=None
)
 This function is used to perform parallel lookups on the list of tensors in params. It is a generalization of tf.gather, where params is interpreted as a partitioning of a large embedding tensor. If len(params) > 1, each element id of ids is partitioned between the elements of params according to the "div" partition strategy, which means we assign ids to partitions in a contiguous manner. For instance, 13 ids are split across 5 partitions as: [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10], [11, 12]]. If the id space does not evenly divide the number of partitions, each of the first (max_id + 1) % len(params) partitions will be assigned one more id. The results of the lookup are concatenated into a dense tensor. The returned tensor has shape shape(ids) + shape(params)[1:].
 


 Args
  params   A single tensor representing the complete embedding tensor, or a list of tensors all of same shape except for the first dimension, representing sharded embedding tensors following "div" partition strategy.  
  ids   A Tensor with type int32 or int64 containing the ids to be looked up in params.  
  max_norm   If not None, each embedding is clipped if its l2-norm is larger than this value.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor with the same type as the tensors in params. For instance, if params is a 5x2 matrix: [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
 or a list of matrices: params[0]: [[1, 2], [3, 4]]
params[1]: [[5, 6], [7, 8]]
params[2]: [[9, 10]]
 and ids is: [0, 3, 4]
 The output will be a 3x2 matrix: [[1, 2], [7, 8], [9, 10]]

 

 


 Raises
  ValueError   If params is empty.
tf.nn.erosion2d     View source on GitHub    Computes the grayscale erosion of 4-D value and 3-D filters tensors. 
tf.nn.erosion2d(
    value, filters, strides, padding, data_format, dilations, name=None
)
 The value tensor has shape [batch, in_height, in_width, depth] and the filters tensor has shape [filters_height, filters_width, depth], i.e., each input channel is processed independently of the others with its own structuring function. The output tensor has shape [batch, out_height, out_width, depth]. The spatial dimensions of the output tensor depend on the padding algorithm. We currently only support the default "NHWC" data_format. In detail, the grayscale morphological 2-D erosion is given by: output[b, y, x, c] =
   min_{dy, dx} value[b,
                      strides[1] * y - dilations[1] * dy,
                      strides[2] * x - dilations[2] * dx,
                      c] -
                filters[dy, dx, c]
 Duality: The erosion of value by the filters is equal to the negation of the dilation of -value by the reflected filters.
 


 Args
  value   A Tensor. 4-D with shape [batch, in_height, in_width, depth].  
  filters   A Tensor. Must have the same type as value. 3-D with shape [filters_height, filters_width, depth].  
  strides   A list of ints that has length >= 4. 1-D of length 4. The stride of the sliding window for each dimension of the input tensor. Must be: [1, stride_height, stride_width, 1].  
  padding   A string from: "SAME", "VALID". The type of padding algorithm to use.  
  data_format   A string, only "NHWC" is currently supported.  
  dilations   A list of ints that has length >= 4. 1-D of length 4. The input stride for atrous morphological dilation. Must be: [1, rate_height, rate_width, 1].  
  name   A name for the operation (optional). If not specified "erosion2d" is used.   
 


 Returns   A Tensor. Has the same type as value. 4-D with shape [batch, out_height, out_width, depth].  

 


 Raises
  ValueError   If the value depth does not match filters' shape, or if padding is other than 'VALID' or 'SAME'.
tf.nn.fractional_avg_pool     View source on GitHub    Performs fractional average pooling on the input. 
tf.nn.fractional_avg_pool(
    value, pooling_ratio, pseudo_random=False, overlapping=False, seed=0, name=None
)
 Fractional average pooling is similar to Fractional max pooling in the pooling region generation step. The only difference is that after pooling regions are generated, a mean operation is performed instead of a max operation in each pooling region.
 


 Args
  value   A Tensor. 4-D with shape [batch, height, width, channels].  
  pooling_ratio   A list of floats that has length >= 4. Pooling ratio for each dimension of value, currently only supports row and col dimension and should be >= 1.0. For example, a valid pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements must be 1.0 because we don't allow pooling on batch and channels dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions respectively.  
  pseudo_random   An optional bool. Defaults to False. When set to True, generates the pooling sequence in a pseudorandom fashion, otherwise, in a random fashion. Check paper (Graham, 2015) for difference between pseudorandom and random.  
  overlapping   An optional bool. Defaults to False. When set to True, it means when pooling, the values at the boundary of adjacent pooling cells are used by both cells. For example: index 0 1 2 3 4 value 20 5 16 3 7 If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. The result would be [20, 16] for fractional avg pooling.  
  seed   An optional int. Defaults to 0. If set to be non-zero, the random number generator is seeded by the given seed. Otherwise it is seeded by a random seed.  
  name   A name for the operation (optional).   
 


 Returns
 A tuple of Tensor objects (output, row_pooling_sequence, col_pooling_sequence). output: Output Tensor after fractional avg pooling. Has the same type as value. row_pooling_sequence: A Tensor of type int64. col_pooling_sequence: A Tensor of type int64. References: Fractional Max-Pooling: Graham, 2015 (pdf)
tf.nn.fractional_max_pool     View source on GitHub    Performs fractional max pooling on the input. 
tf.nn.fractional_max_pool(
    value, pooling_ratio, pseudo_random=False, overlapping=False, seed=0, name=None
)
 Fractional max pooling is slightly different than regular max pooling. In regular max pooling, you downsize an input set by taking the maximum value of smaller N x N subsections of the set (often 2x2), and try to reduce the set by a factor of N, where N is an integer. Fractional max pooling, as you might expect from the word "fractional", means that the overall reduction ratio N does not have to be an integer. The sizes of the pooling regions are generated randomly but are fairly uniform. For example, let's look at the height dimension, and the constraints on the list of rows that will be pool boundaries. First we define the following:  input_row_length : the number of rows from the input set output_row_length : which will be smaller than the input alpha = input_row_length / output_row_length : our reduction ratio K = floor(alpha) row_pooling_sequence : this is the result list of pool boundary rows  Then, row_pooling_sequence should satisfy:  a[0] = 0 : the first value of the sequence is 0 a[end] = input_row_length : the last value of the sequence is the size K <= (a[i+1] - a[i]) <= K+1 : all intervals are K or K+1 size length(row_pooling_sequence) = output_row_length+1 
 


 Args
  value   A Tensor. 4-D with shape [batch, height, width, channels].  
  pooling_ratio   An int or list of ints that has length 1, 2 or 4. Pooling ratio for each dimension of value, currently only supports row and col dimension and should be >= 1.0. For example, a valid pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements must be 1.0 because we don't allow pooling on batch and channels dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions respectively.  
  pseudo_random   An optional bool. Defaults to False. When set to True, generates the pooling sequence in a pseudorandom fashion, otherwise, in a random fashion. Check paper (Graham, 2015) for difference between pseudorandom and random.  
  overlapping   An optional bool. Defaults to False. When set to True, it means when pooling, the values at the boundary of adjacent pooling cells are used by both cells. For example: index 0 1 2 3 4 value 20 5 16 3 7 If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. The result would be [20, 16] for fractional max pooling.  
  seed   An optional int. Defaults to 0. If set to be non-zero, the random number generator is seeded by the given seed. Otherwise it is seeded by a random seed.  
  name   A name for the operation (optional).   
 


 Returns
 A tuple of Tensor objects (output, row_pooling_sequence, col_pooling_sequence). output: Output Tensor after fractional max pooling. Has the same type as value. row_pooling_sequence: A Tensor of type int64. col_pooling_sequence: A Tensor of type int64. References: Fractional Max-Pooling: Graham, 2015 (pdf)
tf.nn.gelu Compute the Gaussian Error Linear Unit (GELU) activation function. 
tf.nn.gelu(
    features, approximate=False, name=None
)
 Gaussian error linear unit (GELU) computes x * P(X <= x), where P(X) ~ N(0, 1). The (GELU) nonlinearity weights inputs by their value, rather than gates inputs by their sign as in ReLU. For example: 
x = tf.constant([-3.0, -1.0, 0.0, 1.0, 3.0], dtype=tf.float32)
y = tf.nn.gelu(x)
y.numpy()
array([-0.00404951, -0.15865529,  0.        ,  0.8413447 ,  2.9959507 ],
    dtype=float32)
y = tf.nn.gelu(x, approximate=True)
y.numpy()
array([-0.00363752, -0.15880796,  0.        ,  0.841192  ,  2.9963627 ],
    dtype=float32)

 


 Args
  features   A Tensor representing preactivation values.  
  approximate   An optional bool. Defaults to False. Whether to enable approximation.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor with the same type as features.  
 References: Gaussian Error Linear Units (GELUs).
tf.nn.isotonic_regression   Solves isotonic regression problems along the given axis. 
tf.nn.isotonic_regression(
    inputs, decreasing=True, axis=-1
)
 For each vector x, the problem solved is  $$\argmin_{y_1 >= y_2 >= ... >= y_n} \sum_i (x_i - y_i)^2.$$  As the solution is component-wise constant, a second tensor is returned that encodes the segments. The problems are solved over the given axis. Consider the following example, where we solve a batch of two problems. The first input is [3, 1, 2], while the second 1, 3, 4. >>> x = tf.constant([[3, 1, 2], [1, 3, 4]], dtype=tf.float32)
>>> y, segments = tf.nn.isotonic_regression(x, axis=1)
>>> y  # The solution.
<tf.Tensor: shape=(2, 3), dtype=float32, numpy=
array([[3.       , 1.5      , 1.5      ],
       [2.6666667, 2.6666667, 2.6666667]], dtype=float32)>
 Note that the first solution has two blocks [2] and [1.5, 1.5]. The second solution is constant, and thus has a single segment. These segments are exactly what the second returned tensor encodes: 
segments
<tf.Tensor: shape=(2, 3), dtype=int32, numpy=
array([[0, 1, 1],
       [0, 0, 0]], dtype=int32)>

 


 Args
  inputs   A tensor holding the inputs.  
  decreasing   If set to False, the inequalities in the optimizing constrained are flipped.  
  axis   The axis along which the problems should be solved.   
 


 Returns
  output   The solutions, same shape as type as the input.  
  segments   An int32 tensor, same shape as the input indicating the segments that have the same value. Specifically, those positions that have the same value correspond to the same segment. These values start at zero, and are monotonously increasing for each solution.
tf.nn.l2_loss L2 Loss.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.l2_loss  
tf.nn.l2_loss(
    t, name=None
)
 Computes half the L2 norm of a tensor without the sqrt: output = sum(t ** 2) / 2

 


 Args
  t   A Tensor. Must be one of the following types: half, bfloat16, float32, float64. Typically 2-D, but may have any dimensions.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as t.
tf.nn.leaky_relu     View source on GitHub    Compute the Leaky ReLU activation function.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.leaky_relu  
tf.nn.leaky_relu(
    features, alpha=0.2, name=None
)
 Source: Rectifier Nonlinearities Improve Neural Network Acoustic Models. AL Maas, AY Hannun, AY Ng - Proc. ICML, 2013. Args: features: A Tensor representing preactivation values. Must be one of the following types: float16, float32, float64, int32, int64. alpha: Slope of the activation function at x < 0. name: A name for the operation (optional).
 


 Returns   The activation value.  
 References: Rectifier Nonlinearities Improve Neural Network Acoustic Models: Maas et al., 2013 (pdf)