tf.raw_ops.SparseCountSparseOutput Performs sparse-output bin counting for a sparse tensor input.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseCountSparseOutput
tf.raw_ops.SparseCountSparseOutput(
    indices, values, dense_shape, weights, binary_output, minlength=-1,
    maxlength=-1, name=None
)
 Counts the number of times each value occurs in the input.

 Args
  indices   A Tensor of type int64. Tensor containing the indices of the sparse tensor to count.
  values   A Tensor. Must be one of the following types: int32, int64. Tensor containing values of the sparse tensor to count.
  dense_shape   A Tensor of type int64. Tensor containing the dense shape of the sparse tensor to count.
  weights   A Tensor. Must be one of the following types: int32, int64, float32, float64. A Tensor of the same shape as indices containing per-index weight values. May also be the empty tensor if no weights are used.
  binary_output   A bool. Whether to output the number of occurrences of each value or 1.
  minlength   An optional int that is >= -1. Defaults to -1. Minimum value to count. Can be set to -1 for no minimum.
  maxlength   An optional int that is >= -1. Defaults to -1. Maximum value to count. Can be set to -1 for no maximum.
  name   A name for the operation (optional).

 Returns   A tuple of Tensor objects (output_indices, output_values, output_dense_shape).     output_indices   A Tensor of type int64.
  output_values   A Tensor. Has the same type as weights.
  output_dense_shape   A Tensor of type int64.


tf.raw_ops.SparseCross Generates sparse cross from a list of sparse and dense tensors.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseCross
tf.raw_ops.SparseCross(
    indices, values, shapes, dense_inputs, hashed_output, num_buckets, hash_key,
    out_type, internal_type, name=None
)
 The op takes two lists, one of 2D SparseTensor and one of 2D Tensor, each representing features of one feature column. It outputs a 2D SparseTensor with the batchwise crosses of these features. For example, if the inputs are inputs[0]: SparseTensor with shape = [2, 2]
[0, 0]: "a"
[1, 0]: "b"
[1, 1]: "c"

inputs[1]: SparseTensor with shape = [2, 1]
[0, 0]: "d"
[1, 0]: "e"

inputs[2]: Tensor [["f"], ["g"]]
 then the output will be shape = [2, 2]
[0, 0]: "a_X_d_X_f"
[1, 0]: "b_X_e_X_g"
[1, 1]: "c_X_e_X_g"
 if hashed_output=true then the output will be shape = [2, 2]
[0, 0]: FingerprintCat64(
            Fingerprint64("f"), FingerprintCat64(
                Fingerprint64("d"), Fingerprint64("a")))
[1, 0]: FingerprintCat64(
            Fingerprint64("g"), FingerprintCat64(
                Fingerprint64("e"), Fingerprint64("b")))
[1, 1]: FingerprintCat64(
            Fingerprint64("g"), FingerprintCat64(
                Fingerprint64("e"), Fingerprint64("c")))

 Args
  indices   A list of Tensor objects with type int64. 2-D. Indices of each input SparseTensor.
  values   A list of Tensor objects with types from: int64, string. 1-D. values of each SparseTensor.
  shapes   A list with the same length as indices of Tensor objects with type int64. 1-D. Shapes of each SparseTensor.
  dense_inputs   A list of Tensor objects with types from: int64, string. 2-D. Columns represented by dense Tensor.
  hashed_output   A bool. If true, returns the hash of the cross instead of the string. This will allow us avoiding string manipulations.
  num_buckets   An int that is >= 0. It is used if hashed_output is true. output = hashed_value%num_buckets if num_buckets > 0 else hashed_value.
  hash_key   An int. Specify the hash_key that will be used by the FingerprintCat64 function to combine the crosses fingerprints.
  out_type   A tf.DType from: tf.int64, tf.string.
  internal_type   A tf.DType from: tf.int64, tf.string.
  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 of type out_type.
  output_shape   A Tensor of type int64.


