neulab/docprompting-conala huggingface dataset:
tf.concat     View source on GitHub    Concatenates tensors along one dimension.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.concat  
tf.concat(
    values, axis, name='concat'
)
 See also tf.tile, tf.stack, tf.repeat. Concatenates the list of tensors values along dimension axis. If values[i].shape = [D0, D1, ... Daxis(i), ...Dn], the concatenated result has shape [D0, D1, ... Raxis, ...Dn]
 where Raxis = sum(Daxis(i))
 That is, the data from the input tensors is joined along the axis dimension. The number of dimensions of the input tensors must match, and all dimensions except axis must be equal. For example: 
t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 0)
<tf.Tensor: shape=(4, 3), dtype=int32, numpy=
array([[ 1,  2,  3],
       [ 4,  5,  6],
       [ 7,  8,  9],
       [10, 11, 12]], dtype=int32)>
 
tf.concat([t1, t2], 1)
<tf.Tensor: shape=(2, 6), dtype=int32, numpy=
array([[ 1,  2,  3,  7,  8,  9],
       [ 4,  5,  6, 10, 11, 12]], dtype=int32)>
 As in Python, the axis could also be negative numbers. Negative axis are interpreted as counting from the end of the rank, i.e., axis + rank(values)-th dimension. For example: 
t1 = [[[1, 2], [2, 3]], [[4, 4], [5, 3]]]
t2 = [[[7, 4], [8, 4]], [[2, 10], [15, 11]]]
tf.concat([t1, t2], -1)
<tf.Tensor: shape=(2, 2, 4), dtype=int32, numpy=
  array([[[ 1,  2,  7,  4],
          [ 2,  3,  8,  4]],
         [[ 4,  4,  2, 10],
          [ 5,  3, 15, 11]]], dtype=int32)>
 
Note: If you are concatenating along a new axis consider using stack. E.g.

tf.concat([tf.expand_dims(t, axis) for t in tensors], axis)
 can be rewritten as tf.stack(tensors, axis=axis)

 


 Args
  values   A list of Tensor objects or a single Tensor.  
  axis   0-D int32 Tensor. Dimension along which to concatenate. Must be in the range [-rank(values), rank(values)). As in Python, indexing for axis is 0-based. Positive axis in the rage of [0, rank(values)) refers to axis-th dimension. And negative axis refers to axis + rank(values)-th dimension.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor resulting from concatenation of the input tensors.
tf.cond     View source on GitHub    Return true_fn() if the predicate pred is true else false_fn(). 
tf.cond(
    pred, true_fn=None, false_fn=None, name=None
)
 true_fn and false_fn both return lists of output tensors. true_fn and false_fn must have the same non-zero number and type of outputs. Warning: Any Tensors or Operations created outside of true_fn and false_fn will be executed regardless of which branch is selected at runtime. Although this behavior is consistent with the dataflow model of TensorFlow, it has frequently surprised users who expected a lazier semantics. Consider the following simple program: z = tf.multiply(a, b)
result = tf.cond(x < y, lambda: tf.add(x, z), lambda: tf.square(y))
 If x < y, the tf.add operation will be executed and tf.square operation will not be executed. Since z is needed for at least one branch of the cond, the tf.multiply operation is always executed, unconditionally. Note that cond calls true_fn and false_fn exactly once (inside the call to cond, and not at all during Session.run()). cond stitches together the graph fragments created during the true_fn and false_fn calls with some additional graph nodes to ensure that the right branch gets executed depending on the value of pred. tf.cond supports nested structures as implemented in tensorflow.python.util.nest. Both true_fn and false_fn must return the same (possibly nested) value structure of lists, tuples, and/or named tuples. Singleton lists and tuples form the only exceptions to this: when returned by true_fn and/or false_fn, they are implicitly unpacked to single values. 
