neulab/docprompting-conala huggingface dataset:
tf.nn.compute_accidental_hits     View source on GitHub    Compute the position ids in sampled_candidates matching true_classes.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.compute_accidental_hits  
tf.nn.compute_accidental_hits(
    true_classes, sampled_candidates, num_true, seed=None, name=None
)
 In Candidate Sampling, this operation facilitates virtually removing sampled classes which happen to match target classes. This is done in Sampled Softmax and Sampled Logistic. See our Candidate Sampling Algorithms Reference. We presuppose that the sampled_candidates are unique. We call it an 'accidental hit' when one of the target classes matches one of the sampled classes. This operation reports accidental hits as triples (index, id, weight), where index represents the row number in true_classes, id represents the position in sampled_candidates, and weight is -FLOAT_MAX. The result of this op should be passed through a sparse_to_dense operation, then added to the logits of the sampled classes. This removes the contradictory effect of accidentally sampling the true target classes as noise classes for the same example.
 


 Args
  true_classes   A Tensor of type int64 and shape [batch_size, num_true]. The target classes.  
  sampled_candidates   A tensor of type int64 and shape [num_sampled]. The sampled_candidates output of CandidateSampler.  
  num_true   An int. The number of target classes per training example.  
  seed   An int. An operation-specific seed. Default is 0.  
  name   A name for the operation (optional).   
 


 Returns
  indices   A Tensor of type int32 and shape [num_accidental_hits]. Values indicate rows in true_classes.  
  ids   A Tensor of type int64 and shape [num_accidental_hits]. Values indicate positions in sampled_candidates.  
  weights   A Tensor of type float and shape [num_accidental_hits]. Each value is -FLOAT_MAX.
tf.nn.compute_average_loss     View source on GitHub    Scales per-example losses with sample_weights and computes their average.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.compute_average_loss  
tf.nn.compute_average_loss(
    per_example_loss, sample_weight=None, global_batch_size=None
)
 Usage with distribution strategy and custom training loop: with strategy.scope():
  def compute_loss(labels, predictions, sample_weight=None):

    # If you are using a `Loss` class instead, set reduction to `NONE` so that
    # we can do the reduction afterwards and divide by global batch size.
    per_example_loss = tf.keras.losses.sparse_categorical_crossentropy(
        labels, predictions)

    # Compute loss that is scaled by sample_weight and by global batch size.
    return tf.nn.compute_average_loss(
        per_example_loss,
        sample_weight=sample_weight,
        global_batch_size=GLOBAL_BATCH_SIZE)

 


 Args
  per_example_loss   Per-example loss.  
  sample_weight   Optional weighting for each example.  
  global_batch_size   Optional global batch size value. Defaults to (size of first dimension of losses) * (number of replicas).   
 


 Returns   Scalar loss value.
tf.nn.conv1d       View source on GitHub    Computes a 1-D convolution given 3-D input and filter tensors. 
tf.nn.conv1d(
    input, filters, stride, padding, data_format='NWC', dilations=None,
    name=None
)
 Given an input tensor of shape batch_shape + [in_width, in_channels] if data_format is "NWC", or batch_shape + [in_channels, in_width] if data_format is "NCW", and a filter / kernel tensor of shape [filter_width, in_channels, out_channels], this op reshapes the arguments to pass them to conv2d to perform the equivalent convolution operation. Internally, this op reshapes the input tensors and invokes tf.nn.conv2d. For example, if data_format does not start with "NC", a tensor of shape batch_shape + [in_width, in_channels] is reshaped to batch_shape + [1, in_width, in_channels], and the filter is reshaped to [1, filter_width, in_channels, out_channels]. The result is then reshaped back to batch_shape + [out_width, out_channels] (where out_width is a function of the stride and padding as in conv2d) and returned to the caller.
 


 Args
  input   A Tensor of rank at least 3. Must be of type float16, float32, or float64.  
  filters   A Tensor of rank at least 3. Must have the same type as input.  
  stride   An int or list of ints that has length 1 or 3. The number of entries by which the filter is moved right at each step.  
  padding   'SAME' or 'VALID'  
  data_format   An optional string from "NWC", "NCW". Defaults to "NWC", the data is stored in the order of batch_shape + [in_width, in_channels]. The "NCW" format stores data as batch_shape + [in_channels, in_width].  
  dilations   An int or list of ints that has length 1 or 3 which defaults to 1. 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. 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.  

 


 Raises
  ValueError   if data_format is invalid.
