neulab/docprompting-conala huggingface dataset:
tf.mlir.experimental.convert_function Import a ConcreteFunction and convert it to a textual MLIR module.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.mlir.experimental.convert_function  
tf.mlir.experimental.convert_function(
    concrete_function, pass_pipeline='tf-standard-pipeline'
)
 This API is only intended for inspecting the internals of TensorFlow and the string returned is at the moment intended for debugging purposes. A tf.function can be imported and converted from TensorFlow to TensorFlow MLIR with this API by extracting its ConcreteFunction (eagerly-executing wrapper around a tf.Graph). For example: 
@tf.function
def add(a, b):
  return a + b
 
concrete_function = add.get_concrete_function(
    tf.TensorSpec(None, tf.dtypes.float32),
    tf.TensorSpec(None, tf.dtypes.float32))
tf.mlir.experimental.convert_function(concrete_function)
'...module attributes {...} {...}'

 


 Args
  concrete_function   An object of type ConcreteFunction.  
  pass_pipeline   A textual description of an MLIR Pass Pipeline to run on the module, see MLIR documentation for the textual pass pipeline syntax.   
 


 Returns   A textual representation of the MLIR module corresponding to the ConcreteFunction.  

 


 Raises
  InvalidArgumentError   if concrete_function is invalid or cannot be converted to MLIR.
tf.mlir.experimental.convert_graph_def Import a GraphDef and convert it to a textual MLIR module.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.mlir.experimental.convert_graph_def  
tf.mlir.experimental.convert_graph_def(
    graph_def, pass_pipeline='tf-standard-pipeline'
)
 This API is only intended for inspecting the internals of TensorFlow and the string returned is at the moment intended for debugging purposes.
 


 Args
  graph_def   An object of type graph_pb2.GraphDef or a textual proto representation of a valid GraphDef.  
  pass_pipeline   A textual description of an MLIR Pass Pipeline to run on the module, see MLIR documentation for the textual pass pipeline syntax.   
 


 Returns   A textual representation of the MLIR module corresponding to the graphdef.  

 


 Raises
  InvalidArgumentError   if graph_def is invalid or cannot be converted to MLIR.
tf.name_scope     View source on GitHub    A context manager for use when defining a Python op. 
tf.name_scope(
    name
)
 This context manager pushes a name scope, which will make the name of all operations added within it have a prefix. For example, to define a new Python op called my_op: def my_op(a, b, c, name=None):
  with tf.name_scope("MyOp") as scope:
    a = tf.convert_to_tensor(a, name="a")
    b = tf.convert_to_tensor(b, name="b")
    c = tf.convert_to_tensor(c, name="c")
    # Define some computation that uses `a`, `b`, and `c`.
    return foo_op(..., name=scope)
 When executed, the Tensors a, b, c, will have names MyOp/a, MyOp/b, and MyOp/c. Inside a tf.function, if the scope name already exists, the name will be made unique by appending _n. For example, calling my_op the second time will generate MyOp_1/a, etc.
 


 Args
  name   The prefix to use on all names created within the name scope.   
 


 Raises
  ValueError   If name is not a string.   
 


 Attributes
  name  
   Methods __enter__ View source 
__enter__()
 Start the scope block.
 


 Returns   The scope name.  
 __exit__ View source 
__exit__(
    type_arg, value_arg, traceback_arg
)
Module: tf.nest Public API for tf.nest namespace. Functions assert_same_structure(...): Asserts that two structures are nested in the same way. flatten(...): Returns a flat list from a given nested structure. is_nested(...): Returns true if its input is a collections.abc.Sequence (except strings). map_structure(...): Applies func to each entry in structure and returns a new structure. pack_sequence_as(...): Returns a given flattened sequence packed into a given structure.
tf.nest.assert_same_structure     View source on GitHub    Asserts that two structures are nested in the same way.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nest.assert_same_structure  
tf.nest.assert_same_structure(
    nest1, nest2, check_types=True, expand_composites=False
)
 Note that namedtuples with identical name and fields are always considered to have the same shallow structure (even with check_types=True). For instance, this code will print True: def nt(a, b):
  return collections.namedtuple('foo', 'a b')(a, b)
