neulab/docprompting-conala huggingface dataset:
tf.summary.trace_on Starts a trace to record computation graphs and profiling information. 
tf.summary.trace_on(
    graph=True, profiler=False
)
 Must be invoked in eager mode. When enabled, TensorFlow runtime will collection information that can later be exported and consumed by TensorBoard. The trace is activated across the entire TensorFlow runtime and affects all threads of execution. To stop the trace and export the collected information, use tf.summary.trace_export. To stop the trace without exporting, use tf.summary.trace_off.
 


 Args
  graph   If True, enables collection of executed graphs. It includes ones from tf.function invocation and ones from the legacy graph mode. The default is True.  
  profiler   If True, enables the advanced profiler. Enabling profiler implicitly enables the graph collection. The profiler may incur a high memory overhead. The default is False.
tf.summary.write Writes a generic summary to the default SummaryWriter if one exists. 
tf.summary.write(
    tag, tensor, step=None, metadata=None, name=None
)
 This exists primarily to support the definition of type-specific summary ops like scalar() and image(), and is not intended for direct use unless defining a new type-specific summary op.
 


 Args
  tag   string tag used to identify the summary (e.g. in TensorBoard), usually generated with tf.summary.summary_scope  
  tensor   the Tensor holding the summary data to write or a callable that returns this Tensor. If a callable is passed, it will only be called when a default SummaryWriter exists and the recording condition specified by record_if() is met.  
  step   Explicit int64-castable monotonic step value for this summary. If omitted, this defaults to tf.summary.experimental.get_step(), which must not be None.  
  metadata   Optional SummaryMetadata, as a proto or serialized bytes  
  name   Optional string name for this op.   
 


 Returns   True on success, or false if no summary was written because no default summary writer was available.  

 


 Raises
  ValueError   if a default writer exists, but no step was provided and tf.summary.experimental.get_step() is None.
tf.switch_case     View source on GitHub    Create a switch/case operation, i.e. an integer-indexed conditional.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.switch_case  
tf.switch_case(
    branch_index, branch_fns, default=None, name='switch_case'
)
 See also tf.case. This op can be substantially more efficient than tf.case when exactly one branch will be selected. tf.switch_case is more like a C++ switch/case statement than tf.case, which is more like an if/elif/elif/else chain. The branch_fns parameter is either a dict from int to callables, or list of (int, callable) pairs, or simply a list of callables (in which case the index is implicitly the key). The branch_index Tensor is used to select an element in branch_fns with matching int key, falling back to default if none match, or max(keys) if no default is provided. The keys must form a contiguous set from 0 to len(branch_fns) - 1. tf.switch_case supports nested structures as implemented in tf.nest. All callables must return the same (possibly nested) value structure of lists, tuples, and/or named tuples. Example: Pseudocode: switch (branch_index) {  // c-style switch
  case 0: return 17;
  case 1: return 31;
  default: return -1;
}
 or branches = {0: lambda: 17, 1: lambda: 31}
branches.get(branch_index, lambda: -1)()
 Expressions: def f1(): return tf.constant(17)
def f2(): return tf.constant(31)
def f3(): return tf.constant(-1)
r = tf.switch_case(branch_index, branch_fns={0: f1, 1: f2}, default=f3)
# Equivalent: tf.switch_case(branch_index, branch_fns={0: f1, 1: f2, 2: f3})

 


 Args
  branch_index   An int Tensor specifying which of branch_fns should be executed.  
  branch_fns   A dict mapping ints to callables, or a list of (int, callable) pairs, or simply a list of callables (in which case the index serves as the key). Each callable must return a matching structure of tensors.  
  default   Optional callable that returns a structure of tensors.  
  name   A name for this operation (optional).   
 


 Returns   The tensors returned by the callable identified by branch_index, or those returned by default if no key matches and default was provided, or those returned by the max-keyed branch_fn if no default is provided.  

 


 Raises
  TypeError   If branch_fns is not a list/dictionary.  
  TypeError   If branch_fns is a list but does not contain 2-tuples or callables.  
  TypeError   If fns[i] is not callable for any i, or default is not callable.