Note: It is illegal to "directly" use tensors created inside a cond branch outside it, e.g. by storing a reference to a branch tensor in the python state. If you need to use a tensor created in a branch function you should return it as an output of the branch function and use the output from tf.cond instead.

 


 Args
  pred   A scalar determining whether to return the result of true_fn or false_fn.  
  true_fn   The callable to be performed if pred is true.  
  false_fn   The callable to be performed if pred is false.  
  name   Optional name prefix for the returned tensors.   
 


 Returns   Tensors returned by the call to either true_fn or false_fn. If the callables return a singleton list, the element is extracted from the list.  

 


 Raises
  TypeError   if true_fn or false_fn is not callable.  
  ValueError   if true_fn and false_fn do not return the same number of tensors, or return tensors of different types.    Example: x = tf.constant(2)
y = tf.constant(5)
def f1(): return tf.multiply(x, 17)
def f2(): return tf.add(y, 23)
r = tf.cond(tf.less(x, y), f1, f2)
# r is set to f1().
# Operations in f2 (e.g., tf.add) are not executed.
Module: tf.config Public API for tf.config namespace. Modules experimental module: Public API for tf.config.experimental namespace. optimizer module: Public API for tf.config.optimizer namespace. threading module: Public API for tf.config.threading namespace. Classes class LogicalDevice: Abstraction for a logical device initialized by the runtime. class LogicalDeviceConfiguration: Configuration class for a logical devices. class PhysicalDevice: Abstraction for a locally visible physical device. Functions experimental_connect_to_cluster(...): Connects to the given cluster. experimental_connect_to_host(...): Connects to a single machine to enable remote execution on it. experimental_functions_run_eagerly(...): Returns the value of the experimental_run_functions_eagerly setting. (deprecated) experimental_run_functions_eagerly(...): Enables / disables eager execution of tf.functions. (deprecated) functions_run_eagerly(...): Returns the value of the run_functions_eagerly setting. get_logical_device_configuration(...): Get the virtual device configuration for a tf.config.PhysicalDevice. get_soft_device_placement(...): Get if soft device placement is enabled. get_visible_devices(...): Get the list of visible physical devices. list_logical_devices(...): Return a list of logical devices created by runtime. list_physical_devices(...): Return a list of physical devices visible to the host runtime. run_functions_eagerly(...): Enables / disables eager execution of tf.functions. set_logical_device_configuration(...): Set the logical device configuration for a tf.config.PhysicalDevice. set_soft_device_placement(...): Set if soft device placement is enabled. set_visible_devices(...): Set the list of visible devices.
Module: tf.config.experimental Public API for tf.config.experimental namespace. Classes class ClusterDeviceFilters: Represent a collection of device filters for the remote workers in cluster. class VirtualDeviceConfiguration: Configuration class for a logical devices. Functions disable_mlir_bridge(...): Disables experimental MLIR-Based TensorFlow Compiler Bridge. disable_mlir_graph_optimization(...): Disables experimental MLIR-Based TensorFlow Compiler Optimizations. enable_mlir_bridge(...): Enables experimental MLIR-Based TensorFlow Compiler Bridge. enable_mlir_graph_optimization(...): Enables experimental MLIR-Based TensorFlow Compiler Optimizations. enable_tensor_float_32_execution(...): Enable or disable the use of TensorFloat-32 on supported hardware. get_device_details(...): Returns details about a physical devices. get_device_policy(...): Gets the current device policy. get_memory_growth(...): Get if memory growth is enabled for a PhysicalDevice. get_memory_usage(...): Get the memory usage, in bytes, for the chosen device. get_synchronous_execution(...): Gets whether operations are executed synchronously or asynchronously. get_virtual_device_configuration(...): Get the virtual device configuration for a tf.config.PhysicalDevice. get_visible_devices(...): Get the list of visible physical devices. list_logical_devices(...): Return a list of logical devices created by runtime. list_physical_devices(...): Return a list of physical devices visible to the host runtime. set_device_policy(...): Sets the current thread device policy. set_memory_growth(...): Set if memory growth should be enabled for a PhysicalDevice. set_synchronous_execution(...): Specifies whether operations are executed synchronously or asynchronously. set_virtual_device_configuration(...): Set the logical device configuration for a tf.config.PhysicalDevice. set_visible_devices(...): Set the list of visible devices. tensor_float_32_execution_enabled(...): Returns whether TensorFloat-32 is enabled.
tf.config.experimental.ClusterDeviceFilters Represent a collection of device filters for the remote workers in cluster.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.ClusterDeviceFilters  
tf.config.experimental.ClusterDeviceFilters()
 
