neulab/docprompting-conala huggingface dataset:
tf.compat.v1.nn.sparse_softmax_cross_entropy_with_logits Computes sparse softmax cross entropy between logits and labels. 
tf.compat.v1.nn.sparse_softmax_cross_entropy_with_logits(
    _sentinel=None, labels=None, logits=None, name=None
)
 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: For this operation, the probability of a given label is considered exclusive. That is, soft classes are not allowed, and the labels vector must provide a single specific index for the true class for each row of logits (each minibatch entry). For soft softmax classification with a probability distribution for each entry, see softmax_cross_entropy_with_logits_v2.

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 of shape [batch_size, num_classes] and have labels of shape [batch_size], but higher dimensions are supported, in which case the dim-th dimension is assumed to be of size num_classes. logits must have the dtype of float16, float32, or float64, and labels must have the dtype of int32 or int64. 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   Tensor of shape [d_0, d_1, ..., d_{r-1}] (where r is rank of labels and result) and dtype int32 or int64. Each entry in labels must be an index in [0, num_classes). Other values will raise an exception when this op is run on CPU, and return NaN for corresponding loss and gradient rows on GPU.  
  logits   Per-label activations (typically a linear output) of shape [d_0, d_1, ..., d_{r-1}, num_classes] and dtype float16, float32, or float64. These activation energies are interpreted as unnormalized log probabilities.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of the same shape as labels and of the same type as logits with the softmax cross entropy loss.  

 


 Raises
  ValueError   If logits are scalars (need to have rank >= 1) or if the rank of the labels is not equal to the rank of the logits minus one.
