neulab/docprompting-conala huggingface dataset:
tf.compat.v1.confusion_matrix Computes the confusion matrix from predictions and labels.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.math.confusion_matrix  
tf.compat.v1.confusion_matrix(
    labels, predictions, num_classes=None, dtype=tf.dtypes.int32, name=None,
    weights=None
)
 The matrix columns represent the prediction labels and the rows represent the real labels. The confusion matrix is always a 2-D array of shape [n, n], where n is the number of valid labels for a given classification task. Both prediction and labels must be 1-D arrays of the same shape in order for this function to work. If num_classes is None, then num_classes will be set to one plus the maximum value in either predictions or labels. Class labels are expected to start at 0. For example, if num_classes is 3, then the possible labels would be [0, 1, 2]. If weights is not None, then each prediction contributes its corresponding weight to the total value of the confusion matrix cell. For example: tf.math.confusion_matrix([1, 2, 4], [2, 2, 4]) ==>
    [[0 0 0 0 0]
     [0 0 1 0 0]
     [0 0 1 0 0]
     [0 0 0 0 0]
     [0 0 0 0 1]]
 Note that the possible labels are assumed to be [0, 1, 2, 3, 4], resulting in a 5x5 confusion matrix.
 


 Args
  labels   1-D Tensor of real labels for the classification task.  
  predictions   1-D Tensor of predictions for a given classification.  
  num_classes   The possible number of labels the classification task can have. If this value is not provided, it will be calculated using both predictions and labels array.  
  dtype   Data type of the confusion matrix.  
  name   Scope name.  
  weights   An optional Tensor whose shape matches predictions.   
 


 Returns   A Tensor of type dtype with shape [n, n] representing the confusion matrix, where n is the number of possible labels in the classification task.  

 


 Raises
  ValueError   If both predictions and labels are not 1-D vectors and have mismatched shapes, or if weights is not None and its shape doesn't match predictions.
tf.compat.v1.constant Creates a constant tensor. 
tf.compat.v1.constant(
    value, dtype=None, shape=None, name='Const', verify_shape=False
)
 The resulting tensor is populated with values of type dtype, as specified by arguments value and (optionally) shape (see examples below). The argument value can be a constant value, or a list of values of type dtype. If value is a list, then the length of the list must be less than or equal to the number of elements implied by the shape argument (if specified). In the case where the list length is less than the number of elements specified by shape, the last element in the list will be used to fill the remaining entries. The argument shape is optional. If present, it specifies the dimensions of the resulting tensor. If not present, the shape of value is used. If the argument dtype is not specified, then the type is inferred from the type of value. For example: # Constant 1-D Tensor populated with value list.
tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) => [1 2 3 4 5 6 7]

# Constant 2-D tensor populated with scalar value -1.
tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.]
                                             [-1. -1. -1.]]
 tf.constant differs from tf.fill in a few ways:  
tf.constant supports arbitrary constants, not just uniform scalar Tensors like tf.fill. 
tf.constant creates a Const node in the computation graph with the exact value at graph construction time. On the other hand, tf.fill creates an Op in the graph that is expanded at runtime. Because tf.constant only embeds constant values in the graph, it does not support dynamic shapes based on other runtime Tensors, whereas tf.fill does. 
 


 Args
  value   A constant value (or list) of output type dtype.  
  dtype   The type of the elements of the resulting tensor.  
  shape   Optional dimensions of resulting tensor.  
  name   Optional name for the tensor.  
  verify_shape   Boolean that enables verification of a shape of values.   
 


 Returns   A Constant Tensor.  

 


 Raises
  TypeError   if shape is incorrectly specified or unsupported.
tf.compat.v1.container Wrapper for Graph.container() using the default graph. 
tf.compat.v1.container(
    container_name
)

 


 Args
  container_name   The container string to use in the context.   
 


 Returns   A context manager that specifies the default container to use for newly created stateful ops.
tf.compat.v1.control_flow_v2_enabled Returns True if v2 control flow is enabled. 
tf.compat.v1.control_flow_v2_enabled()
 
Note: v2 control flow is always enabled inside of tf.function.
tf.compat.v1.convert_to_tensor Converts the given value to a Tensor. 
tf.compat.v1.convert_to_tensor(
    value, dtype=None, name=None, preferred_dtype=None, dtype_hint=None
)
 This function converts Python objects of various types to Tensor objects. It accepts Tensor objects, numpy arrays, Python lists, and Python scalars. For example: import numpy as np