Note: this is an experimental API and subject to changes.
 Set device filters for selective jobs and tasks. For each remote worker, the device filters are a list of strings. When any filters are present, the remote worker will ignore all devices which do not match any of its filters. Each filter can be partially specified, e.g. "/job:ps", "/job:worker/replica:3", etc. Note that a device is always visible to the worker it is located on. For example, to set the device filters for a parameter server cluster: cdf = tf.config.experimental.ClusterDeviceFilters()
for i in range(num_workers):
  cdf.set_device_filters('worker', i, ['/job:ps'])
for i in range(num_ps):
  cdf.set_device_filters('ps', i, ['/job:worker'])

tf.config.experimental_connect_to_cluster(cluster_def,
                                          cluster_device_filters=cdf)
 The device filters can be partically specified. For remote tasks that do not have device filters specified, all devices will be visible to them. Methods set_device_filters View source 
set_device_filters(
    job_name, task_index, device_filters
)
 Set the device filters for given job name and task id.
tf.config.experimental.disable_mlir_bridge Disables experimental MLIR-Based TensorFlow Compiler Bridge.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.disable_mlir_bridge  
tf.config.experimental.disable_mlir_bridge()
tf.config.experimental.disable_mlir_graph_optimization Disables experimental MLIR-Based TensorFlow Compiler Optimizations.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.disable_mlir_graph_optimization  
tf.config.experimental.disable_mlir_graph_optimization()
tf.config.experimental.enable_mlir_bridge Enables experimental MLIR-Based TensorFlow Compiler Bridge.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.enable_mlir_bridge  
tf.config.experimental.enable_mlir_bridge()
 DO NOT USE, DEV AND TESTING ONLY AT THE MOMENT. 
Note: MLIR-Based TensorFlow Compiler is under active development and has missing features, please refrain from using. This API exists for development and testing only.
 TensorFlow Compiler Bridge (TF Bridge) is responsible for translating parts of TensorFlow graph into a form that can be accepted as an input by a backend compiler such as XLA.
tf.config.experimental.enable_mlir_graph_optimization Enables experimental MLIR-Based TensorFlow Compiler Optimizations.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.enable_mlir_graph_optimization  
tf.config.experimental.enable_mlir_graph_optimization()
 DO NOT USE, DEV AND TESTING ONLY AT THE MOMENT. 
Note: MLIR-Based TensorFlow Compiler is under active development and has missing features, please refrain from using. This API exists for development and testing only.
 TensorFlow Compiler Optimizations are responsible general graph level optimizations that in the current stack mostly done by Grappler graph optimizers.
tf.config.experimental.enable_tensor_float_32_execution Enable or disable the use of TensorFloat-32 on supported hardware.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.enable_tensor_float_32_execution  
tf.config.experimental.enable_tensor_float_32_execution(
    enabled
)
 TensorFloat-32, or TF32 for short, is a math mode for NVIDIA Ampere GPUs. TensorFloat-32 execution causes certain float32 ops, such as matrix multiplications and convolutions, to run much faster on Ampere GPUs but with reduced precision. This reduced precision should not impact convergence of deep learning models in practice. TensorFloat-32 is enabled by default. TensorFloat-32 is only supported on Ampere GPUs, so all other hardware will use the full float32 precision regardless of whether TensorFloat-32 is enabled or not. If you want to use the full float32 precision on Ampere, you can disable TensorFloat-32 execution with this function. For example: x = tf.fill((2, 2), 1.0001)