tf.nn.conv1d_transpose     View source on GitHub    The transpose of conv1d.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.conv1d_transpose  
tf.nn.conv1d_transpose(
    input, filters, output_shape, strides, padding='SAME',
    data_format='NWC', dilations=None, name=None
)
 This operation is sometimes called "deconvolution" after (Zeiler et al., 2010), but is actually the transpose (gradient) of conv1d rather than an actual deconvolution.
 


 Args
  input   A 3-D Tensor of type float and shape [batch, in_width, in_channels] for NWC data format or [batch, in_channels, in_width] for NCW data format.  
  filters   A 3-D Tensor with the same type as input and shape [filter_width, output_channels, in_channels]. filter's in_channels dimension must match that of input.  
  output_shape   A 1-D Tensor, containing three elements, representing the output shape of the deconvolution op.  
  strides   An int or list of ints that has length 1 or 3. The number of entries by which the filter is moved right at each step.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm. See the "returns" section of tf.nn.convolution for details.  
  data_format   A string. 'NWC' and 'NCW' are supported.  
  dilations   An int or list of ints that has length 1 or 3 which defaults to 1. 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. Dilations in the batch and depth dimensions must be 1.  
  name   Optional name for the returned tensor.   
 


 Returns   A Tensor with the same type as input.  

 


 Raises
  ValueError   If input/output depth does not match filter's shape, if output_shape is not at 3-element vector, if padding is other than 'VALID' or 'SAME', or if data_format is invalid.    References: Deconvolutional Networks: Zeiler et al., 2010 (pdf)
