doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
tf.raw_ops.SparseReduceMaxSparse Computes the max of elements across dimensions of a SparseTensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseReduceMaxSparse tf.raw_ops.SparseReduceMaxSparse( input_indices, input_values, input_shape, reduction_axes, keep_dims=False, name=None ) This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_max(). In contrast to SparseReduceMax, this Op returns a SparseTensor. Reduces sp_input along the dimensions given in reduction_axes. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keep_dims 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 input_indices A Tensor of type int64. 2-D. N x R matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering. input_values A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, half, uint32, uint64. 1-D. N non-empty values corresponding to input_indices. input_shape A Tensor of type int64. 1-D. Shape of the input SparseTensor. reduction_axes A Tensor of type int32. 1-D. Length-K vector containing the reduction axes. keep_dims An optional bool. Defaults to False. If true, retain reduced dimensions with length 1. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_values, output_shape). output_indices A Tensor of type int64. output_values A Tensor. Has the same type as input_values. output_shape A Tensor of type int64.
tensorflow.raw_ops.sparsereducemaxsparse
tf.raw_ops.SparseReduceSum Computes the sum of elements across dimensions of a SparseTensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseReduceSum tf.raw_ops.SparseReduceSum( input_indices, input_values, input_shape, reduction_axes, keep_dims=False, name=None ) 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 keep_dims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keep_dims 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 input_indices A Tensor of type int64. 2-D. N x R matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering. input_values 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. 1-D. N non-empty values corresponding to input_indices. input_shape A Tensor of type int64. 1-D. Shape of the input SparseTensor. reduction_axes A Tensor of type int32. 1-D. Length-K vector containing the reduction axes. keep_dims An optional bool. Defaults to False. If true, retain reduced dimensions with length 1. name A name for the operation (optional). Returns A Tensor. Has the same type as input_values.
tensorflow.raw_ops.sparsereducesum
tf.raw_ops.SparseReduceSumSparse Computes the sum of elements across dimensions of a SparseTensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseReduceSumSparse tf.raw_ops.SparseReduceSumSparse( input_indices, input_values, input_shape, reduction_axes, keep_dims=False, name=None ) This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_sum(). In contrast to SparseReduceSum, this Op returns a SparseTensor. Reduces sp_input along the dimensions given in reduction_axes. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keep_dims 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 input_indices A Tensor of type int64. 2-D. N x R matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering. input_values 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. 1-D. N non-empty values corresponding to input_indices. input_shape A Tensor of type int64. 1-D. Shape of the input SparseTensor. reduction_axes A Tensor of type int32. 1-D. Length-K vector containing the reduction axes. keep_dims An optional bool. Defaults to False. If true, retain reduced dimensions with length 1. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_values, output_shape). output_indices A Tensor of type int64. output_values A Tensor. Has the same type as input_values. output_shape A Tensor of type int64.
tensorflow.raw_ops.sparsereducesumsparse
tf.raw_ops.SparseReorder Reorders a SparseTensor into the canonical, row-major ordering. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseReorder tf.raw_ops.SparseReorder( input_indices, input_values, input_shape, name=None ) Note that by convention, all sparse ops preserve the canonical ordering along increasing dimension number. The only time ordering can be violated is during manual manipulation of the indices and values vectors to add entries. Reordering does not affect the shape of the SparseTensor. If the tensor has rank R and N non-empty values, input_indices has shape [N, R], input_values has length N, and input_shape has length R. Args input_indices A Tensor of type int64. 2-D. N x R matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering. input_values A Tensor. 1-D. N non-empty values corresponding to input_indices. input_shape A Tensor of type int64. 1-D. Shape of the input SparseTensor. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_values). output_indices A Tensor of type int64. output_values A Tensor. Has the same type as input_values.
tensorflow.raw_ops.sparsereorder
tf.raw_ops.SparseReshape Reshapes a SparseTensor to represent values in a new dense shape. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseReshape tf.raw_ops.SparseReshape( input_indices, input_shape, new_shape, name=None ) This operation has the same semantics as reshape on the represented dense tensor. The input_indices are recomputed based on the requested new_shape. If one component of new_shape is the special value -1, the size of that dimension is computed so that the total dense size remains constant. At most one component of new_shape can be -1. The number of dense elements implied by new_shape must be the same as the number of dense elements originally implied by input_shape. Reshaping does not affect the order of values in the SparseTensor. If the input tensor has rank R_in and N non-empty values, and new_shape has length R_out, then input_indices has shape [N, R_in], input_shape has length R_in, output_indices has shape [N, R_out], and output_shape has length R_out. Args input_indices A Tensor of type int64. 2-D. N x R_in matrix with the indices of non-empty values in a SparseTensor. input_shape A Tensor of type int64. 1-D. R_in vector with the input SparseTensor's dense shape. new_shape A Tensor of type int64. 1-D. R_out vector with the requested new dense shape. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_shape). output_indices A Tensor of type int64. output_shape A Tensor of type int64.
tensorflow.raw_ops.sparsereshape
tf.raw_ops.SparseSegmentMean Computes the mean along sparse segments of a tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentMean tf.raw_ops.SparseSegmentMean( data, indices, segment_ids, name=None ) See tf.sparse.segment_sum for usage examples. Like SegmentMean, but segment_ids can have rank less than data's first dimension, selecting a subset of dimension 0, specified by indices. Args data A Tensor. Must be one of the following types: bfloat16, float32, float64. indices A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Has same rank as segment_ids. segment_ids A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Values should be sorted and can be repeated. name A name for the operation (optional). Returns A Tensor. Has the same type as data.
tensorflow.raw_ops.sparsesegmentmean
tf.raw_ops.SparseSegmentMeanGrad Computes gradients for SparseSegmentMean. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentMeanGrad tf.raw_ops.SparseSegmentMeanGrad( grad, indices, segment_ids, output_dim0, name=None ) Returns tensor "output" with same shape as grad, except for dimension 0 whose value is output_dim0. Args grad A Tensor. Must be one of the following types: float32, float64. gradient propagated to the SparseSegmentMean op. indices A Tensor. Must be one of the following types: int32, int64. indices passed to the corresponding SparseSegmentMean op. segment_ids A Tensor. Must be one of the following types: int32, int64. segment_ids passed to the corresponding SparseSegmentMean op. output_dim0 A Tensor of type int32. dimension 0 of "data" passed to SparseSegmentMean op. name A name for the operation (optional). Returns A Tensor. Has the same type as grad.
tensorflow.raw_ops.sparsesegmentmeangrad
tf.raw_ops.SparseSegmentMeanWithNumSegments Computes the mean along sparse segments of a tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentMeanWithNumSegments tf.raw_ops.SparseSegmentMeanWithNumSegments( data, indices, segment_ids, num_segments, name=None ) Like SparseSegmentMean, but allows missing ids in segment_ids. If an id is missing, the output tensor at that position will be zeroed. Read the section on segmentation for an explanation of segments. Args data A Tensor. Must be one of the following types: bfloat16, float32, float64. indices A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Has same rank as segment_ids. segment_ids A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Values should be sorted and can be repeated. num_segments A Tensor. Must be one of the following types: int32, int64. Should equal the number of distinct segment IDs. name A name for the operation (optional). Returns A Tensor. Has the same type as data.
tensorflow.raw_ops.sparsesegmentmeanwithnumsegments
tf.raw_ops.SparseSegmentSqrtN Computes the sum along sparse segments of a tensor divided by the sqrt of N. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentSqrtN tf.raw_ops.SparseSegmentSqrtN( data, indices, segment_ids, name=None ) N is the size of the segment being reduced. See tf.sparse.segment_sum for usage examples. Args data A Tensor. Must be one of the following types: bfloat16, float32, float64. indices A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Has same rank as segment_ids. segment_ids A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Values should be sorted and can be repeated. name A name for the operation (optional). Returns A Tensor. Has the same type as data.
tensorflow.raw_ops.sparsesegmentsqrtn
tf.raw_ops.SparseSegmentSqrtNGrad Computes gradients for SparseSegmentSqrtN. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentSqrtNGrad tf.raw_ops.SparseSegmentSqrtNGrad( grad, indices, segment_ids, output_dim0, name=None ) Returns tensor "output" with same shape as grad, except for dimension 0 whose value is output_dim0. Args grad A Tensor. Must be one of the following types: float32, float64. gradient propagated to the SparseSegmentSqrtN op. indices A Tensor. Must be one of the following types: int32, int64. indices passed to the corresponding SparseSegmentSqrtN op. segment_ids A Tensor. Must be one of the following types: int32, int64. segment_ids passed to the corresponding SparseSegmentSqrtN op. output_dim0 A Tensor of type int32. dimension 0 of "data" passed to SparseSegmentSqrtN op. name A name for the operation (optional). Returns A Tensor. Has the same type as grad.
tensorflow.raw_ops.sparsesegmentsqrtngrad
tf.raw_ops.SparseSegmentSqrtNWithNumSegments Computes the sum along sparse segments of a tensor divided by the sqrt of N. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentSqrtNWithNumSegments tf.raw_ops.SparseSegmentSqrtNWithNumSegments( data, indices, segment_ids, num_segments, name=None ) N is the size of the segment being reduced. Like SparseSegmentSqrtN, but allows missing ids in segment_ids. If an id is missing, the output tensor at that position will be zeroed. Read the section on segmentation for an explanation of segments. Args data A Tensor. Must be one of the following types: bfloat16, float32, float64. indices A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Has same rank as segment_ids. segment_ids A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Values should be sorted and can be repeated. num_segments A Tensor. Must be one of the following types: int32, int64. Should equal the number of distinct segment IDs. name A name for the operation (optional). Returns A Tensor. Has the same type as data.
tensorflow.raw_ops.sparsesegmentsqrtnwithnumsegments
tf.raw_ops.SparseSegmentSum Computes the sum along sparse segments of a tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentSum tf.raw_ops.SparseSegmentSum( data, indices, segment_ids, name=None ) Read the section on segmentation for an explanation of segments. Like SegmentSum, but segment_ids can have rank less than data's first dimension, selecting a subset of dimension 0, specified by indices. For example: c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) # Select two rows, one segment. tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0])) # => [[0 0 0 0]] # Select two rows, two segment. tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1])) # => [[ 1 2 3 4] # [-1 -2 -3 -4]] # Select all rows, two segments. tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1])) # => [[0 0 0 0] # [5 6 7 8]] # Which is equivalent to: tf.segment_sum(c, tf.constant([0, 0, 1])) Args data A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, half, uint32, uint64. indices A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Has same rank as segment_ids. segment_ids A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Values should be sorted and can be repeated. name A name for the operation (optional). Returns A Tensor. Has the same type as data.
tensorflow.raw_ops.sparsesegmentsum
tf.raw_ops.SparseSegmentSumWithNumSegments Computes the sum along sparse segments of a tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSegmentSumWithNumSegments tf.raw_ops.SparseSegmentSumWithNumSegments( data, indices, segment_ids, num_segments, name=None ) Like SparseSegmentSum, but allows missing ids in segment_ids. If an id is missing, the output tensor at that position will be zeroed. Read the section on segmentation for an explanation of segments. For example: c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) tf.sparse_segment_sum_with_num_segments( c, tf.constant([0, 1]), tf.constant([0, 0]), num_segments=3) # => [[0 0 0 0] # [0 0 0 0] # [0 0 0 0]] tf.sparse_segment_sum_with_num_segments(c, tf.constant([0, 1]), tf.constant([0, 2], num_segments=4)) # => [[ 1 2 3 4] # [ 0 0 0 0] # [-1 -2 -3 -4] # [ 0 0 0 0]] Args data A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, half, uint32, uint64. indices A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Has same rank as segment_ids. segment_ids A Tensor. Must be one of the following types: int32, int64. A 1-D tensor. Values should be sorted and can be repeated. num_segments A Tensor. Must be one of the following types: int32, int64. Should equal the number of distinct segment IDs. name A name for the operation (optional). Returns A Tensor. Has the same type as data.
tensorflow.raw_ops.sparsesegmentsumwithnumsegments
tf.raw_ops.SparseSlice Slice a SparseTensor based on the start and size. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSlice tf.raw_ops.SparseSlice( indices, values, shape, start, size, name=None ) For example, if the input is input_tensor = shape = [2, 7] [ a d e ] [b c ] Graphically the output tensors are: sparse_slice([0, 0], [2, 4]) = shape = [2, 4] [ a ] [b c ] sparse_slice([0, 4], [2, 3]) = shape = [2, 3] [ d e ] [ ] Args indices A Tensor of type int64. 2-D tensor represents the indices of the sparse tensor. values A Tensor. 1-D tensor represents the values of the sparse tensor. shape A Tensor of type int64. 1-D. tensor represents the shape of the sparse tensor. start A Tensor of type int64. 1-D. tensor represents the start of the slice. size A Tensor of type int64. 1-D. tensor represents the size of the slice. output indices: A list of 1-D tensors represents the indices of the output sparse tensors. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_values, output_shape). output_indices A Tensor of type int64. output_values A Tensor. Has the same type as values. output_shape A Tensor of type int64.
tensorflow.raw_ops.sparseslice
tf.raw_ops.SparseSliceGrad The gradient operator for the SparseSlice op. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSliceGrad tf.raw_ops.SparseSliceGrad( backprop_val_grad, input_indices, input_start, output_indices, name=None ) This op takes in the upstream gradient w.r.t. non-empty values of the sliced SparseTensor, and outputs the gradients w.r.t. the non-empty values of input SparseTensor. Args backprop_val_grad 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. 1-D. The gradient with respect to the non-empty values of the sliced SparseTensor. input_indices A Tensor of type int64. 2-D. The indices of the input SparseTensor. input_start A Tensor of type int64. 1-D. tensor represents the start of the slice. output_indices A Tensor of type int64. 2-D. The indices of the sliced SparseTensor. name A name for the operation (optional). Returns A Tensor. Has the same type as backprop_val_grad.
tensorflow.raw_ops.sparseslicegrad
tf.raw_ops.SparseSoftmax Applies softmax to a batched N-D SparseTensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSoftmax tf.raw_ops.SparseSoftmax( sp_indices, sp_values, sp_shape, name=None ) The inputs represent an N-D SparseTensor with logical shape [..., B, C] (where N >= 2), and with indices sorted in the canonical lexicographic order. This op is equivalent to applying the normal tf.nn.softmax() to each innermost logical submatrix with shape [B, C], but with the catch that the implicitly zero elements do not participate. Specifically, the algorithm is equivalent to the following: (1) Applies tf.nn.softmax() to a densified view of each innermost submatrix with shape [B, C], along the size-C dimension; (2) Masks out the original implicitly-zero locations; (3) Renormalizes the remaining elements. Hence, the SparseTensor result has exactly the same non-zero indices and shape. Args sp_indices A Tensor of type int64. 2-D. NNZ x R matrix with the indices of non-empty values in a SparseTensor, in canonical ordering. sp_values A Tensor. Must be one of the following types: float32, float64. 1-D. NNZ non-empty values corresponding to sp_indices. sp_shape A Tensor of type int64. 1-D. Shape of the input SparseTensor. name A name for the operation (optional). Returns A Tensor. Has the same type as sp_values.
tensorflow.raw_ops.sparsesoftmax
tf.raw_ops.SparseSoftmaxCrossEntropyWithLogits Computes softmax cross entropy cost and gradients to backpropagate. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSoftmaxCrossEntropyWithLogits tf.raw_ops.SparseSoftmaxCrossEntropyWithLogits( features, labels, name=None ) Unlike SoftmaxCrossEntropyWithLogits, this operation does not accept a matrix of label probabilities, but rather a single label per row of features. This label is considered to have probability 1.0 for the given row. Inputs are the logits, not probabilities. Args features A Tensor. Must be one of the following types: half, bfloat16, float32, float64. batch_size x num_classes matrix labels A Tensor. Must be one of the following types: int32, int64. batch_size vector with values in [0, num_classes). This is the label for the given minibatch entry. name A name for the operation (optional). Returns A tuple of Tensor objects (loss, backprop). loss A Tensor. Has the same type as features. backprop A Tensor. Has the same type as features.
tensorflow.raw_ops.sparsesoftmaxcrossentropywithlogits
tf.raw_ops.SparseSparseMaximum Returns the element-wise max of two SparseTensors. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSparseMaximum tf.raw_ops.SparseSparseMaximum( a_indices, a_values, a_shape, b_indices, b_values, b_shape, name=None ) Assumes the two SparseTensors have the same shape, i.e., no broadcasting. Args a_indices A Tensor of type int64. 2-D. N x R matrix with the indices of non-empty values in a SparseTensor, in the canonical lexicographic ordering. a_values A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, half, uint32, uint64. 1-D. N non-empty values corresponding to a_indices. a_shape A Tensor of type int64. 1-D. Shape of the input SparseTensor. b_indices A Tensor of type int64. counterpart to a_indices for the other operand. b_values A Tensor. Must have the same type as a_values. counterpart to a_values for the other operand; must be of the same dtype. b_shape A Tensor of type int64. counterpart to a_shape for the other operand; the two shapes must be equal. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_values). output_indices A Tensor of type int64. output_values A Tensor. Has the same type as a_values.
tensorflow.raw_ops.sparsesparsemaximum
tf.raw_ops.SparseSparseMinimum Returns the element-wise min of two SparseTensors. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSparseMinimum tf.raw_ops.SparseSparseMinimum( a_indices, a_values, a_shape, b_indices, b_values, b_shape, name=None ) Assumes the two SparseTensors have the same shape, i.e., no broadcasting. Args a_indices A Tensor of type int64. 2-D. N x R matrix with the indices of non-empty values in a SparseTensor, in the canonical lexicographic ordering. a_values 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. 1-D. N non-empty values corresponding to a_indices. a_shape A Tensor of type int64. 1-D. Shape of the input SparseTensor. b_indices A Tensor of type int64. counterpart to a_indices for the other operand. b_values A Tensor. Must have the same type as a_values. counterpart to a_values for the other operand; must be of the same dtype. b_shape A Tensor of type int64. counterpart to a_shape for the other operand; the two shapes must be equal. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_values). output_indices A Tensor of type int64. output_values A Tensor. Has the same type as a_values.
tensorflow.raw_ops.sparsesparseminimum
tf.raw_ops.SparseSplit Split a SparseTensor into num_split tensors along one dimension. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseSplit tf.raw_ops.SparseSplit( split_dim, indices, values, shape, num_split, name=None ) If the shape[split_dim] is not an integer multiple of num_split. Slices [0 : shape[split_dim] % num_split] gets one extra dimension. For example, if split_dim = 1 and num_split = 2 and the input is input_tensor = shape = [2, 7] [ a d e ] [b c ] Graphically the output tensors are: output_tensor[0] = shape = [2, 4] [ a ] [b c ] output_tensor[1] = shape = [2, 3] [ d e ] [ ] Args split_dim A Tensor of type int64. 0-D. The dimension along which to split. Must be in the range [0, rank(shape)). indices A Tensor of type int64. 2-D tensor represents the indices of the sparse tensor. values A Tensor. 1-D tensor represents the values of the sparse tensor. shape A Tensor of type int64. 1-D. tensor represents the shape of the sparse tensor. output indices: A list of 1-D tensors represents the indices of the output sparse tensors. num_split An int that is >= 1. The number of ways to split. name A name for the operation (optional). Returns A tuple of Tensor objects (output_indices, output_values, output_shape). output_indices A list of num_split Tensor objects with type int64. output_values A list of num_split Tensor objects with the same type as values. output_shape A list of num_split Tensor objects with type int64.
tensorflow.raw_ops.sparsesplit
tf.raw_ops.SparseTensorDenseAdd Adds up a SparseTensor and a dense Tensor, producing a dense Tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseTensorDenseAdd tf.raw_ops.SparseTensorDenseAdd( a_indices, a_values, a_shape, b, name=None ) This Op does not require a_indices be sorted in standard lexicographic order. Args a_indices A Tensor. Must be one of the following types: int32, int64. 2-D. The indices of the SparseTensor, with shape [nnz, ndims]. a_values 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. 1-D. The values of the SparseTensor, with shape [nnz]. a_shape A Tensor. Must have the same type as a_indices. 1-D. The shape of the SparseTensor, with shape [ndims]. b A Tensor. Must have the same type as a_values. ndims-D Tensor. With shape a_shape. name A name for the operation (optional). Returns A Tensor. Has the same type as a_values.
tensorflow.raw_ops.sparsetensordenseadd
tf.raw_ops.SparseTensorDenseMatMul Multiply SparseTensor (of rank 2) "A" by dense matrix "B". View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseTensorDenseMatMul tf.raw_ops.SparseTensorDenseMatMul( a_indices, a_values, a_shape, b, adjoint_a=False, adjoint_b=False, name=None ) No validity checking is performed on the indices of A. However, the following input format is recommended for optimal behavior: if adjoint_a == false: A should be sorted in lexicographically increasing order. Use SparseReorder if you're not sure. if adjoint_a == true: A should be sorted in order of increasing dimension 1 (i.e., "column major" order instead of "row major" order). Args a_indices A Tensor. Must be one of the following types: int32, int64. 2-D. The indices of the SparseTensor, size [nnz, 2] Matrix. a_values A Tensor. 1-D. The values of the SparseTensor, size [nnz] Vector. a_shape A Tensor of type int64. 1-D. The shape of the SparseTensor, size [2] Vector. b A Tensor. Must have the same type as a_values. 2-D. A dense Matrix. adjoint_a An optional bool. Defaults to False. Use the adjoint of A in the matrix multiply. If A is complex, this is transpose(conj(A)). Otherwise it's transpose(A). adjoint_b An optional bool. Defaults to False. Use the adjoint of B in the matrix multiply. If B is complex, this is transpose(conj(B)). Otherwise it's transpose(B). name A name for the operation (optional). Returns A Tensor. Has the same type as a_values.
tensorflow.raw_ops.sparsetensordensematmul
tf.raw_ops.SparseTensorSliceDataset Creates a dataset that splits a SparseTensor into elements row-wise. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseTensorSliceDataset tf.raw_ops.SparseTensorSliceDataset( indices, values, dense_shape, name=None ) Args indices A Tensor of type int64. values A Tensor. dense_shape A Tensor of type int64. name A name for the operation (optional). Returns A Tensor of type variant.
tensorflow.raw_ops.sparsetensorslicedataset
tf.raw_ops.SparseTensorToCSRSparseMatrix Converts a SparseTensor to a (possibly batched) CSRSparseMatrix. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseTensorToCSRSparseMatrix tf.raw_ops.SparseTensorToCSRSparseMatrix( indices, values, dense_shape, name=None ) Args indices A Tensor of type int64. SparseTensor indices. values A Tensor. Must be one of the following types: float32, float64, complex64, complex128. SparseTensor values. dense_shape A Tensor of type int64. SparseTensor dense shape. name A name for the operation (optional). Returns A Tensor of type variant.
tensorflow.raw_ops.sparsetensortocsrsparsematrix
tf.raw_ops.SparseToDense Converts a sparse representation into a dense tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseToDense tf.raw_ops.SparseToDense( sparse_indices, output_shape, sparse_values, default_value, validate_indices=True, name=None ) Builds an array dense with shape output_shape such that # If sparse_indices is scalar dense[i] = (i == sparse_indices ? sparse_values : default_value) # If sparse_indices is a vector, then for each i dense[sparse_indices[i]] = sparse_values[i] # If sparse_indices is an n by d matrix, then for each i in [0, n) dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i] All other values in dense are set to default_value. If sparse_values is a scalar, all sparse indices are set to this single value. Indices should be sorted in lexicographic order, and indices must not contain any repeats. If validate_indices is true, these properties are checked during execution. Args sparse_indices A Tensor. Must be one of the following types: int32, int64. 0-D, 1-D, or 2-D. sparse_indices[i] contains the complete index where sparse_values[i] will be placed. output_shape A Tensor. Must have the same type as sparse_indices. 1-D. Shape of the dense output tensor. sparse_values A Tensor. 1-D. Values corresponding to each row of sparse_indices, or a scalar value to be used for all sparse indices. default_value A Tensor. Must have the same type as sparse_values. Scalar value to set for indices not specified in sparse_indices. validate_indices An optional bool. Defaults to True. If true, indices are checked to make sure they are sorted in lexicographic order and that there are no repeats. name A name for the operation (optional). Returns A Tensor. Has the same type as sparse_values.
tensorflow.raw_ops.sparsetodense
tf.raw_ops.SparseToSparseSetOperation Applies set operation along last dimension of 2 SparseTensor inputs. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SparseToSparseSetOperation tf.raw_ops.SparseToSparseSetOperation( set1_indices, set1_values, set1_shape, set2_indices, set2_values, set2_shape, set_operation, validate_indices=True, name=None ) See SetOperationOp::SetOperationFromContext for values of set_operation. If validate_indices is True, SparseToSparseSetOperation validates the order and range of set1 and set2 indices. Input set1 is a SparseTensor represented by set1_indices, set1_values, and set1_shape. For set1 ranked n, 1st n-1 dimensions must be the same as set2. Dimension n contains values in a set, duplicates are allowed but ignored. Input set2 is a SparseTensor represented by set2_indices, set2_values, and set2_shape. For set2 ranked n, 1st n-1 dimensions must be the same as set1. Dimension n contains values in a set, duplicates are allowed but ignored. If validate_indices is True, this op validates the order and range of set1 and set2 indices. Output result is a SparseTensor represented by result_indices, result_values, and result_shape. For set1 and set2 ranked n, this has rank n and the same 1st n-1 dimensions as set1 and set2. The nth dimension contains the result of set_operation applied to the corresponding [0...n-1] dimension of set. Args set1_indices A Tensor of type int64. 2D Tensor, indices of a SparseTensor. Must be in row-major order. set1_values A Tensor. Must be one of the following types: int8, int16, int32, int64, uint8, uint16, string. 1D Tensor, values of a SparseTensor. Must be in row-major order. set1_shape A Tensor of type int64. 1D Tensor, shape of a SparseTensor. set1_shape[0...n-1] must be the same as set2_shape[0...n-1], set1_shape[n] is the max set size across 0...n-1 dimensions. set2_indices A Tensor of type int64. 2D Tensor, indices of a SparseTensor. Must be in row-major order. set2_values A Tensor. Must have the same type as set1_values. 1D Tensor, values of a SparseTensor. Must be in row-major order. set2_shape A Tensor of type int64. 1D Tensor, shape of a SparseTensor. set2_shape[0...n-1] must be the same as set1_shape[0...n-1], set2_shape[n] is the max set size across 0...n-1 dimensions. set_operation A string. validate_indices An optional bool. Defaults to True. name A name for the operation (optional). Returns A tuple of Tensor objects (result_indices, result_values, result_shape). result_indices A Tensor of type int64. result_values A Tensor. Has the same type as set1_values. result_shape A Tensor of type int64.
tensorflow.raw_ops.sparsetosparsesetoperation
tf.raw_ops.Spence View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Spence tf.raw_ops.Spence( x, name=None ) Args x A Tensor. Must be one of the following types: bfloat16, half, float32, float64. name A name for the operation (optional). Returns A Tensor. Has the same type as x.
tensorflow.raw_ops.spence
tf.raw_ops.Split Splits a tensor into num_split tensors along one dimension. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Split tf.raw_ops.Split( axis, value, num_split, name=None ) Args axis A Tensor of type int32. 0-D. The dimension along which to split. Must be in the range [-rank(value), rank(value)). value A Tensor. The tensor to split. num_split An int that is >= 1. The number of ways to split. Must evenly divide value.shape[split_dim]. name A name for the operation (optional). Returns A list of num_split Tensor objects with the same type as value.
tensorflow.raw_ops.split
tf.raw_ops.SplitV Splits a tensor into num_split tensors along one dimension. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SplitV tf.raw_ops.SplitV( value, size_splits, axis, num_split, name=None ) Args value A Tensor. The tensor to split. size_splits A Tensor. Must be one of the following types: int32, int64. list containing the sizes of each output tensor along the split dimension. Must sum to the dimension of value along split_dim. Can contain one -1 indicating that dimension is to be inferred. axis A Tensor of type int32. 0-D. The dimension along which to split. Must be in the range [-rank(value), rank(value)). num_split An int that is >= 1. name A name for the operation (optional). Returns A list of num_split Tensor objects with the same type as value.
tensorflow.raw_ops.splitv
tf.raw_ops.SqlDataset Creates a dataset that executes a SQL query and emits rows of the result set. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SqlDataset tf.raw_ops.SqlDataset( driver_name, data_source_name, query, output_types, output_shapes, name=None ) Args driver_name A Tensor of type string. The database type. Currently, the only supported type is 'sqlite'. data_source_name A Tensor of type string. A connection string to connect to the database. query A Tensor of type string. A SQL query to execute. output_types A list of tf.DTypes that has length >= 1. output_shapes A list of shapes (each a tf.TensorShape or list of ints) that has length >= 1. name A name for the operation (optional). Returns A Tensor of type variant.
tensorflow.raw_ops.sqldataset
tf.raw_ops.Sqrt Computes square root of x element-wise. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Sqrt tf.raw_ops.Sqrt( x, name=None ) I.e., \(y = \sqrt{x} = x^{1/2}\). Args x A Tensor. Must be one of the following types: bfloat16, half, float32, float64, complex64, complex128. name A name for the operation (optional). Returns A Tensor. Has the same type as x.
tensorflow.raw_ops.sqrt
tf.raw_ops.SqrtGrad Computes the gradient for the sqrt of x wrt its input. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SqrtGrad tf.raw_ops.SqrtGrad( y, dy, name=None ) Specifically, grad = dy * 0.5 / y, where y = sqrt(x), and dy is the corresponding input gradient. Args y A Tensor. Must be one of the following types: bfloat16, half, float32, float64, complex64, complex128. dy A Tensor. Must have the same type as y. name A name for the operation (optional). Returns A Tensor. Has the same type as y.
tensorflow.raw_ops.sqrtgrad
tf.raw_ops.Square Computes square of x element-wise. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Square tf.raw_ops.Square( x, name=None ) I.e., \(y = x * x = x^2\). tf.math.square([-2., 0., 3.]) <tf.Tensor: shape=(3,), dtype=float32, numpy=array([4., 0., 9.], dtype=float32)> Args x A Tensor. Must be one of the following types: bfloat16, half, float32, float64, int8, int16, int32, int64, complex64, complex128. name A name for the operation (optional). Returns A Tensor. Has the same type as x.
tensorflow.raw_ops.square
tf.raw_ops.SquaredDifference Returns conj(x - y)(x - y) element-wise. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.SquaredDifference tf.raw_ops.SquaredDifference( x, y, name=None ) Note: math.squared_difference supports broadcasting. More about broadcasting here Args x A Tensor. Must be one of the following types: bfloat16, half, float32, float64, int32, int64, complex64, complex128. y A Tensor. Must have the same type as x. name A name for the operation (optional). Returns A Tensor. Has the same type as x.
tensorflow.raw_ops.squareddifference
tf.raw_ops.Squeeze Removes dimensions of size 1 from the shape of a tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Squeeze tf.raw_ops.Squeeze( input, axis=[], name=None ) Given a tensor input, this operation returns a tensor of the same type with all dimensions of size 1 removed. If you don't want to remove all size 1 dimensions, you can remove specific size 1 dimensions by specifying axis. For example: # 't' is a tensor of shape [1, 2, 1, 3, 1, 1] shape(squeeze(t)) ==> [2, 3] Or, to remove specific size 1 dimensions: # 't' is a tensor of shape [1, 2, 1, 3, 1, 1] shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1] Args input A Tensor. The input to squeeze. axis An optional list of ints. Defaults to []. If specified, only squeezes the dimensions listed. The dimension index starts at 0. It is an error to squeeze a dimension that is not 1. Must be in the range [-rank(input), rank(input)). name A name for the operation (optional). Returns A Tensor. Has the same type as input.
tensorflow.raw_ops.squeeze
tf.raw_ops.Stack Deprecated, use StackV2. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Stack tf.raw_ops.Stack( elem_type, stack_name='', name=None ) Args elem_type A tf.DType. stack_name An optional string. Defaults to "". name A name for the operation (optional). Returns A Tensor of type mutable string.
tensorflow.raw_ops.stack
tf.raw_ops.StackClose Deprecated, use StackCloseV2. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StackClose tf.raw_ops.StackClose( handle, name=None ) Args handle A Tensor of type mutable string. name A name for the operation (optional). Returns The created Operation.
tensorflow.raw_ops.stackclose
tf.raw_ops.StackCloseV2 Delete the stack from its resource container. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StackCloseV2 tf.raw_ops.StackCloseV2( handle, name=None ) Args handle A Tensor of type resource. The handle to a stack. name A name for the operation (optional). Returns The created Operation.
tensorflow.raw_ops.stackclosev2
tf.raw_ops.StackPop Deprecated, use StackPopV2. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StackPop tf.raw_ops.StackPop( handle, elem_type, name=None ) Args handle A Tensor of type mutable string. elem_type A tf.DType. name A name for the operation (optional). Returns A Tensor of type elem_type.
tensorflow.raw_ops.stackpop
tf.raw_ops.StackPopV2 Pop the element at the top of the stack. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StackPopV2 tf.raw_ops.StackPopV2( handle, elem_type, name=None ) Args handle A Tensor of type resource. The handle to a stack. elem_type A tf.DType. The type of the elem that is popped. name A name for the operation (optional). Returns A Tensor of type elem_type.
tensorflow.raw_ops.stackpopv2
tf.raw_ops.StackPush Deprecated, use StackPushV2. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StackPush tf.raw_ops.StackPush( handle, elem, swap_memory=False, name=None ) Args handle A Tensor of type mutable string. elem A Tensor. swap_memory An optional bool. Defaults to False. name A name for the operation (optional). Returns A Tensor. Has the same type as elem.
tensorflow.raw_ops.stackpush
tf.raw_ops.StackPushV2 Push an element onto the stack. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StackPushV2 tf.raw_ops.StackPushV2( handle, elem, swap_memory=False, name=None ) Args handle A Tensor of type resource. The handle to a stack. elem A Tensor. The tensor to be pushed onto the stack. swap_memory An optional bool. Defaults to False. Swap elem to CPU. Default to false. name A name for the operation (optional). Returns A Tensor. Has the same type as elem.
tensorflow.raw_ops.stackpushv2
tf.raw_ops.StackV2 A stack that produces elements in first-in last-out order. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StackV2 tf.raw_ops.StackV2( max_size, elem_type, stack_name='', name=None ) Args max_size A Tensor of type int32. The maximum size of the stack if non-negative. If negative, the stack size is unlimited. elem_type A tf.DType. The type of the elements on the stack. stack_name An optional string. Defaults to "". Overrides the name used for the temporary stack resource. Default value is the name of the 'Stack' op (which is guaranteed unique). name A name for the operation (optional). Returns A Tensor of type resource.
tensorflow.raw_ops.stackv2
tf.raw_ops.Stage Stage values similar to a lightweight Enqueue. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Stage tf.raw_ops.Stage( values, capacity=0, memory_limit=0, container='', shared_name='', name=None ) The basic functionality of this Op is similar to a queue with many fewer capabilities and options. This Op is optimized for performance. Args values A list of Tensor objects. a list of tensors dtypes A list of data types that inserted values should adhere to. capacity An optional int that is >= 0. Defaults to 0. Maximum number of elements in the Staging Area. If > 0, inserts on the container will block when the capacity is reached. memory_limit An optional int that is >= 0. Defaults to 0. The maximum number of bytes allowed for Tensors in the Staging Area. If > 0, inserts will block until sufficient space is available. container An optional string. Defaults to "". If non-empty, this queue is placed in the given container. Otherwise, a default container is used. shared_name An optional string. Defaults to "". It is necessary to match this name to the matching Unstage Op. name A name for the operation (optional). Returns The created Operation.
tensorflow.raw_ops.stage
tf.raw_ops.StageClear Op removes all elements in the underlying container. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StageClear tf.raw_ops.StageClear( dtypes, capacity=0, memory_limit=0, container='', shared_name='', name=None ) Args dtypes A list of tf.DTypes. capacity An optional int that is >= 0. Defaults to 0. memory_limit An optional int that is >= 0. Defaults to 0. container An optional string. Defaults to "". shared_name An optional string. Defaults to "". name A name for the operation (optional). Returns The created Operation.
tensorflow.raw_ops.stageclear
tf.raw_ops.StagePeek Op peeks at the values at the specified index. If the View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StagePeek tf.raw_ops.StagePeek( index, dtypes, capacity=0, memory_limit=0, container='', shared_name='', name=None ) underlying container does not contain sufficient elements this op will block until it does. This Op is optimized for performance. Args index A Tensor of type int32. dtypes A list of tf.DTypes that has length >= 1. capacity An optional int that is >= 0. Defaults to 0. memory_limit An optional int that is >= 0. Defaults to 0. container An optional string. Defaults to "". shared_name An optional string. Defaults to "". name A name for the operation (optional). Returns A list of Tensor objects of type dtypes.
tensorflow.raw_ops.stagepeek
tf.raw_ops.StageSize Op returns the number of elements in the underlying container. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StageSize tf.raw_ops.StageSize( dtypes, capacity=0, memory_limit=0, container='', shared_name='', name=None ) Args dtypes A list of tf.DTypes. capacity An optional int that is >= 0. Defaults to 0. memory_limit An optional int that is >= 0. Defaults to 0. container An optional string. Defaults to "". shared_name An optional string. Defaults to "". name A name for the operation (optional). Returns A Tensor of type int32.
tensorflow.raw_ops.stagesize
tf.raw_ops.StatefulPartitionedCall returns f(inputs), where f's body is placed and partitioned. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulPartitionedCall tf.raw_ops.StatefulPartitionedCall( args, Tout, f, config='', config_proto='', executor_type='', name=None ) Args args A list of Tensor objects. A list of input tensors. Tout A list of tf.DTypes. A list of output types. f A function decorated with @Defun. A function that takes 'args', a list of tensors, and returns 'output', another list of tensors. Input and output types are specified by 'Tin' and 'Tout'. The function body of f will be placed and partitioned across devices, setting this op apart from the regular Call op. This op is stateful. config An optional string. Defaults to "". config_proto An optional string. Defaults to "". executor_type An optional string. Defaults to "". name A name for the operation (optional). Returns A list of Tensor objects of type Tout.
tensorflow.raw_ops.statefulpartitionedcall
tf.raw_ops.StatefulRandomBinomial View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulRandomBinomial tf.raw_ops.StatefulRandomBinomial( resource, algorithm, shape, counts, probs, dtype=tf.dtypes.int64, name=None ) Args resource A Tensor of type resource. algorithm A Tensor of type int64. shape A Tensor. Must be one of the following types: int32, int64. counts A Tensor. Must be one of the following types: half, float32, float64, int32, int64. probs A Tensor. Must have the same type as counts. dtype An optional tf.DType from: tf.half, tf.float32, tf.float64, tf.int32, tf.int64. Defaults to tf.int64. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statefulrandombinomial
tf.raw_ops.StatefulStandardNormal Outputs random values from a normal distribution. This op is deprecated in favor of op 'StatefulStandardNormalV2' View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulStandardNormal tf.raw_ops.StatefulStandardNormal( resource, shape, dtype=tf.dtypes.float32, name=None ) The generated values will have mean 0 and standard deviation 1. Args resource A Tensor of type resource. The handle of the resource variable that stores the state of the RNG. shape A Tensor. The shape of the output tensor. dtype An optional tf.DType. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statefulstandardnormal
tf.raw_ops.StatefulStandardNormalV2 Outputs random values from a normal distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulStandardNormalV2 tf.raw_ops.StatefulStandardNormalV2( resource, algorithm, shape, dtype=tf.dtypes.float32, name=None ) The generated values will have mean 0 and standard deviation 1. Args resource A Tensor of type resource. The handle of the resource variable that stores the state of the RNG. algorithm A Tensor of type int64. The RNG algorithm. shape A Tensor. The shape of the output tensor. dtype An optional tf.DType. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statefulstandardnormalv2
tf.raw_ops.StatefulTruncatedNormal Outputs random values from a truncated normal distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulTruncatedNormal tf.raw_ops.StatefulTruncatedNormal( resource, algorithm, shape, dtype=tf.dtypes.float32, name=None ) The generated values follow a normal distribution with mean 0 and standard deviation 1, except that values whose magnitude is more than 2 standard deviations from the mean are dropped and re-picked. Args resource A Tensor of type resource. The handle of the resource variable that stores the state of the RNG. algorithm A Tensor of type int64. The RNG algorithm. shape A Tensor. The shape of the output tensor. dtype An optional tf.DType. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statefultruncatednormal
tf.raw_ops.StatefulUniform Outputs random values from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulUniform tf.raw_ops.StatefulUniform( resource, algorithm, shape, dtype=tf.dtypes.float32, name=None ) The generated values follow a uniform distribution in the range [0, 1). The lower bound 0 is included in the range, while the upper bound 1 is excluded. Args resource A Tensor of type resource. The handle of the resource variable that stores the state of the RNG. algorithm A Tensor of type int64. The RNG algorithm. shape A Tensor. The shape of the output tensor. dtype An optional tf.DType. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statefuluniform
tf.raw_ops.StatefulUniformFullInt Outputs random integers from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulUniformFullInt tf.raw_ops.StatefulUniformFullInt( resource, algorithm, shape, dtype=tf.dtypes.uint64, name=None ) The generated values are uniform integers covering the whole range of dtype. Args resource A Tensor of type resource. The handle of the resource variable that stores the state of the RNG. algorithm A Tensor of type int64. The RNG algorithm. shape A Tensor. The shape of the output tensor. dtype An optional tf.DType. Defaults to tf.uint64. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statefuluniformfullint
tf.raw_ops.StatefulUniformInt Outputs random integers from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatefulUniformInt tf.raw_ops.StatefulUniformInt( resource, algorithm, shape, minval, maxval, name=None ) The generated values are uniform integers in the range [minval, maxval). The lower bound minval is included in the range, while the upper bound maxval is excluded. The random integers are slightly biased unless maxval - minval is an exact power of two. The bias is small for values of maxval - minval significantly smaller than the range of the output (either 2^32 or 2^64). Args resource A Tensor of type resource. The handle of the resource variable that stores the state of the RNG. algorithm A Tensor of type int64. The RNG algorithm. shape A Tensor. The shape of the output tensor. minval A Tensor. Minimum value (inclusive, scalar). maxval A Tensor. Must have the same type as minval. Maximum value (exclusive, scalar). name A name for the operation (optional). Returns A Tensor. Has the same type as minval.
tensorflow.raw_ops.statefuluniformint
tf.raw_ops.StatelessCase An n-way switch statement which calls a single branch function. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessCase tf.raw_ops.StatelessCase( branch_index, input, Tout, branches, output_shapes=[], name=None ) An n-way switch statement, implementing the following: ``` switch (branch_index) { case 0: output = branches[0](input); break; case 1: output = branches[1](input); break; ... case [[nbranches-1]]: default: output = branches[nbranches-1](input); break; } ``` This should only be used when the none of branches has stateful ops. Args branch_index A Tensor of type int32. The branch selector, an int32 Tensor. input A list of Tensor objects. A list of input tensors passed to the branch function. Tout A list of tf.DTypes. A list of output types. branches A list of functions decorated with @Defun that has length >= 1. A list of functions each of which takes 'inputs' and returns a list of tensors, whose types are the same as what every other branch returns. output_shapes An optional list of shapes (each a tf.TensorShape or list of ints). Defaults to []. name A name for the operation (optional). Returns A list of Tensor objects of type Tout.
tensorflow.raw_ops.statelesscase
tf.raw_ops.StatelessIf output = cond ? then_branch(input) : else_branch(input) View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessIf tf.raw_ops.StatelessIf( cond, input, Tout, then_branch, else_branch, output_shapes=[], name=None ) Args cond A Tensor. A Tensor. If the tensor is a scalar of non-boolean type, the scalar is converted to a boolean according to the following rule: if the scalar is a numerical value, non-zero means True and zero means False; if the scalar is a string, non-empty means True and empty means False. If the tensor is not a scalar, being empty means False and being non-empty means True. This should only be used when the if then/else body functions do not have stateful ops. input A list of Tensor objects. A list of input tensors. Tout A list of tf.DTypes. A list of output types. then_branch A function decorated with @Defun. A function that takes 'inputs' and returns a list of tensors, whose types are the same as what else_branch returns. else_branch A function decorated with @Defun. A function that takes 'inputs' and returns a list of tensors, whose types are the same as what then_branch returns. output_shapes An optional list of shapes (each a tf.TensorShape or list of ints). Defaults to []. name A name for the operation (optional). Returns A list of Tensor objects of type Tout.
tensorflow.raw_ops.statelessif
tf.raw_ops.StatelessMultinomial Draws samples from a multinomial distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessMultinomial tf.raw_ops.StatelessMultinomial( logits, num_samples, seed, output_dtype=tf.dtypes.int64, name=None ) Args logits A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, half, uint32, uint64. 2-D Tensor with shape [batch_size, num_classes]. Each slice [i, :] represents the unnormalized log probabilities for all classes. num_samples A Tensor of type int32. 0-D. Number of independent samples to draw for each row slice. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). output_dtype 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_dtype.
tensorflow.raw_ops.statelessmultinomial
tf.raw_ops.StatelessParameterizedTruncatedNormal View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessParameterizedTruncatedNormal tf.raw_ops.StatelessParameterizedTruncatedNormal( shape, seed, means, stddevs, minvals, maxvals, name=None ) Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). means A Tensor. Must be one of the following types: half, float32, float64. The mean parameter of each batch. stddevs A Tensor. Must have the same type as means. The standard deviation parameter of each batch. Must be greater than 0. minvals A Tensor. Must have the same type as means. The minimum cutoff. May be -infinity. maxvals A Tensor. Must have the same type as means. The maximum cutoff. May be +infinity, and must be more than the minval for each batch. name A name for the operation (optional). Returns A Tensor. Has the same type as means.
tensorflow.raw_ops.statelessparameterizedtruncatednormal
tf.raw_ops.StatelessRandomBinomial Outputs deterministic pseudorandom random numbers from a binomial distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomBinomial tf.raw_ops.StatelessRandomBinomial( shape, seed, counts, probs, dtype=tf.dtypes.int64, name=None ) Outputs random values from a binomial distribution. The outputs are a deterministic function of shape, seed, counts, and probs. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). counts A Tensor. Must be one of the following types: half, float32, float64, int32, int64. The counts of the binomial distribution. Must be broadcastable with probs, and broadcastable with the rightmost dimensions of shape. probs A Tensor. Must have the same type as counts. The probability of success for the binomial distribution. Must be broadcastable with counts and broadcastable with the rightmost dimensions of shape. dtype An optional tf.DType from: tf.half, tf.float32, tf.float64, tf.int32, tf.int64. Defaults to tf.int64. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandombinomial
tf.raw_ops.StatelessRandomGammaV2 Outputs deterministic pseudorandom random numbers from a gamma distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomGammaV2 tf.raw_ops.StatelessRandomGammaV2( shape, seed, alpha, name=None ) Outputs random values from a gamma distribution. The outputs are a deterministic function of shape, seed, and alpha. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). alpha A Tensor. Must be one of the following types: half, float32, float64. The concentration of the gamma distribution. Shape must match the rightmost dimensions of shape. name A name for the operation (optional). Returns A Tensor. Has the same type as alpha.
tensorflow.raw_ops.statelessrandomgammav2
tf.raw_ops.StatelessRandomGetKeyCounterAlg Picks the best algorithm based on device, and scrambles seed into key and counter. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomGetKeyCounterAlg tf.raw_ops.StatelessRandomGetKeyCounterAlg( seed, name=None ) This op picks the best counter-based RNG algorithm based on device, and scrambles a shape-[2] seed into a key and a counter, both needed by the counter-based algorithm. The scrambling is opaque but approximately satisfies the property that different seed results in different key/counter pair (which will in turn result in different random numbers). Args seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). name A name for the operation (optional). Returns A tuple of Tensor objects (key, counter, alg). key A Tensor of type uint64. counter A Tensor of type uint64. alg A Tensor of type int32.
tensorflow.raw_ops.statelessrandomgetkeycounteralg
tf.raw_ops.StatelessRandomNormal Outputs deterministic pseudorandom values from a normal distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomNormal tf.raw_ops.StatelessRandomNormal( shape, seed, dtype=tf.dtypes.float32, name=None ) The generated values will have mean 0 and standard deviation 1. The outputs are a deterministic function of shape and seed. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). dtype An optional tf.DType from: tf.half, tf.bfloat16, tf.float32, tf.float64. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandomnormal
tf.raw_ops.StatelessRandomNormalV2 Outputs deterministic pseudorandom values from a normal distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomNormalV2 tf.raw_ops.StatelessRandomNormalV2( shape, key, counter, alg, dtype=tf.dtypes.float32, name=None ) The generated values will have mean 0 and standard deviation 1. The outputs are a deterministic function of shape, key, counter and alg. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. key A Tensor of type uint64. Key for the counter-based RNG algorithm (shape uint64[1]). counter A Tensor of type uint64. Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. alg A Tensor of type int32. The RNG algorithm (shape int32[]). dtype An optional tf.DType from: tf.half, tf.bfloat16, tf.float32, tf.float64. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandomnormalv2
tf.raw_ops.StatelessRandomPoisson Outputs deterministic pseudorandom random numbers from a Poisson distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomPoisson tf.raw_ops.StatelessRandomPoisson( shape, seed, lam, dtype, name=None ) Outputs random values from a Poisson distribution. The outputs are a deterministic function of shape, seed, and lam. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). lam A Tensor. Must be one of the following types: half, float32, float64, int32, int64. The rate of the Poisson distribution. Shape must match the rightmost dimensions of shape. dtype A tf.DType from: tf.half, tf.float32, tf.float64, tf.int32, tf.int64. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandompoisson
tf.raw_ops.StatelessRandomUniform Outputs deterministic pseudorandom random values from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomUniform tf.raw_ops.StatelessRandomUniform( shape, seed, dtype=tf.dtypes.float32, name=None ) The generated values follow a uniform distribution in the range [0, 1). The lower bound 0 is included in the range, while the upper bound 1 is excluded. The outputs are a deterministic function of shape and seed. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). dtype An optional tf.DType from: tf.half, tf.bfloat16, tf.float32, tf.float64. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandomuniform
tf.raw_ops.StatelessRandomUniformFullInt Outputs deterministic pseudorandom random integers from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomUniformFullInt tf.raw_ops.StatelessRandomUniformFullInt( shape, seed, dtype=tf.dtypes.uint64, name=None ) The generated values are uniform integers covering the whole range of dtype. The outputs are a deterministic function of shape and seed. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64, uint32, uint64. 2 seeds (shape [2]). dtype An optional tf.DType from: tf.int32, tf.int64, tf.uint32, tf.uint64. Defaults to tf.uint64. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandomuniformfullint
tf.raw_ops.StatelessRandomUniformFullIntV2 Outputs deterministic pseudorandom random integers from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomUniformFullIntV2 tf.raw_ops.StatelessRandomUniformFullIntV2( shape, key, counter, alg, dtype=tf.dtypes.uint64, name=None ) The generated values are uniform integers covering the whole range of dtype. The outputs are a deterministic function of shape, key, counter and alg. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. key A Tensor of type uint64. Key for the counter-based RNG algorithm (shape uint64[1]). counter A Tensor of type uint64. Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. alg A Tensor of type int32. The RNG algorithm (shape int32[]). dtype An optional tf.DType from: tf.int32, tf.int64, tf.uint32, tf.uint64. Defaults to tf.uint64. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandomuniformfullintv2
tf.raw_ops.StatelessRandomUniformInt Outputs deterministic pseudorandom random integers from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomUniformInt tf.raw_ops.StatelessRandomUniformInt( shape, seed, minval, maxval, name=None ) The generated values follow a uniform distribution in the range [minval, maxval). The outputs are a deterministic function of shape, seed, minval, and maxval. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). minval A Tensor. Must be one of the following types: int32, int64. Minimum value (inclusive, scalar). maxval A Tensor. Must have the same type as minval. Maximum value (exclusive, scalar). name A name for the operation (optional). Returns A Tensor. Has the same type as minval.
tensorflow.raw_ops.statelessrandomuniformint
tf.raw_ops.StatelessRandomUniformIntV2 Outputs deterministic pseudorandom random integers from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomUniformIntV2 tf.raw_ops.StatelessRandomUniformIntV2( shape, key, counter, alg, minval, maxval, name=None ) The generated values follow a uniform distribution in the range [minval, maxval). The outputs are a deterministic function of shape, key, counter, alg, minval and maxval. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. key A Tensor of type uint64. Key for the counter-based RNG algorithm (shape uint64[1]). counter A Tensor of type uint64. Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. alg A Tensor of type int32. The RNG algorithm (shape int32[]). minval A Tensor. Must be one of the following types: int32, int64, uint32, uint64. Minimum value (inclusive, scalar). maxval A Tensor. Must have the same type as minval. Maximum value (exclusive, scalar). name A name for the operation (optional). Returns A Tensor. Has the same type as minval.
tensorflow.raw_ops.statelessrandomuniformintv2
tf.raw_ops.StatelessRandomUniformV2 Outputs deterministic pseudorandom random values from a uniform distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessRandomUniformV2 tf.raw_ops.StatelessRandomUniformV2( shape, key, counter, alg, dtype=tf.dtypes.float32, name=None ) The generated values follow a uniform distribution in the range [0, 1). The lower bound 0 is included in the range, while the upper bound 1 is excluded. The outputs are a deterministic function of shape, key, counter and alg. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. key A Tensor of type uint64. Key for the counter-based RNG algorithm (shape uint64[1]). counter A Tensor of type uint64. Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. alg A Tensor of type int32. The RNG algorithm (shape int32[]). dtype An optional tf.DType from: tf.half, tf.bfloat16, tf.float32, tf.float64. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelessrandomuniformv2
tf.raw_ops.StatelessSampleDistortedBoundingBox Generate a randomly distorted bounding box for an image deterministically. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessSampleDistortedBoundingBox tf.raw_ops.StatelessSampleDistortedBoundingBox( image_size, bounding_boxes, min_object_covered, seed, aspect_ratio_range=[0.75, 1.33], area_range=[0.05, 1], max_attempts=100, use_image_if_no_bounding_boxes=False, name=None ) Bounding box annotations are often supplied in addition to ground-truth labels in image recognition or object localization tasks. A common technique for training such a system is to randomly distort an image while preserving its content, i.e. data augmentation. This Op, given the same seed, deterministically outputs a randomly distorted localization of an object, i.e. bounding box, given an image_size, bounding_boxes and a series of constraints. The output of this Op is a single bounding box that may be used to crop the original image. The output is returned as 3 tensors: begin, size and bboxes. The first 2 tensors can be fed directly into tf.slice to crop the image. The latter may be supplied to tf.image.draw_bounding_boxes to visualize what the bounding box looks like. Bounding boxes are supplied and returned as [y_min, x_min, y_max, x_max]. The bounding box coordinates are floats in [0.0, 1.0] relative to the width and the height of the underlying image. The output of this Op is guaranteed to be the same given the same seed and is independent of how many times the function is called, and independent of global seed settings (e.g. tf.random.set_seed). Example usage: image = np.array([[[1], [2], [3]], [[4], [5], [6]], [[7], [8], [9]]]) bbox = tf.constant( [0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4]) seed = (1, 2) # Generate a single distorted bounding box. bbox_begin, bbox_size, bbox_draw = ( tf.image.stateless_sample_distorted_bounding_box( tf.shape(image), bounding_boxes=bbox, seed=seed)) # Employ the bounding box to distort the image. tf.slice(image, bbox_begin, bbox_size) <tf.Tensor: shape=(2, 2, 1), dtype=int64, numpy= array([[[1], [2]], [[4], [5]]])> # Draw the bounding box in an image summary. colors = np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) tf.image.draw_bounding_boxes( tf.expand_dims(tf.cast(image, tf.float32),0), bbox_draw, colors) <tf.Tensor: shape=(1, 3, 3, 1), dtype=float32, numpy= array([[[[1.], [1.], [3.]], [[1.], [1.], [6.]], [[7.], [8.], [9.]]]], dtype=float32)> Note that if no bounding box information is available, setting use_image_if_no_bounding_boxes = true will assume there is a single implicit bounding box covering the whole image. If use_image_if_no_bounding_boxes is false and no bounding boxes are supplied, an error is raised. Args image_size A Tensor. Must be one of the following types: uint8, int8, int16, int32, int64. 1-D, containing [height, width, channels]. bounding_boxes A Tensor of type float32. 3-D with shape [batch, N, 4] describing the N bounding boxes associated with the image. min_object_covered A Tensor of type float32. The cropped area of the image must contain at least this fraction of any bounding box supplied. The value of this parameter should be non-negative. In the case of 0, the cropped area does not need to overlap any of the bounding boxes supplied. seed A Tensor. Must be one of the following types: int32, int64. 1-D with shape [2]. The seed to the random number generator. Must have dtype int32 or int64. (When using XLA, only int32 is allowed.) aspect_ratio_range An optional list of floats. Defaults to [0.75, 1.33]. The cropped area of the image must have an aspect ratio = width / height within this range. area_range An optional list of floats. Defaults to [0.05, 1]. The cropped area of the image must contain a fraction of the supplied image within this range. max_attempts An optional int. Defaults to 100. Number of attempts at generating a cropped region of the image of the specified constraints. After max_attempts failures, return the entire image. use_image_if_no_bounding_boxes An optional bool. Defaults to False. Controls behavior if no bounding boxes supplied. If true, assume an implicit bounding box covering the whole input. If false, raise an error. name A name for the operation (optional). Returns A tuple of Tensor objects (begin, size, bboxes). begin A Tensor. Has the same type as image_size. size A Tensor. Has the same type as image_size. bboxes A Tensor of type float32.
tensorflow.raw_ops.statelesssampledistortedboundingbox
tf.raw_ops.StatelessTruncatedNormal Outputs deterministic pseudorandom values from a truncated normal distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessTruncatedNormal tf.raw_ops.StatelessTruncatedNormal( shape, seed, dtype=tf.dtypes.float32, name=None ) The generated values follow a normal distribution with mean 0 and standard deviation 1, except that values whose magnitude is more than 2 standard deviations from the mean are dropped and re-picked. The outputs are a deterministic function of shape and seed. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. seed A Tensor. Must be one of the following types: int32, int64. 2 seeds (shape [2]). dtype An optional tf.DType from: tf.half, tf.bfloat16, tf.float32, tf.float64. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelesstruncatednormal
tf.raw_ops.StatelessTruncatedNormalV2 Outputs deterministic pseudorandom values from a truncated normal distribution. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessTruncatedNormalV2 tf.raw_ops.StatelessTruncatedNormalV2( shape, key, counter, alg, dtype=tf.dtypes.float32, name=None ) The generated values follow a normal distribution with mean 0 and standard deviation 1, except that values whose magnitude is more than 2 standard deviations from the mean are dropped and re-picked. The outputs are a deterministic function of shape, key, counter and alg. Args shape A Tensor. Must be one of the following types: int32, int64. The shape of the output tensor. key A Tensor of type uint64. Key for the counter-based RNG algorithm (shape uint64[1]). counter A Tensor of type uint64. Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. alg A Tensor of type int32. The RNG algorithm (shape int32[]). dtype An optional tf.DType from: tf.half, tf.bfloat16, tf.float32, tf.float64. Defaults to tf.float32. The type of the output. name A name for the operation (optional). Returns A Tensor of type dtype.
tensorflow.raw_ops.statelesstruncatednormalv2
tf.raw_ops.StatelessWhile output = input; While (Cond(output)) { output = Body(output) } View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatelessWhile tf.raw_ops.StatelessWhile( input, cond, body, output_shapes=[], parallel_iterations=10, name=None ) Args input A list of Tensor objects. A list of input tensors whose types are T. cond A function decorated with @Defun. A function takes 'input' and returns a tensor. If the tensor is a scalar of non-boolean, the scalar is converted to a boolean according to the following rule: if the scalar is a numerical value, non-zero means True and zero means False; if the scalar is a string, non-empty means True and empty means False. If the tensor is not a scalar, non-emptiness means True and False otherwise. This should only be used when the while condition and body functions do not have stateful ops. body A function decorated with @Defun. A function that takes a list of tensors and returns another list of tensors. Both lists have the same types as specified by T. output_shapes An optional list of shapes (each a tf.TensorShape or list of ints). Defaults to []. parallel_iterations An optional int. Defaults to 10. name A name for the operation (optional). Returns A list of Tensor objects. Has the same type as input.
tensorflow.raw_ops.statelesswhile
tf.raw_ops.StaticRegexFullMatch Check if the input matches the regex pattern. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StaticRegexFullMatch tf.raw_ops.StaticRegexFullMatch( input, pattern, name=None ) The input is a string tensor of any shape. The pattern is the regular expression to be matched with every element of the input tensor. The boolean values (True or False) of the output tensor indicate if the input matches the regex pattern provided. The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) Args input A Tensor of type string. A string tensor of the text to be processed. pattern A string. The regular expression to match the input. name A name for the operation (optional). Returns A Tensor of type bool.
tensorflow.raw_ops.staticregexfullmatch
tf.raw_ops.StaticRegexReplace Replaces the match of pattern in input with rewrite. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StaticRegexReplace tf.raw_ops.StaticRegexReplace( input, pattern, rewrite, replace_global=True, name=None ) It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) Args input A Tensor of type string. The text to be processed. pattern A string. The regular expression to match the input. rewrite A string. The rewrite to be applied to the matched expression. replace_global An optional bool. Defaults to True. If True, the replacement is global, otherwise the replacement is done only on the first match. name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.staticregexreplace
tf.raw_ops.StatsAggregatorHandle Creates a statistics manager resource. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatsAggregatorHandle tf.raw_ops.StatsAggregatorHandle( container='', shared_name='', name=None ) Args container An optional string. Defaults to "". shared_name An optional string. Defaults to "". name A name for the operation (optional). Returns A Tensor of type resource.
tensorflow.raw_ops.statsaggregatorhandle
tf.raw_ops.StatsAggregatorHandleV2 View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatsAggregatorHandleV2 tf.raw_ops.StatsAggregatorHandleV2( container='', shared_name='', name=None ) Args container An optional string. Defaults to "". shared_name An optional string. Defaults to "". name A name for the operation (optional). Returns A Tensor of type resource.
tensorflow.raw_ops.statsaggregatorhandlev2
tf.raw_ops.StatsAggregatorSetSummaryWriter Set a summary_writer_interface to record statistics using given stats_aggregator. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatsAggregatorSetSummaryWriter tf.raw_ops.StatsAggregatorSetSummaryWriter( stats_aggregator, summary, name=None ) Args stats_aggregator A Tensor of type resource. summary A Tensor of type resource. name A name for the operation (optional). Returns The created Operation.
tensorflow.raw_ops.statsaggregatorsetsummarywriter
tf.raw_ops.StatsAggregatorSummary Produces a summary of any statistics recorded by the given statistics manager. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StatsAggregatorSummary tf.raw_ops.StatsAggregatorSummary( iterator, name=None ) Args iterator A Tensor of type resource. name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.statsaggregatorsummary
tf.raw_ops.StopGradient Stops gradient computation. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StopGradient tf.raw_ops.StopGradient( input, name=None ) When executed in a graph, this op outputs its input tensor as-is. When building ops to compute gradients, this op prevents the contribution of its inputs to be taken into account. Normally, the gradient generator adds ops to a graph to compute the derivatives of a specified 'loss' by recursively finding out inputs that contributed to its computation. If you insert this op in the graph it inputs are masked from the gradient generator. They are not taken into account for computing gradients. This is useful any time you want to compute a value with TensorFlow but need to pretend that the value was a constant. Some examples include: The EM algorithm where the M-step should not involve backpropagation through the output of the E-step. Contrastive divergence training of Boltzmann machines where, when differentiating the energy function, the training must not backpropagate through the graph that generated the samples from the model. Adversarial training, where no backprop should happen through the adversarial example generation process. Args input A Tensor. name A name for the operation (optional). Returns A Tensor. Has the same type as input.
tensorflow.raw_ops.stopgradient
tf.raw_ops.StridedSlice Return a strided slice from input. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StridedSlice tf.raw_ops.StridedSlice( input, begin, end, strides, begin_mask=0, end_mask=0, ellipsis_mask=0, new_axis_mask=0, shrink_axis_mask=0, name=None ) Note, most python users will want to use the Python Tensor.getitem or Variable.getitem rather than this op directly. The goal of this op is to produce a new tensor with a subset of the elements from the n dimensional input tensor. The subset is chosen using a sequence of m sparse range specifications encoded into the arguments of this function. Note, in some cases m could be equal to n, but this need not be the case. Each range specification entry can be one of the following: An ellipsis (...). Ellipses are used to imply zero or more dimensions of full-dimension selection and are produced using ellipsis_mask. For example, foo[...] is the identity slice. A new axis. This is used to insert a new shape=1 dimension and is produced using new_axis_mask. For example, foo[:, ...] where foo is shape (3, 4) produces a (1, 3, 4) tensor. A range begin:end:stride. This is used to specify how much to choose from a given dimension. stride can be any integer but 0. begin is an integer which represents the index of the first value to select while end represents the index of the last value to select. The number of values selected in each dimension is end - begin if stride > 0 and begin - end if stride < 0. begin and end can be negative where -1 is the last element, -2 is the second to last. begin_mask controls whether to replace the explicitly given begin with an implicit effective value of 0 if stride > 0 and -1 if stride < 0. end_mask is analogous but produces the number required to create the largest open interval. For example, given a shape (3,) tensor foo[:], the effective begin and end are 0 and 3. Do not assume this is equivalent to foo[0:-1] which has an effective begin and end of 0 and 2. Another example is foo[-2::-1] which reverses the first dimension of a tensor while dropping the last two (in the original order elements). For example foo = [1,2,3,4]; foo[-2::-1] is [4,3]. A single index. This is used to keep only elements that have a given index. For example (foo[2, :] on a shape (5,6) tensor produces a shape (6,) tensor. This is encoded in begin and end and shrink_axis_mask. Each conceptual range specification is encoded in the op's argument. This encoding is best understand by considering a non-trivial example. In particular, foo[1, 2:4, None, ..., :-3:-1, :] will be encoded as begin = [1, 2, x, x, 0, x] # x denotes don't care (usually 0) end = [2, 4, x, x, -3, x] strides = [1, 1, x, x, -1, 1] begin_mask = 1<<4 | 1<<5 = 48 end_mask = 1<<5 = 32 ellipsis_mask = 1<<3 = 8 new_axis_mask = 1<<2 = 4 shrink_axis_mask = 1<<0 = 1 In this case if foo.shape is (5, 5, 5, 5, 5, 5) the final shape of the slice becomes (2, 1, 5, 5, 2, 5). Let us walk step by step through each argument specification. The first argument in the example slice is turned into begin = 1 and end = begin + 1 = 2. To disambiguate from the original spec 2:4 we also set the appropriate bit in shrink_axis_mask. 2:4 is contributes 2, 4, 1 to begin, end, and stride. All masks have zero bits contributed. None is a synonym for tf.newaxis. This means insert a dimension of size 1 dimension in the final shape. Dummy values are contributed to begin, end and stride, while the new_axis_mask bit is set. ... grab the full ranges from as many dimensions as needed to fully specify a slice for every dimension of the input shape. :-3:-1 shows the use of negative indices. A negative index i associated with a dimension that has shape s is converted to a positive index s + i. So -1 becomes s-1 (i.e. the last element). This conversion is done internally so begin, end and strides receive x, -3, and -1. The appropriate begin_mask bit is set to indicate the start range is the full range (ignoring the x). : indicates that the entire contents of the corresponding dimension is selected. This is equivalent to :: or 0::1. begin, end, and strides receive 0, 0, and 1, respectively. The appropriate bits in begin_mask and end_mask are also set. Requirements: 0 != strides[i] for i in [0, m) ellipsis_mask must be a power of two (only one ellipsis) Args input A Tensor. begin A Tensor. Must be one of the following types: int32, int64. begin[k] specifies the offset into the kth range specification. The exact dimension this corresponds to will be determined by context. Out-of-bounds values will be silently clamped. If the kth bit of begin_mask then begin[k] is ignored and the full range of the appropriate dimension is used instead. Negative values causes indexing to start from the highest element e.g. If foo==[1,2,3] then foo[-1]==3. end A Tensor. Must have the same type as begin. end[i] is like begin with the exception that end_mask is used to determine full ranges. strides A Tensor. Must have the same type as begin. strides[i] specifies the increment in the ith specification after extracting a given element. Negative indices will reverse the original order. Out or range values are clamped to [0,dim[i]) if slice[i]>0 or [-1,dim[i]-1] if slice[i] < 0 begin_mask An optional int. Defaults to 0. a bitmask where a bit i being 1 means to ignore the begin value and instead use the largest interval possible. At runtime begin[i] will be replaced with [0, n-1) if stride[i] > 0 or [-1, n-1] if stride[i] < 0 end_mask An optional int. Defaults to 0. analogous to begin_mask ellipsis_mask An optional int. Defaults to 0. a bitmask where bit i being 1 means the ith position is actually an ellipsis. One bit at most can be 1. If ellipsis_mask == 0, then an implicit ellipsis mask of 1 << (m+1) is provided. This means that foo[3:5] == foo[3:5, ...]. An ellipsis implicitly creates as many range specifications as necessary to fully specify the sliced range for every dimension. For example for a 4-dimensional tensor foo the slice foo[2, ..., 5:8] implies foo[2, :, :, 5:8]. new_axis_mask An optional int. Defaults to 0. a bitmask where bit i being 1 means the ith specification creates a new shape 1 dimension. For example foo[:4, tf.newaxis, :2] would produce a shape (4, 1, 2) tensor. shrink_axis_mask An optional int. Defaults to 0. a bitmask where bit i implies that the ith specification should shrink the dimensionality. begin and end must imply a slice of size 1 in the dimension. For example in python one might do foo[:, 3, :] which would result in shrink_axis_mask being 2. name A name for the operation (optional). Returns A Tensor. Has the same type as input.
tensorflow.raw_ops.stridedslice
tf.raw_ops.StridedSliceAssign Assign value to the sliced l-value reference of ref. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StridedSliceAssign tf.raw_ops.StridedSliceAssign( ref, begin, end, strides, value, begin_mask=0, end_mask=0, ellipsis_mask=0, new_axis_mask=0, shrink_axis_mask=0, name=None ) The values of value are assigned to the positions in the variable ref that are selected by the slice parameters. The slice parameters begin, end, strides, etc. work exactly as in StridedSlice. NOTE this op currently does not support broadcasting and so value's shape must be exactly the shape produced by the slice of ref. Args ref A mutable Tensor. begin A Tensor. Must be one of the following types: int32, int64. end A Tensor. Must have the same type as begin. strides A Tensor. Must have the same type as begin. value A Tensor. Must have the same type as ref. begin_mask An optional int. Defaults to 0. end_mask An optional int. Defaults to 0. ellipsis_mask An optional int. Defaults to 0. new_axis_mask An optional int. Defaults to 0. shrink_axis_mask An optional int. Defaults to 0. name A name for the operation (optional). Returns A mutable Tensor. Has the same type as ref.
tensorflow.raw_ops.stridedsliceassign
tf.raw_ops.StridedSliceGrad Returns the gradient of StridedSlice. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StridedSliceGrad tf.raw_ops.StridedSliceGrad( shape, begin, end, strides, dy, begin_mask=0, end_mask=0, ellipsis_mask=0, new_axis_mask=0, shrink_axis_mask=0, name=None ) Since StridedSlice cuts out pieces of its input which is size shape, its gradient will have the same shape (which is passed here as shape). The gradient will be zero in any element that the slice does not select. Arguments are the same as StridedSliceGrad with the exception that dy is the input gradient to be propagated and shape is the shape of StridedSlice's input. Args shape A Tensor. Must be one of the following types: int32, int64. begin A Tensor. Must have the same type as shape. end A Tensor. Must have the same type as shape. strides A Tensor. Must have the same type as shape. dy A Tensor. begin_mask An optional int. Defaults to 0. end_mask An optional int. Defaults to 0. ellipsis_mask An optional int. Defaults to 0. new_axis_mask An optional int. Defaults to 0. shrink_axis_mask An optional int. Defaults to 0. name A name for the operation (optional). Returns A Tensor. Has the same type as dy.
tensorflow.raw_ops.stridedslicegrad
tf.raw_ops.StringFormat Formats a string template using a list of tensors. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringFormat tf.raw_ops.StringFormat( inputs, template='%s', placeholder='%s', summarize=3, name=None ) Formats a string template using a list of tensors, pretty-printing tensor summaries. Args inputs A list of Tensor objects. The list of tensors to format into the placeholder string. template An optional string. Defaults to "%s". A string, the template to format tensor summaries into. placeholder An optional string. Defaults to "%s". A string, at each placeholder in the template a subsequent tensor summary will be inserted. summarize An optional int. Defaults to 3. When formatting the tensor summaries print the first and last summarize entries of each tensor dimension. name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.stringformat
tf.raw_ops.StringJoin Joins the strings in the given list of string tensors into one tensor; View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringJoin tf.raw_ops.StringJoin( inputs, separator='', name=None ) with the given separator (default is an empty separator). Examples: s = ["hello", "world", "tensorflow"] tf.strings.join(s, " ") <tf.Tensor: shape=(), dtype=string, numpy=b'hello world tensorflow'> Args inputs A list of at least 1 Tensor objects with type string. A list of string tensors. The tensors must all have the same shape, or be scalars. Scalars may be mixed in; these will be broadcast to the shape of non-scalar inputs. separator An optional string. Defaults to "". string, an optional join separator. name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.stringjoin
tf.raw_ops.StringLength String lengths of input. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringLength tf.raw_ops.StringLength( input, unit='BYTE', name=None ) Computes the length of each string given in the input tensor. strings = tf.constant(['Hello','TensorFlow', '\U0001F642']) tf.strings.length(strings).numpy() # default counts bytes array([ 5, 10, 4], dtype=int32) tf.strings.length(strings, unit="UTF8_CHAR").numpy() array([ 5, 10, 1], dtype=int32) Args input A Tensor of type string. The strings for which to compute the length for each element. unit An optional string from: "BYTE", "UTF8_CHAR". Defaults to "BYTE". The unit that is counted to compute string length. One of: "BYTE" (for the number of bytes in each string) or "UTF8_CHAR" (for the number of UTF-8 encoded Unicode code points in each string). Results are undefined if unit=UTF8_CHAR and the input strings do not contain structurally valid UTF-8. name A name for the operation (optional). Returns A Tensor of type int32.
tensorflow.raw_ops.stringlength
tf.raw_ops.StringLower Converts all uppercase characters into their respective lowercase replacements. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringLower tf.raw_ops.StringLower( input, encoding='', name=None ) Example: tf.strings.lower("CamelCase string and ALL CAPS") <tf.Tensor: shape=(), dtype=string, numpy=b'camelcase string and all caps'> Args input A Tensor of type string. encoding An optional string. Defaults to "". name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.stringlower
tf.raw_ops.StringNGrams Creates ngrams from ragged string data. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringNGrams tf.raw_ops.StringNGrams( data, data_splits, separator, ngram_widths, left_pad, right_pad, pad_width, preserve_short_sequences, name=None ) This op accepts a ragged tensor with 1 ragged dimension containing only strings and outputs a ragged tensor with 1 ragged dimension containing ngrams of that string, joined along the innermost axis. Args data A Tensor of type string. The values tensor of the ragged string tensor to make ngrams out of. Must be a 1D string tensor. data_splits A Tensor. Must be one of the following types: int32, int64. The splits tensor of the ragged string tensor to make ngrams out of. separator A string. The string to append between elements of the token. Use "" for no separator. ngram_widths A list of ints. The sizes of the ngrams to create. left_pad A string. The string to use to pad the left side of the ngram sequence. Only used if pad_width != 0. right_pad A string. The string to use to pad the right side of the ngram sequence. Only used if pad_width != 0. pad_width An int. The number of padding elements to add to each side of each sequence. Note that padding will never be greater than 'ngram_widths'-1 regardless of this value. If pad_width=-1, then add max(ngram_widths)-1 elements. preserve_short_sequences A bool. name A name for the operation (optional). Returns A tuple of Tensor objects (ngrams, ngrams_splits). ngrams A Tensor of type string. ngrams_splits A Tensor. Has the same type as data_splits.
tensorflow.raw_ops.stringngrams
tf.raw_ops.StringSplit Split elements of input based on delimiter into a SparseTensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringSplit tf.raw_ops.StringSplit( input, delimiter, skip_empty=True, name=None ) Let N be the size of source (typically N will be the batch size). Split each element of input based on delimiter and return a SparseTensor containing the splitted tokens. Empty tokens are ignored. delimiter can be empty, or a string of split characters. If delimiter is an empty string, each element of input is split into individual single-byte character strings, including splitting of UTF-8 multibyte sequences. Otherwise every character of delimiter is a potential split point. For example: N = 2, input[0] is 'hello world' and input[1] is 'a b c', then the output will be indices = [0, 0; 0, 1; 1, 0; 1, 1; 1, 2] shape = [2, 3] values = ['hello', 'world', 'a', 'b', 'c'] Args input A Tensor of type string. 1-D. Strings to split. delimiter A Tensor of type string. 0-D. Delimiter characters (bytes), or empty string. skip_empty An optional bool. Defaults to True. A bool. If True, skip the empty strings from the result. name A name for the operation (optional). Returns A tuple of Tensor objects (indices, values, shape). indices A Tensor of type int64. values A Tensor of type string. shape A Tensor of type int64.
tensorflow.raw_ops.stringsplit
tf.raw_ops.StringSplitV2 Split elements of source based on sep into a SparseTensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringSplitV2 tf.raw_ops.StringSplitV2( input, sep, maxsplit=-1, name=None ) Let N be the size of source (typically N will be the batch size). Split each element of source based on sep and return a SparseTensor containing the split tokens. Empty tokens are ignored. For example, N = 2, source[0] is 'hello world' and source[1] is 'a b c', then the output will be st.indices = [0, 0; 0, 1; 1, 0; 1, 1; 1, 2] st.shape = [2, 3] st.values = ['hello', 'world', 'a', 'b', 'c'] If sep is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings. For example, source of "1<>2<><>3" and sep of "<>" returns ["1", "2", "", "3"]. If sep is None or an empty string, consecutive whitespace are regarded as a single separator, and the result will contain no empty strings at the startor end if the string has leading or trailing whitespace. Note that the above mentioned behavior matches python's str.split. Args input A Tensor of type string. 1-D string Tensor, the strings to split. sep A Tensor of type string. 0-D string Tensor, the delimiter character. maxsplit An optional int. Defaults to -1. An int. If maxsplit > 0, limit of the split of the result. name A name for the operation (optional). Returns A tuple of Tensor objects (indices, values, shape). indices A Tensor of type int64. values A Tensor of type string. shape A Tensor of type int64.
tensorflow.raw_ops.stringsplitv2
tf.raw_ops.StringStrip Strip leading and trailing whitespaces from the Tensor. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringStrip tf.raw_ops.StringStrip( input, name=None ) Args input A Tensor of type string. A string Tensor of any shape. name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.stringstrip
tf.raw_ops.StringToHashBucket Converts each string in the input Tensor to its hash mod by a number of buckets. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringToHashBucket tf.raw_ops.StringToHashBucket( string_tensor, num_buckets, name=None ) The hash function is deterministic on the content of the string within the process. Note that the hash function may change from time to time. This functionality will be deprecated and it's recommended to use tf.string_to_hash_bucket_fast() or tf.string_to_hash_bucket_strong(). Args string_tensor A Tensor of type string. num_buckets An int that is >= 1. The number of buckets. name A name for the operation (optional). Returns A Tensor of type int64.
tensorflow.raw_ops.stringtohashbucket
tf.raw_ops.StringToHashBucketFast Converts each string in the input Tensor to its hash mod by a number of buckets. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringToHashBucketFast tf.raw_ops.StringToHashBucketFast( input, num_buckets, name=None ) The hash function is deterministic on the content of the string within the process and will never change. However, it is not suitable for cryptography. This function may be used when CPU time is scarce and inputs are trusted or unimportant. There is a risk of adversaries constructing inputs that all hash to the same bucket. To prevent this problem, use a strong hash function with tf.string_to_hash_bucket_strong. Examples: tf.strings.to_hash_bucket_fast(["Hello", "TensorFlow", "2.x"], 3).numpy() array([0, 2, 2]) Args input A Tensor of type string. The strings to assign a hash bucket. num_buckets An int that is >= 1. The number of buckets. name A name for the operation (optional). Returns A Tensor of type int64.
tensorflow.raw_ops.stringtohashbucketfast
tf.raw_ops.StringToHashBucketStrong Converts each string in the input Tensor to its hash mod by a number of buckets. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringToHashBucketStrong tf.raw_ops.StringToHashBucketStrong( input, num_buckets, key, name=None ) The hash function is deterministic on the content of the string within the process. The hash function is a keyed hash function, where attribute key defines the key of the hash function. key is an array of 2 elements. A strong hash is important when inputs may be malicious, e.g. URLs with additional components. Adversaries could try to make their inputs hash to the same bucket for a denial-of-service attack or to skew the results. A strong hash can be used to make it difficult to find inputs with a skewed hash value distribution over buckets. This requires that the hash function is seeded by a high-entropy (random) "key" unknown to the adversary. The additional robustness comes at a cost of roughly 4x higher compute time than tf.string_to_hash_bucket_fast. Examples: tf.strings.to_hash_bucket_strong(["Hello", "TF"], 3, [1, 2]).numpy() array([2, 0]) Args input A Tensor of type string. The strings to assign a hash bucket. num_buckets An int that is >= 1. The number of buckets. key A list of ints. The key used to seed the hash function, passed as a list of two uint64 elements. name A name for the operation (optional). Returns A Tensor of type int64.
tensorflow.raw_ops.stringtohashbucketstrong
tf.raw_ops.StringToNumber Converts each string in the input Tensor to the specified numeric type. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringToNumber tf.raw_ops.StringToNumber( string_tensor, out_type=tf.dtypes.float32, name=None ) (Note that int32 overflow results in an error while float overflow results in a rounded value.) Example: strings = ["5.0", "3.0", "7.0"] tf.strings.to_number(strings) <tf.Tensor: shape=(3,), dtype=float32, numpy=array([5., 3., 7.], dtype=float32)> Args string_tensor A Tensor of type string. out_type An optional tf.DType from: tf.float32, tf.float64, tf.int32, tf.int64. Defaults to tf.float32. The numeric type to interpret each string in string_tensor as. name A name for the operation (optional). Returns A Tensor of type out_type.
tensorflow.raw_ops.stringtonumber
tf.raw_ops.StringUpper Converts all lowercase characters into their respective uppercase replacements. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.StringUpper tf.raw_ops.StringUpper( input, encoding='', name=None ) Example: tf.strings.upper("CamelCase string and ALL CAPS") <tf.Tensor: shape=(), dtype=string, numpy=b'CAMELCASE STRING AND ALL CAPS'> Args input A Tensor of type string. encoding An optional string. Defaults to "". name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.stringupper
tf.raw_ops.Sub Returns x - y element-wise. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Sub tf.raw_ops.Sub( x, y, name=None ) Note: Subtract supports broadcasting. More about broadcasting here Args x A Tensor. Must be one of the following types: bfloat16, half, float32, float64, uint8, int8, uint16, int16, int32, int64, complex64, complex128, uint32. y A Tensor. Must have the same type as x. name A name for the operation (optional). Returns A Tensor. Has the same type as x.
tensorflow.raw_ops.sub
tf.raw_ops.Substr Return substrings from Tensor of strings. View aliases Compat aliases for migration See Migration guide for more details. tf.compat.v1.raw_ops.Substr tf.raw_ops.Substr( input, pos, len, unit='BYTE', name=None ) For each string in the input Tensor, creates a substring starting at index pos with a total length of len. If len defines a substring that would extend beyond the length of the input string, or if len is negative, then as many characters as possible are used. A negative pos indicates distance within the string backwards from the end. If pos specifies an index which is out of range for any of the input strings, then an InvalidArgumentError is thrown. pos and len must have the same shape, otherwise a ValueError is thrown on Op creation. Note: Substr supports broadcasting up to two dimensions. More about broadcasting here Examples Using scalar pos and len: input = [b'Hello', b'World'] position = 1 length = 3 output = [b'ell', b'orl'] Using pos and len with same shape as input: input = [[b'ten', b'eleven', b'twelve'], [b'thirteen', b'fourteen', b'fifteen'], [b'sixteen', b'seventeen', b'eighteen']] position = [[1, 2, 3], [1, 2, 3], [1, 2, 3]] length = [[2, 3, 4], [4, 3, 2], [5, 5, 5]] output = [[b'en', b'eve', b'lve'], [b'hirt', b'urt', b'te'], [b'ixtee', b'vente', b'hteen']] Broadcasting pos and len onto input: input = [[b'ten', b'eleven', b'twelve'], [b'thirteen', b'fourteen', b'fifteen'], [b'sixteen', b'seventeen', b'eighteen'], [b'nineteen', b'twenty', b'twentyone']] position = [1, 2, 3] length = [1, 2, 3] output = [[b'e', b'ev', b'lve'], [b'h', b'ur', b'tee'], [b'i', b've', b'hte'], [b'i', b'en', b'nty']] Broadcasting input onto pos and len: input = b'thirteen' position = [1, 5, 7] length = [3, 2, 1] output = [b'hir', b'ee', b'n'] Raises ValueError: If the first argument cannot be converted to a Tensor of dtype string. InvalidArgumentError: If indices are out of range. ValueError: If pos and len are not the same shape. Args input A Tensor of type string. Tensor of strings pos A Tensor. Must be one of the following types: int32, int64. Scalar defining the position of first character in each substring len A Tensor. Must have the same type as pos. Scalar defining the number of characters to include in each substring unit An optional string from: "BYTE", "UTF8_CHAR". Defaults to "BYTE". The unit that is used to create the substring. One of: "BYTE" (for defining position and length by bytes) or "UTF8_CHAR" (for the UTF-8 encoded Unicode code points). The default is "BYTE". Results are undefined if unit=UTF8_CHAR and the input strings do not contain structurally valid UTF-8. name A name for the operation (optional). Returns A Tensor of type string.
tensorflow.raw_ops.substr