neulab/docprompting-conala huggingface dataset:
tf.compat.dimension_at_index     View source on GitHub    Compatibility utility required to allow for both V1 and V2 behavior in TF.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.compat.dimension_at_index, tf.compat.v1.dimension_at_index  
tf.compat.dimension_at_index(
    shape, index
)
 Until the release of TF 2.0, we need the legacy behavior of TensorShape to coexist with the new behavior. This utility is a bridge between the two. If you want to retrieve the Dimension instance corresponding to a certain index in a TensorShape instance, use this utility, like this: # If you had this in your V1 code:
dim = tensor_shape[i]

# Use `dimension_at_index` as direct replacement compatible with both V1 & V2:
dim = dimension_at_index(tensor_shape, i)

# Another possibility would be this, but WARNING: it only works if the
# tensor_shape instance has a defined rank.
dim = tensor_shape.dims[i]  # `dims` may be None if the rank is undefined!

# In native V2 code, we recommend instead being more explicit:
if tensor_shape.rank is None:
  dim = Dimension(None)
else:
  dim = tensor_shape.dims[i]

# Being more explicit will save you from the following trap (present in V1):
# you might do in-place modifications to `dim` and expect them to be reflected
# in `tensor_shape[i]`, but they would not be (as the Dimension object was
# instantiated on the fly.

 


 Arguments
  shape   A TensorShape instance.  
  index   An integer index.   
 


 Returns   A dimension object.
tf.compat.dimension_value     View source on GitHub    Compatibility utility required to allow for both V1 and V2 behavior in TF.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.compat.dimension_value, tf.compat.v1.dimension_value  
tf.compat.dimension_value(
    dimension
)
 Until the release of TF 2.0, we need the legacy behavior of TensorShape to coexist with the new behavior. This utility is a bridge between the two. When accessing the value of a TensorShape dimension, use this utility, like this: # If you had this in your V1 code:
value = tensor_shape[i].value

# Use `dimension_value` as direct replacement compatible with both V1 & V2:
value = dimension_value(tensor_shape[i])

# This would be the V2 equivalent:
value = tensor_shape[i]  # Warning: this will return the dim value in V2!

 


 Arguments
  dimension   Either a Dimension instance, an integer, or None.   
 


 Returns   A plain value, i.e. an integer or None.
tf.compat.forward_compatibility_horizon     View source on GitHub    Context manager for testing forward compatibility of generated graphs.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.compat.forward_compatibility_horizon  
@tf_contextlib.contextmanager
tf.compat.forward_compatibility_horizon(
    year, month, day
)
 See Version compatibility. To ensure forward compatibility of generated graphs (see forward_compatible) with older binaries, new features can be gated with: if compat.forward_compatible(year=2018, month=08, date=01):
  generate_graph_with_new_features()
else:
  generate_graph_so_older_binaries_can_consume_it()
 However, when adding new features, one may want to unittest it before the forward compatibility window expires. This context manager enables such tests. For example: from tensorflow.python.compat import compat

def testMyNewFeature(self):
  with compat.forward_compatibility_horizon(2018, 08, 02):
     # Test that generate_graph_with_new_features() has an effect

 


 Args
  year   A year (e.g., 2018). Must be an int.  
  month   A month (1 <= month <= 12) in year. Must be an int.  
  day   A day (1 <= day <= 31, or 30, or 29, or 28) in month. Must be an int.   
 


 Yields   Nothing.
tf.compat.forward_compatible     View source on GitHub    Return true if the forward compatibility window has expired.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.compat.forward_compatible  
tf.compat.forward_compatible(
    year, month, day
)
 See Version compatibility. Forward-compatibility refers to scenarios where the producer of a TensorFlow model (a GraphDef or SavedModel) is compiled against a version of the TensorFlow library newer than what the consumer was compiled against. The "producer" is typically a Python program that constructs and trains a model while the "consumer" is typically another program that loads and serves the model. TensorFlow has been supporting a 3 week forward-compatibility window for programs compiled from source at HEAD. For example, consider the case where a new operation MyNewAwesomeAdd is created with the intent of replacing the implementation of an existing Python wrapper - tf.add. The Python wrapper implementation should change from something like: def add(inputs, name=None):
  return gen_math_ops.add(inputs, name)
 to: from tensorflow.python.compat import compat