tf.raw_ops.SparseCrossHashed Generates sparse cross from a list of sparse and dense tensors.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseCrossHashed
tf.raw_ops.SparseCrossHashed(
    indices, values, shapes, dense_inputs, num_buckets, strong_hash, salt, name=None
)
 The op takes two lists, one of 2D SparseTensor and one of 2D Tensor, each representing features of one feature column. It outputs a 2D SparseTensor with the batchwise crosses of these features. For example, if the inputs are inputs[0]: SparseTensor with shape = [2, 2]
[0, 0]: "a"
[1, 0]: "b"
[1, 1]: "c"

inputs[1]: SparseTensor with shape = [2, 1]
[0, 0]: "d"
[1, 0]: "e"

inputs[2]: Tensor [["f"], ["g"]]
 then the output will be shape = [2, 2]
[0, 0]: "a_X_d_X_f"
[1, 0]: "b_X_e_X_g"
[1, 1]: "c_X_e_X_g"
 if hashed_output=true then the output will be shape = [2, 2]
[0, 0]: FingerprintCat64(
            Fingerprint64("f"), FingerprintCat64(
                Fingerprint64("d"), Fingerprint64("a")))
[1, 0]: FingerprintCat64(
            Fingerprint64("g"), FingerprintCat64(
                Fingerprint64("e"), Fingerprint64("b")))
[1, 1]: FingerprintCat64(
            Fingerprint64("g"), FingerprintCat64(
                Fingerprint64("e"), Fingerprint64("c")))

 Args
  indices   A list of Tensor objects with type int64. 2-D. Indices of each input SparseTensor.
  values   A list of Tensor objects with types from: int64, string. 1-D. values of each SparseTensor.
  shapes   A list with the same length as indices of Tensor objects with type int64. 1-D. Shapes of each SparseTensor.
  dense_inputs   A list of Tensor objects with types from: int64, string. 2-D. Columns represented by dense Tensor.
  num_buckets   A Tensor of type int64. It is used if hashed_output is true. output = hashed_value%num_buckets if num_buckets > 0 else hashed_value.
  strong_hash   A Tensor of type bool. boolean, if true, siphash with salt will be used instead of farmhash.
  salt   A Tensor of type int64. Specify the salt that will be used by the siphash function.
  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 of type int64.
  output_shape   A Tensor of type int64.


tf.raw_ops.SparseCrossV2 Generates sparse cross from a list of sparse and dense tensors.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseCrossV2
tf.raw_ops.SparseCrossV2(
    indices, values, shapes, dense_inputs, sep, name=None
)
 The op takes two lists, one of 2D SparseTensor and one of 2D Tensor, each representing features of one feature column. It outputs a 2D SparseTensor with the batchwise crosses of these features. For example, if the inputs are inputs[0]: SparseTensor with shape = [2, 2]
[0, 0]: "a"
[1, 0]: "b"
[1, 1]: "c"

inputs[1]: SparseTensor with shape = [2, 1]
[0, 0]: "d"
[1, 0]: "e"

inputs[2]: Tensor [["f"], ["g"]]
 then the output will be shape = [2, 2]
[0, 0]: "a_X_d_X_f"
[1, 0]: "b_X_e_X_g"
[1, 1]: "c_X_e_X_g"
 if hashed_output=true then the output will be shape = [2, 2]
[0, 0]: FingerprintCat64(
            Fingerprint64("f"), FingerprintCat64(
                Fingerprint64("d"), Fingerprint64("a")))
[1, 0]: FingerprintCat64(
            Fingerprint64("g"), FingerprintCat64(
                Fingerprint64("e"), Fingerprint64("b")))
[1, 1]: FingerprintCat64(
            Fingerprint64("g"), FingerprintCat64(
                Fingerprint64("e"), Fingerprint64("c")))

 Args
  indices   A list of Tensor objects with type int64. 2-D. Indices of each input SparseTensor.
  values   A list of Tensor objects with types from: int64, string. 1-D. values of each SparseTensor.
  shapes   A list with the same length as indices of Tensor objects with type int64. 1-D. Shapes of each SparseTensor.
  dense_inputs   A list of Tensor objects with types from: int64, string. 2-D. Columns represented by dense Tensor.
  sep   A Tensor of type string. string used when joining a list of string inputs, can be used as separator later.
  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 of type string.
  output_shape   A Tensor of type int64.