y = tf.fill((2, 2), 1.)
# TensorFloat-32 is enabled, so matmul is run with reduced precision
print(tf.linalg.matmul(x, y))  # [[2., 2.], [2., 2.]]
tf.config.experimental.enable_tensor_float_32_execution(False)
# Matmul is run with full precision
print(tf.linalg.matmul(x, y))  # [[2.0002, 2.0002], [2.0002, 2.0002]]
 To check whether TensorFloat-32 execution is currently enabled, use tf.config.experimental.tensor_float_32_execution_enabled. If TensorFloat-32 is enabled, float32 inputs of supported ops, such as tf.linalg.matmul, will be rounded from 23 bits of precision to 10 bits of precision in most cases. This allows the ops to execute much faster by utilizing the GPU's tensor cores. TensorFloat-32 has the same dynamic range as float32, meaning it is no more likely to underflow or overflow than float32. Ops still use float32 accumulation when TensorFloat-32 is enabled. Enabling or disabling TensorFloat-32 only affects Ampere GPUs and subsequent GPUs that support TensorFloat-32. Note TensorFloat-32 is not always used in supported ops, as only inputs of certain shapes are supported. Support for more input shapes and more ops may be added in the future. As a result, precision of float32 ops may decrease in minor versions of TensorFlow. TensorFloat-32 is also used for some complex64 ops. Currently, TensorFloat-32 is used in fewer cases for complex64 as it is for float32.
 


 Args
  enabled   Bool indicating whether to enable TensorFloat-32 execution.
tf.config.experimental.get_device_details Returns details about a physical devices.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.get_device_details  
tf.config.experimental.get_device_details(
    device
)
 This API takes in a tf.config.PhysicalDevice returned by tf.config.list_physical_devices. It returns a dict with string keys containing various details about the device. Each key is only supported by a subset of devices, so you should not assume the returned dict will have any particular key. 
gpu_devices = tf.config.list_physical_devices('GPU')
if gpu_devices:
  details = tf.config.experimental.get_device_details(gpu_devices[0])
  details.get('device_name', 'Unknown GPU')
 Currently, details are only returned for GPUs. This function returns an empty dict if passed a non-GPU device. The returned dict may have the following keys:  
