neulab/docprompting-conala huggingface dataset:
tf.compat.v1.nn.rnn_cell.GRUCell Gated Recurrent Unit cell. Inherits From: RNNCell, Layer, Layer, Module 
tf.compat.v1.nn.rnn_cell.GRUCell(
    num_units, activation=None, reuse=None, kernel_initializer=None,
    bias_initializer=None, name=None, dtype=None, **kwargs
)
 Note that this cell is not optimized for performance. Please use tf.contrib.cudnn_rnn.CudnnGRU for better performance on GPU, or tf.contrib.rnn.GRUBlockCellV2 for better performance on CPU.
 


 Args
  num_units   int, The number of units in the GRU cell.  
  activation   Nonlinearity to use. Default: tanh.  
  reuse   (optional) Python boolean describing whether to reuse variables in an existing scope. If not True, and the existing scope already has the given variables, an error is raised.  
  kernel_initializer   (optional) The initializer to use for the weight and projection matrices.  
  bias_initializer   (optional) The initializer to use for the bias.  
  name   String, the name of the layer. Layers with the same name will share weights, but to avoid mistakes we require reuse=True in such cases.  
  dtype   Default dtype of the layer (default of None means use the type of the first input). Required when build is called before call.  
  **kwargs   Dict, keyword named properties for common layer attributes, like trainable etc when constructing the cell from configs of get_config(). References: Learning Phrase Representations using RNN Encoder Decoder for Statistical Machine Translation: Cho et al., 2014 (pdf) 
  
 


 Attributes
  graph  
 
  output_size   Integer or TensorShape: size of outputs produced by this cell.  
  scope_name  
 
  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
)
 zero_state View source 
zero_state(
    batch_size, dtype
)
 Return zero-filled state tensor(s).
 


 Args
  batch_size   int, float, or unit Tensor representing the batch size.  
  dtype   the data type to use for the state.   
 


 Returns   If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size, state_size] filled with zeros. If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size, s] for each s in state_size.
tf.compat.v1.nn.rnn_cell.LSTMStateTuple Tuple used by LSTM Cells for state_size, zero_state, and output state. 
tf.compat.v1.nn.rnn_cell.LSTMStateTuple(
    c, h
)
 Stores two elements: (c, h), in that order. Where c is the hidden state and h is the output. Only used when state_is_tuple=True.
 


 Attributes
  c  
 
  h  
 
  dtype
tf.compat.v1.nn.rnn_cell.MultiRNNCell RNN cell composed sequentially of multiple simple cells. Inherits From: RNNCell, Layer, Layer, Module 
tf.compat.v1.nn.rnn_cell.MultiRNNCell(
    cells, state_is_tuple=True
)
 Example: num_units = [128, 64]
cells = [BasicLSTMCell(num_units=n) for n in num_units]
stacked_rnn_cell = MultiRNNCell(cells)

 


 Args
  cells   list of RNNCells that will be composed in this order.  
  state_is_tuple   If True, accepted and returned states are n-tuples, where n = len(cells). If False, the states are all concatenated along the column axis. This latter behavior will soon be deprecated.   
 


 Raises
  ValueError   if cells is empty (not allowed), or at least one of the cells returns a state tuple but the flag state_is_tuple is False.   
 


 Attributes
  graph  
 
  output_size   Integer or TensorShape: size of outputs produced by this cell.  
  scope_name  
 
  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
)
 zero_state View source 
zero_state(
    batch_size, dtype
)
 Return zero-filled state tensor(s).
 


 Args
  batch_size   int, float, or unit Tensor representing the batch size.  
  dtype   the data type to use for the state.   
 


 Returns   If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size, state_size] filled with zeros. If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size, s] for each s in state_size.
tf.compat.v1.nn.rnn_cell.ResidualWrapper RNNCell wrapper that ensures cell inputs are added to the outputs. Inherits From: RNNCell, Layer, Layer, Module 
tf.compat.v1.nn.rnn_cell.ResidualWrapper(
    *args, **kwargs
)

 


 Args
  cell   An instance of RNNCell.  
  residual_fn   (Optional) The function to map raw cell inputs and raw cell outputs to the actual cell outputs of the residual network. Defaults to calling nest.map_structure on (lambda i, o: i + o), inputs and outputs.  
  **kwargs   dict of keyword arguments for base layer.   
 


 Attributes
  graph  
 
  output_size  
 
  scope_name  
 
  state_size  
   Methods get_initial_state View source 
get_initial_state(
    inputs=None, batch_size=None, dtype=None
)
 zero_state View source 