tf.raw_ops.SparseDenseCwiseAdd Adds up a SparseTensor and a dense Tensor, using these special rules:  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseDenseCwiseAdd
tf.raw_ops.SparseDenseCwiseAdd(
    sp_indices, sp_values, sp_shape, dense, name=None
)
 (1) Broadcasts the dense side to have the same shape as the sparse side, if eligible; (2) Then, only the dense values pointed to by the indices of the SparseTensor participate in the cwise addition. By these rules, the result is a logical SparseTensor with exactly the same indices and shape, but possibly with different non-zero values. The output of this Op is the resultant non-zero values.

 Args
  sp_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.
  sp_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 sp_indices.
  sp_shape   A Tensor of type int64. 1-D. Shape of the input SparseTensor.
  dense   A Tensor. Must have the same type as sp_values. R-D. The dense Tensor operand.
  name   A name for the operation (optional).

 Returns   A Tensor. Has the same type as sp_values.


tf.raw_ops.SparseDenseCwiseDiv Component-wise divides a SparseTensor by a dense Tensor.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseDenseCwiseDiv
tf.raw_ops.SparseDenseCwiseDiv(
    sp_indices, sp_values, sp_shape, dense, name=None
)
 Limitation: this Op only broadcasts the dense side to the sparse side, but not the other direction.

 Args
  sp_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.
  sp_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 sp_indices.
  sp_shape   A Tensor of type int64. 1-D. Shape of the input SparseTensor.
  dense   A Tensor. Must have the same type as sp_values. R-D. The dense Tensor operand.
  name   A name for the operation (optional).

 Returns   A Tensor. Has the same type as sp_values.