def my_func(arg):
  arg = tf.convert_to_tensor(arg, dtype=tf.float32)
  return tf.matmul(arg, arg) + arg

# The following calls are equivalent.
value_1 = my_func(tf.constant([[1.0, 2.0], [3.0, 4.0]]))
value_2 = my_func([[1.0, 2.0], [3.0, 4.0]])
value_3 = my_func(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32))
 This function can be useful when composing a new operation in Python (such as my_func in the example above). All standard Python op constructors apply this function to each of their Tensor-valued inputs, which allows those ops to accept numpy arrays, Python lists, and scalars in addition to Tensor objects. 
Note: This function diverges from default Numpy behavior for float and string types when None is present in a Python list or scalar. Rather than silently converting None values, an error will be thrown.

 


 Args
  value   An object whose type has a registered Tensor conversion function.  
  dtype   Optional element type for the returned tensor. If missing, the type is inferred from the type of value.  
  name   Optional name to use if a new Tensor is created.  
  preferred_dtype   Optional element type for the returned tensor, used when dtype is None. In some cases, a caller may not have a dtype in mind when converting to a tensor, so preferred_dtype can be used as a soft preference. If the conversion to preferred_dtype is not possible, this argument has no effect.  
  dtype_hint   same meaning as preferred_dtype, and overrides it.   
 


 Returns   A Tensor based on value.  

 


 Raises
  TypeError   If no conversion function is registered for value to dtype.  
  RuntimeError   If a registered conversion function returns an invalid value.  
  ValueError   If the value is a tensor not of given dtype in graph mode.
tf.compat.v1.convert_to_tensor_or_indexed_slices Converts the given object to a Tensor or an IndexedSlices. 
tf.compat.v1.convert_to_tensor_or_indexed_slices(
    value, dtype=None, name=None
)
 If value is an IndexedSlices or SparseTensor it is returned unmodified. Otherwise, it is converted to a Tensor using convert_to_tensor().
 


 Args
  value   An IndexedSlices, SparseTensor, or an object that can be consumed by convert_to_tensor().  
  dtype   (Optional.) The required DType of the returned Tensor or IndexedSlices.  
  name   (Optional.) A name to use if a new Tensor is created.   
 


 Returns   A Tensor, IndexedSlices, or SparseTensor based on value.  

 


 Raises
  ValueError   If dtype does not match the element type of value.
tf.compat.v1.convert_to_tensor_or_sparse_tensor Converts value to a SparseTensor or Tensor. 
tf.compat.v1.convert_to_tensor_or_sparse_tensor(
    value, dtype=None, name=None
)

 


 Args
  value   A SparseTensor, SparseTensorValue, or an object whose type has a registered Tensor conversion function.  
  dtype   Optional element type for the returned tensor. If missing, the type is inferred from the type of value.  
  name   Optional name to use if a new Tensor is created.   
 


 Returns   A SparseTensor or Tensor based on value.  

 


 Raises
  RuntimeError   If result type is incompatible with dtype.