Module: tf.sysconfig System configuration library. Functions get_build_info(...): Get a dictionary describing TensorFlow's build environment. get_compile_flags(...): Get the compilation flags for custom operators. get_include(...): Get the directory containing the TensorFlow C++ header files. get_lib(...): Get the directory containing the TensorFlow framework library. get_link_flags(...): Get the link flags for custom operators.
 


 Other Members
  CXX11_ABI_FLAG   0  
  MONOLITHIC_BUILD   0
tf.sysconfig.get_build_info Get a dictionary describing TensorFlow's build environment.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sysconfig.get_build_info  
tf.sysconfig.get_build_info()
 Values are generated when TensorFlow is compiled, and are static for each TensorFlow package. The return value is a dictionary with string keys such as:  cuda_version cudnn_version is_cuda_build is_rocm_build msvcp_dll_names nvcuda_dll_name cudart_dll_name cudnn_dll_name  Note that the actual keys and values returned by this function is subject to change across different versions of TensorFlow or across platforms.
 


 Returns   A Dictionary describing TensorFlow's build environment.
tf.sysconfig.get_compile_flags     View source on GitHub    Get the compilation flags for custom operators.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sysconfig.get_compile_flags  
tf.sysconfig.get_compile_flags()

 


 Returns   The compilation flags.
tf.sysconfig.get_include     View source on GitHub    Get the directory containing the TensorFlow C++ header files.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sysconfig.get_include  
tf.sysconfig.get_include()

 


 Returns   The directory as string.
tf.sysconfig.get_lib     View source on GitHub    Get the directory containing the TensorFlow framework library.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sysconfig.get_lib  
tf.sysconfig.get_lib()

 


 Returns   The directory as string.
tf.sysconfig.get_link_flags     View source on GitHub    Get the link flags for custom operators.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sysconfig.get_link_flags  
tf.sysconfig.get_link_flags()

 


 Returns   The link flags.
tf.TensorArraySpec     View source on GitHub    Type specification for a tf.TensorArray. Inherits From: TypeSpec  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.TensorArraySpec  
tf.TensorArraySpec(
    element_shape=None, dtype=tf.dtypes.float32, dynamic_size=False,
    infer_shape=True
)

 


 Args
  element_shape   The shape of each element in the TensorArray.  
  dtype   Data type of the TensorArray.  
  dynamic_size   Whether the TensorArray can grow past its initial size.  
  infer_shape   Whether shape inference is enabled.   
 


 Attributes
  value_type  
   Methods from_value View source 
@staticmethod
from_value(
    value
)
 is_compatible_with View source 
is_compatible_with(
    other
)
 Returns true if spec_or_value is compatible with this TypeSpec. most_specific_compatible_type View source 
most_specific_compatible_type(
    other
)
 Returns the most specific TypeSpec compatible with self and other.
 


 Args
  other   A TypeSpec.   
 


 Raises
  ValueError   If there is no TypeSpec that is compatible with both self and other.    __eq__ View source 
__eq__(
    other
)
 Return self==value. __ne__ View source 
__ne__(
    other
)
 Return self!=value.