tf.nn.conv2d_transpose     View source on GitHub    The transpose of conv2d. 
tf.nn.conv2d_transpose(
    input, filters, output_shape, strides, padding='SAME',
    data_format='NHWC', dilations=None, name=None
)
 This operation is sometimes called "deconvolution" after (Zeiler et al., 2010), but is really the transpose (gradient) of atrous_conv2d rather than an actual deconvolution.
 


 Args
  input   A 4-D Tensor of type float and shape [batch, height, width, in_channels] for NHWC data format or [batch, in_channels, height, width] for NCHW data format.  
  filters   A 4-D Tensor with the same type as input and shape [height, width, output_channels, in_channels]. filter's in_channels dimension must match that of input.  
  output_shape   A 1-D Tensor representing the output shape of the deconvolution op.  
  strides   An int or list of ints that has length 1, 2 or 4. The stride of the sliding window for each dimension of input. If a single value is given it is replicated in the H and W dimension. By default the N and C dimensions are set to 0. The dimension order is determined by the value of data_format, see below for details.  
  padding   Either 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]]. </td> </tr><tr> <td>data_format</td> <td> A string. 'NHWC' and 'NCHW' are supported. </td> </tr><tr> <td>dilations</td> <td> An int or list ofintsthat has length1,2or4, defaults to 1. The dilation factor for each dimension ofinput. If a single value is given it is replicated in theHandWdimension. By default theNandCdimensions are set to 1. 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 ofdata_format, see above for details. Dilations in the batch and depth dimensions if a 4-d tensor must be 1. </td> </tr><tr> <td>name`   Optional name for the returned tensor.   
 


 Returns   A Tensor with the same type as input.  

 


 Raises
  ValueError   If input/output depth does not match filter's shape, or if padding is other than 'VALID' or 'SAME'.    References: Deconvolutional Networks: Zeiler et al., 2010 (pdf)
tf.nn.conv3d     View source on GitHub    Computes a 3-D convolution given 5-D input and filters tensors. 
tf.nn.conv3d(
    input, filters, strides, padding, data_format='NDHWC', dilations=None,
    name=None
)
 In signal processing, cross-correlation is a measure of similarity of two waveforms as a function of a time-lag applied to one of them. This is also known as a sliding dot product or sliding inner-product. Our Conv3D implements a form of cross-correlation.
 


 Args
  input   A Tensor. Must be one of the following types: half, bfloat16, float32, float64. Shape [batch, in_depth, in_height, in_width, in_channels].  
  filters   A Tensor. Must have the same type as input. Shape [filter_depth, filter_height, filter_width, in_channels, out_channels]. in_channels must match between input and filters.  
  strides   A list of ints that has length >= 5. 1-D tensor of length 5. The stride of the sliding window for each dimension of input. Must have strides[0] = strides[4] = 1.  
  padding   A string from: "SAME", "VALID". The type of padding algorithm to use.  
  data_format   An optional string from: "NDHWC", "NCDHW". Defaults to "NDHWC". The data format of the input and output data. With the default format "NDHWC", the data is stored in the order of: [batch, in_depth, in_height, in_width, in_channels]. Alternatively, the format could be "NCDHW", the data storage order is: [batch, in_channels, in_depth, in_height, in_width].  
  dilations   An optional list of ints. Defaults to [1, 1, 1, 1, 1]. 1-D tensor of length 5. 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.conv3d_transpose     View source on GitHub    The transpose of conv3d. 
tf.nn.conv3d_transpose(
    input, filters, output_shape, strides, padding='SAME',
    data_format='NDHWC', dilations=None, name=None
)
 This operation is sometimes called "deconvolution" after (Zeiler et al., 2010), but is really the transpose (gradient) of conv3d rather than an actual deconvolution.
 


 Args
  input   A 5-D Tensor of type float and shape [batch, depth, height, width, in_channels] for NDHWC data format or [batch, in_channels, depth, height, width] for NCDHW data format.  
  filters   A 5-D Tensor with the same type as input and shape [depth, height, width, output_channels, in_channels]. filter's in_channels dimension must match that of input.  
  output_shape   A 1-D Tensor representing the output shape of the deconvolution op.  
  strides   An int or list of ints that has length 1, 3 or 5. The stride of the sliding window for each dimension of input. If a single value is given it is replicated in the D, H and W dimension. By default the N and C dimensions are set to 0. The dimension order is determined by the value of data_format, see below for details.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm. See the "returns" section of tf.nn.convolution for details.  
  data_format   A string. 'NDHWC' and 'NCDHW' are supported.  
  dilations   An int or list of ints that has length 1, 3 or 5, defaults to 1. The dilation factor for each dimension ofinput. If a single value is given it is replicated in the D, H and W dimension. By default the N and C dimensions are set to 1. 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 if a 5-d tensor must be 1.  
  name   Optional name for the returned tensor.   
 


 Returns   A Tensor with the same type as input.  
 References: Deconvolutional Networks: Zeiler et al., 2010 (pdf)
tf.nn.conv_transpose     View source on GitHub    The transpose of convolution.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.conv_transpose  
tf.nn.conv_transpose(
    input, filters, output_shape, strides, padding='SAME',
    data_format=None, dilations=None, name=None
)
 This operation is sometimes called "deconvolution" after (Zeiler et al., 2010), but is really the transpose (gradient) of conv3d rather than an actual deconvolution.
 


 Args
  input   An N+2 dimensional Tensor of shape [batch_size] + input_spatial_shape + [in_channels] if data_format does not start with "NC" (default), or [batch_size, in_channels] + input_spatial_shape if data_format starts with "NC". It must be one of the following types: half, bfloat16, float32, float64.  
  filters   An N+2 dimensional Tensor with the same type as input and shape spatial_filter_shape + [in_channels, out_channels].  
  output_shape   A 1-D Tensor representing the output shape of the deconvolution op.  
  strides   An int or list of ints that has length 1, N or N+2. The stride of the sliding window for each dimension of input. If a single value is given it is replicated in the spatial dimensions. By default the N and C dimensions are set to 0. The dimension order is determined by the value of data_format, see below for details.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm. See the "returns" section of tf.nn.convolution for details.  
  data_format   A string or None. Specifies whether the channel dimension of the input and output is the last dimension (default, or if data_format does not start with "NC"), or the second dimension (if data_format starts with "NC"). For N=1, the valid values are "NWC" (default) and "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For N=3, the valid values are "NDHWC" (default) and "NCDHW".  
  dilations   An int or list of ints that has length 1, N or N+2, defaults to 1. The dilation factor for each dimension ofinput. If a single value is given it is replicated in the spatial dimensions. By default the N and C dimensions are set to 1. 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.  
  name   A name for the operation (optional). If not specified "conv_transpose" is used.   
 


 Returns   A Tensor with the same type as value.  
 References: Deconvolutional Networks: Zeiler et al., 2010 (pdf)
tf.nn.crelu     View source on GitHub    Computes Concatenated ReLU. 
tf.nn.crelu(
    features, axis=-1, name=None
)
 Concatenates a ReLU which selects only the positive part of the activation with a ReLU which selects only the negative part of the activation. Note that as a result this non-linearity doubles the depth of the activations. Source: Understanding and Improving Convolutional Neural Networks via Concatenated Rectified Linear Units. W. Shang, et al.
 


 Args
  features   A Tensor with type float, double, int32, int64, uint8, int16, or int8.  
  name   A name for the operation (optional).  
  axis   The axis that the output values are concatenated along. Default is -1.   
 


 Returns   A Tensor with the same type as features.  
 References: Understanding and Improving Convolutional Neural Networks via Concatenated Rectified Linear Units: Shang et al., 2016 (pdf)
tf.nn.ctc_beam_search_decoder     View source on GitHub    Performs beam search decoding on the logits given in input.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.ctc_beam_search_decoder_v2  
tf.nn.ctc_beam_search_decoder(
    inputs, sequence_length, beam_width=100, top_paths=1
)
 
Note: The ctc_greedy_decoder is a special case of the ctc_beam_search_decoder with top_paths=1 and beam_width=1 (but that decoder is faster for this special case).

 


 Args
  inputs   3-D float Tensor, size [max_time, batch_size, num_classes]. The logits.  
  sequence_length   1-D int32 vector containing sequence lengths, having size [batch_size].  
  beam_width   An int scalar >= 0 (beam search beam width).  
  top_paths   An int scalar >= 0, <= beam_width (controls output size).   
 


 Returns   A tuple (decoded, log_probabilities) where     decoded   A list of length top_paths, where decoded[j] is a SparseTensor containing the decoded outputs: decoded[j].indices: Indices matrix [total_decoded_outputs[j], 2]; The rows store: [batch, time]. decoded[j].values: Values vector, size [total_decoded_outputs[j]]. The vector stores the decoded classes for beam j. decoded[j].dense_shape: Shape vector, size (2). The shape values are: [batch_size, max_decoded_length[j]]. 
 
  log_probability   A float matrix [batch_size, top_paths] containing sequence log-probabilities.
tf.nn.ctc_greedy_decoder     View source on GitHub    Performs greedy decoding on the logits given in input (best path).  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.ctc_greedy_decoder  
tf.nn.ctc_greedy_decoder(
    inputs, sequence_length, merge_repeated=True
)
 
Note: Regardless of the value of merge_repeated, if the maximum index of a given time and batch corresponds to the blank index (num_classes - 1), no new element is emitted.
 If merge_repeated is True, merge repeated classes in output. This means that if consecutive logits' maximum indices are the same, only the first of these is emitted. The sequence A B B * B * B (where '*' is the blank label) becomes  
A B B B if merge_repeated=True. 
A B B B B if merge_repeated=False. 
 


 Args
  inputs   3-D float Tensor sized [max_time, batch_size, num_classes]. The logits.  
  sequence_length   1-D int32 vector containing sequence lengths, having size [batch_size].  
  merge_repeated   Boolean. Default: True.   
 


 Returns   A tuple (decoded, neg_sum_logits) where     decoded   A single-element list. decoded[0] is an SparseTensor containing the decoded outputs s.t.: decoded.indices: Indices matrix (total_decoded_outputs, 2). The rows store: [batch, time]. decoded.values: Values vector, size (total_decoded_outputs). The vector stores the decoded classes. decoded.dense_shape: Shape vector, size (2). The shape values are: [batch_size, max_decoded_length] 
 
  neg_sum_logits   A float matrix (batch_size x 1) containing, for the sequence found, the negative of the sum of the greatest logit at each timeframe.
tf.nn.ctc_loss     View source on GitHub    Computes CTC (Connectionist Temporal Classification) loss. 
tf.nn.ctc_loss(
    labels, logits, label_length, logit_length, logits_time_major=True, unique=None,
    blank_index=None, name=None
)
 This op implements the CTC loss as presented in (Graves et al., 2006). Notes:  Same as the "Classic CTC" in TensorFlow 1.x's tf.compat.v1.nn.ctc_loss setting of preprocess_collapse_repeated=False, ctc_merge_repeated=True Labels may be supplied as either a dense, zero-padded tensor with a vector of label sequence lengths OR as a SparseTensor. On TPU and GPU: Only dense padded labels are supported. On CPU: Caller may use SparseTensor or dense padded labels but calling with a SparseTensor will be significantly faster. Default blank label is 0 rather num_classes - 1, unless overridden by blank_index. 
 


 Args
  labels   tensor of shape [batch_size, max_label_seq_length] or SparseTensor  
  logits   tensor of shape [frames, batch_size, num_labels], if logits_time_major == False, shape is [batch_size, frames, num_labels].  
  label_length   tensor of shape [batch_size], None if labels is SparseTensor Length of reference label sequence in labels.  
  logit_length   tensor of shape [batch_size] Length of input sequence in logits.  
  logits_time_major   (optional) If True (default), logits is shaped [time, batch, logits]. If False, shape is [batch, time, logits]  
  unique   (optional) Unique label indices as computed by ctc_unique_labels(labels). If supplied, enable a faster, memory efficient implementation on TPU.  
  blank_index   (optional) Set the class index to use for the blank label. Negative values will start from num_classes, ie, -1 will reproduce the ctc_loss behavior of using num_classes - 1 for the blank symbol. There is some memory/performance overhead to switching from the default of 0 as an additional shifted copy of the logits may be created.  
  name   A name for this Op. Defaults to "ctc_loss_dense".   
 


 Returns
  loss   tensor of shape [batch_size], negative log probabilities.    References: Connectionist Temporal Classification - Labeling Unsegmented Sequence Data with Recurrent Neural Networks: Graves et al., 2006 (pdf)
tf.nn.ctc_unique_labels     View source on GitHub    Get unique labels and indices for batched labels for tf.nn.ctc_loss.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.ctc_unique_labels  
tf.nn.ctc_unique_labels(
    labels, name=None
)
 For use with tf.nn.ctc_loss optional argument unique: This op can be used to preprocess labels in input pipeline to for better speed/memory use computing the ctc loss on TPU. Example: ctc_unique_labels([[3, 4, 4, 3]]) -> unique labels padded with 0: [[3, 4, 0, 0]] indices of original labels in unique: [0, 1, 1, 0]
 


 Args
  labels   tensor of shape [batch_size, max_label_length] padded with 0.  
  name   A name for this Op. Defaults to "ctc_unique_labels".   
 


 Returns   tuple of  unique labels, tensor of shape [batch_size, max_label_length]
 indices into unique labels, shape [batch_size, max_label_length]