zero_state(
    batch_size, dtype
)
tf.compat.v1.nn.rnn_cell.RNNCell Abstract object representing an RNN cell. Inherits From: Layer, Layer, Module 
tf.compat.v1.nn.rnn_cell.RNNCell(
    trainable=True, name=None, dtype=None, **kwargs
)
 Every RNNCell must have the properties below and implement call with the signature (output, next_state) = call(input, state). The optional third input argument, scope, is allowed for backwards compatibility purposes; but should be left off for new subclasses. 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
  graph  
 
  output_size   Integer or TensorShape: size of outputs produced by this cell.  
  scope_name  
 
  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
)
 zero_state View source 
zero_state(
    batch_size, dtype
)
 Return zero-filled state tensor(s).
 


 Args
  batch_size   int, float, or unit Tensor representing the batch size.  
  dtype   the data type to use for the state.   
 


 Returns   If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size, state_size] filled with zeros. If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size, s] for each s in state_size.
tf.compat.v1.nn.safe_embedding_lookup_sparse Lookup embedding results, accounting for invalid IDs and empty features. 
tf.compat.v1.nn.safe_embedding_lookup_sparse(
    embedding_weights, sparse_ids, sparse_weights=None, combiner='mean',
    default_id=None, name=None, partition_strategy='div', max_norm=None
)
 The partitioned embedding in embedding_weights must all be the same shape except for the first dimension. The first dimension is allowed to vary as the vocabulary size is not necessarily a multiple of P. embedding_weights may be a PartitionedVariable as returned by using tf.compat.v1.get_variable() with a partitioner. Invalid IDs (< 0) are pruned from input IDs and weights, as well as any IDs with non-positive weight. For an entry with no features, the embedding vector for default_id is returned, or the 0-vector if default_id is not supplied. The ids and weights may be multi-dimensional. Embeddings are always aggregated along the last dimension.
 


 Args
  embedding_weights   A single tensor representing the complete embedding tensor, or a list tensors all of same shape except for the first dimension, representing sharded embedding tensors. Alternatively, a PartitionedVariable, created by partitioning along dimension 0. Each element must be appropriately sized for the given partition_strategy.  
  sparse_ids   SparseTensor of shape [d_0, d_1, ..., d_n] containing the ids. d_0 is typically batch size.  
  sparse_weights   SparseTensor of same shape as sparse_ids, containing float weights corresponding to sparse_ids, or None if all weights are be assumed to be 1.0.  
  combiner   A string specifying how to combine embedding results for each entry. Currently "mean", "sqrtn" and "sum" are supported, with "mean" the default.  
  default_id   The id to use for an entry with no features.  
  name   A name for this operation (optional).  
  partition_strategy   A string specifying the partitioning strategy. Currently "div" and "mod" are supported. Default is "div".  
  max_norm   If not None, all embeddings are l2-normalized to max_norm before combining.   
 


 Returns   A dense tensor representing the combined embeddings for the sparse ids. For each row in the dense tensor represented by sp_ids, the op looks up the embeddings for all ids in that row, multiplies them by the corresponding weight, and combines these embeddings as specified. In other words, if shape(combined embedding_weights) = [p0, p1, ..., pm] and shape(sparse_ids) = shape(sparse_weights) = [d0, d1, ..., dn] then shape(output) = [d0, d1, ... dn-1, p1, ..., pm]. For instance, if params is a 10x20 matrix, and sp_ids / sp_weights are [0, 0]: id 1, weight 2.0
[0, 1]: id 3, weight 0.5
[1, 0]: id -1, weight 1.0
[2, 3]: id 1, weight 3.0
 default_id is 0. with combiner="mean", then the output will be a 3x20 matrix where output[0, :] = (params[1, :] * 2.0 + params[3, :] * 0.5) / (2.0 + 0.5)
output[1, :] = (params[0, :] * 1.0) / 1.0
output[2, :] = (params[1, :] * 3.0) / 3.0

 

 


 Raises
  ValueError   if embedding_weights is empty.
tf.compat.v1.nn.sampled_softmax_loss Computes and returns the sampled softmax training loss. 
tf.compat.v1.nn.sampled_softmax_loss(
    weights, biases, labels, inputs, num_sampled, num_classes, num_true=1,
    sampled_values=None, remove_accidental_hits=True,
    partition_strategy='mod', name='sampled_softmax_loss',
    seed=None
)
 This is a faster way to train a softmax classifier over a huge number of classes. This operation is for training only. It is generally an underestimate of the full softmax loss. A common use case is to use this method for training, and calculate the full softmax loss for evaluation or inference. In this case, you must set partition_strategy="div" for the two losses to be consistent, as in the following example: if mode == "train":
  loss = tf.nn.sampled_softmax_loss(
      weights=weights,
      biases=biases,
      labels=labels,
      inputs=inputs,
      ...,
      partition_strategy="div")
