tensorflow/core/kernels/sparse/csr_sparse_matrix_to_sparse_tensor_op.cc
// Validate that CSR SparseMatrix has the expected dtype and rank 2 or 3.
Validate that CSR SparseMatrix has the expected dtype and rank 2 or 3.
Validate that CSR SparseMatrix has the expected dtype and rank 2 or 3 .
Status ValidateCSRSparseMatrix(const CSRSparseMatrix& csr_sparse_matrix,
                               DataType expected_dtype) {
  if (csr_sparse_matrix.dtype() != expected_dtype) {
    return errors::InvalidArgument(
        "Expected a CSRSparseMatrix of type ", DataTypeString(expected_dtype),
        " but saw type: ", DataTypeString(csr_sparse_matrix.dtype()));
  }
  const int rank = csr_sparse_matrix.dense_shape().dim_size(0);
  if (rank != 2 && rank != 3) {
    return errors::InvalidArgument("CSR SparseMatrix must have rank 2 or 3; ",
                                   "but dense_shape has size ", rank);
  }
  return Status::OK();
}
Status ValidateCSRSparseMatrix ( const CSRSparseMatrix & csr_sparse_matrix , DataType expected_dtype ) { if ( csr_sparse_matrix . dtype ( ) != expected_dtype ) { return errors :: InvalidArgument ( " " , DataTypeString ( expected_dtype ) , " " , DataTypeString ( csr_sparse_matrix . dtype ( ) ) ) ; } const int rank = csr_sparse_matrix . dense_shape ( ) . dim_size ( 0 ) ; if ( rank != 2 && rank != 3 ) { return errors :: InvalidArgument ( " " , " " , rank ) ; } return Status :: OK ( ) ; }
Validate that CSR SparseMatrix has the expected dtype and rank 2 or 3.
Validate that CSR SparseMatrix has the expected dtype and rank 2 or 3 .