tensorflow/core/ops/training_ops_test.cc
// Used for testing the grad+indices handling for SparseApplyXYZ tests.
Used for testing the grad+indices handling for SparseApplyXYZ tests.
Used for testing the grad + indices handling for SparseApplyXYZ tests .
static void TestGradAndIndicesErrorHandling(const ShapeInferenceTestOp& op,
                                            string shape_spec_middle,
                                            const string& shape_spec_end = "") {
  auto shape_spec = [&shape_spec_middle, shape_spec_end](
                        const char* var_spec, const char* grad_indices_spec) {
    return strings::StrCat(var_spec, ";", shape_spec_middle, ";",
                           grad_indices_spec, shape_spec_end);
  };
  INFER_ERROR("Dimension 1 in both shapes must be equal", op,
              shape_spec("[?,1]", "[?,2];[?]"));
  INFER_ERROR("Dimensions must be equal, but are 1 and 2", op,
              shape_spec("?", "[2,?];[1]"));
  INFER_ERROR("must be equal rank", op, shape_spec("[1]", "[?,2];[?]"));
  INFER_ERROR("Shape must be rank 1 but is rank 2", op,
              shape_spec("[?]", "[?];[1,2]"));
}
static void TestGradAndIndicesErrorHandling ( const ShapeInferenceTestOp & op , string shape_spec_middle , const string & shape_spec_end = " " ) { auto shape_spec = [ & shape_spec_middle , shape_spec_end ] ( const char * var_spec , const char * grad_indices_spec ) { return strings :: StrCat ( var_spec , " " , shape_spec_middle , " " , grad_indices_spec , shape_spec_end ) ; } ; INFER_ERROR ( " " , op , shape_spec ( " " , " " ) ) ; INFER_ERROR ( " " , op , shape_spec ( " " , " " ) ) ; INFER_ERROR ( " " , op , shape_spec ( " " , " " ) ) ; INFER_ERROR ( " " , op , shape_spec ( " " , " " ) ) ; }
Used for testing the grad+indices handling for SparseApplyXYZ tests.
Used for testing the grad + indices handling for SparseApplyXYZ tests .
// mismatch between grad[1] and var[1]. // grad[0] and indices[0] must match. // grad is wrong rank. // indices is wrong rank.