elif mode == "eval":
  logits = tf.matmul(inputs, tf.transpose(weights))
  logits = tf.nn.bias_add(logits, biases)
  labels_one_hot = tf.one_hot(labels, n_classes)
  loss = tf.nn.softmax_cross_entropy_with_logits(
      labels=labels_one_hot,
      logits=logits)
 See our Candidate Sampling Algorithms Reference (pdf). Also see Section 3 of (Jean et al., 2014) for the math.
 


 Args
  weights   A Tensor of shape [num_classes, dim], or a list of Tensor objects whose concatenation along dimension 0 has shape [num_classes, dim]. The (possibly-sharded) class embeddings.  
  biases   A Tensor of shape [num_classes]. The class biases.  
  labels   A Tensor of type int64 and shape [batch_size, num_true]. The target classes. Note that this format differs from the labels argument of nn.softmax_cross_entropy_with_logits.  
  inputs   A Tensor of shape [batch_size, dim]. The forward activations of the input network.  
  num_sampled   An int. The number of classes to randomly sample per batch.  
  num_classes   An int. The number of possible classes.  
  num_true   An int. The number of target classes per training example.  
  sampled_values   a tuple of (sampled_candidates, true_expected_count, sampled_expected_count) returned by a *_candidate_sampler function. (if None, we default to log_uniform_candidate_sampler)  
  remove_accidental_hits   A bool. whether to remove "accidental hits" where a sampled class equals one of the target classes. Default is True.  
  partition_strategy   A string specifying the partitioning strategy, relevant if len(weights) > 1. Currently "div" and "mod" are supported. Default is "mod". See tf.nn.embedding_lookup for more details.  
  name   A name for the operation (optional).  
  seed   random seed for candidate sampling. Default to None, which doesn't set the op-level random seed for candidate sampling.   
 


 Returns   A batch_size 1-D tensor of per-example sampled softmax losses.  
 References: On Using Very Large Target Vocabulary for Neural Machine Translation: Jean et al., 2014 (pdf)
tf.compat.v1.nn.separable_conv2d 2-D convolution with separable filters. 
tf.compat.v1.nn.separable_conv2d(
    input, depthwise_filter, pointwise_filter, strides, padding, rate=None,
    name=None, data_format=None, dilations=None
)
 Performs a depthwise convolution that acts separately on channels followed by a pointwise convolution that mixes channels. Note that this is separability between dimensions [1, 2] and 3, not spatial separability between dimensions 1 and 2. In detail, with the default NHWC format, output[b, i, j, k] = sum_{di, dj, q, r}
    input[b, strides[1] * i + di, strides[2] * j + dj, q] *
    depthwise_filter[di, dj, q, r] *
    pointwise_filter[0, 0, q * channel_multiplier + r, k]
 strides controls the strides for the depthwise convolution only, since the pointwise convolution has implicit strides of [1, 1, 1, 1]. Must have strides[0] = strides[3] = 1. For the most common case of the same horizontal and vertical strides, strides = [1, stride, stride, 1]. If any value in rate is greater than 1, we perform atrous depthwise convolution, in which case all values in the strides tensor must be equal to 1.
 


 Args
  input   4-D Tensor with shape according to data_format.  
  depthwise_filter   4-D Tensor with shape [filter_height, filter_width, in_channels, channel_multiplier]. Contains in_channels convolutional filters of depth 1.  
  pointwise_filter   4-D Tensor with shape [1, 1, channel_multiplier * in_channels, out_channels]. Pointwise filter to mix channels after depthwise_filter has convolved spatially.  
  strides   1-D of size 4. The strides for the depthwise convolution for each dimension of input.  
  padding   Controls how to pad the image before applying the depthwise convolution. Can be the string "SAME" or "VALID" indicating the type of padding algorithm to use, or a Python 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]].  
  rate   1-D of size 2. The dilation rate in which we sample input values across the height and width dimensions in atrous convolution. If it is greater than 1, then all values of strides must be 1.  
  name   A name for this operation (optional).  
  data_format   The data format for input. Either "NHWC" (default) or "NCHW".  
  dilations   Alias of rate.   
 


 Returns   A 4-D Tensor with shape according to 'data_format'. For example, with data_format="NHWC", shape is [batch, out_height, out_width, out_channels].
tf.compat.v1.nn.sigmoid_cross_entropy_with_logits Computes sigmoid cross entropy given logits. 
tf.compat.v1.nn.sigmoid_cross_entropy_with_logits(
    _sentinel=None, labels=None, logits=None, name=None
)
 Measures the probability error in discrete classification tasks in which each class is independent and not mutually exclusive. For instance, one could perform multilabel classification where a picture can contain both an elephant and a dog at the same time. For brevity, let x = logits, z = labels. The logistic loss is   z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x))
= z * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x)))
= z * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x)))
= z * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x))
= (1 - z) * x + log(1 + exp(-x))
= x - x * z + log(1 + exp(-x))
 For x < 0, to avoid overflow in exp(-x), we reformulate the above   x - x * z + log(1 + exp(-x))