tf.compat.v1.nn.static_bidirectional_rnn Creates a bidirectional recurrent neural network. (deprecated) 
tf.compat.v1.nn.static_bidirectional_rnn(
    cell_fw, cell_bw, inputs, initial_state_fw=None, initial_state_bw=None,
    dtype=None, sequence_length=None, scope=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use keras.layers.Bidirectional(keras.layers.RNN(cell, unroll=True)), which is equivalent to this API Similar to the unidirectional case above (rnn) but takes input and builds independent forward and backward RNNs with the final forward and backward outputs depth-concatenated, such that the output will have the format [time][batch][cell_fw.output_size + cell_bw.output_size]. The input_size of forward and backward cell must match. The initial state for both directions is zero by default (but can be set optionally) and no intermediate states are ever returned -- the network is fully unrolled for the given (passed in) length(s) of the sequence(s) or completely unrolled if length(s) is not given.
 


 Args
  cell_fw   An instance of RNNCell, to be used for forward direction.  
  cell_bw   An instance of RNNCell, to be used for backward direction.  
  inputs   A length T list of inputs, each a tensor of shape [batch_size, input_size], or a nested tuple of such elements.  
  initial_state_fw   (optional) An initial state for the forward RNN. This must be a tensor of appropriate type and shape [batch_size, cell_fw.state_size]. If cell_fw.state_size is a tuple, this should be a tuple of tensors having shapes [batch_size, s] for s in cell_fw.state_size.  
  initial_state_bw   (optional) Same as for initial_state_fw, but using the corresponding properties of cell_bw.  
  dtype   (optional) The data type for the initial state. Required if either of the initial states are not provided.  
  sequence_length   (optional) An int32/int64 vector, size [batch_size], containing the actual lengths for each of the sequences.  
  scope   VariableScope for the created subgraph; defaults to "bidirectional_rnn"   
 


 Returns   A tuple (outputs, output_state_fw, output_state_bw) where: outputs is a length T list of outputs (one for each input), which are depth-concatenated forward and backward outputs. output_state_fw is the final state of the forward rnn. output_state_bw is the final state of the backward rnn.  

 


 Raises
  TypeError   If cell_fw or cell_bw is not an instance of RNNCell.  
  ValueError   If inputs is None or an empty list.
tf.compat.v1.nn.static_rnn Creates a recurrent neural network specified by RNNCell cell. (deprecated) 
tf.compat.v1.nn.static_rnn(
    cell, inputs, initial_state=None, dtype=None, sequence_length=None, scope=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use keras.layers.RNN(cell, unroll=True), which is equivalent to this API The simplest form of RNN network generated is: state = cell.zero_state(...)
outputs = []
for input_ in inputs:
  output, state = cell(input_, state)
  outputs.append(output)
return (outputs, state)
 However, a few other options are available: An initial state can be provided. If the sequence_length vector is provided, dynamic calculation is performed. This method of calculation does not compute the RNN steps past the maximum sequence length of the minibatch (thus saving computational time), and properly propagates the state at an example's sequence length to the final state output. The dynamic calculation performed is, at time t for batch row b, (output, state)(b, t) =
  (t >= sequence_length(b))
    ? (zeros(cell.output_size), states(b, sequence_length(b) - 1))
    : cell(input(b, t), state(b, t - 1))

 


 Args
  cell   An instance of RNNCell.  
  inputs   A length T list of inputs, each a Tensor of shape [batch_size, input_size], or a nested tuple of such elements.  
  initial_state   (optional) An initial state for the RNN. If cell.state_size is an integer, this must be a Tensor of appropriate type and shape [batch_size, cell.state_size]. If cell.state_size is a tuple, this should be a tuple of tensors having shapes [batch_size, s] for s in cell.state_size.  
  dtype   (optional) The data type for the initial state and expected output. Required if initial_state is not provided or RNN state has a heterogeneous dtype.  
  sequence_length   Specifies the length of each sequence in inputs. An int32 or int64 vector (tensor) size [batch_size], values in [0, T).  
  scope   VariableScope for the created subgraph; defaults to "rnn".   
 


 Returns   A pair (outputs, state) where:  outputs is a length T list of outputs (one for each input), or a nested tuple of such elements. state is the final state 

 

 


 Raises
  TypeError   If cell is not an instance of RNNCell.  
  ValueError   If inputs is None or an empty list, or if the input depth (column size) cannot be inferred from inputs via shape inference.
tf.compat.v1.nn.static_state_saving_rnn RNN that accepts a state saver for time-truncated RNN calculation. (deprecated) 
tf.compat.v1.nn.static_state_saving_rnn(
    cell, inputs, state_saver, state_name, sequence_length=None, scope=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use keras.layers.RNN(cell, stateful=True), which is equivalent to this API
 


 Args
  cell   An instance of RNNCell.  
  inputs   A length T list of inputs, each a Tensor of shape [batch_size, input_size].  
  state_saver   A state saver object with methods state and save_state.  
  state_name   Python string or tuple of strings. The name to use with the state_saver. If the cell returns tuples of states (i.e., cell.state_size is a tuple) then state_name should be a tuple of strings having the same length as cell.state_size. Otherwise it should be a single string.  
  sequence_length   (optional) An int32/int64 vector size [batch_size]. See the documentation for rnn() for more details about sequence_length.  
  scope   VariableScope for the created subgraph; defaults to "rnn".   
 


 Returns   A pair (outputs, state) where: outputs is a length T list of outputs (one for each input) states is the final state  

 


 Raises
  TypeError   If cell is not an instance of RNNCell.  
  ValueError   If inputs is None or an empty list, or if the arity and type of state_name does not match that of cell.state_size.
tf.compat.v1.nn.sufficient_statistics Calculate the sufficient statistics for the mean and variance of x. 
tf.compat.v1.nn.sufficient_statistics(
    x, axes, shift=None, keep_dims=None, name=None, keepdims=None
)
 These sufficient statistics are computed using the one pass algorithm on an input that's optionally shifted. See: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Computing_shifted_data For example: 
t = [[1, 2, 3], [4, 5, 6]]
sufficient_statistics(t, [1])
(<tf.Tensor: shape=(), dtype=int32, numpy=3>, <tf.Tensor: shape=(2,),
dtype=int32, numpy=array([ 6, 15], dtype=int32)>, <tf.Tensor: shape=(2,),
dtype=int32, numpy=array([14, 77], dtype=int32)>, None)
sufficient_statistics(t, [-1])
(<tf.Tensor: shape=(), dtype=int32, numpy=3>, <tf.Tensor: shape=(2,),
dtype=int32, numpy=array([ 6, 15], dtype=int32)>, <tf.Tensor: shape=(2,),
dtype=int32, numpy=array([14, 77], dtype=int32)>, None)

 


 Args
  x   A Tensor.  
  axes   Array of ints. Axes along which to compute mean and variance. As in Python, the axes can also be negative numbers. A negative axis is interpreted as counting from the end of the rank, i.e., axis + rank(values)-th dimension.  
  shift   A Tensor containing the value by which to shift the data for numerical stability, or None if no shift is to be performed. A shift close to the true mean provides the most numerically stable results.  
  keep_dims   produce statistics with the same dimensionality as the input.  
  name   Name used to scope the operations that compute the sufficient stats.  
  keepdims   Alias for keep_dims.   
 


 Returns   Four Tensor objects of the same type as x:  the count (number of elements to average over). the (possibly shifted) sum of the elements in the array. the (possibly shifted) sum of squares of the elements in the array. the shift by which the mean must be corrected or None if shift is None.
tf.compat.v1.nn.weighted_cross_entropy_with_logits Computes a weighted cross entropy. (deprecated arguments) 
tf.compat.v1.nn.weighted_cross_entropy_with_logits(
    labels=None, logits=None, pos_weight=None, name=None, targets=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (targets). They will be removed in a future version. Instructions for updating: targets is deprecated, use labels instead This is like sigmoid_cross_entropy_with_logits() except that pos_weight, allows one to trade off recall and precision by up- or down-weighting the cost of a positive error relative to a negative error. The usual cross-entropy cost is defined as: labels * -log(sigmoid(logits)) +
    (1 - labels) * -log(1 - sigmoid(logits))
 A value pos_weight > 1 decreases the false negative count, hence increasing the recall. Conversely setting pos_weight < 1 decreases the false positive count and increases the precision. This can be seen from the fact that pos_weight is introduced as a multiplicative coefficient for the positive labels term in the loss expression: labels * -log(sigmoid(logits)) * pos_weight +
    (1 - labels) * -log(1 - sigmoid(logits))
 For brevity, let x = logits, z = labels, q = pos_weight. The loss is:   qz * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x))
= qz * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x)))
= qz * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x)))
= qz * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x))
= (1 - z) * x + (qz +  1 - z) * log(1 + exp(-x))
= (1 - z) * x + (1 + (q - 1) * z) * log(1 + exp(-x))
 Setting l = (1 + (q - 1) * z), to ensure stability and avoid overflow, the implementation uses (1 - z) * x + l * (log(1 + exp(-abs(x))) + max(-x, 0))
 logits and labels must have the same type and shape.
 


 Args
  labels   A Tensor of the same type and shape as logits.  
  logits   A Tensor of type float32 or float64.  
  pos_weight   A coefficient to use on the positive examples.  
  name   A name for the operation (optional).  
  targets   Deprecated alias for labels.   
 


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

 


 Raises
  ValueError   If logits and labels do not have the same shape.