tf.tensordot       View source on GitHub    Tensor contraction of a and b along specified axes and outer product.  View aliases  Main aliases 
tf.linalg.tensordot Compat aliases for migration See Migration guide for more details. tf.compat.v1.linalg.tensordot, tf.compat.v1.tensordot  
tf.tensordot(
    a, b, axes, name=None
)
 Tensordot (also known as tensor contraction) sums the product of elements from a and b over the indices specified by a_axes and b_axes. The lists a_axes and b_axes specify those pairs of axes along which to contract the tensors. The axis a_axes[i] of a must have the same dimension as axis b_axes[i] of b for all i in range(0, len(a_axes)). The lists a_axes and b_axes must have identical length and consist of unique integers that specify valid axes for each of the tensors. Additionally outer product is supported by passing axes=0. This operation corresponds to numpy.tensordot(a, b, axes). Example 1: When a and b are matrices (order 2), the case axes = 1 is equivalent to matrix multiplication. Example 2: When a and b are matrices (order 2), the case axes = [[1], [0]] is equivalent to matrix multiplication. Example 3: When a and b are matrices (order 2), the case axes=0 gives the outer product, a tensor of order 4. Example 4: Suppose that \(a_{ijk}\) and \(b_{lmn}\) represent two tensors of order 3. Then, contract(a, b, [[0], [2]]) is the order 4 tensor \(c_{jklm}\) whose entry corresponding to the indices \((j,k,l,m)\) is given by: \( c_{jklm} = \sum_i a_{ijk} b_{lmi} \). In general, order(c) = order(a) + order(b) - 2*len(axes[0]).
 


 Args
  a   Tensor of type float32 or float64.  
  b   Tensor with the same type as a.  
  axes   Either a scalar N, or a list or an int32 Tensor of shape [2, k]. If axes is a scalar, sum over the last N axes of a and the first N axes of b in order. If axes is a list or Tensor the first and second row contain the set of unique integers specifying axes along which the contraction is computed, for a and b, respectively. The number of axes for a and b must be equal. If axes=0, computes the outer product between a and b.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor with the same type as a.  

 


 Raises
  ValueError   If the shapes of a, b, and axes are incompatible.  
  IndexError   If the values in axes exceed the rank of the corresponding tensor.
tf.TensorSpec     View source on GitHub    Describes a tf.Tensor. Inherits From: TypeSpec  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.TensorSpec  
tf.TensorSpec(
    shape, dtype=tf.dtypes.float32, name=None
)
 Metadata for describing the tf.Tensor objects accepted or returned by some TensorFlow APIs.
 


 Args
  shape   Value convertible to tf.TensorShape. The shape of the tensor.  
  dtype   Value convertible to tf.DType. The type of the tensor values.  
  name   Optional name for the Tensor.   
 


 Raises
  TypeError   If shape is not convertible to a tf.TensorShape, or dtype is not convertible to a tf.DType.   
 


 Attributes
  dtype   Returns the dtype of elements in the tensor.  
  name   Returns the (optionally provided) name of the described tensor.  
  shape   Returns the TensorShape that represents the shape of the tensor.  
  value_type  
   Methods from_spec View source 
@classmethod
from_spec(
    spec, name=None
)
 from_tensor View source 
@classmethod
from_tensor(
    tensor, name=None
)
 is_compatible_with View source 
is_compatible_with(
    spec_or_tensor
)
 Returns True if spec_or_tensor is compatible with this TensorSpec. Two tensors are considered compatible if they have the same dtype and their shapes are compatible (see tf.TensorShape.is_compatible_with).
 


 Args
  spec_or_tensor   A tf.TensorSpec or a tf.Tensor   
 


 Returns   True if spec_or_tensor is compatible with self.  
 most_specific_compatible_type View source 
most_specific_compatible_type(
    other
)
 Returns the most specific TypeSpec compatible with self and other.
 


 Args
  other   A TypeSpec.   
 


 Raises
  ValueError   If there is no TypeSpec that is compatible with both self and other.    __eq__ View source 
__eq__(
    other
)
 Return self==value. __ne__ View source 
__ne__(
    other
)
 Return self!=value.