tf.raw_ops.SparseDenseCwiseMul Component-wise multiplies a SparseTensor by a dense Tensor.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseDenseCwiseMul
tf.raw_ops.SparseDenseCwiseMul(
    sp_indices, sp_values, sp_shape, dense, name=None
)
 The output locations corresponding to the implicitly zero elements in the sparse tensor will be zero (i.e., will not take up storage space), regardless of the contents of the dense tensor (even if it's +/-INF and that INF*0 == NaN). Limitation: this Op only broadcasts the dense side to the sparse side, but not the other direction.

 Args
  sp_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.
  sp_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 sp_indices.
  sp_shape   A Tensor of type int64. 1-D. Shape of the input SparseTensor.
  dense   A Tensor. Must have the same type as sp_values. R-D. The dense Tensor operand.
  name   A name for the operation (optional).

 Returns   A Tensor. Has the same type as sp_values.


tf.raw_ops.SparseFillEmptyRows Fills empty rows in the input 2-D SparseTensor with a default value.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseFillEmptyRows
tf.raw_ops.SparseFillEmptyRows(
    indices, values, dense_shape, default_value, name=None
)
 The input SparseTensor is represented via the tuple of inputs (indices, values, dense_shape). The output SparseTensor has the same dense_shape but with indices output_indices and values output_values. This op inserts a single entry for every row that doesn't have any values. The index is created as [row, 0, ..., 0] and the inserted value is default_value. For example, suppose sp_input has shape [5, 6] and non-empty values: [0, 1]: a
[0, 3]: b
[2, 0]: c
[3, 1]: d
 Rows 1 and 4 are empty, so the output will be of shape [5, 6] with values: [0, 1]: a
[0, 3]: b
[1, 0]: default_value
[2, 0]: c
[3, 1]: d
[4, 0]: default_value
 The output SparseTensor will be in row-major order and will have the same shape as the input. This op also returns an indicator vector shaped [dense_shape[0]] such that empty_row_indicator[i] = True iff row i was an empty row.
 And a reverse index map vector shaped [indices.shape[0]] that is used during backpropagation, reverse_index_map[j] = out_j s.t. indices[j, :] == output_indices[out_j, :]

 Args
  indices   A Tensor of type int64. 2-D. the indices of the sparse tensor.
  values   A Tensor. 1-D. the values of the sparse tensor.
  dense_shape   A Tensor of type int64. 1-D. the shape of the sparse tensor.
  default_value   A Tensor. Must have the same type as values. 0-D. default value to insert into location [row, 0, ..., 0] for rows missing from the input sparse tensor. output indices: 2-D. the indices of the filled sparse tensor.
  name   A name for the operation (optional).

 Returns   A tuple of Tensor objects (output_indices, output_values, empty_row_indicator, reverse_index_map).     output_indices   A Tensor of type int64.
  output_values   A Tensor. Has the same type as values.
  empty_row_indicator   A Tensor of type bool.
  reverse_index_map   A Tensor of type int64.


tf.raw_ops.SparseFillEmptyRowsGrad The gradient of SparseFillEmptyRows.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseFillEmptyRowsGrad
tf.raw_ops.SparseFillEmptyRowsGrad(
    reverse_index_map, grad_values, name=None
)
 Takes vectors reverse_index_map, shaped [N], and grad_values, shaped [N_full], where N_full >= N and copies data into either d_values or d_default_value. Here d_values is shaped [N] and d_default_value is a scalar. d_values[j] = grad_values[reverse_index_map[j]] d_defaultvalue = sum{k : 0 .. N_full - 1} ( grad_values[k] * 1{k not in reverse_index_map})

 Args
  reverse_index_map   A Tensor of type int64. 1-D. The reverse index map from SparseFillEmptyRows.
  grad_values   A Tensor. 1-D. The gradients from backprop.
  name   A name for the operation (optional).

 Returns   A tuple of Tensor objects (d_values, d_default_value).     d_values   A Tensor. Has the same type as grad_values.
  d_default_value   A Tensor. Has the same type as grad_values.


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

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

 Returns   A Tensor of type float32.


tf.raw_ops.SparseMatrixAdd Sparse addition of two CSR matrices, C = alpha * A + beta * B.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixAdd
tf.raw_ops.SparseMatrixAdd(
    a, b, alpha, beta, name=None
)
 The gradients of SparseMatrixAdd outputs with respect to alpha and beta are not currently defined (TensorFlow will return zeros for these entries).

 Args
  a   A Tensor of type variant. A CSRSparseMatrix.
  b   A Tensor of type variant. A CSRSparseMatrix.
  alpha   A Tensor. Must be one of the following types: float32, float64, complex64, complex128. A constant scalar.
  beta   A Tensor. Must have the same type as alpha. A constant scalar.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseMatrixMatMul Matrix-multiplies a sparse matrix with a dense matrix.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixMatMul
tf.raw_ops.SparseMatrixMatMul(
    a, b, transpose_a=False, transpose_b=False, adjoint_a=False, adjoint_b=False,
    transpose_output=False, conjugate_output=False, name=None
)
 Returns a dense matrix. For inputs A and B, where A is CSR and B is dense; this op returns a dense C; If transpose_output is false, returns: C = A . B
 If transpose_output is true, returns: C = transpose(A . B) = transpose(B) . transpose(A)
 where the transposition is performed along the two innermost (matrix) dimensions. If conjugate_output is true, returns: C = conjugate(A . B) = conjugate(A) . conjugate(B)
 If both conjugate_output and transpose_output are true, returns: C = conjugate(transpose(A . B)) = conjugate(transpose(B)) .
                                  conjugate(transpose(A))

 Args
  a   A Tensor of type variant. A CSRSparseMatrix.
  b   A Tensor. A dense tensor.
  transpose_a   An optional bool. Defaults to False. Indicates whether a should be transposed.
  transpose_b   An optional bool. Defaults to False. Indicates whether b should be transposed.
  adjoint_a   An optional bool. Defaults to False. Indicates whether a should be conjugate-transposed.
  adjoint_b   An optional bool. Defaults to False. Indicates whether b should be conjugate-transposed.
  transpose_output   An optional bool. Defaults to False. Transposes the product of a and b.
  conjugate_output   An optional bool. Defaults to False. Conjugates the product of a and b.
  name   A name for the operation (optional).

 Returns   A Tensor. Has the same type as b.


tf.raw_ops.SparseMatrixMul Element-wise multiplication of a sparse matrix with a dense tensor.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixMul
tf.raw_ops.SparseMatrixMul(
    a, b, name=None
)
 Returns a sparse matrix. The dense tensor b may be either a scalar; otherwise a must be a rank-3 SparseMatrix; in this case b must be shaped [batch_size, 1, 1] and the multiply operation broadcasts.
Note: even if b is zero, the sparsity structure of the output does not change.

 Args
  a   A Tensor of type variant. A CSRSparseMatrix.
  b   A Tensor. A dense tensor.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseMatrixNNZ Returns the number of nonzeroes of sparse_matrix.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixNNZ
tf.raw_ops.SparseMatrixNNZ(
    sparse_matrix, name=None
)

 Args
  sparse_matrix   A Tensor of type variant. A CSRSparseMatrix.
  name   A name for the operation (optional).

 Returns   A Tensor of type int32.


tf.raw_ops.SparseMatrixOrderingAMD Computes the Approximate Minimum Degree (AMD) ordering of input.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixOrderingAMD
tf.raw_ops.SparseMatrixOrderingAMD(
    input, name=None
)
 Computes the Approximate Minimum Degree (AMD) ordering for a sparse matrix. The returned permutation may be used to permute the rows and columns of the given sparse matrix. This typically results in permuted sparse matrix's sparse Cholesky (or other decompositions) in having fewer zero fill-in compared to decomposition of the original matrix. The input sparse matrix may have rank 2 or rank 3. The output Tensor, representing would then have rank 1 or 2 respectively, with the same batch shape as the input. Each component of the input sparse matrix must represent a square symmetric matrix; only the lower triangular part of the matrix is read. The values of the sparse matrix does not affect the returned permutation, only the sparsity pattern of the sparse matrix is used. Hence, a single AMD ordering may be reused for the Cholesky decompositions of sparse matrices with the same sparsity pattern but with possibly different values. Each batch component of the output permutation represents a permutation of N elements, where the input sparse matrix components each have N rows. That is, the component contains each of the integers {0, .. N-1} exactly once. The ith element represents the row index that the ith row maps to. Usage example: from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops

a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]])
a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32)
a_dense_shape = [4, 4]

