neulab/docprompting-conala huggingface dataset:
tf.dynamic_stitch Interleave the values from the data tensors into a single tensor.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.dynamic_stitch  
tf.dynamic_stitch(
    indices, data, name=None
)
 Builds a merged tensor such that merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
 For example, if each indices[m] is scalar or vector, we have # Scalar indices:
merged[indices[m], ...] = data[m][...]

# Vector indices:
merged[indices[m][i], ...] = data[m][i, ...]
 Each data[i].shape must start with the corresponding indices[i].shape, and the rest of data[i].shape must be constant w.r.t. i. That is, we must have data[i].shape = indices[i].shape + constant. In terms of this constant, the output shape is merged.shape = [max(indices)] + constant
 Values are merged in order, so if an index appears in both indices[m][i] and indices[n][j] for (m,i) < (n,j) the slice data[n][j] will appear in the merged result. If you do not need this guarantee, ParallelDynamicStitch might perform better on some devices. For example: indices[0] = 6
indices[1] = [4, 1]
indices[2] = [[5, 2], [0, 3]]
data[0] = [61, 62]
data[1] = [[41, 42], [11, 12]]
data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
          [51, 52], [61, 62]]
 This method can be used to merge partitions created by dynamic_partition as illustrated on the following example: # Apply function (increments x_i) on elements for which a certain condition
# apply (x_i != -1 in this example).
x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
condition_mask=tf.not_equal(x,tf.constant(-1.))
partitioned_data = tf.dynamic_partition(
    x, tf.cast(condition_mask, tf.int32) , 2)