tf.compat.v1.count_nonzero Computes number of nonzero elements across dimensions of a tensor. (deprecated arguments) (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.math.count_nonzero  
tf.compat.v1.count_nonzero(
    input_tensor=None, axis=None, keepdims=None, dtype=tf.dtypes.int64, name=None,
    reduction_indices=None, keep_dims=None, input=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 insteadWarning: SOME ARGUMENTS ARE DEPRECATED: (reduction_indices). They will be removed in a future version. Instructions for updating: reduction_indices is deprecated, use axis instead Reduces input_tensor along the dimensions given in axis. Unless keepdims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keepdims is true, the reduced dimensions are retained with length 1. If axis has no entries, all dimensions are reduced, and a tensor with a single element is returned. 
Note: Floating point comparison to zero is done by exact floating point equality check. Small values are not rounded to zero for purposes of the nonzero check.
 For example: x = tf.constant([[0, 1, 0], [1, 1, 0]])
tf.math.count_nonzero(x)  # 3
tf.math.count_nonzero(x, 0)  # [1, 2, 0]
tf.math.count_nonzero(x, 1)  # [1, 2]
tf.math.count_nonzero(x, 1, keepdims=True)  # [[1], [2]]
tf.math.count_nonzero(x, [0, 1])  # 3


Note: Strings are compared against zero-length empty string "". Any string with a size greater than zero is already considered as nonzero.
 For example: x = tf.constant(["", "a", "  ", "b", ""])
tf.math.count_nonzero(x) # 3, with "a", "  ", and "b" as nonzero strings.

 


 Args
  input_tensor   The tensor to reduce. Should be of numeric type, bool, or string.  
  axis   The dimensions to reduce. If None (the default), reduces all dimensions. Must be in the range [-rank(input_tensor), rank(input_tensor)).  
  keepdims   If true, retains reduced dimensions with length 1.  
  dtype   The output dtype; defaults to tf.int64.  
  name   A name for the operation (optional).  
  reduction_indices   The old (deprecated) name for axis.  
  keep_dims   Deprecated alias for keepdims.  
  input   Overrides input_tensor. For compatibility.   
 


 Returns   The reduced tensor (number of nonzero values).
tf.compat.v1.count_up_to Increments 'ref' until it reaches 'limit'. (deprecated) 
tf.compat.v1.count_up_to(
    ref, limit, name=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Prefer Dataset.range instead.
 


 Args
  ref   A Variable. Must be one of the following types: int32, int64. Should be from a scalar Variable node.  
  limit   An int. If incrementing ref would bring it above limit, instead generates an 'OutOfRange' error.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as ref. A copy of the input before increment. If nothing else modifies the input, the values produced will all be distinct.
tf.compat.v1.create_partitioned_variables Create a list of partitioned variables according to the given slicing. (deprecated) 
tf.compat.v1.create_partitioned_variables(
    shape, slicing, initializer, dtype=tf.dtypes.float32, trainable=True,
    collections=None, name=None, reuse=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.get_variable with a partitioner set. Currently only one dimension of the full variable can be sliced, and the full variable can be reconstructed by the concatenation of the returned list along that dimension.
 


 Args
  shape   List of integers. The shape of the full variable.  
  slicing   List of integers. How to partition the variable. Must be of the same length as shape. Each value indicate how many slices to create in the corresponding dimension. Presently only one of the values can be more than 1; that is, the variable can only be sliced along one dimension. For convenience, The requested number of partitions does not have to divide the corresponding dimension evenly. If it does not, the shapes of the partitions are incremented by 1 starting from partition 0 until all slack is absorbed. The adjustment rules may change in the future, but as you can save/restore these variables with different slicing specifications this should not be a problem. 
 
  initializer   A Tensor of shape shape or a variable initializer function. If a function, it will be called once for each slice, passing the shape and data type of the slice as parameters. The function must return a tensor with the same shape as the slice.  
  dtype   Type of the variables. Ignored if initializer is a Tensor.  
  trainable   If True also add all the variables to the graph collection GraphKeys.TRAINABLE_VARIABLES.  
  collections   List of graph collections keys to add the variables to. Defaults to [GraphKeys.GLOBAL_VARIABLES].  
  name   Optional name for the full variable. Defaults to "PartitionedVariable" and gets uniquified automatically.  
  reuse   Boolean or None; if True and name is set, it would reuse previously created variables. if False it will create new variables. if None, it would inherit the parent scope reuse.   
 


 Returns   A list of Variables corresponding to the slicing.  

 


 Raises
  ValueError   If any of the arguments is malformed.
Module: tf.compat.v1.data tf.data.Dataset API for input pipelines. See Importing Data for an overview. Modules experimental module: Experimental API for building input pipelines. Classes class Dataset: Represents a potentially large set of elements. class DatasetSpec: Type specification for tf.data.Dataset. class FixedLengthRecordDataset: A Dataset of fixed-length records from one or more binary files. class Iterator: Represents the state of iterating through a Dataset. class Options: Represents options for tf.data.Dataset. class TFRecordDataset: A Dataset comprising records from one or more TFRecord files. class TextLineDataset: A Dataset comprising lines from one or more text files. Functions get_output_classes(...): Returns the output classes for elements of the input dataset / iterator. get_output_shapes(...): Returns the output shapes for elements of the input dataset / iterator. get_output_types(...): Returns the output shapes for elements of the input dataset / iterator. make_initializable_iterator(...): Creates an iterator for elements of dataset. make_one_shot_iterator(...): Creates an iterator for elements of dataset.
 


 Other Members
  AUTOTUNE   -1  
  INFINITE_CARDINALITY   -1  
  UNKNOWN_CARDINALITY   -2
tf.compat.v1.data.experimental.choose_from_datasets Creates a dataset that deterministically chooses elements from datasets. 
tf.compat.v1.data.experimental.choose_from_datasets(
    datasets, choice_dataset
)
 For example, given the following datasets: datasets = [tf.data.Dataset.from_tensors("foo").repeat(),
            tf.data.Dataset.from_tensors("bar").repeat(),
            tf.data.Dataset.from_tensors("baz").repeat()]

# Define a dataset containing `[0, 1, 2, 0, 1, 2, 0, 1, 2]`.
choice_dataset = tf.data.Dataset.range(3).repeat(3)

result = tf.data.experimental.choose_from_datasets(datasets, choice_dataset)
 The elements of result will be: "foo", "bar", "baz", "foo", "bar", "baz", "foo", "bar", "baz"

 


 Args
  datasets   A list of tf.data.Dataset objects with compatible structure.  
  choice_dataset   A tf.data.Dataset of scalar tf.int64 tensors between 0 and len(datasets) - 1.   
 


 Returns   A dataset that interleaves elements from datasets according to the values of choice_dataset.  

 


 Raises
  TypeError   If the datasets or choice_dataset arguments have the wrong type.
tf.compat.v1.data.experimental.Counter Creates a Dataset that counts from start in steps of size step. 
tf.compat.v1.data.experimental.Counter(
    start=0, step=1, dtype=tf.dtypes.int64
)
 For example: Dataset.count() == [0, 1, 2, ...)
Dataset.count(2) == [2, 3, ...)
Dataset.count(2, 5) == [2, 7, 12, ...)
Dataset.count(0, -1) == [0, -1, -2, ...)
Dataset.count(10, -1) == [10, 9, ...)

 


 Args
  start   (Optional.) The starting value for the counter. Defaults to 0.  
  step   (Optional.) The step size for the counter. Defaults to 1.  
  dtype   (Optional.) The data type for counter elements. Defaults to tf.int64.   
 


 Returns   A Dataset of scalar dtype elements.
tf.compat.v1.data.experimental.map_and_batch_with_legacy_function Fused implementation of map and batch. (deprecated) 
tf.compat.v1.data.experimental.map_and_batch_with_legacy_function(
    map_func, batch_size, num_parallel_batches=None, drop_remainder=False,
    num_parallel_calls=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use `tf.data.experimental.map_and_batch()
Note: This is an escape hatch for existing uses of map_and_batch that do not work with V2 functions. New uses are strongly discouraged and existing uses should migrate to map_and_batch as this method will not be removed in V2.

 


 Args
  map_func   A function mapping a nested structure of tensors to another nested structure of tensors.  
  batch_size   A tf.int64 scalar tf.Tensor, representing the number of consecutive elements of this dataset to combine in a single batch.  
  num_parallel_batches   (Optional.) A tf.int64 scalar tf.Tensor, representing the number of batches to create in parallel. On one hand, higher values can help mitigate the effect of stragglers. On the other hand, higher values can increase contention if CPU is scarce.  
  drop_remainder   (Optional.) A tf.bool scalar tf.Tensor, representing whether the last batch should be dropped in case its size is smaller than desired; the default behavior is not to drop the smaller batch.  
  num_parallel_calls   (Optional.) A tf.int32 scalar tf.Tensor, representing the number of elements to process in parallel. If not specified, batch_size * num_parallel_batches elements will be processed in parallel. If the value tf.data.AUTOTUNE is used, then the number of parallel calls is set dynamically based on available CPU.   
 


 Returns   A Dataset transformation function, which can be passed to tf.data.Dataset.apply.  

 


 Raises
  ValueError   If both num_parallel_batches and num_parallel_calls are specified.
tf.compat.v1.data.experimental.RaggedTensorStructure DEPRECATED FUNCTION 
tf.compat.v1.data.experimental.RaggedTensorStructure(
    dtype, shape, ragged_rank
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.RaggedTensorSpec instead.
tf.compat.v1.data.experimental.sample_from_datasets Samples elements at random from the datasets in datasets. 
tf.compat.v1.data.experimental.sample_from_datasets(
    datasets, weights=None, seed=None
)

 


 Args
  datasets   A list of tf.data.Dataset objects with compatible structure.  
  weights   (Optional.) A list of len(datasets) floating-point values where weights[i] represents the probability with which an element should be sampled from datasets[i], or a tf.data.Dataset object where each element is such a list. Defaults to a uniform distribution across datasets.  
  seed   (Optional.) A tf.int64 scalar tf.Tensor, representing the random seed that will be used to create the distribution. See tf.random.set_seed for behavior.   
 


 Returns   A dataset that interleaves elements from datasets at random, according to weights if provided, otherwise with uniform probability.  

 


 Raises
  TypeError   If the datasets or weights arguments have the wrong type.  
  ValueError   If the weights argument is specified and does not match the length of the datasets element.
tf.compat.v1.data.experimental.SparseTensorStructure DEPRECATED FUNCTION 
tf.compat.v1.data.experimental.SparseTensorStructure(
    dtype, shape
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.SparseTensorSpec instead.
tf.compat.v1.data.experimental.StatsAggregator A stateful resource that aggregates statistics from one or more iterators. 
tf.compat.v1.data.experimental.StatsAggregator()
 To record statistics, use one of the custom transformation functions defined in this module when defining your tf.data.Dataset. All statistics will be aggregated by the StatsAggregator that is associated with a particular iterator (see below). For example, to record the latency of producing each element by iterating over a dataset: dataset = ...
dataset = dataset.apply(tf.data.experimental.latency_stats("total_bytes"))
 To associate a StatsAggregator with a tf.data.Dataset object, use the following pattern: aggregator = tf.data.experimental.StatsAggregator()
dataset = ...

# Apply `StatsOptions` to associate `dataset` with `aggregator`.
options = tf.data.Options()
options.experimental_stats.aggregator = aggregator
dataset = dataset.with_options(options)
 To get a protocol buffer summary of the currently aggregated statistics, use the StatsAggregator.get_summary() tensor. The easiest way to do this is to add the returned tensor to the tf.GraphKeys.SUMMARIES collection, so that the summaries will be included with any existing summaries. aggregator = tf.data.experimental.StatsAggregator()
# ...
stats_summary = aggregator.get_summary()
tf.compat.v1.add_to_collection(tf.GraphKeys.SUMMARIES, stats_summary)


Note: This interface is experimental and expected to change. In particular, we expect to add other implementations of StatsAggregator that provide different ways of exporting statistics, and add more types of statistics.
 Methods get_summary View source 
get_summary()
 Returns a string tf.Tensor that summarizes the aggregated statistics. The returned tensor will contain a serialized tf.compat.v1.summary.Summary protocol buffer, which can be used with the standard TensorBoard logging facilities.
 


 Returns   A scalar string tf.Tensor that summarizes the aggregated statistics.
tf.compat.v1.data.experimental.TensorArrayStructure DEPRECATED FUNCTION 
tf.compat.v1.data.experimental.TensorArrayStructure(
    dtype, element_shape, dynamic_size, infer_shape
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.TensorArraySpec instead.
tf.compat.v1.data.experimental.TensorStructure DEPRECATED FUNCTION 
tf.compat.v1.data.experimental.TensorStructure(
    dtype, shape
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.TensorSpec instead.
tf.compat.v1.data.get_output_classes Returns the output classes for elements of the input dataset / iterator. 
tf.compat.v1.data.get_output_classes(
    dataset_or_iterator
)

 


 Args
  dataset_or_iterator   A tf.data.Dataset or tf.data.Iterator.   
 


 Returns   A nested structure of Python type objects matching the structure of the dataset / iterator elements and specifying the class of the individual components.
tf.compat.v1.data.get_output_shapes Returns the output shapes for elements of the input dataset / iterator. 
tf.compat.v1.data.get_output_shapes(
    dataset_or_iterator
)

 


 Args
  dataset_or_iterator   A tf.data.Dataset or tf.data.Iterator.   
 


 Returns   A nested structure of tf.TensorShape objects matching the structure of the dataset / iterator elements and specifying the shape of the individual components.
tf.compat.v1.data.get_output_types Returns the output shapes for elements of the input dataset / iterator. 
tf.compat.v1.data.get_output_types(
    dataset_or_iterator
)

 


 Args
  dataset_or_iterator   A tf.data.Dataset or tf.data.Iterator.   
 


 Returns   A nested structure of tf.DType objects objects matching the structure of dataset / iterator elements and specifying the shape of the individual components.