def add(inputs, name=None):
  if compat.forward_compatible(year, month, day):
    # Can use the awesome new implementation.
    return gen_math_ops.my_new_awesome_add(inputs, name)
  # To maintain forward compatibility, use the old implementation.
  return gen_math_ops.add(inputs, name)
 Where year, month, and day specify the date beyond which binaries that consume a model are expected to have been updated to include the new operations. This date is typically at least 3 weeks beyond the date the code that adds the new operation is committed.
 


 Args
  year   A year (e.g., 2018). Must be an int.  
  month   A month (1 <= month <= 12) in year. Must be an int.  
  day   A day (1 <= day <= 31, or 30, or 29, or 28) in month. Must be an int.   
 


 Returns   True if the caller can expect that serialized TensorFlow graphs produced can be consumed by programs that are compiled with the TensorFlow library source code after (year, month, day).
tf.compat.path_to_str       View source on GitHub    Converts input which is a PathLike object to str type.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.compat.path_to_str  
tf.compat.path_to_str(
    path
)
 Converts from any python constant representation of a PathLike object to a string. If the input is not a PathLike object, simply returns the input.
 


 Args
  path   An object that can be converted to path representation.   
 


 Returns   A str object.  
 Usage: In case a simplified str version of the path is needed from an os.PathLike object Examples: $ tf.compat.path_to_str('C:\XYZ\tensorflow\./.././tensorflow')
'C:\XYZ\tensorflow\./.././tensorflow' # Windows OS
$ tf.compat.path_to_str(Path('C:\XYZ\tensorflow\./.././tensorflow'))
'C:\XYZ\tensorflow\..\tensorflow' # Windows OS
$ tf.compat.path_to_str(Path('./corpus'))
'corpus' # Linux OS
$ tf.compat.path_to_str('./.././Corpus')
'./.././Corpus' # Linux OS
$ tf.compat.path_to_str(Path('./.././Corpus'))
'../Corpus' # Linux OS
$ tf.compat.path_to_str(Path('./..////../'))
'../..' # Linux OS
tf.compat.v1.add_check_numerics_ops Connect a tf.debugging.check_numerics to every floating point tensor. 
tf.compat.v1.add_check_numerics_ops()
 check_numerics operations themselves are added for each half, float, or double tensor in the current default graph. For all ops in the graph, the check_numerics op for all of its (half, float, or double) inputs is guaranteed to run before the check_numerics op on any of its outputs. 
Note: This API is not compatible with the use of tf.cond or tf.while_loop, and will raise a ValueError if you attempt to call it in such a graph.

 


 Returns   A group op depending on all check_numerics ops added.  

 


 Raises
  ValueError   If the graph contains any numeric operations in a control flow structure.  
  RuntimeError   If called with eager execution enabled.    Eager Compatibility Not compatible with eager execution. To check for Infs and NaNs under eager execution, call tf.debugging.enable_check_numerics() once before executing the checked operations.
tf.compat.v1.add_to_collection Wrapper for Graph.add_to_collection() using the default graph. 
tf.compat.v1.add_to_collection(
    name, value
)
 See tf.Graph.add_to_collection for more details.
 


 Args
  name   The key for the collection. For example, the GraphKeys class contains many standard names for collections.  
  value   The value to add to the collection.    Eager Compatibility Collections are only supported in eager when variables are created inside an EagerVariableStore (e.g. as part of a layer or template).
tf.compat.v1.add_to_collections Wrapper for Graph.add_to_collections() using the default graph. 
tf.compat.v1.add_to_collections(
    names, value
)
 See tf.Graph.add_to_collections for more details.
 


 Args
  names   The key for the collections. The GraphKeys class contains many standard names for collections.  
  value   The value to add to the collections.    Eager Compatibility Collections are only supported in eager when variables are created inside an EagerVariableStore (e.g. as part of a layer or template).