print(assert_same_structure(nt(0, 1), nt(2, 3)))

 


 Args
  nest1   an arbitrarily nested structure.  
  nest2   an arbitrarily nested structure.  
  check_types   if True (default) types of sequences are checked as well, including the keys of dictionaries. If set to False, for example a list and a tuple of objects will look the same if they have the same size. Note that namedtuples with identical name and fields are always considered to have the same shallow structure. Two types will also be considered the same if they are both list subtypes (which allows "list" and "_ListWrapper" from trackable dependency tracking to compare equal).  
  expand_composites   If true, then composite tensors such as tf.sparse.SparseTensor and tf.RaggedTensor are expanded into their component tensors.   
 


 Raises
  ValueError   If the two structures do not have the same number of elements or if the two structures are not nested in the same way.  
  TypeError   If the two structures differ in the type of sequence in any of their substructures. Only possible if check_types is True.
tf.nest.flatten     View source on GitHub    Returns a flat list from a given nested structure.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nest.flatten  
tf.nest.flatten(
    structure, expand_composites=False
)
 If nest is not a structure , tuple (or a namedtuple), dict, or an attrs class, then returns a single-element list: [nest]. In the case of dict instances, the sequence consists of the values, sorted by key to ensure deterministic behavior. This is true also for OrderedDict instances: their sequence order is ignored, the sorting order of keys is used instead. The same convention is followed in pack_sequence_as. This correctly repacks dicts and OrderedDicts after they have been flattened, and also allows flattening an OrderedDict and then repacking it back using a corresponding plain dict, or vice-versa. Dictionaries with non-sortable keys cannot be flattened. Users must not modify any collections used in nest while this function is running. Examples:  Python dict (ordered by key):  
dict = { "key3": "value3", "key1": "value1", "key2": "value2" }
tf.nest.flatten(dict)
['value1', 'value2', 'value3']
  For a nested python tuple:  
tuple = ((1.0, 2.0), (3.0, 4.0, 5.0), (6.0))
tf.nest.flatten(tuple)
    [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
  Numpy array (will not flatten):  
array = np.array([[1, 2], [3, 4]])
tf.nest.flatten(array)
    [array([[1, 2],
            [3, 4]])]
  
tf.Tensor (will not flatten):  
tensor = tf.constant([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]])
tf.nest.flatten(tensor)
    [<tf.Tensor: shape=(3, 3), dtype=float32, numpy=
      array([[1., 2., 3.],
             [4., 5., 6.],
             [7., 8., 9.]], dtype=float32)>]

 


 Args
  structure   an arbitrarily nested structure. Note, numpy arrays are considered atoms and are not flattened.  
  expand_composites   If true, then composite tensors such as tf.sparse.SparseTensor and tf.RaggedTensor are expanded into their component tensors.   
 


 Returns   A Python list, the flattened version of the input.  

 


 Raises
  TypeError   The nest is or contains a dict with non-sortable keys.
tf.nest.is_nested     View source on GitHub    Returns true if its input is a collections.abc.Sequence (except strings).  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nest.is_nested  
tf.nest.is_nested(
    seq
)

 


 Args
  seq   an input sequence.   
 


 Returns   True if the sequence is a not a string and is a collections.abc.Sequence or a dict.
tf.nest.map_structure     View source on GitHub    Applies func to each entry in structure and returns a new structure.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nest.map_structure  
tf.nest.map_structure(
    func, *structure, **kwargs
)
 Applies func(x[0], x[1], ...) where x[i] is an entry in structure[i]. All structures in structure must have the same arity, and the return value will contain results with the same structure layout. Examples:  A single Python dict:  
a = {"hello": 24, "world": 76}
tf.nest.map_structure(lambda p: p * 2, a)
{'hello': 48, 'world': 152}
  Multiple Python dictionaries:  
d1 = {"hello": 24, "world": 76}
d2 = {"hello": 36, "world": 14}
tf.nest.map_structure(lambda p1, p2: p1 + p2, d1, d2)
{'hello': 60, 'world': 90}

 


 Args
  func   A callable that accepts as many arguments as there are structures.  
  *structure   scalar, or tuple or dict or list of constructed scalars and/or other tuples/lists, or scalars. Note: numpy arrays are considered as scalars.  
  **kwargs   Valid keyword args are:  