partitioned_data[1] = partitioned_data[1] + 1.0
condition_indices = tf.dynamic_partition(
    tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
x = tf.dynamic_stitch(condition_indices, partitioned_data)
# Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
# unchanged.
   
 


 Args
  indices   A list of at least 1 Tensor objects with type int32.  
  data   A list with the same length as indices of Tensor objects with the same type.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as data.
tf.edit_distance     View source on GitHub    Computes the Levenshtein distance between sequences.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.edit_distance  
tf.edit_distance(
    hypothesis, truth, normalize=True, name='edit_distance'
)
 This operation takes variable-length sequences (hypothesis and truth), each provided as a SparseTensor, and computes the Levenshtein distance. You can normalize the edit distance by length of truth by setting normalize to true. For example: Given the following input,  
hypothesis is a tf.SparseTensor of shape [2, 1, 1]
 
truth is a tf.SparseTensor of shape [2, 2, 2]
  
hypothesis = tf.SparseTensor(
  [[0, 0, 0],
   [1, 0, 0]],
  ["a", "b"],
  (2, 1, 1))
truth = tf.SparseTensor(
  [[0, 1, 0],
   [1, 0, 0],
   [1, 0, 1],
   [1, 1, 0]],
   ["a", "b", "c", "a"],
   (2, 2, 2))
tf.edit_distance(hypothesis, truth, normalize=True)
<tf.Tensor: shape=(2, 2), dtype=float32, numpy=
array([[inf, 1. ],
       [0.5, 1. ]], dtype=float32)>
 The operaton returns a dense Tensor of shape [2, 2] with edit distances normalized by truth lengths. 
Note: It is possible to calculate edit distance between two sparse tensors with variable-length values. However, attempting to create them while eager execution is enabled will result in a ValueError.
 For the following inputs, # 'hypothesis' is a tensor of shape `[2, 1]` with variable-length values:
#   (0,0) = ["a"]
#   (1,0) = ["b"]
hypothesis = tf.sparse.SparseTensor(
    [[0, 0, 0],
     [1, 0, 0]],
    ["a", "b"],
    (2, 1, 1))

# 'truth' is a tensor of shape `[2, 2]` with variable-length values:
#   (0,0) = []
#   (0,1) = ["a"]
#   (1,0) = ["b", "c"]
#   (1,1) = ["a"]
truth = tf.sparse.SparseTensor(
    [[0, 1, 0],
     [1, 0, 0],
     [1, 0, 1],
     [1, 1, 0]],
    ["a", "b", "c", "a"],
    (2, 2, 2))

normalize = True

# The output would be a dense Tensor of shape `(2,)`, with edit distances
noramlized by 'truth' lengths.
# output => array([0., 0.5], dtype=float32)

 


 Args
  hypothesis   A SparseTensor containing hypothesis sequences.  
  truth   A SparseTensor containing truth sequences.  
  normalize   A bool. If True, normalizes the Levenshtein distance by length of truth.  
  name   A name for the operation (optional).   
 


 Returns   A dense Tensor with rank R - 1, where R is the rank of the SparseTensor inputs hypothesis and truth.  

 


 Raises
  TypeError   If either hypothesis or truth are not a SparseTensor.
Module: tf.errors Exception types for TensorFlow errors. Classes class AbortedError: The operation was aborted, typically due to a concurrent action. class AlreadyExistsError: Raised when an entity that we attempted to create already exists. class CancelledError: Raised when an operation or step is cancelled. class DataLossError: Raised when unrecoverable data loss or corruption is encountered. class DeadlineExceededError: Raised when a deadline expires before an operation could complete. class FailedPreconditionError: Operation was rejected because the system is not in a state to execute it. class InternalError: Raised when the system experiences an internal error. class InvalidArgumentError: Raised when an operation receives an invalid argument. class NotFoundError: Raised when a requested entity (e.g., a file or directory) was not found. class OpError: A generic error that is raised when TensorFlow execution fails. class OperatorNotAllowedInGraphError: An error is raised for unsupported operator in Graph execution. class OutOfRangeError: Raised when an operation iterates past the valid input range. class PermissionDeniedError: Raised when the caller does not have permission to run an operation. class ResourceExhaustedError: Some resource has been exhausted. class UnauthenticatedError: The request does not have valid authentication credentials. class UnavailableError: Raised when the runtime is currently unavailable. class UnimplementedError: Raised when an operation has not been implemented. class UnknownError: Unknown error.
 


 Other Members
  ABORTED   10  
  ALREADY_EXISTS   6  
  CANCELLED   1  
  DATA_LOSS   15  
  DEADLINE_EXCEEDED   4  
  FAILED_PRECONDITION   9  
  INTERNAL   13  
  INVALID_ARGUMENT   3  
  NOT_FOUND   5  
  OK   0  
  OUT_OF_RANGE   11  
  PERMISSION_DENIED   7  
  RESOURCE_EXHAUSTED   8  
  UNAUTHENTICATED   16  
  UNAVAILABLE   14  
  UNIMPLEMENTED   12  
  UNKNOWN   2
tf.errors.AbortedError     View source on GitHub    The operation was aborted, typically due to a concurrent action. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.AbortedError  
tf.errors.AbortedError(
    node_def, op, message
)
 For example, running a tf.QueueBase.enqueue operation may raise AbortedError if a tf.QueueBase.close operation previously ran.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.AlreadyExistsError     View source on GitHub    Raised when an entity that we attempted to create already exists. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.AlreadyExistsError  
tf.errors.AlreadyExistsError(
    node_def, op, message
)
 For example, running an operation that saves a file (e.g. tf.train.Saver.save) could potentially raise this exception if an explicit filename for an existing file was passed.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.CancelledError     View source on GitHub    Raised when an operation or step is cancelled. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.CancelledError  
tf.errors.CancelledError(
    node_def, op, message
)
 For example, a long-running operation (e.g. tf.QueueBase.enqueue may be cancelled by running another operation (e.g. tf.QueueBase.close, or by tf.Session.close. A step that is running such a long-running operation will fail by raising CancelledError.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.DataLossError     View source on GitHub    Raised when unrecoverable data loss or corruption is encountered. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.DataLossError  
tf.errors.DataLossError(
    node_def, op, message
)
 For example, this may be raised by running a tf.WholeFileReader.read operation, if the file is truncated while it is being read.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.DeadlineExceededError     View source on GitHub    Raised when a deadline expires before an operation could complete. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.DeadlineExceededError  
tf.errors.DeadlineExceededError(
    node_def, op, message
)
 This exception is not currently used.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.FailedPreconditionError     View source on GitHub    Operation was rejected because the system is not in a state to execute it. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.FailedPreconditionError  
tf.errors.FailedPreconditionError(
    node_def, op, message
)
 This exception is most commonly raised when running an operation that reads a tf.Variable before it has been initialized.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.InternalError     View source on GitHub    Raised when the system experiences an internal error. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.InternalError  
tf.errors.InternalError(
    node_def, op, message
)
 This exception is raised when some invariant expected by the runtime has been broken. Catching this exception is not recommended.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.InvalidArgumentError     View source on GitHub    Raised when an operation receives an invalid argument. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.InvalidArgumentError  
tf.errors.InvalidArgumentError(
    node_def, op, message
)
 This may occur, for example, if an operation receives an input tensor that has an invalid value or shape. For example, the tf.matmul op will raise this error if it receives an input that is not a matrix, and the tf.reshape op will raise this error if the new shape does not match the number of elements in the input tensor.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.NotFoundError     View source on GitHub    Raised when a requested entity (e.g., a file or directory) was not found. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.NotFoundError  
tf.errors.NotFoundError(
    node_def, op, message
)
 For example, running the tf.WholeFileReader.read operation could raise NotFoundError if it receives the name of a file that does not exist.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.OperatorNotAllowedInGraphError An error is raised for unsupported operator in Graph execution. 
tf.errors.OperatorNotAllowedInGraphError(
    *args, **kwargs
)
 For example, using a tf.Tensor as a Python bool in Graph execution is not allowed.
tf.errors.OpError     View source on GitHub    A generic error that is raised when TensorFlow execution fails.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.OpError, tf.compat.v1.errors.OpError  
tf.errors.OpError(
    node_def, op, message, error_code
)
 Whenever possible, the session will raise a more specific subclass of OpError from the tf.errors module.
 


 Args
  node_def   The node_def_pb2.NodeDef proto representing the op that failed, if known; otherwise None.  
  op   The ops.Operation that failed, if known; otherwise None.  
  message   The message string describing the failure.  
  error_code   The error_codes_pb2.Code describing the error.   
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.OutOfRangeError     View source on GitHub    Raised when an operation iterates past the valid input range. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.OutOfRangeError  
tf.errors.OutOfRangeError(
    node_def, op, message
)
 This exception is raised in "end-of-file" conditions, such as when a tf.QueueBase.dequeue operation is blocked on an empty queue, and a tf.QueueBase.close operation executes.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.PermissionDeniedError     View source on GitHub    Raised when the caller does not have permission to run an operation. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.PermissionDeniedError  
tf.errors.PermissionDeniedError(
    node_def, op, message
)
 For example, running the tf.WholeFileReader.read operation could raise PermissionDeniedError if it receives the name of a file for which the user does not have the read file permission.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.ResourceExhaustedError     View source on GitHub    Some resource has been exhausted. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.ResourceExhaustedError  
tf.errors.ResourceExhaustedError(
    node_def, op, message
)
 For example, this error might be raised if a per-user quota is exhausted, or perhaps the entire file system is out of space.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.UnauthenticatedError     View source on GitHub    The request does not have valid authentication credentials. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.UnauthenticatedError  
tf.errors.UnauthenticatedError(
    node_def, op, message
)
 This exception is not currently used.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.UnavailableError     View source on GitHub    Raised when the runtime is currently unavailable. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.UnavailableError  
tf.errors.UnavailableError(
    node_def, op, message
)
 This exception is not currently used.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.UnimplementedError     View source on GitHub    Raised when an operation has not been implemented. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.UnimplementedError  
tf.errors.UnimplementedError(
    node_def, op, message
)
 Some operations may raise this error when passed otherwise-valid arguments that it does not currently support. For example, running the tf.nn.max_pool2d operation would raise this error if pooling was requested on the batch dimension, because this is not yet supported.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
tf.errors.UnknownError     View source on GitHub    Unknown error. Inherits From: OpError  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.errors.UnknownError  
tf.errors.UnknownError(
    node_def, op, message, error_code=UNKNOWN
)
 An example of where this error may be returned is if a Status value received from another address space belongs to an error-space that is not known to this address space. Also, errors raised by APIs that do not return enough error information may be converted to this error.
 


 Attributes
  error_code   The integer error code that describes the error.  
  message   The error message that describes the error.  
  node_def   The NodeDef proto representing the op that failed.  
  op   The operation that failed, if known. 
Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.