tf.compat.v1.nn.weighted_moments Returns the frequency-weighted mean and variance of x. 
tf.compat.v1.nn.weighted_moments(
    x, axes, frequency_weights, name=None, keep_dims=None, keepdims=None
)

 


 Args
  x   A tensor.  
  axes   1-d tensor of int32 values; these are the axes along which to compute mean and variance.  
  frequency_weights   A tensor of positive weights which can be broadcast with x.  
  name   Name used to scope the operation.  
  keep_dims   Produce moments with the same dimensionality as the input.  
  keepdims   Alias of keep_dims.   
 


 Returns   Two tensors: weighted_mean and weighted_variance.
tf.compat.v1.nn.xw_plus_b Computes matmul(x, weights) + biases. 
tf.compat.v1.nn.xw_plus_b(
    x, weights, biases, name=None
)

 


 Args
  x   a 2D tensor. Dimensions typically: batch, in_units  
  weights   a 2D tensor. Dimensions typically: in_units, out_units  
  biases   a 1D tensor. Dimensions: out_units  
  name   A name for the operation (optional). If not specified "xw_plus_b" is used.   
 


 Returns   A 2-D Tensor computing matmul(x, weights) + biases. Dimensions typically: batch, out_units.
tf.compat.v1.NodeDef A ProtocolMessage
 


 Attributes
  attr   repeated AttrEntry attr  
  device   string device  
  experimental_debug_info   ExperimentalDebugInfo experimental_debug_info  
  input   repeated string input  
  name   string name  
  op   string op    Child Classes class AttrEntry class ExperimentalDebugInfo
tf.compat.v1.NodeDef.AttrEntry A ProtocolMessage
 


 Attributes
  key   string key  
  value   AttrValue value
tf.compat.v1.NodeDef.ExperimentalDebugInfo A ProtocolMessage
 


 Attributes
  original_func_names   repeated string original_func_names  
  original_node_names   repeated string original_node_names