tf.tensor_scatter_nd_add Adds sparse updates to an existing tensor according to indices.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.tensor_scatter_add, tf.compat.v1.tensor_scatter_nd_add  
tf.tensor_scatter_nd_add(
    tensor, indices, updates, name=None
)
 This operation creates a new tensor by adding sparse updates to the passed in tensor. This operation is very similar to tf.scatter_nd_add, except that the updates are added onto an existing tensor (as opposed to a variable). If the memory for the existing tensor cannot be re-used, a copy is made and updated. indices is an integer tensor containing indices into a new tensor of shape tensor.shape. The last dimension of indices can be at most the rank of tensor.shape: indices.shape[-1] <= tensor.shape.rank
 The last dimension of indices corresponds to indices into elements (if indices.shape[-1] = tensor.shape.rank) or slices (if indices.shape[-1] < tensor.shape.rank) along dimension indices.shape[-1] of tensor.shape. updates is a tensor with shape indices.shape[:-1] + tensor.shape[indices.shape[-1]:]
 The simplest form of tensor_scatter_add is to add individual elements to a tensor by index. For example, say we want to add 4 elements in a rank-1 tensor with 8 elements. In Python, this scatter add operation would look like this: indices = tf.constant([[4], [3], [1], [7]])
updates = tf.constant([9, 10, 11, 12])
tensor = tf.ones([8], dtype=tf.int32)
updated = tf.tensor_scatter_nd_add(tensor, indices, updates)
print(updated)
 The resulting tensor would look like this: [1, 12, 1, 11, 10, 1, 1, 13]
 We can also, insert entire slices of a higher rank tensor all at once. For example, if we wanted to insert two slices in the first dimension of a rank-3 tensor with two matrices of new values. In Python, this scatter add operation would look like this: indices = tf.constant([[0], [2]])
updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
                        [7, 7, 7, 7], [8, 8, 8, 8]],
                       [[5, 5, 5, 5], [6, 6, 6, 6],
                        [7, 7, 7, 7], [8, 8, 8, 8]]])
tensor = tf.ones([4, 4, 4],dtype=tf.int32)
updated = tf.tensor_scatter_nd_add(tensor, indices, updates)
print(updated)
 The resulting tensor would look like this: [[[6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8], [9, 9, 9, 9]],
 [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],
 [[6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8], [9, 9, 9, 9]],
 [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]]
 Note that on CPU, if an out of bound index is found, an error is returned. On GPU, if an out of bound index is found, the index is ignored.
 


 Args
  tensor   A Tensor. Tensor to copy/update.  
  indices   A Tensor. Must be one of the following types: int32, int64. Index tensor.  
  updates   A Tensor. Must have the same type as tensor. Updates to scatter into output.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as tensor.
tf.tensor_scatter_nd_max  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.tensor_scatter_nd_max  
tf.tensor_scatter_nd_max(
    tensor, indices, updates, name=None
)

 


 Args
  tensor   A Tensor. Tensor to update.  
  indices   A Tensor. Must be one of the following types: int32, int64. Index tensor.  
  updates   A Tensor. Must have the same type as tensor. Updates to scatter into output.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as tensor.
tf.tensor_scatter_nd_min  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.tensor_scatter_nd_min  
tf.tensor_scatter_nd_min(
    tensor, indices, updates, name=None
)

 


 Args
  tensor   A Tensor. Tensor to update.  
  indices   A Tensor. Must be one of the following types: int32, int64. Index tensor.  
  updates   A Tensor. Must have the same type as tensor. Updates to scatter into output.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as tensor.
tf.tensor_scatter_nd_sub Subtracts sparse updates from an existing tensor according to indices.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.tensor_scatter_nd_sub, tf.compat.v1.tensor_scatter_sub  
tf.tensor_scatter_nd_sub(
    tensor, indices, updates, name=None
)
 This operation creates a new tensor by subtracting sparse updates from the passed in tensor. This operation is very similar to tf.scatter_nd_sub, except that the updates are subtracted from an existing tensor (as opposed to a variable). If the memory for the existing tensor cannot be re-used, a copy is made and updated. indices is an integer tensor containing indices into a new tensor of shape shape. The last dimension of indices can be at most the rank of shape: indices.shape[-1] <= shape.rank
 The last dimension of indices corresponds to indices into elements (if indices.shape[-1] = shape.rank) or slices (if indices.shape[-1] < shape.rank) along dimension indices.shape[-1] of shape. updates is a tensor with shape indices.shape[:-1] + shape[indices.shape[-1]:]
 The simplest form of tensor_scatter_sub is to subtract individual elements from a tensor by index. For example, say we want to insert 4 scattered elements in a rank-1 tensor with 8 elements. In Python, this scatter subtract operation would look like this: indices = tf.constant([[4], [3], [1], [7]])
