From f62b3fc8c7b1e15dc4b4d3085a9b3cdedf686242 Mon Sep 17 00:00:00 2001 From: zyfncg Date: Wed, 30 Nov 2022 16:33:44 +0800 Subject: [PATCH] Fix error log for yaml check (#48126) * fix error log for yaml check * remove grad_op of increment --- paddle/fluid/operators/generator/CMakeLists.txt | 17 +++++++++++------ paddle/phi/api/yaml/legacy_backward.yaml | 17 +---------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/paddle/fluid/operators/generator/CMakeLists.txt b/paddle/fluid/operators/generator/CMakeLists.txt index 111e1da92c..7ebc130034 100644 --- a/paddle/fluid/operators/generator/CMakeLists.txt +++ b/paddle/fluid/operators/generator/CMakeLists.txt @@ -77,16 +77,21 @@ execute_process( ./parsed_ops/ops.parsed.yaml ./parsed_ops/legacy_ops.parsed.yaml --backward_yaml_paths ./parsed_ops/backward_ops.parsed.yaml ./parsed_ops/legacy_backward_ops.parsed.yaml + RESULT_VARIABLE _result) +if(${_result}) + message(FATAL_ERROR "ops validation failed, exiting.") +endif() + +execute_process( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/paddle/fluid/operators/generator COMMAND ${PYTHON_EXECUTABLE} cross_validate.py --forward_yaml_paths ./parsed_ops/sparse_ops.parsed.yaml --backward_yaml_paths ./parsed_ops/sparse_backward.parsed.yaml - RESULT_VARIABLE _results) -foreach(_result in ${_results}) - if(${_result}) - message(FATAL_ERROR "ops validation failed, exiting.") - endif() -endforeach() + RESULT_VARIABLE _result) +if(${_result}) + message(FATAL_ERROR "sparse ops validation failed, exiting.") +endif() # code generation for op, op makers, and argument mapping functions message( diff --git a/paddle/phi/api/yaml/legacy_backward.yaml b/paddle/phi/api/yaml/legacy_backward.yaml index 814b3c89c0..47ba24b091 100755 --- a/paddle/phi/api/yaml/legacy_backward.yaml +++ b/paddle/phi/api/yaml/legacy_backward.yaml @@ -326,7 +326,7 @@ func : conv3d_transpose_grad - backward_op : crop_grad - forward : crop_tensor (Tensor x, IntArray shape, IntArray offsets) -> Tensor(out) + forward : crop (Tensor x, IntArray shape, IntArray offsets) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray offsets) output : Tensor(x_grad) infer_meta : @@ -674,12 +674,6 @@ output : Tensor(x_grad) invoke : imag_grad_impl(out_grad, x_grad) -- backward_op : increment_grad - forward : increment (Tensor x, float value) -> Tensor(out) - args : (Tensor out, float value) - output : Tensor(x_grad) - invoke : increment (out, -value) - - backward_op : index_add_grad forward : index_add(Tensor x, Tensor index, Tensor add_value, int axis) -> Tensor(out) args : (Tensor index, Tensor add_value, Tensor out_grad, int axis) @@ -1338,15 +1332,6 @@ backward : reshape_double_grad inplace : (out_grad -> x_grad) -- backward_op : reverse_array_grad - forward : reverse_array (Tensor[] x, IntArray axis) -> Tensor[](out) - args : (Tensor[] out_grad, IntArray axis) - output : Tensor[](x_grad){out_grad.size()} - infer_meta : - func : ReverseArrayInferMeta - kernel : - func : reverse - - backward_op : reverse_grad forward : reverse (Tensor x, IntArray axis) -> Tensor(out) args : (Tensor out_grad, IntArray axis) -- GitLab