tf.compat.v1.norm Computes the norm of vectors, matrices, and tensors. (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.linalg.norm  
tf.compat.v1.norm(
    tensor, ord='euclidean', axis=None, keepdims=None, name=None,
    keep_dims=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (keep_dims). They will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead This function can compute several different vector norms (the 1-norm, the Euclidean or 2-norm, the inf-norm, and in general the p-norm for p > 0) and matrix norms (Frobenius, 1-norm, 2-norm and inf-norm).
 


 Args
  tensor   Tensor of types float32, float64, complex64, complex128  
  ord   Order of the norm. Supported values are 'fro', 'euclidean', 1, 2, np.inf and any positive real number yielding the corresponding p-norm. Default is 'euclidean' which is equivalent to Frobenius norm if tensor is a matrix and equivalent to 2-norm for vectors. Some restrictions apply: a) The Frobenius norm fro is not defined for vectors, b) If axis is a 2-tuple (matrix norm), only 'euclidean', 'fro', 1, 2, np.inf are supported. See the description of axis on how to compute norms for a batch of vectors or matrices stored in a tensor.  
  axis   If axis is None (the default), the input is considered a vector and a single vector norm is computed over the entire set of values in the tensor, i.e. norm(tensor, ord=ord) is equivalent to norm(reshape(tensor, [-1]), ord=ord). If axis is a Python integer, the input is considered a batch of vectors, and axis determines the axis in tensor over which to compute vector norms. If axis is a 2-tuple of Python integers it is considered a batch of matrices and axis determines the axes in tensor over which to compute a matrix norm. Negative indices are supported. Example: If you are passing a tensor that can be either a matrix or a batch of matrices at runtime, pass axis=[-2,-1] instead of axis=None to make sure that matrix norms are computed.  
  keepdims   If True, the axis indicated in axis are kept with size 1. Otherwise, the dimensions in axis are removed from the output shape.  
  name   The name of the op.  
  keep_dims   Deprecated alias for keepdims.   
 


 Returns
  output   A Tensor of the same type as tensor, containing the vector or matrix norms. If keepdims is True then the rank of output is equal to the rank of tensor. Otherwise, if axis is none the output is a scalar, if axis is an integer, the rank of output is one less than the rank of tensor, if axis is a 2-tuple the rank of output is two less than the rank of tensor.   
 


 Raises
  ValueError   If ord or axis is invalid.    Numpy Compatibility Mostly equivalent to numpy.linalg.norm. Not supported: ord <= 0, 2-norm for matrices, nuclear norm. Other differences: a) If axis is None, treats the flattened tensor as a vector regardless of rank. b) Explicitly supports 'euclidean' norm as the default, including for higher order tensors.
tf.compat.v1.no_regularizer Use this function to prevent regularization of variables. 
tf.compat.v1.no_regularizer(
    _
)
tf.compat.v1.ones_like Creates a tensor with all elements set to 1. 
tf.compat.v1.ones_like(
    tensor, dtype=None, name=None, optimize=True
)
 See also tf.ones. Given a single tensor (tensor), this operation returns a tensor of the same type and shape as tensor with all elements set to 1. Optionally, you can specify a new type (dtype) for the returned tensor. For example: tensor = tf.constant([[1, 2, 3], [4, 5, 6]])
tf.ones_like(tensor)  # [[1, 1, 1], [1, 1, 1]]

 


 Args
  tensor   A Tensor.  
  dtype   A type for the returned Tensor. Must be float32, float64, int8, uint8, int16, uint16, int32, int64, complex64, complex128 or bool.  
  name   A name for the operation (optional).  
  optimize   if true, attempt to statically determine the shape of 'tensor' and encode it as a constant.   
 


 Returns   A Tensor with all elements set to 1.
tf.compat.v1.OptimizerOptions A ProtocolMessage
 


 Attributes
  do_common_subexpression_elimination   bool do_common_subexpression_elimination  
  do_constant_folding   bool do_constant_folding  
  do_function_inlining   bool do_function_inlining  
  global_jit_level   GlobalJitLevel global_jit_level  
  max_folded_constant_in_bytes   int64 max_folded_constant_in_bytes  
  opt_level   Level opt_level   
 


 Class Variables
  DEFAULT   0  
  GlobalJitLevel  
 
  L0   -1  
  L1   0  
  Level  
 
  OFF   -1  
  ON_1   1  
  ON_2   2