updates = tf.constant([9, 10, 11, 12])
tensor = tf.ones([8], dtype=tf.int32)
updated = tf.tensor_scatter_nd_sub(tensor, indices, updates)
print(updated)
 The resulting tensor would look like this: [1, -10, 1, -9, -8, 1, 1, -11]
 We can also, insert entire slices of a higher rank tensor all at once. For example, if we wanted to insert two slices in the first dimension of a rank-3 tensor with two matrices of new values. In Python, this scatter add operation would look like this: indices = tf.constant([[0], [2]])
updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
                        [7, 7, 7, 7], [8, 8, 8, 8]],
                       [[5, 5, 5, 5], [6, 6, 6, 6],
                        [7, 7, 7, 7], [8, 8, 8, 8]]])
tensor = tf.ones([4, 4, 4],dtype=tf.int32)
updated = tf.tensor_scatter_nd_sub(tensor, indices, updates)
print(updated)
 The resulting tensor would look like this: [[[-4, -4, -4, -4], [-5, -5, -5, -5], [-6, -6, -6, -6], [-7, -7, -7, -7]],
 [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],
 [[-4, -4, -4, -4], [-5, -5, -5, -5], [-6, -6, -6, -6], [-7, -7, -7, -7]],
 [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]]
 Note that on CPU, if an out of bound index is found, an error is returned. On GPU, if an out of bound index is found, the index is ignored.
 


 Args
  tensor   A Tensor. Tensor to copy/update.  
  indices   A Tensor. Must be one of the following types: int32, int64. Index tensor.  
  updates   A Tensor. Must have the same type as tensor. Updates to scatter into output.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as tensor.
Module: tf.test Testing. Classes class Benchmark: Abstract class that provides helpers for TensorFlow benchmarks. class TestCase: Base class for tests that need to test TensorFlow. Functions assert_equal_graph_def(...): Asserts that two GraphDefs are (mostly) the same. benchmark_config(...): Returns a tf.compat.v1.ConfigProto for disabling the dependency optimizer. compute_gradient(...): Computes the theoretical and numeric Jacobian of f. create_local_cluster(...): Create and start local servers and return the associated Server objects. gpu_device_name(...): Returns the name of a GPU device if available or the empty string. is_built_with_cuda(...): Returns whether TensorFlow was built with CUDA (GPU) support. is_built_with_gpu_support(...): Returns whether TensorFlow was built with GPU (i.e. CUDA or ROCm) support. is_built_with_rocm(...): Returns whether TensorFlow was built with ROCm (GPU) support. is_built_with_xla(...): Returns whether TensorFlow was built with XLA support. is_gpu_available(...): Returns whether TensorFlow can access a GPU. (deprecated) main(...): Runs all unit tests.
tf.test.assert_equal_graph_def     View source on GitHub    Asserts that two GraphDefs are (mostly) the same. 
tf.test.assert_equal_graph_def(
    expected, actual
)
 Compares two GraphDef protos for equality, ignoring versions and ordering of nodes, attrs, and control inputs. Node names are used to match up nodes between the graphs, so the naming of nodes must be consistent. This function ignores randomized attribute values that may appear in V2 checkpoints.
 


 Args
  expected   The GraphDef we expected.  
  actual   The GraphDef we have.   
 


 Raises
  AssertionError   If the GraphDefs do not match.  
  TypeError   If either argument is not a GraphDef.