check_types: If set to True (default) the types of iterables within the structures have to be same (e.g. map_structure(func, [1], (1,)) raises a TypeError exception). To allow this set this argument to False. Note that namedtuples with identical name and fields are always considered to have the same shallow structure. 
expand_composites: If set to True, then composite tensors such as tf.sparse.SparseTensor and tf.RaggedTensor are expanded into their component tensors. If False (the default), then composite tensors are not expanded. 

  
 


 Returns   A new structure with the same arity as structure, whose values correspond to func(x[0], x[1], ...) where x[i] is a value in the corresponding location in structure[i]. If there are different sequence types and check_types is False the sequence types of the first structure will be used.  

 


 Raises
  TypeError   If func is not callable or if the structures do not match each other by depth tree.  
  ValueError   If no structure is provided or if the structures do not match each other by type.  
  ValueError   If wrong keyword arguments are provided.
tf.nest.pack_sequence_as     View source on GitHub    Returns a given flattened sequence packed into a given structure.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nest.pack_sequence_as  
tf.nest.pack_sequence_as(
    structure, flat_sequence, expand_composites=False
)
 If structure is a scalar, flat_sequence must be a single-element list; in this case the return value is flat_sequence[0]. If structure is or contains a dict instance, the keys will be sorted to pack the flat sequence in deterministic order. This is true also for OrderedDict instances: their sequence order is ignored, the sorting order of keys is used instead. The same convention is followed in flatten. This correctly repacks dicts and OrderedDicts after they have been flattened, and also allows flattening an OrderedDict and then repacking it back using a corresponding plain dict, or vice-versa. Dictionaries with non-sortable keys cannot be flattened.
 


 Args
  structure   Nested structure, whose structure is given by nested lists, tuples, and dicts. Note: numpy arrays and strings are considered scalars.  
  flat_sequence   flat sequence to pack.  
  expand_composites   If true, then composite tensors such as tf.sparse.SparseTensor and tf.RaggedTensor are expanded into their component tensors.   
 


 Returns
  packed   flat_sequence converted to have the same recursive structure as structure.   
 


 Raises
  ValueError   If flat_sequence and structure have different element counts.  
  TypeError   structure is or contains a dict with non-sortable keys.
tf.nn.atrous_conv2d_transpose     View source on GitHub    The transpose of atrous_conv2d.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.atrous_conv2d_transpose  
tf.nn.atrous_conv2d_transpose(
    value, filters, output_shape, rate, padding, name=None
)
 This operation is sometimes called "deconvolution" after (Zeiler et al., 2010), but is really the transpose (gradient) of atrous_conv2d rather than an actual deconvolution.
 


 Args
  value   A 4-D Tensor of type float. It needs to be in the default NHWC format. Its shape is [batch, in_height, in_width, in_channels].  
  filters   A 4-D Tensor with the same type as value and shape [filter_height, filter_width, out_channels, in_channels]. filters' in_channels dimension must match that of value. Atrous convolution is equivalent to standard convolution with upsampled filters with effective height filter_height + (filter_height - 1) * (rate - 1) and effective width filter_width + (filter_width - 1) * (rate - 1), produced by inserting rate - 1 zeros along consecutive elements across the filters' spatial dimensions.  
  output_shape   A 1-D Tensor of shape representing the output shape of the deconvolution op.  
  rate   A positive int32. The stride with which we sample input values across the height and width dimensions. Equivalently, the rate by which we upsample the filter values by inserting zeros across the height and width dimensions. In the literature, the same parameter is sometimes called input stride or dilation.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm.  
  name   Optional name for the returned tensor.   
 


 Returns   A Tensor with the same type as value.  

 


 Raises
  ValueError   If input/output depth does not match filters' shape, or if padding is other than 'VALID' or 'SAME', or if the rate is less than one, or if the output_shape is not a tensor with 4 elements.    References: Deconvolutional Networks: Zeiler et al., 2010 (pdf)