with tf.Session() as sess:
  # Define (COO format) SparseTensor over Numpy array.
  a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape)

  # Convert SparseTensors to CSR SparseMatrix.
  a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(
      a_st.indices, a_st.values, a_st.dense_shape)

  # Obtain the AMD Ordering for the CSR SparseMatrix.
  ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix)

  ordering_amd_value = sess.run(ordering_amd)
 ordering_amd_value stores the AMD ordering: [1 2 3 0]. input: A CSRSparseMatrix.

 Args
  input   A Tensor of type variant. A CSRSparseMatrix.
  name   A name for the operation (optional).

 Returns   A Tensor of type int32.


tf.raw_ops.SparseMatrixSoftmax Calculates the softmax of a CSRSparseMatrix.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixSoftmax
tf.raw_ops.SparseMatrixSoftmax(
    logits, type, name=None
)
 Calculate the softmax of the innermost dimensions of a SparseMatrix. Missing values are treated as -inf (i.e., logits of zero probability); and the output has the same sparsity structure as the input (though missing values in the output may now be treated as having probability zero).

 Args
  logits   A Tensor of type variant. A CSRSparseMatrix.
  type   A tf.DType from: tf.float32, tf.float64.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseMatrixSoftmaxGrad Calculates the gradient of the SparseMatrixSoftmax op.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixSoftmaxGrad
tf.raw_ops.SparseMatrixSoftmaxGrad(
    softmax, grad_softmax, type, name=None
)

 Args
  softmax   A Tensor of type variant. A CSRSparseMatrix.
  grad_softmax   A Tensor of type variant. The gradient of softmax.
  type   A tf.DType from: tf.float32, tf.float64.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseMatrixSparseCholesky Computes the sparse Cholesky decomposition of input.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixSparseCholesky
tf.raw_ops.SparseMatrixSparseCholesky(
    input, permutation, type, name=None
)
 Computes the Sparse Cholesky decomposition of a sparse matrix, with the given fill-in reducing permutation. The input sparse matrix and the fill-in reducing permutation permutation must have compatible shapes. If the sparse matrix has rank 3; with the batch dimension B, then the permutation must be of rank 2; with the same batch dimension B. There is no support for broadcasting. Furthermore, each component vector of permutation must be of length N, containing each of the integers {0, 1, ..., N - 1} exactly once, where N is the number of rows of each component of the sparse matrix. Each component of the input sparse matrix must represent a symmetric positive definite (SPD) matrix; although only the lower triangular part of the matrix is read. If any individual component is not SPD, then an InvalidArgument error is thrown. The returned sparse matrix has the same dense shape as the input sparse matrix. For each component A of the input sparse matrix, the corresponding output sparse matrix represents L, the lower triangular Cholesky factor satisfying the following identity: A = L * Lt
 where Lt denotes the transpose of L (or its conjugate transpose, if type is complex64 or complex128). The type parameter denotes the type of the matrix elements. The supported types are: float32, float64, complex64 and complex128. Usage example: from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops

a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]])
a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32)
a_dense_shape = [4, 4]

with tf.Session() as sess:
  # Define (COO format) SparseTensor over Numpy array.
  a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape)

  # Convert SparseTensors to CSR SparseMatrix.
  a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(
      a_st.indices, a_st.values, a_st.dense_shape)

  # Obtain the Sparse Cholesky factor using AMD Ordering for reducing zero
  # fill-in (number of structural non-zeros in the sparse Cholesky factor).
  ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix)
  cholesky_sparse_matrices = (
      sparse_csr_matrix_ops.sparse_matrix_sparse_cholesky(
          sparse_matrix, ordering_amd, type=tf.float32))

  # Convert the CSRSparseMatrix Cholesky factor to a dense Tensor
  dense_cholesky = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense(
      cholesky_sparse_matrices, tf.float32)

  # Evaluate the dense Tensor value.
  dense_cholesky_value = sess.run(dense_cholesky)
 dense_cholesky_value stores the dense Cholesky factor: [[  1.  0.    0.    0.]
 [  0.  1.41  0.    0.]
 [  0.  0.70  1.58  0.]
 [  0.  0.    0.    2.]]
 input: A CSRSparseMatrix. permutation: A Tensor. type: The type of input.

 Args
  input   A Tensor of type variant. A CSRSparseMatrix.
  permutation   A Tensor of type int32. A fill-in reducing permutation matrix.
  type   A tf.DType from: tf.float32, tf.float64, tf.complex64, tf.complex128.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseMatrixSparseMatMul Sparse-matrix-multiplies two CSR matrices a and b.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixSparseMatMul
tf.raw_ops.SparseMatrixSparseMatMul(
    a, b, type, transpose_a=False, transpose_b=False, adjoint_a=False,
    adjoint_b=False, name=None
)
 Performs a matrix multiplication of a sparse matrix a with a sparse matrix b; returns a sparse matrix a * b, unless either a or b is transposed or adjointed. Each matrix may be transposed or adjointed (conjugated and transposed) according to the Boolean parameters transpose_a, adjoint_a, transpose_b and adjoint_b. At most one of transpose_a or adjoint_a may be True. Similarly, at most one of transpose_b or adjoint_b may be True. The inputs must have compatible shapes. That is, the inner dimension of a must be equal to the outer dimension of b. This requirement is adjusted according to whether either a or b is transposed or adjointed. The type parameter denotes the type of the matrix elements. Both a and b must have the same type. The supported types are: float32, float64, complex64 and complex128. Both a and b must have the same rank. Broadcasting is not supported. If they have rank 3, each batch of 2D CSRSparseMatrices within a and b must have the same dense shape. The sparse matrix product may have numeric (non-structural) zeros. zeros. Usage example: from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops

a_indices = np.array([[0, 0], [2, 3], [2, 4], [3, 0]])
a_values = np.array([1.0, 5.0, -1.0, -2.0], np.float32)
a_dense_shape = [4, 5]

b_indices = np.array([[0, 0], [3, 0], [3, 1]])
b_values = np.array([2.0, 7.0, 8.0], np.float32)
b_dense_shape = [5, 3]

with tf.Session() as sess:
  # Define (COO format) Sparse Tensors over Numpy arrays
  a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape)
  b_st = tf.sparse.SparseTensor(b_indices, b_values, b_dense_shape)

  # Convert SparseTensors to CSR SparseMatrix
  a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(
      a_st.indices, a_st.values, a_st.dense_shape)
  b_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(
      b_st.indices, b_st.values, b_st.dense_shape)

  # Compute the CSR SparseMatrix matrix multiplication
  c_sm = sparse_csr_matrix_ops.sparse_matrix_sparse_mat_mul(
      a=a_sm, b=b_sm, type=tf.float32)

  # Convert the CSR SparseMatrix product to a dense Tensor
  c_sm_dense = sparse_csr_matrix_ops.csr_sparse_matrix_to_dense(
      c_sm, tf.float32)
  # Evaluate the dense Tensor value
  c_sm_dense_value = sess.run(c_sm_dense)
 c_sm_dense_value stores the dense matrix product: [[  2.   0.   0.]
 [  0.   0.   0.]
 [ 35.  40.   0.]
 [ -4.   0.   0.]]
 a: A CSRSparseMatrix. b: A CSRSparseMatrix with the same type and rank as a. type: The type of both a and b. transpose_a: If True, a transposed before multiplication. transpose_b: If True, b transposed before multiplication. adjoint_a: If True, a adjointed before multiplication. adjoint_b: If True, b adjointed before multiplication.

 Args
  a   A Tensor of type variant. A CSRSparseMatrix.
  b   A Tensor of type variant. A CSRSparseMatrix.
  type   A tf.DType from: tf.float32, tf.float64, tf.complex64, tf.complex128.
  transpose_a   An optional bool. Defaults to False. Indicates whether a should be transposed.
  transpose_b   An optional bool. Defaults to False. Indicates whether b should be transposed.
  adjoint_a   An optional bool. Defaults to False. Indicates whether a should be conjugate-transposed.
  adjoint_b   An optional bool. Defaults to False. Indicates whether b should be conjugate-transposed.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseMatrixTranspose Transposes the inner (matrix) dimensions of a CSRSparseMatrix.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixTranspose
tf.raw_ops.SparseMatrixTranspose(
    input, type, conjugate=False, name=None
)
 Transposes the inner (matrix) dimensions of a SparseMatrix and optionally conjugates its values.

 Args
  input   A Tensor of type variant. A CSRSparseMatrix.
  type   A tf.DType from: tf.float32, tf.float64, tf.complex64, tf.complex128.
  conjugate   An optional bool. Defaults to False. Indicates whether input should be conjugated.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseMatrixZeros Creates an all-zeros CSRSparseMatrix with shape dense_shape.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.raw_ops.SparseMatrixZeros
tf.raw_ops.SparseMatrixZeros(
    dense_shape, type, name=None
)

 Args
  dense_shape   A Tensor of type int64. The desired matrix shape.
  type   A tf.DType from: tf.float32, tf.float64, tf.complex64, tf.complex128.
  name   A name for the operation (optional).

 Returns   A Tensor of type variant.


tf.raw_ops.SparseReduceMax 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.SparseReduceMax
tf.raw_ops.SparseReduceMax(
    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 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, 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 Tensor. Has the same type as input_values.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.


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.