'device_name': A human-readable name of the device as a string, e.g. "Titan V". Unlike tf.config.PhysicalDevice.name, this will be the same for multiple devices if each device is the same model. Currently only available for GPUs. 
'compute_capability': The compute capability of the device as a tuple of two ints, in the form (major_version, minor_version). Only available for NVIDIA GPUs  
Note: This is similar to tf.sysconfig.get_build_info in that both functions can return information relating to GPUs. However, this function returns run-time information about a specific device (such as a GPU's compute capability), while tf.sysconfig.get_build_info returns compile-time information about how TensorFlow was built (such as what version of CUDA TensorFlow was built for).

 


 Args
  device   A tf.config.PhysicalDevice returned by tf.config.list_physical_devices or tf.config.get_visible_devices.   
 


 Returns   A dict with string keys.
tf.config.experimental.get_device_policy     View source on GitHub    Gets the current device policy.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.get_device_policy  
tf.config.experimental.get_device_policy()
 The device policy controls how operations requiring inputs on a specific device (e.g., on GPU:0) handle inputs on a different device (e.g. GPU:1). This function only gets the device policy for the current thread. Any subsequently started thread will again use the default policy.
 


 Returns   Current thread device policy
tf.config.experimental.get_memory_growth     View source on GitHub    Get if memory growth is enabled for a PhysicalDevice.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.get_memory_growth  
tf.config.experimental.get_memory_growth(
    device
)
 If memory growth is enabled for a PhysicalDevice, the runtime initialization will not allocate all memory on the device. For example: 
physical_devices = tf.config.list_physical_devices('GPU')
try:
  tf.config.experimental.set_memory_growth(physical_devices[0], True)
  assert tf.config.experimental.get_memory_growth(physical_devices[0])
except:
  # Invalid device or cannot modify virtual devices once initialized.
  pass

 


 Args
  device   PhysicalDevice to query   
 


 Returns   A boolean indicating the memory growth setting for the PhysicalDevice.  

 


 Raises
  ValueError   Invalid PhysicalDevice specified.
tf.config.experimental.get_memory_usage Get the memory usage, in bytes, for the chosen device.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.get_memory_usage  
tf.config.experimental.get_memory_usage(
    device
)
 See https://www.tensorflow.org/api_docs/python/tf/device for specifying device strings. For example: 
gpu_devices = tf.config.list_physical_devices('GPU')
if gpu_devices:
  tf.config.experimental.get_memory_usage('GPU:0')
 Does not work for CPU.
 


 Args
  device   Device string to get the bytes in use for.   
 


 Returns   Total memory usage in bytes.  

 


 Raises
  ValueError   Non-existent or CPU device specified.
tf.config.experimental.get_synchronous_execution     View source on GitHub    Gets whether operations are executed synchronously or asynchronously.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.get_synchronous_execution  
tf.config.experimental.get_synchronous_execution()
 TensorFlow can execute operations synchronously or asynchronously. If asynchronous execution is enabled, operations may return "non-ready" handles.
 


 Returns   Current thread execution mode
tf.config.experimental.set_device_policy     View source on GitHub    Sets the current thread device policy.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.set_device_policy  
tf.config.experimental.set_device_policy(
    device_policy
)
 The device policy controls how operations requiring inputs on a specific device (e.g., on GPU:0) handle inputs on a different device (e.g. GPU:1). When using the default, an appropriate policy will be picked automatically. The default policy may change over time. This function only sets the device policy for the current thread. Any subsequently started thread will again use the default policy.
 


 Args
  device_policy   A device policy. Valid values:  None: Switch to a system default. 'warn': Copies the tensors which are not on the right device and logs a warning. 'explicit': Raises an error if the placement is not as required. 'silent': Silently copies the tensors. Note that this may hide performance problems as there is no notification provided when operations are blocked on the tensor being copied between devices. 'silent_for_int32': silently copies int32 tensors, raising errors on the other ones. 

  
 


 Raises
  ValueError   If an invalid device_policy is passed.
tf.config.experimental.set_memory_growth     View source on GitHub    Set if memory growth should be enabled for a PhysicalDevice.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.set_memory_growth  
tf.config.experimental.set_memory_growth(
    device, enable
)
 If memory growth is enabled for a PhysicalDevice, the runtime initialization will not allocate all memory on the device. Memory growth cannot be configured on a PhysicalDevice with virtual devices configured. For example: 
physical_devices = tf.config.list_physical_devices('GPU')
try:
  tf.config.experimental.set_memory_growth(physical_devices[0], True)
except:
  # Invalid device or cannot modify virtual devices once initialized.
  pass

 


 Args
  device   PhysicalDevice to configure  
  enable   (Boolean) Whether to enable or disable memory growth   
 


 Raises
  ValueError   Invalid PhysicalDevice specified.  
  RuntimeError   Runtime is already initialized.
tf.config.experimental.set_synchronous_execution     View source on GitHub    Specifies whether operations are executed synchronously or asynchronously.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.set_synchronous_execution  
tf.config.experimental.set_synchronous_execution(
    enable
)
 TensorFlow can execute operations synchronously or asynchronously. If asynchronous execution is enabled, operations may return "non-ready" handles. When enable is set to None, an appropriate value will be picked automatically. The value picked may change between TensorFlow releases.
 


 Args
  enable   Whether operations should be dispatched synchronously. Valid values:  None: sets the system default. True: executes each operation synchronously. False: executes each operation asynchronously.
tf.config.experimental.tensor_float_32_execution_enabled Returns whether TensorFloat-32 is enabled.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.config.experimental.tensor_float_32_execution_enabled  
tf.config.experimental.tensor_float_32_execution_enabled()
 By default, TensorFloat-32 is enabled, but this can be changed with tf.config.experimental.enable_tensor_float_32_execution.
 


 Returns   True if TensorFloat-32 is enabled (the default) and False otherwise