= log(exp(x)) - x * z + log(1 + exp(-x))
= - x * z + log(1 + exp(x))
 Hence, to ensure stability and avoid overflow, the implementation uses this equivalent formulation max(x, 0) - x * z + log(1 + exp(-abs(x)))
 logits and labels must have the same type and shape.
 


 Args
  _sentinel   Used to prevent positional parameters. Internal, do not use.  
  labels   A Tensor of the same type and shape as logits.  
  logits   A Tensor of type float32 or float64.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of the same shape as logits with the componentwise logistic losses.  

 


 Raises
  ValueError   If logits and labels do not have the same shape.
tf.compat.v1.nn.softmax_cross_entropy_with_logits Computes softmax cross entropy between logits and labels. (deprecated) 
tf.compat.v1.nn.softmax_cross_entropy_with_logits(
    _sentinel=None, labels=None, logits=None, dim=-1, name=None, axis=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Future major versions of TensorFlow will allow gradients to flow into the labels input on backprop by default. See tf.nn.softmax_cross_entropy_with_logits_v2. Measures the probability error in discrete classification tasks in which the classes are mutually exclusive (each entry is in exactly one class). For example, each CIFAR-10 image is labeled with one and only one label: an image can be a dog or a truck, but not both. 
Note: While the classes are mutually exclusive, their probabilities need not be. All that is required is that each row of labels is a valid probability distribution. If they are not, the computation of the gradient will be incorrect.
 If using exclusive labels (wherein one and only one class is true at a time), see sparse_softmax_cross_entropy_with_logits. Warning: This op expects unscaled logits, since it performs a softmax on logits internally for efficiency. Do not call this op with the output of softmax, as it will produce incorrect results. A common use case is to have logits and labels of shape [batch_size, num_classes], but higher dimensions are supported, with the dim argument specifying the class dimension. Backpropagation will happen only into logits. To calculate a cross entropy loss that allows backpropagation into both logits and labels, see tf.nn.softmax_cross_entropy_with_logits_v2. Note that to avoid confusion, it is required to pass only named arguments to this function.
 


 Args
  _sentinel   Used to prevent positional parameters. Internal, do not use.  
  labels   Each vector along the class dimension should hold a valid probability distribution e.g. for the case in which labels are of shape [batch_size, num_classes], each row of labels[i] must be a valid probability distribution.  
  logits   Per-label activations, typically a linear output. These activation energies are interpreted as unnormalized log probabilities.  
  dim   The class dimension. Defaulted to -1 which is the last dimension.  
  name   A name for the operation (optional).  
  axis   Alias for dim.   
 


 Returns   A Tensor that contains the softmax cross entropy loss. Its type is the same as logits and its shape is the same as labels except that it does not have the last dimension of labels.
tf.compat.v1.nn.softmax_cross_entropy_with_logits_v2 Computes softmax cross entropy between logits and labels. (deprecated arguments) 
tf.compat.v1.nn.softmax_cross_entropy_with_logits_v2(
    labels, logits, axis=None, name=None, dim=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (dim). They will be removed in a future version. Instructions for updating: dim is deprecated, use axis instead Measures the probability error in discrete classification tasks in which the classes are mutually exclusive (each entry is in exactly one class). For example, each CIFAR-10 image is labeled with one and only one label: an image can be a dog or a truck, but not both. 
Note: While the classes are mutually exclusive, their probabilities need not be. All that is required is that each row of labels is a valid probability distribution. If they are not, the computation of the gradient will be incorrect.
 If using exclusive labels (wherein one and only one class is true at a time), see sparse_softmax_cross_entropy_with_logits. Warning: This op expects unscaled logits, since it performs a softmax on logits internally for efficiency. Do not call this op with the output of softmax, as it will produce incorrect results. A common use case is to have logits and labels of shape [batch_size, num_classes], but higher dimensions are supported, with the axis argument specifying the class dimension. logits and labels must have the same dtype (either float16, float32, or float64). Backpropagation will happen into both logits and labels. To disallow backpropagation into labels, pass label tensors through tf.stop_gradient before feeding it to this function. Note that to avoid confusion, it is required to pass only named arguments to this function.
 


 Args
  labels   Each vector along the class dimension should hold a valid probability distribution e.g. for the case in which labels are of shape [batch_size, num_classes], each row of labels[i] must be a valid probability distribution.  
  logits   Unscaled log probabilities.  
  axis   The class dimension. Defaulted to -1 which is the last dimension.  
  name   A name for the operation (optional).  
  dim   Deprecated alias for axis.   
 


 Returns   A Tensor that contains the softmax cross entropy loss. Its type is the same as logits and its shape is the same as labels except that it does not have the last dimension of labels.