tf.nn.avg_pool     View source on GitHub    Performs the avg pooling on the input.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.avg_pool_v2  
tf.nn.avg_pool(
    input, ksize, strides, padding, data_format=None, name=None
)
 Each entry in output is the mean of the corresponding size ksize window in value.
 


 Args
  input   Tensor of rank N+2, of shape [batch_size] + input_spatial_shape + [num_channels] if data_format does not start with "NC" (default), or [batch_size, num_channels] + input_spatial_shape if data_format starts with "NC". Pooling happens over the spatial dimensions only.  
  ksize   An int or list of ints that has length 1, N or N+2. The size of the window for each dimension of the input tensor.  
  strides   An int or list of ints that has length 1, N or N+2. The stride of the sliding window for each dimension of the input tensor.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm. See the "returns" section of tf.nn.convolution for details.  
  data_format   A string. Specifies the channel dimension. For N=1 it can be either "NWC" (default) or "NCW", for N=2 it can be either "NHWC" (default) or "NCHW" and for N=3 either "NDHWC" (default) or "NCDHW".  
  name   Optional name for the operation.   
 


 Returns   A Tensor of format specified by data_format. The average pooled output tensor.
tf.nn.avg_pool1d     View source on GitHub    Performs the average pooling on the input.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.avg_pool1d  
tf.nn.avg_pool1d(
    input, ksize, strides, padding, data_format='NWC', name=None
)
 Each entry in output is the mean of the corresponding size ksize window in value. Note internally this op reshapes and uses the underlying 2d operation.
 


 Args
  input   A 3-D Tensor of the format specified by data_format.  
  ksize   An int or list of ints that has length 1 or 3. The size of the window for each dimension of the input tensor.  
  strides   An int or list of ints that has length 1 or 3. The stride of the sliding window for each dimension of the input tensor.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm. See the "returns" section of tf.nn.convolution for details.  
  data_format   An optional string from: "NWC", "NCW". Defaults to "NWC".  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of format specified by data_format. The max pooled output tensor.
tf.nn.avg_pool2d Performs the average pooling on the input. 
tf.nn.avg_pool2d(
    input, ksize, strides, padding, data_format='NHWC', name=None
)
 Each entry in output is the mean of the corresponding size ksize window in value.
 


 Args
  input   A 4-D Tensor of shape [batch, height, width, channels] and type float32, float64, qint8, quint8, or qint32.  
  ksize   An int or list of ints that has length 1, 2 or 4. The size of the window for each dimension of the input tensor.  
  strides   An int or list of ints that has length 1, 2 or 4. The stride of the sliding window for each dimension of the input tensor.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm. See the "returns" section of tf.nn.convolution for details.  
  data_format   A string. 'NHWC' and 'NCHW' are supported.  
  name   Optional name for the operation.   
 


 Returns   A Tensor with the same type as value. The average pooled output tensor.
tf.nn.avg_pool3d     View source on GitHub    Performs the average pooling on the input.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.avg_pool3d  
tf.nn.avg_pool3d(
    input, ksize, strides, padding, data_format='NDHWC', name=None
)
 Each entry in output is the mean of the corresponding size ksize window in value.
 


 Args
  input   A 5-D Tensor of shape [batch, height, width, channels] and type float32, float64, qint8, quint8, or qint32.  
  ksize   An int or list of ints that has length 1, 3 or 5. The size of the window for each dimension of the input tensor.  
  strides   An int or list of ints that has length 1, 3 or 5. The stride of the sliding window for each dimension of the input tensor.  
  padding   A string, either 'VALID' or 'SAME'. The padding algorithm. See the "returns" section of tf.nn.convolution for details.  
  data_format   A string. 'NDHWC' and 'NCDHW' are supported.  
  name   Optional name for the operation.   
 


 Returns   A Tensor with the same type as value. The average pooled output tensor.