tf.compat.v1.all_variables Use tf.compat.v1.global_variables instead. (deprecated) 
tf.compat.v1.all_variables()
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. Instructions for updating: Please use tf.global_variables instead.
Module: tf.compat.v1.app Generic entry point script. Modules flags module: Import router for absl.flags. See https://github.com/abseil/abseil-py Functions run(...): Runs the program with an optional 'main' function and 'argv' list.
tf.compat.v1.app.run Runs the program with an optional 'main' function and 'argv' list. 
tf.compat.v1.app.run(
    main=None, argv=None
)
tf.compat.v1.argmax Returns the index with the largest value across axes of a tensor. (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.math.argmax  
tf.compat.v1.argmax(
    input, axis=None, name=None, dimension=None, output_type=tf.dtypes.int64
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (dimension). They will be removed in a future version. Instructions for updating: Use the axis argument instead Note that in case of ties the identity of the return value is not guaranteed. Usage: import tensorflow as tf
a = [1, 10, 26.9, 2.8, 166.32, 62.3]
b = tf.math.argmax(input = a)
c = tf.keras.backend.eval(b)
# c = 4
# here a[4] = 166.32 which is the largest element of a across axis 0

 


 Args
  input   A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16, complex128, half, uint32, uint64, bool.  
  axis   A Tensor. Must be one of the following types: int32, int64. int32 or int64, must be in the range [-rank(input), rank(input)). Describes which axis of the input Tensor to reduce across. For vectors, use axis = 0.  
  output_type   An optional tf.DType from: tf.int32, tf.int64. Defaults to tf.int64.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type output_type.
tf.compat.v1.argmin Returns the index with the smallest value across axes of a tensor. (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.math.argmin  
tf.compat.v1.argmin(
    input, axis=None, name=None, dimension=None, output_type=tf.dtypes.int64
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (dimension). They will be removed in a future version. Instructions for updating: Use the axis argument instead Note that in case of ties the identity of the return value is not guaranteed. Usage: import tensorflow as tf
a = [1, 10, 26.9, 2.8, 166.32, 62.3]
b = tf.math.argmin(input = a)
c = tf.keras.backend.eval(b)
# c = 0
# here a[0] = 1 which is the smallest element of a across axis 0

 


 Args
  input   A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16, complex128, half, uint32, uint64, bool.  
  axis   A Tensor. Must be one of the following types: int32, int64. int32 or int64, must be in the range [-rank(input), rank(input)). Describes which axis of the input Tensor to reduce across. For vectors, use axis = 0.  
  output_type   An optional tf.DType from: tf.int32, tf.int64. Defaults to tf.int64.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type output_type.
tf.compat.v1.arg_max Returns the index with the largest value across dimensions of a tensor. 
tf.compat.v1.arg_max(
    input, dimension, output_type=tf.dtypes.int64, name=None
)
 Note that in case of ties the identity of the return value is not guaranteed. Usage: import tensorflow as tf
a = [1, 10, 26.9, 2.8, 166.32, 62.3]
b = tf.math.argmax(input = a)
c = tf.keras.backend.eval(b)
# c = 4
# here a[4] = 166.32 which is the largest element of a across axis 0

 


 Args
  input   A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16, complex128, half, uint32, uint64, bool.  
  dimension   A Tensor. Must be one of the following types: int32, int64. int32 or int64, must be in the range [-rank(input), rank(input)). Describes which dimension of the input Tensor to reduce across. For vectors, use dimension = 0.  
  output_type   An optional tf.DType from: tf.int32, tf.int64. Defaults to tf.int64.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type output_type.
tf.compat.v1.arg_min Returns the index with the smallest value across dimensions of a tensor. 
tf.compat.v1.arg_min(
    input, dimension, output_type=tf.dtypes.int64, name=None
)
 Note that in case of ties the identity of the return value is not guaranteed. Usage: import tensorflow as tf
a = [1, 10, 26.9, 2.8, 166.32, 62.3]
b = tf.math.argmin(input = a)
c = tf.keras.backend.eval(b)
# c = 0
# here a[0] = 1 which is the smallest element of a across axis 0

 


 Args
  input   A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16, complex128, half, uint32, uint64, bool.  
  dimension   A Tensor. Must be one of the following types: int32, int64. int32 or int64, must be in the range [-rank(input), rank(input)). Describes which dimension of the input Tensor to reduce across. For vectors, use dimension = 0.  
  output_type   An optional tf.DType from: tf.int32, tf.int64. Defaults to tf.int64.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type output_type.
tf.compat.v1.assert_equal Assert the condition x == y holds element-wise.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_equal  
tf.compat.v1.assert_equal(
    x, y, data=None, summarize=None, message=None, name=None
)
 This condition holds if for every pair of (possibly broadcast) elements x[i], y[i], we have x[i] == y[i]. If both x and y are empty, this is trivially satisfied. When running in graph mode, you should add a dependency on this operation to ensure that it runs. Example of adding a dependency to an operation: with tf.control_dependencies([tf.compat.v1.assert_equal(x, y)]):
  output = tf.reduce_sum(x)

 


 Args
  x   Numeric Tensor.  
  y   Numeric Tensor, same dtype as and broadcastable to x.  
  data   The tensors to print out if the condition is False. Defaults to error message and first few entries of x, y.  
  summarize   Print this many entries of each tensor.  
  message   A string to prefix to the default message.  
  name   A name for this operation (optional). Defaults to "assert_equal".   
 


 Returns   Op that raises InvalidArgumentError if x == y is False.  

 


 Raises
  InvalidArgumentError   if the check can be performed immediately and x == y is False. The check can be performed immediately during eager execution or if x and y are statically known.    Eager Compatibility returns None
tf.compat.v1.assert_greater Assert the condition x > y holds element-wise.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_greater  
tf.compat.v1.assert_greater(
    x, y, data=None, summarize=None, message=None, name=None
)
 This condition holds if for every pair of (possibly broadcast) elements x[i], y[i], we have x[i] > y[i]. If both x and y are empty, this is trivially satisfied. When running in graph mode, you should add a dependency on this operation to ensure that it runs. Example of adding a dependency to an operation: with tf.control_dependencies([tf.compat.v1.assert_greater(x, y)]):
  output = tf.reduce_sum(x)

 


 Args
  x   Numeric Tensor.  
  y   Numeric Tensor, same dtype as and broadcastable to x.  
  data   The tensors to print out if the condition is False. Defaults to error message and first few entries of x, y.  
  summarize   Print this many entries of each tensor.  
  message   A string to prefix to the default message.  
  name   A name for this operation (optional). Defaults to "assert_greater".   
 


 Returns   Op that raises InvalidArgumentError if x > y is False.  

 


 Raises
  InvalidArgumentError   if the check can be performed immediately and x > y is False. The check can be performed immediately during eager execution or if x and y are statically known.    Eager Compatibility returns None
tf.compat.v1.assert_greater_equal Assert the condition x >= y holds element-wise.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_greater_equal  
tf.compat.v1.assert_greater_equal(
    x, y, data=None, summarize=None, message=None, name=None
)
 This condition holds if for every pair of (possibly broadcast) elements x[i], y[i], we have x[i] >= y[i]. If both x and y are empty, this is trivially satisfied. When running in graph mode, you should add a dependency on this operation to ensure that it runs. Example of adding a dependency to an operation: with tf.control_dependencies([tf.compat.v1.assert_greater_equal(x, y)]):
  output = tf.reduce_sum(x)

 


 Args
  x   Numeric Tensor.  
  y   Numeric Tensor, same dtype as and broadcastable to x.  
  data   The tensors to print out if the condition is False. Defaults to error message and first few entries of x, y.  
  summarize   Print this many entries of each tensor.  
  message   A string to prefix to the default message.  
  name   A name for this operation (optional). Defaults to "assert_greater_equal".   
 


 Returns   Op that raises InvalidArgumentError if x >= y is False.  

 


 Raises
  InvalidArgumentError   if the check can be performed immediately and x >= y is False. The check can be performed immediately during eager execution or if x and y are statically known.    Eager Compatibility returns None
tf.compat.v1.assert_integer Assert that x is of integer dtype.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_integer  
tf.compat.v1.assert_integer(
    x, message=None, name=None
)
 Example of adding a dependency to an operation: with tf.control_dependencies([tf.compat.v1.assert_integer(x)]):
  output = tf.reduce_sum(x)

 


 Args
  x   Tensor whose basetype is integer and is not quantized.  
  message   A string to prefix to the default message.  
  name   A name for this operation (optional). Defaults to "assert_integer".   
 


 Raises
  TypeError   If x.dtype is anything other than non-quantized integer.   
 


 Returns   A no_op that does nothing. Type can be determined statically.
tf.compat.v1.assert_less Assert the condition x < y holds element-wise.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_less  
tf.compat.v1.assert_less(
    x, y, data=None, summarize=None, message=None, name=None
)
 This condition holds if for every pair of (possibly broadcast) elements x[i], y[i], we have x[i] < y[i]. If both x and y are empty, this is trivially satisfied. When running in graph mode, you should add a dependency on this operation to ensure that it runs. Example of adding a dependency to an operation: with tf.control_dependencies([tf.compat.v1.assert_less(x, y)]):
  output = tf.reduce_sum(x)

 


 Args
  x   Numeric Tensor.  
  y   Numeric Tensor, same dtype as and broadcastable to x.  
  data   The tensors to print out if the condition is False. Defaults to error message and first few entries of x, y.  
  summarize   Print this many entries of each tensor.  
  message   A string to prefix to the default message.  
  name   A name for this operation (optional). Defaults to "assert_less".   
 


 Returns   Op that raises InvalidArgumentError if x < y is False.  

 


 Raises
  InvalidArgumentError   if the check can be performed immediately and x < y is False. The check can be performed immediately during eager execution or if x and y are statically known.    Eager Compatibility returns None
tf.compat.v1.assert_less_equal Assert the condition x <= y holds element-wise.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_less_equal  
tf.compat.v1.assert_less_equal(
    x, y, data=None, summarize=None, message=None, name=None
)
 This condition holds if for every pair of (possibly broadcast) elements x[i], y[i], we have x[i] <= y[i]. If both x and y are empty, this is trivially satisfied. When running in graph mode, you should add a dependency on this operation to ensure that it runs. Example of adding a dependency to an operation: with tf.control_dependencies([tf.compat.v1.assert_less_equal(x, y)]):
  output = tf.reduce_sum(x)

 


 Args
  x   Numeric Tensor.  
  y   Numeric Tensor, same dtype as and broadcastable to x.  
  data   The tensors to print out if the condition is False. Defaults to error message and first few entries of x, y.  
  summarize   Print this many entries of each tensor.  
  message   A string to prefix to the default message.  
  name   A name for this operation (optional). Defaults to "assert_less_equal".   
 


 Returns   Op that raises InvalidArgumentError if x <= y is False.  

 


 Raises
  InvalidArgumentError   if the check can be performed immediately and x <= y is False. The check can be performed immediately during eager execution or if x and y are statically known.    Eager Compatibility returns None
tf.compat.v1.assert_near Assert the condition x and y are close element-wise.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.debugging.assert_near  
tf.compat.v1.assert_near(
    x, y, rtol=None, atol=None, data=None, summarize=None, message=None, name=None
)
 Example of adding a dependency to an operation: with tf.control_dependencies([tf.compat.v1.assert_near(x, y)]):
  output = tf.reduce_sum(x)
 This condition holds if for every pair of (possibly broadcast) elements x[i], y[i], we have tf.abs(x[i] - y[i]) <= atol + rtol * tf.abs(y[i]). If both x and y are empty, this is trivially satisfied. The default atol and rtol is 10 * eps, where eps is the smallest representable positive number such that 1 + eps != 1. This is about 1.2e-6 in 32bit, 2.22e-15 in 64bit, and 0.00977 in 16bit. See numpy.finfo.
 


 Args
  x   Float or complex Tensor.  
  y   Float or complex Tensor, same dtype as, and broadcastable to, x.  
  rtol   Tensor. Same dtype as, and broadcastable to, x. The relative tolerance. Default is 10 * eps.  
  atol   Tensor. Same dtype as, and broadcastable to, x. The absolute tolerance. Default is 10 * eps.  
  data   The tensors to print out if the condition is False. Defaults to error message and first few entries of x, y.  
  summarize   Print this many entries of each tensor.  
  message   A string to prefix to the default message.  
  name   A name for this operation (optional). Defaults to "assert_near".   
 


 Returns   Op that raises InvalidArgumentError if x and y are not close enough.  
 Numpy Compatibility Similar to numpy.testing.assert_allclose, except tolerance depends on data type. This is due to the fact that TensorFlow is often used with 32bit, 64bit, and even 16bit data.