tf.compat.v1.op_scope DEPRECATED. Same as name_scope above, just different argument order. 
@tf_contextlib.contextmanager
tf.compat.v1.op_scope(
    values, name, default_name=None
)
tf.compat.v1.pad Pads a tensor. 
tf.compat.v1.pad(
    tensor, paddings, mode='CONSTANT', name=None, constant_values=0
)
 This operation pads a tensor according to the paddings you specify. paddings is an integer tensor with shape [n, 2], where n is the rank of tensor. For each dimension D of input, paddings[D, 0] indicates how many values to add before the contents of tensor in that dimension, and paddings[D, 1] indicates how many values to add after the contents of tensor in that dimension. If mode is "REFLECT" then both paddings[D, 0] and paddings[D, 1] must be no greater than tensor.dim_size(D) - 1. If mode is "SYMMETRIC" then both paddings[D, 0] and paddings[D, 1] must be no greater than tensor.dim_size(D). The padded size of each dimension D of the output is: paddings[D, 0] + tensor.dim_size(D) + paddings[D, 1] For example: t = tf.constant([[1, 2, 3], [4, 5, 6]])
paddings = tf.constant([[1, 1,], [2, 2]])
# 'constant_values' is 0.
# rank of 't' is 2.
tf.pad(t, paddings, "CONSTANT")  # [[0, 0, 0, 0, 0, 0, 0],
                                 #  [0, 0, 1, 2, 3, 0, 0],
                                 #  [0, 0, 4, 5, 6, 0, 0],
                                 #  [0, 0, 0, 0, 0, 0, 0]]

tf.pad(t, paddings, "REFLECT")  # [[6, 5, 4, 5, 6, 5, 4],
                                #  [3, 2, 1, 2, 3, 2, 1],
                                #  [6, 5, 4, 5, 6, 5, 4],
                                #  [3, 2, 1, 2, 3, 2, 1]]

tf.pad(t, paddings, "SYMMETRIC")  # [[2, 1, 1, 2, 3, 3, 2],
                                  #  [2, 1, 1, 2, 3, 3, 2],
                                  #  [5, 4, 4, 5, 6, 6, 5],
                                  #  [5, 4, 4, 5, 6, 6, 5]]

 


 Args
  tensor   A Tensor.  
  paddings   A Tensor of type int32.  
  mode   One of "CONSTANT", "REFLECT", or "SYMMETRIC" (case-insensitive)  
  name   A name for the operation (optional).  
  constant_values   In "CONSTANT" mode, the scalar pad value to use. Must be same type as tensor.   
 


 Returns   A Tensor. Has the same type as tensor.  

 


 Raises
  ValueError   When mode is not one of "CONSTANT", "REFLECT", or "SYMMETRIC".
tf.compat.v1.parse_single_example Parses a single Example proto.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.io.parse_single_example  
tf.compat.v1.parse_single_example(
    serialized, features, name=None, example_names=None
)
 Similar to parse_example, except: For dense tensors, the returned Tensor is identical to the output of parse_example, except there is no batch dimension, the output shape is the same as the shape given in dense_shape. For SparseTensors, the first (batch) column of the indices matrix is removed (the indices matrix is a column vector), the values vector is unchanged, and the first (batch_size) entry of the shape vector is removed (it is now a single element vector). One might see performance advantages by batching Example protos with parse_example instead of using this function directly.
 


 Args
  serialized   A scalar string Tensor, a single serialized Example.  
  features   A dict mapping feature keys to FixedLenFeature or VarLenFeature values.  
  name   A name for this operation (optional).  
  example_names   (Optional) A scalar string Tensor, the associated name.   
 


 Returns   A dict mapping feature keys to Tensor and SparseTensor values.  

 


 Raises
  ValueError   if any feature is invalid.
tf.compat.v1.placeholder Inserts a placeholder for a tensor that will be always fed. 
tf.compat.v1.placeholder(
    dtype, shape=None, name=None
)
 Key Point: This tensor will produce an error if evaluated. Its value must be fed using the feed_dict optional argument to Session.run(), Tensor.eval(), or Operation.run(). For example: x = tf.compat.v1.placeholder(tf.float32, shape=(1024, 1024))
y = tf.matmul(x, x)

with tf.compat.v1.Session() as sess:
  print(sess.run(y))  # ERROR: will fail because x was not fed.

  rand_array = np.random.rand(1024, 1024)
  print(sess.run(y, feed_dict={x: rand_array}))  # Will succeed.

 


 Args
  dtype   The type of elements in the tensor to be fed.  
  shape   The shape of the tensor to be fed (optional). If the shape is not specified, you can feed a tensor of any shape.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor that may be used as a handle for feeding a value, but not evaluated directly.  

 


 Raises
  RuntimeError   if eager execution is enabled    Eager Compatibility Placeholders are not compatible with eager execution.