tf.nn.batch_normalization       View source on GitHub    Batch normalization.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.batch_normalization  
tf.nn.batch_normalization(
    x, mean, variance, offset, scale, variance_epsilon, name=None
)
 Normalizes a tensor by mean and variance, and applies (optionally) a scale \(\gamma\) to it, as well as an offset \(\beta\): \(\frac{\gamma(x-\mu)}{\sigma}+\beta\) mean, variance, offset and scale are all expected to be of one of two shapes:  In all generality, they can have the same number of dimensions as the input x, with identical sizes as x for the dimensions that are not normalized over (the 'depth' dimension(s)), and dimension 1 for the others which are being normalized over. mean and variance in this case would typically be the outputs of tf.nn.moments(..., keepdims=True) during training, or running averages thereof during inference. In the common case where the 'depth' dimension is the last dimension in the input tensor x, they may be one dimensional tensors of the same size as the 'depth' dimension. This is the case for example for the common [batch, depth] layout of fully-connected layers, and [batch, height, width, depth] for convolutions. mean and variance in this case would typically be the outputs of tf.nn.moments(..., keepdims=False) during training, or running averages thereof during inference.  See equation 11 in Algorithm 2 of source: Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift; S. Ioffe, C. Szegedy.
 


 Args
  x   Input Tensor of arbitrary dimensionality.  
  mean   A mean Tensor.  
  variance   A variance Tensor.  
  offset   An offset Tensor, often denoted \(\beta\) in equations, or None. If present, will be added to the normalized tensor.  
  scale   A scale Tensor, often denoted \(\gamma\) in equations, or None. If present, the scale is applied to the normalized tensor.  
  variance_epsilon   A small float number to avoid dividing by 0.  
  name   A name for this operation (optional).   
 


 Returns   the normalized, scaled, offset tensor.  
 References: Batch Normalization - Accelerating Deep Network Training by Reducing Internal Covariate Shift: Ioffe et al., 2015 (pdf)
tf.nn.batch_norm_with_global_normalization     View source on GitHub    Batch normalization. 
tf.nn.batch_norm_with_global_normalization(
    input, mean, variance, beta, gamma, variance_epsilon, scale_after_normalization,
    name=None
)
 This op is deprecated. See tf.nn.batch_normalization.
 


 Args
  input   A 4D input Tensor.  
  mean   A 1D mean Tensor with size matching the last dimension of t. This is the first output from tf.nn.moments, or a saved moving average thereof.  
  variance   A 1D variance Tensor with size matching the last dimension of t. This is the second output from tf.nn.moments, or a saved moving average thereof.  
  beta   A 1D beta Tensor with size matching the last dimension of t. An offset to be added to the normalized tensor.  
  gamma   A 1D gamma Tensor with size matching the last dimension of t. If "scale_after_normalization" is true, this tensor will be multiplied with the normalized tensor.  
  variance_epsilon   A small float number to avoid dividing by 0.  
  scale_after_normalization   A bool indicating whether the resulted tensor needs to be multiplied with gamma.  
  name   A name for this operation (optional).   
 


 Returns   A batch-normalized t.  
 References: Batch Normalization - Accelerating Deep Network Training by Reducing Internal Covariate Shift: Ioffe et al., 2015 (pdf)
tf.nn.bias_add     View source on GitHub    Adds bias to value.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.bias_add  
tf.nn.bias_add(
    value, bias, data_format=None, name=None
)
 This is (mostly) a special case of tf.add where bias is restricted to 1-D. Broadcasting is supported, so value may have any number of dimensions. Unlike tf.add, the type of bias is allowed to differ from value in the case where both types are quantized.
 


 Args
  value   A Tensor with type float, double, int64, int32, uint8, int16, int8, complex64, or complex128.  
  bias   A 1-D Tensor with size matching the channel dimension of value. Must be the same type as value unless value is a quantized type, in which case a different quantized type may be used.  
  data_format   A string. 'N...C' and 'NC...' are supported. If None (the default) is specified then 'N..C' is assumed.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor with the same type as value.  

 


 Raises   ValueError if data format is unrecognized, if value has less than two dimensions when data_format is 'N..C'/None or value has less then three dimensions when data_format is NC.., if bias does not have exactly one dimension (is a vector), or if the size of bias does not match the size of the channel dimension of value.
tf.nn.collapse_repeated     View source on GitHub    Merge repeated labels into single labels.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.collapse_repeated  
tf.nn.collapse_repeated(
    labels, seq_length, name=None
)

 


 Args
  labels   Tensor of shape [batch, max value in seq_length]  
  seq_length   Tensor of shape [batch], sequence length of each batch element.  
  name   A name for this Op. Defaults to "collapse_repeated_labels".   
 


 Returns   A tuple (collapsed_labels, new_seq_length) where     collapsed_labels   Tensor of shape [batch, max_seq_length] with repeated labels collapsed and padded to max_seq_length, eg: [[A, A, B, B, A], [A, B, C, D, E]] => [[A, B, A, 0, 0], [A, B, C, D, E]]  
  new_seq_length   int tensor of shape [batch] with new sequence lengths.