tensorflow/core/ops/sparse_csr_matrix_ops.cc
// Validates that a shape represents a (rank-2) square matrix or a (rank-3)
// batch of square matrices.
Validates that a shape represents a (rank-2) square matrix or a (rank-3)
batch of square matrices.
Validates that a shape represents a ( rank - 2 ) square matrix or a ( rank - 3 ) batch of square matrices .
Status ValidateSquareMatrixShape(InferenceContext* c,
                                 const ShapeHandle& matrix_shape,
                                 DimensionHandle* matrix_dimension) {
  ShapeHandle out;
  TF_RETURN_IF_ERROR(c->WithRankAtLeast(matrix_shape, 2, &out));
  TF_RETURN_IF_ERROR(c->WithRankAtMost(matrix_shape, 3, &out));
  if (!c->RankKnown(matrix_shape)) {
    return errors::Internal("Sparse matrix has an unknown rank.");
  }
  TF_RETURN_IF_ERROR(c->Merge(c->Dim(matrix_shape, -2),
                              c->Dim(matrix_shape, -1), matrix_dimension));
  return Status::OK();
}
Status ValidateSquareMatrixShape ( InferenceContext * c , const ShapeHandle & matrix_shape , DimensionHandle * matrix_dimension ) { ShapeHandle out ; TF_RETURN_IF_ERROR ( c -> WithRankAtLeast ( matrix_shape , 2 , & out ) ) ; TF_RETURN_IF_ERROR ( c -> WithRankAtMost ( matrix_shape , 3 , & out ) ) ; if ( ! c -> RankKnown ( matrix_shape ) ) { return errors :: Internal ( " " ) ; } TF_RETURN_IF_ERROR ( c -> Merge ( c -> Dim ( matrix_shape , -2 ) , c -> Dim ( matrix_shape , -1 ) , matrix_dimension ) ) ; return Status :: OK ( ) ; }
Validates that a shape represents a (rank-2) square matrix or a (rank-3)
batch of square matrices.
Validates that a shape represents a ( rank - 2 ) square matrix or a ( rank - 3 ) batch of square matrices .