neulab/docprompting-conala huggingface dataset:
tf.compat.v1.space_to_batch SpaceToBatch for 4-D tensors of type T.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.space_to_batch  
tf.compat.v1.space_to_batch(
    input, paddings, block_size=None, name=None, block_shape=None
)
 This is a legacy version of the more general SpaceToBatchND. Zero-pads and then rearranges (permutes) blocks of spatial data into batch. More specifically, this op outputs a copy of the input tensor where values from the height and width dimensions are moved to the batch dimension. After the zero-padding, both height and width of the input must be divisible by the block size.
 


 Args
  input   A Tensor. 4-D with shape [batch, height, width, depth].  
  paddings   A Tensor. Must be one of the following types: int32, int64. 2-D tensor of non-negative integers with shape [2, 2]. It specifies the padding of the input with zeros across the spatial dimensions as follows: paddings = [[pad_top, pad_bottom], [pad_left, pad_right]] The effective spatial dimensions of the zero-padded input tensor will be: height_pad = pad_top + height + pad_bottom width_pad = pad_left + width + pad_right The attr block_size must be greater than one. It indicates the block size.  Non-overlapping blocks of size block_size x block size in the height and width dimensions are rearranged into the batch dimension at each location. The batch of the output tensor is batch * block_size * block_size. Both height_pad and width_pad must be divisible by block_size.  The shape of the output will be: [batchblock_sizeblock_size, height_pad/block_size, width_pad/block_size, depth] Some examples: (1) For the following input of shape [1, 2, 2, 1] and block_size of 2: x = [[[[1], [2]], [[3], [4]]]]
 The output tensor has shape [4, 1, 1, 1] and value: [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
 (2) For the following input of shape [1, 2, 2, 3] and block_size of 2: x = [[[[1, 2, 3], [4, 5, 6]],
[[7, 8, 9], [10, 11, 12]]]]
 The output tensor has shape [4, 1, 1, 3] and value: [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
 (3) For the following input of shape [1, 4, 4, 1] and block_size of 2: x = [[[[1],   [2],  [3],  [4]],
[[5],   [6],  [7],  [8]],
[[9],  [10], [11],  [12]],
[[13], [14], [15],  [16]]]]
 The output tensor has shape [4, 2, 2, 1] and value: x = [[[[1], [3]], [[9], [11]]],
[[[2], [4]], [[10], [12]]],
[[[5], [7]], [[13], [15]]],
[[[6], [8]], [[14], [16]]]]
 (4) For the following input of shape [2, 2, 4, 1] and block_size of 2: x = [[[[1],   [2],  [3],  [4]],
[[5],   [6],  [7],  [8]]],
[[[9],  [10], [11],  [12]],
[[13], [14], [15],  [16]]]]
 The output tensor has shape [8, 1, 2, 1] and value: x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],
[[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]
 Among others, this operation is useful for reducing atrous convolution into regular convolution. 
 
  block_size   An int that is >= 2.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as input.
tf.compat.v1.space_to_depth SpaceToDepth for tensors of type T.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.nn.space_to_depth  
tf.compat.v1.space_to_depth(
    input, block_size, name=None, data_format='NHWC'
)
 Rearranges blocks of spatial data, into depth. More specifically, this op outputs a copy of the input tensor where values from the height and width dimensions are moved to the depth dimension. The attr block_size indicates the input block size.  Non-overlapping blocks of size block_size x block size are rearranged into depth at each location. The depth of the output tensor is block_size * block_size * input_depth. The Y, X coordinates within each block of the input become the high order component of the output channel index. The input tensor's height and width must be divisible by block_size.  The data_format attr specifies the layout of the input and output tensors with the following options: "NHWC": [ batch, height, width, channels ] "NCHW": [ batch, channels, height, width ] "NCHW_VECT_C": qint8 [ batch, channels / 4, height, width, 4 ] It is useful to consider the operation as transforming a 6-D Tensor. e.g. for data_format = NHWC, Each element in the input tensor can be specified via 6 coordinates, ordered by decreasing memory layout significance as: n,oY,bY,oX,bX,iC (where n=batch index, oX, oY means X or Y coordinates within the output image, bX, bY means coordinates within the input block, iC means input channels). The output would be a transpose to the following layout: n,oY,oX,bY,bX,iC This operation is useful for resizing the activations between convolutions (but keeping all data), e.g. instead of pooling. It is also useful for training purely convolutional models. For example, given an input of shape [1, 2, 2, 1], data_format = "NHWC" and block_size = 2: x = [[[[1], [2]],
      [[3], [4]]]]
 This operation will output a tensor of shape [1, 1, 1, 4]: [[[[1, 2, 3, 4]]]]
 Here, the input has a batch of 1 and each batch element has shape [2, 2, 1], the corresponding output will have a single element (i.e. width and height are both 1) and will have a depth of 4 channels (1 * block_size * block_size). The output element shape is [1, 1, 4]. For an input tensor with larger depth, here of shape [1, 2, 2, 3], e.g. x = [[[[1, 2, 3], [4, 5, 6]],
      [[7, 8, 9], [10, 11, 12]]]]
 This operation, for block_size of 2, will return the following tensor of shape [1, 1, 1, 12] [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
 Similarly, for the following input of shape [1 4 4 1], and a block size of 2: x = [[[[1],   [2],  [5],  [6]],
      [[3],   [4],  [7],  [8]],
      [[9],  [10], [13],  [14]],
      [[11], [12], [15],  [16]]]]
 the operator will return the following tensor of shape [1 2 2 4]: x = [[[[1, 2, 3, 4],
       [5, 6, 7, 8]],
      [[9, 10, 11, 12],
       [13, 14, 15, 16]]]]

 


 Args
  input   A Tensor.  
  block_size   An int that is >= 2. The size of the spatial block.  
  data_format   An optional string from: "NHWC", "NCHW", "NCHW_VECT_C". Defaults to "NHWC".  
  name   A name for the operation (optional).   
 


 Returns   A Tensor. Has the same type as input.
Module: tf.compat.v1.sparse Sparse Tensor Representation. See also tf.sparse.SparseTensor. Classes class SparseConditionalAccumulator: A conditional accumulator for aggregating sparse gradients. class SparseTensor: Represents a sparse tensor. Functions add(...): Adds two tensors, at least one of each is a SparseTensor. (deprecated arguments) bincount(...): Count the number of times an integer value appears in a tensor. concat(...): Concatenates a list of SparseTensor along the specified dimension. (deprecated arguments) cross(...): Generates sparse cross from a list of sparse and dense tensors. cross_hashed(...): Generates hashed sparse cross from a list of sparse and dense tensors. expand_dims(...): Returns a tensor with an length 1 axis inserted at index axis. eye(...): Creates a two-dimensional sparse tensor with ones along the diagonal. fill_empty_rows(...): Fills empty rows in the input 2-D SparseTensor with a default value. from_dense(...): Converts a dense tensor into a sparse tensor. mask(...): Masks elements of IndexedSlices. matmul(...): Multiply SparseTensor (or dense Matrix) (of rank 2) "A" by dense matrix maximum(...): Returns the element-wise max of two SparseTensors. merge(...): Combines a batch of feature ids and values into a single SparseTensor. (deprecated) minimum(...): Returns the element-wise min of two SparseTensors. placeholder(...): Inserts a placeholder for a sparse tensor that will be always fed. reduce_max(...): Computes the max of elements across dimensions of a SparseTensor. (deprecated arguments) (deprecated arguments) reduce_max_sparse(...): Computes the max of elements across dimensions of a SparseTensor. (deprecated arguments) reduce_sum(...): Computes the sum of elements across dimensions of a SparseTensor. (deprecated arguments) (deprecated arguments) reduce_sum_sparse(...): Computes the sum of elements across dimensions of a SparseTensor. (deprecated arguments) reorder(...): Reorders a SparseTensor into the canonical, row-major ordering. reset_shape(...): Resets the shape of a SparseTensor with indices and values unchanged. reshape(...): Reshapes a SparseTensor to represent values in a new dense shape. retain(...): Retains specified non-empty values within a SparseTensor. segment_mean(...): Computes the mean along sparse segments of a tensor. segment_sqrt_n(...): Computes the sum along sparse segments of a tensor divided by the sqrt(N). segment_sum(...): Computes the sum along sparse segments of a tensor. slice(...): Slice a SparseTensor based on the start and `size. softmax(...): Applies softmax to a batched N-D SparseTensor. sparse_dense_matmul(...): Multiply SparseTensor (or dense Matrix) (of rank 2) "A" by dense matrix split(...): Split a SparseTensor into num_split tensors along axis. (deprecated arguments) to_dense(...): Converts a SparseTensor into a dense tensor. to_indicator(...): Converts a SparseTensor of ids into a dense bool indicator tensor. transpose(...): Transposes a SparseTensor
tf.compat.v1.SparseTensorValue SparseTensorValue(indices, values, dense_shape) 
tf.compat.v1.SparseTensorValue(
    indices, values, dense_shape
)

 


 Attributes
  indices  
 
  values  
 
  dense_shape
tf.compat.v1.sparse_add Adds two tensors, at least one of each is a SparseTensor. (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sparse.add  
tf.compat.v1.sparse_add(
    a, b, threshold=None, thresh=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (thresh). They will be removed in a future version. Instructions for updating: thresh is deprecated, use threshold instead If one SparseTensor and one Tensor are passed in, returns a Tensor. If both arguments are SparseTensors, this returns a SparseTensor. The order of arguments does not matter. Use vanilla tf.add() for adding two dense Tensors. The shapes of the two operands must match: broadcasting is not supported. The indices of any input SparseTensor are assumed ordered in standard lexicographic order. If this is not the case, before this step run SparseReorder to restore index ordering. If both arguments are sparse, we perform "clipping" as follows. By default, if two values sum to zero at some index, the output SparseTensor would still include that particular location in its index, storing a zero in the corresponding value slot. To override this, callers can specify thresh, indicating that if the sum has a magnitude strictly smaller than thresh, its corresponding value and index would then not be included. In particular, thresh == 0.0 (default) means everything is kept and actual thresholding happens only for a positive value. For example, suppose the logical sum of two sparse operands is (densified): [       2]
[.1     0]
[ 6   -.2]
 Then,  
thresh == 0 (the default): all 5 index/value pairs will be returned. 
thresh == 0.11: only .1 and 0 will vanish, and the remaining three index/value pairs will be returned. 
thresh == 0.21: .1, 0, and -.2 will vanish. 
 


 Args
  a   The first operand; SparseTensor or Tensor.  
  b   The second operand; SparseTensor or Tensor. At least one operand must be sparse.  
  threshold   An optional 0-D Tensor (defaults to 0). The magnitude threshold that determines if an output value/index pair takes space. Its dtype should match that of the values if they are real; if the latter are complex64/complex128, then the dtype should be float32/float64, correspondingly.  
  thresh   Deprecated alias for threshold.   
 


 Returns   A SparseTensor or a Tensor, representing the sum.  

 


 Raises
  TypeError   If both a and b are Tensors. Use tf.add() instead.
tf.compat.v1.sparse_matmul Multiply matrix "a" by matrix "b". 
tf.compat.v1.sparse_matmul(
    a, b, transpose_a=False, transpose_b=False, a_is_sparse=False,
    b_is_sparse=False, name=None
)
 The inputs must be two-dimensional matrices and the inner dimension of "a" must match the outer dimension of "b". Both "a" and "b" must be Tensors not SparseTensors. This op is optimized for the case where at least one of "a" or "b" is sparse, in the sense that they have a large proportion of zero values. The breakeven for using this versus a dense matrix multiply on one platform was 30% zero values in the sparse matrix. The gradient computation of this operation will only take advantage of sparsity in the input gradient when that gradient comes from a Relu.
 


 Args
  a   A Tensor. Must be one of the following types: float32, bfloat16.  
  b   A Tensor. Must be one of the following types: float32, bfloat16.  
  transpose_a   An optional bool. Defaults to False.  
  transpose_b   An optional bool. Defaults to False.  
  a_is_sparse   An optional bool. Defaults to False.  
  b_is_sparse   An optional bool. Defaults to False.  
  name   A name for the operation (optional).   
 


 Returns   A Tensor of type float32.
tf.compat.v1.sparse_placeholder Inserts a placeholder for a sparse tensor that will be always fed.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sparse.placeholder  
tf.compat.v1.sparse_placeholder(
    dtype, shape=None, name=None
)
 Key Point: This sparse tensor will produce an error if evaluated. Its value must be fed using the feed_dict optional argument to Session.run(), Tensor.eval(), or Operation.run(). For example: x = tf.compat.v1.sparse.placeholder(tf.float32)
y = tf.sparse.reduce_sum(x)

with tf.compat.v1.Session() as sess:
  print(sess.run(y))  # ERROR: will fail because x was not fed.

  indices = np.array([[3, 2, 0], [4, 5, 1]], dtype=np.int64)
  values = np.array([1.0, 2.0], dtype=np.float32)
  shape = np.array([7, 9, 2], dtype=np.int64)
  print(sess.run(y, feed_dict={
    x: tf.compat.v1.SparseTensorValue(indices, values, shape)}))  # Will
    succeed.
  print(sess.run(y, feed_dict={
    x: (indices, values, shape)}))  # Will succeed.

  sp = tf.sparse.SparseTensor(indices=indices, values=values,
                              dense_shape=shape)
  sp_value = sp.eval(session=sess)
  print(sess.run(y, feed_dict={x: sp_value}))  # Will succeed.
 @compatibility{eager} Placeholders are not compatible with eager execution.
 


 Args
  dtype   The type of values elements in the tensor to be fed.  
  shape   The shape of the tensor to be fed (optional). If the shape is not specified, you can feed a sparse tensor of any shape.  
  name   A name for prefixing the operations (optional).   
 


 Returns   A SparseTensor that may be used as a handle for feeding a value, but not evaluated directly.  

 


 Raises
  RuntimeError   if eager execution is enabled
tf.compat.v1.sparse_reduce_max Computes the max of elements across dimensions of a SparseTensor. (deprecated arguments) (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sparse.reduce_max  
tf.compat.v1.sparse_reduce_max(
    sp_input, axis=None, keepdims=None, reduction_axes=None, keep_dims=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (keep_dims). They will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims insteadWarning: SOME ARGUMENTS ARE DEPRECATED: (reduction_axes). They will be removed in a future version. Instructions for updating: reduction_axes is deprecated, use axis instead This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_max(). In particular, this Op also returns a dense Tensor instead of a sparse one. 
Note: A gradient is not defined for this function, so it can't be used in training models that need gradient descent.
 Reduces sp_input along the dimensions given in reduction_axes. Unless keepdims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keepdims is true, the reduced dimensions are retained with length 1. If reduction_axes has no entries, all dimensions are reduced, and a tensor with a single element is returned. Additionally, the axes can be negative, similar to the indexing rules in Python. The values not defined in sp_input don't participate in the reduce max, as opposed to be implicitly assumed 0 -- hence it can return negative values for sparse reduction_axes. But, in case there are no values in reduction_axes, it will reduce to 0. See second example below. For example: # 'x' represents [[1, ?, 2]
#                 [?, 3, ?]]
# where ? is implicitly-zero.
tf.sparse.reduce_max(x) ==> 3
tf.sparse.reduce_max(x, 0) ==> [1, 3, 2]
tf.sparse.reduce_max(x, 1) ==> [2, 3]  # Can also use -1 as the axis.
tf.sparse.reduce_max(x, 1, keepdims=True) ==> [[2], [3]]
tf.sparse.reduce_max(x, [0, 1]) ==> 3

# 'y' represents [[-7, ?]
#                 [ 4, 3]
#                 [ ?, ?]
tf.sparse.reduce_max(x, 1) ==> [-7, 4, 0]

 


 Args
  sp_input   The SparseTensor to reduce. Should have numeric type.  
  axis   The dimensions to reduce; list or scalar. If None (the default), reduces all dimensions.  
  keepdims   If true, retain reduced dimensions with length 1.  
  reduction_axes   Deprecated name of axis.  
  keep_dims   Deprecated alias for keepdims.   
 


 Returns   The reduced Tensor.
tf.compat.v1.sparse_reduce_max_sparse Computes the max of elements across dimensions of a SparseTensor. (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sparse.reduce_max_sparse  
tf.compat.v1.sparse_reduce_max_sparse(
    sp_input, axis=None, keepdims=None, reduction_axes=None, keep_dims=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (keep_dims). They will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_max(). In contrast to SparseReduceSum, this Op returns a SparseTensor. 
Note: A gradient is not defined for this function, so it can't be used in training models that need gradient descent.
 Reduces sp_input along the dimensions given in reduction_axes. Unless keepdims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keepdims is true, the reduced dimensions are retained with length 1. If reduction_axes has no entries, all dimensions are reduced, and a tensor with a single element is returned. Additionally, the axes can be negative, which are interpreted according to the indexing rules in Python.
 


 Args
  sp_input   The SparseTensor to reduce. Should have numeric type.  
  axis   The dimensions to reduce; list or scalar. If None (the default), reduces all dimensions.  
  keepdims   If true, retain reduced dimensions with length 1.  
  reduction_axes   Deprecated name of axis.  
  keep_dims   Deprecated alias for keepdims.   
 


 Returns   The reduced SparseTensor.
tf.compat.v1.sparse_reduce_sum Computes the sum of elements across dimensions of a SparseTensor. (deprecated arguments) (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sparse.reduce_sum  
tf.compat.v1.sparse_reduce_sum(
    sp_input, axis=None, keepdims=None, reduction_axes=None, keep_dims=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (keep_dims). They will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims insteadWarning: SOME ARGUMENTS ARE DEPRECATED: (reduction_axes). They will be removed in a future version. Instructions for updating: reduction_axes is deprecated, use axis instead This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_sum(). In particular, this Op also returns a dense Tensor instead of a sparse one. Reduces sp_input along the dimensions given in reduction_axes. Unless keepdims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keepdims is true, the reduced dimensions are retained with length 1. If reduction_axes has no entries, all dimensions are reduced, and a tensor with a single element is returned. Additionally, the axes can be negative, similar to the indexing rules in Python. For example: # 'x' represents [[1, ?, 1]
#                 [?, 1, ?]]
# where ? is implicitly-zero.
tf.sparse.reduce_sum(x) ==> 3
tf.sparse.reduce_sum(x, 0) ==> [1, 1, 1]
tf.sparse.reduce_sum(x, 1) ==> [2, 1]  # Can also use -1 as the axis.
tf.sparse.reduce_sum(x, 1, keepdims=True) ==> [[2], [1]]
tf.sparse.reduce_sum(x, [0, 1]) ==> 3

 


 Args
  sp_input   The SparseTensor to reduce. Should have numeric type.  
  axis   The dimensions to reduce; list or scalar. If None (the default), reduces all dimensions.  
  keepdims   If true, retain reduced dimensions with length 1.  
  reduction_axes   Deprecated name of axis.  
  keep_dims   Deprecated alias for keepdims.   
 


 Returns   The reduced Tensor.
tf.compat.v1.sparse_reduce_sum_sparse Computes the sum of elements across dimensions of a SparseTensor. (deprecated arguments)  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sparse.reduce_sum_sparse  
tf.compat.v1.sparse_reduce_sum_sparse(
    sp_input, axis=None, keepdims=None, reduction_axes=None, keep_dims=None
)
 Warning: SOME ARGUMENTS ARE DEPRECATED: (keep_dims). They will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_sum(). In contrast to SparseReduceSum, this Op returns a SparseTensor. 
Note: A gradient is not defined for this function, so it can't be used in training models that need gradient descent.
 Reduces sp_input along the dimensions given in reduction_axes. Unless keepdims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keepdims is true, the reduced dimensions are retained with length 1. If reduction_axes has no entries, all dimensions are reduced, and a tensor with a single element is returned. Additionally, the axes can be negative, which are interpreted according to the indexing rules in Python.
 


 Args
  sp_input   The SparseTensor to reduce. Should have numeric type.  
  axis   The dimensions to reduce; list or scalar. If None (the default), reduces all dimensions.  
  keepdims   If true, retain reduced dimensions with length 1.  
  reduction_axes   Deprecated name of axis.  
  keep_dims   Deprecated alias for keepdims.   
 


 Returns   The reduced SparseTensor.
tf.compat.v1.sparse_segment_mean Computes the mean along sparse segments of a tensor.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.sparse.segment_mean  
tf.compat.v1.sparse_segment_mean(
    data, indices, segment_ids, name=None, num_segments=None
)
 Read the section on segmentation for an explanation of segments. Like tf.math.segment_mean, but segment_ids can have rank less than data's first dimension, selecting a subset of dimension 0, specified by indices. segment_ids is allowed to have missing ids, in which case the output will be zeros at those indices. In those cases num_segments is used to determine the size of the output.
 


 Args
  data   A Tensor with data that will be assembled in the output.  
  indices   A 1-D Tensor with indices into data. Has same rank as segment_ids.  
  segment_ids   A 1-D Tensor with indices into the output Tensor. Values should be sorted and can be repeated.  
  name   A name for the operation (optional).  
  num_segments   An optional int32 scalar. Indicates the size of the output Tensor.   
 


 Returns   A tensor of the shape as data, except for dimension 0 which has size k, the number of segments specified via num_segments or inferred for the last element in segments_ids.