From 8caaf85a8e5b9b06261cb4f90acb17efe82f1220 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Fri, 16 Sep 2022 09:36:23 +0800 Subject: [PATCH] [Cherry-pick] Normalize yaml name and label (#46052) * normalize yaml file name (#45894) * Clear extra attributes of activation op in OpMaker (#45772) * clear extra attr of activation op in opmaker * fix syntax bug * fix mkldnn kernel * fix merge conflict * fix bug * [PHI] Normalize yaml op label (#45976) * normalize yaml op label * revert op_compat yaml change * fix prelu and rnn compat problem * replace api by op * support assign op backward refuse forward (#45879) * normize yaml backward op label (#46028) Co-authored-by: zyfncg Co-authored-by: Charles-hit <56987902+Charles-hit@users.noreply.github.com> --- .../generator/CMakeLists.txt | 6 +- .../generator/codegen_utils.py | 14 +- .../generator/eager_gen.py | 21 +- paddle/fluid/framework/grad_op_desc_maker.h | 2 +- paddle/fluid/operators/activation_op.cc | 93 +-- paddle/phi/api/lib/CMakeLists.txt | 24 +- paddle/phi/api/lib/data_transform.cc | 2 +- paddle/phi/api/yaml/backward.yaml | 42 +- paddle/phi/api/yaml/generator/api_base.py | 4 +- paddle/phi/api/yaml/generator/api_gen.py | 2 +- .../api/yaml/generator/backward_api_gen.py | 6 +- paddle/phi/api/yaml/generator/generate_op.py | 12 +- .../yaml/generator/intermediate_api_gen.py | 4 +- .../api/yaml/generator/ops_extra_info_gen.py | 26 +- paddle/phi/api/yaml/generator/parse_api.py | 2 +- paddle/phi/api/yaml/generator/parse_utils.py | 8 +- .../phi/api/yaml/generator/sparse_api_gen.py | 4 +- .../api/yaml/generator/sparse_bw_api_gen.py | 2 +- .../phi/api/yaml/generator/strings_api_gen.py | 2 +- .../yaml/generator/wrapped_infermeta_gen.py | 2 +- paddle/phi/api/yaml/legacy_backward.yaml | 536 +++++++-------- .../yaml/{legacy_api.yaml => legacy_ops.yaml} | 620 +++++++++--------- .../yaml/{api_compat.yaml => op_compat.yaml} | 331 +++++++--- .../{api_version.yaml => op_version.yaml} | 2 +- paddle/phi/api/yaml/{api.yaml => ops.yaml} | 44 +- ...parse_bw_api.yaml => sparse_backward.yaml} | 76 +-- .../yaml/{sparse_api.yaml => sparse_ops.yaml} | 82 +-- .../{strings_api.yaml => strings_ops.yaml} | 8 +- paddle/phi/infermeta/unary.cc | 2 +- .../fluid/tests/unittests/test_assign_op.py | 77 +++ tools/infrt/generate_phi_kernel_dialect.py | 2 +- tools/infrt/get_phi_kernel_info.py | 2 +- 32 files changed, 1111 insertions(+), 949 deletions(-) rename paddle/phi/api/yaml/{legacy_api.yaml => legacy_ops.yaml} (92%) rename paddle/phi/api/yaml/{api_compat.yaml => op_compat.yaml} (63%) rename paddle/phi/api/yaml/{api_version.yaml => op_version.yaml} (97%) rename paddle/phi/api/yaml/{api.yaml => ops.yaml} (91%) rename paddle/phi/api/yaml/{sparse_bw_api.yaml => sparse_backward.yaml} (90%) rename paddle/phi/api/yaml/{sparse_api.yaml => sparse_ops.yaml} (93%) rename paddle/phi/api/yaml/{strings_api.yaml => strings_ops.yaml} (93%) diff --git a/paddle/fluid/eager/auto_code_generator/generator/CMakeLists.txt b/paddle/fluid/eager/auto_code_generator/generator/CMakeLists.txt index aeceb50573e..f82e28de1f3 100644 --- a/paddle/fluid/eager/auto_code_generator/generator/CMakeLists.txt +++ b/paddle/fluid/eager/auto_code_generator/generator/CMakeLists.txt @@ -1,8 +1,8 @@ set(api_yaml_path - "${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/api.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/legacy_api.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_api.yaml" + "${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/ops.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/legacy_ops.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_ops.yaml" ) set(backward_yaml_path - "${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/backward.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/legacy_backward.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_bw_api.yaml" + "${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/backward.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/legacy_backward.yaml,${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_backward.yaml" ) set(tmp_forwards_cc_path "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/eager_generated/forwards/tmp_dygraph_functions.cc" @@ -30,7 +30,7 @@ set(nodes_h_path ) # StringTensor only needs forward api set(fwd_api_yaml_path - "${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/strings_api.yaml") + "${PADDLE_SOURCE_DIR}/paddle/phi/api/yaml/strings_ops.yaml") message("Final State Eager CodeGen") add_custom_target( diff --git a/paddle/fluid/eager/auto_code_generator/generator/codegen_utils.py b/paddle/fluid/eager/auto_code_generator/generator/codegen_utils.py index 45895791128..9022e800905 100644 --- a/paddle/fluid/eager/auto_code_generator/generator/codegen_utils.py +++ b/paddle/fluid/eager/auto_code_generator/generator/codegen_utils.py @@ -83,10 +83,10 @@ def ReadBwdFile(filepath): ret = {} if contents is not None: for content in contents: - assert 'backward_api' in content.keys(), AssertMessage( - 'backward_api', content.keys()) - if 'backward_api' in content.keys(): - api_name = content['backward_api'] + assert 'backward_op' in content.keys(), AssertMessage( + 'backward_op', content.keys()) + if 'backward_op' in content.keys(): + api_name = content['backward_op'] ret[api_name] = content f.close() @@ -418,12 +418,12 @@ class FunctionGeneratorBase: def CollectOriginalForwardInfo(self): forward_api_contents = self.forward_api_contents - self.forward_api_name = forward_api_contents['api'] + self.forward_api_name = forward_api_contents['op'] forward_args_str = forward_api_contents['args'] forward_returns_str = forward_api_contents['output'] - assert 'api' in forward_api_contents.keys( - ), "Unable to find \"api\" in forward_api_contents keys" + assert 'op' in forward_api_contents.keys( + ), "Unable to find \"op\" in forward_api_contents keys" assert 'args' in forward_api_contents.keys( ), "Unable to find \"args\" in forward_api_contents keys" assert 'output' in forward_api_contents.keys( diff --git a/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py b/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py index 41af2c3f150..100dfd57405 100644 --- a/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py +++ b/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py @@ -569,16 +569,16 @@ class DygraphFunctionGeneratorBase(FunctionGeneratorBase): forward_api_contents = self.forward_api_contents grad_api_contents = self.grad_api_contents - assert 'api' in forward_api_contents.keys( - ), "Unable to find \"api\" in api.yaml" + assert 'op' in forward_api_contents.keys( + ), "Unable to find \"op\" in ops.yaml" assert 'args' in forward_api_contents.keys( - ), "Unable to find \"args\" in api.yaml" + ), "Unable to find \"args\" in ops.yaml" assert 'output' in forward_api_contents.keys( - ), "Unable to find \"output\" in api.yaml" + ), "Unable to find \"output\" in ops.yaml" if grad_api_contents is not None: assert 'backward' in forward_api_contents.keys( - ), "Unable to find \"backward\" in api.yaml" + ), "Unable to find \"backward\" in ops.yaml" assert 'args' in grad_api_contents.keys( ), "Unable to find \"args\" in backward.yaml" assert 'output' in grad_api_contents.keys( @@ -1485,7 +1485,7 @@ class DygraphNodeGenerator(DygraphFunctionGeneratorBase): if next_grad_api_contents: # Fake forward_api_contents and backward_api_contents forward_api_contents = grad_api_contents - forward_api_contents['api'] = forward_api_contents['backward_api'] + forward_api_contents['op'] = forward_api_contents['backward_op'] backward_api_contents = next_grad_api_contents next_node_generator = DygraphFunctionGeneratorBase( @@ -1914,11 +1914,11 @@ class DygraphForwardAndNodesGenerator(GeneratorBase): grad_api_dict = self.grad_api_dict forward_apis_dict = {} for api_item in forward_api_list: - forward_apis_dict[api_item['api']] = api_item + forward_apis_dict[api_item['op']] = api_item namespace = self.namespace for forward_api_contents in forward_api_list: - if forward_api_contents['api'] in black_ops_list: continue + if forward_api_contents['op'] in black_ops_list: continue self.CollectIsForwardOnly(forward_api_contents) @@ -1959,8 +1959,7 @@ class DygraphForwardAndNodesGenerator(GeneratorBase): forward_api_contents = backward_api_contents # Fake forward_api_content - forward_api_contents['api'] = forward_api_contents[ - 'backward_api'] + forward_api_contents['op'] = forward_api_contents['backward_op'] backward_api_contents = next_grad_api_contents if len(namespace) > 0: @@ -2043,7 +2042,7 @@ if __name__ == "__main__": api_yaml_path = api_yaml_paths[i] # string api is forwrad only - if not api_yaml_path.endswith('strings_api.yaml'): + if not api_yaml_path.endswith('strings_ops.yaml'): backward_yaml_path = backward_yaml_paths[i] else: backward_yaml_path = None diff --git a/paddle/fluid/framework/grad_op_desc_maker.h b/paddle/fluid/framework/grad_op_desc_maker.h index 141499d005d..bb36742d475 100644 --- a/paddle/fluid/framework/grad_op_desc_maker.h +++ b/paddle/fluid/framework/grad_op_desc_maker.h @@ -213,8 +213,8 @@ class SingleGradOpMaker : public GradOpDescMakerBase { std::vector> retv; retv.emplace_back(new OpDesc()); try { - this->Apply(retv.front().get()); retv.front()->SetRuntimeAttrMap(this->RuntimeAttrs()); + this->Apply(retv.front().get()); } catch (platform::EnforceNotMet& exception) { framework::AppendErrorOpHint(retv.front().get()->Type(), &exception); throw std::move(exception); diff --git a/paddle/fluid/operators/activation_op.cc b/paddle/fluid/operators/activation_op.cc index 62b805cf422..1337533f3bb 100644 --- a/paddle/fluid/operators/activation_op.cc +++ b/paddle/fluid/operators/activation_op.cc @@ -38,29 +38,20 @@ static constexpr bool CanInplaceAct() { GradFunctor::FwdDeps() == ActBwdOpFwdDeps::kNoDeps; } -#define REGISTER_ACTIVATION_OP_MAKER(OP_NAME, OP_COMMENT) \ - class OP_NAME##OpMaker \ - : public ::paddle::framework::OpProtoAndCheckerMaker { \ - public: \ - void Make() override { \ - AddInput("X", \ - "Input of " #OP_NAME \ - " operator, an N-D Tensor, with data type float32, " \ - "float64 or float16."); \ - AddOutput("Out", \ - "Output of " #OP_NAME \ - " operator, a Tensor with shape same as input."); \ - AddAttr("use_mkldnn", \ - "(bool, default false) Only used in mkldnn kernel") \ - .SetDefault(false) \ - .AsExtra(); \ - AddAttr("use_cudnn", \ - "(bool, default false) Only used in cudnn kernel, need " \ - "install cudnn") \ - .SetDefault(false) \ - .AsExtra(); \ - AddComment(OP_COMMENT); \ - } \ +#define REGISTER_ACTIVATION_OP_MAKER(OP_NAME, OP_COMMENT) \ + class OP_NAME##OpMaker \ + : public ::paddle::framework::OpProtoAndCheckerMaker { \ + public: \ + void Make() override { \ + AddInput("X", \ + "Input of " #OP_NAME \ + " operator, an N-D Tensor, with data type float32, " \ + "float64 or float16."); \ + AddOutput("Out", \ + "Output of " #OP_NAME \ + " operator, a Tensor with shape same as input."); \ + AddComment(OP_COMMENT); \ + } \ } template @@ -107,8 +98,7 @@ framework::OpKernelType GetKernelType(const framework::ExecutionContext& ctx, // } // #endif #ifdef PADDLE_WITH_MKLDNN - auto it = oper.Attrs().find("use_mkldnn"); - if (library == framework::LibraryType::kPlain && it != oper.Attrs().end() && + if (library == framework::LibraryType::kPlain && oper.CanMKLDNNBeUsed(ctx, data_type)) { library = framework::LibraryType::kMKLDNN; layout = framework::DataLayout::kMKLDNN; @@ -458,10 +448,6 @@ class LeakyReluOpMaker : public framework::OpProtoAndCheckerMaker { "A LoDTensor or Tensor with the same type and size as that of x."); AddAttr("alpha", "Slope of the activation function at x < 0.") .SetDefault(0.02f); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( LeakyRelu Activation Operator. @@ -483,35 +469,6 @@ class SoftplusOpMaker : public framework::OpProtoAndCheckerMaker { AddAttr("beta", "The value of beta for Softplus.").SetDefault(1.0f); AddAttr("threshold", "The value of threshold for Softplus.") .SetDefault(20.0f); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel.") - .SetDefault(false) - .AsExtra(); - AddAttr( - "use_cudnn", - "(bool, default false) Only used in cudnn kernel, need install cudnn.") - .SetDefault(false) - .AsExtra(); - AddAttr( - "fuse_activation_type", - "Fused activation type used in softplus OneDNN kernel.") - .SetDefault("") - .AsExtra(); - AddAttr( - "fuse_activation_alpha", - "Fused activation alpha parameter type used in softplus OneDNN kernel.") - .SetDefault(0.0f) - .AsExtra(); - AddAttr( - "fuse_activation_beta", - "Fused activation beta parameter type used in softplus OneDNN kernel.") - .SetDefault(0.0f) - .AsExtra(); - AddAttr( - "fuse_activation_scale", - "Fused activation scale parameter type used in softplus OneDNN kernel.") - .SetDefault(1.0f) - .AsExtra(); AddComment(R"DOC( :strong:`Softplus Activation Operator` @@ -613,10 +570,6 @@ class ELUOpMaker : public framework::OpProtoAndCheckerMaker { "The output is a multi-dimensional Tensor which has same " "dimension and data type as the ``x``."); AddAttr("alpha", "The alpha value of ELU").SetDefault(1.0f); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( ELU Activation Operator. @@ -712,10 +665,6 @@ class Relu6OpMaker : public framework::OpProtoAndCheckerMaker { AddAttr("threshold", "The threshold value of Relu6. Default is 6.0. ") .SetDefault(6.0f); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( Relu6 Activation Operator. @@ -817,10 +766,6 @@ class SwishOpMaker : public framework::OpProtoAndCheckerMaker { AddInput("X", "Input of Swish operator"); AddOutput("Out", "Output of Swish operator"); AddAttr("beta", "Constant beta of swish operator").SetDefault(1.0f); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( Swish Activation Operator. @@ -841,10 +786,6 @@ class MishOpMaker : public framework::OpProtoAndCheckerMaker { "of softplus will be used if absolute value of input is greater than " ":attr:`threshold`") .SetDefault(20.f); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( Mish Activation Operator. @@ -871,10 +812,6 @@ class HardSwishOpMaker : public framework::OpProtoAndCheckerMaker { .SetDefault(6.0f); AddAttr("offset", "The offset parameter of HardSwish operator") .SetDefault(3.0f); - AddAttr("use_mkldnn", - "(bool, default false) Only used in mkldnn kernel") - .SetDefault(false) - .AsExtra(); AddComment(R"DOC( HardSwish Activation Operator. diff --git a/paddle/phi/api/lib/CMakeLists.txt b/paddle/phi/api/lib/CMakeLists.txt index 924f6f3526a..957d43b4623 100644 --- a/paddle/phi/api/lib/CMakeLists.txt +++ b/paddle/phi/api/lib/CMakeLists.txt @@ -21,9 +21,9 @@ set(api_gen_base ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/api_base.py) # forward api file set(api_gen_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/api_gen.py) -set(api_yaml_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/api.yaml) +set(api_yaml_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/ops.yaml) set(legacy_api_yaml_file - ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/legacy_api.yaml) + ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/legacy_ops.yaml) set(api_header_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/include/api.h) set(api_source_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/lib/api.cc) set(api_header_file_tmp ${api_header_file}.tmp) @@ -55,7 +55,7 @@ set(dygraph_api_source_file_tmp ${dygraph_api_source_file}.tmp) set(sparse_api_gen_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/sparse_api_gen.py) set(sparse_api_yaml_file - ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_api.yaml) + ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_ops.yaml) set(sparse_api_header_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/include/sparse_api.h) set(sparse_api_source_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/lib/sparse_api.cc) @@ -66,7 +66,7 @@ set(sparse_api_source_file_tmp ${sparse_api_source_file}.tmp) set(sparse_bw_api_gen_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/sparse_bw_api_gen.py) set(sparse_bw_api_yaml_file - ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_bw_api.yaml) + ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/sparse_backward.yaml) set(sparse_bw_api_header_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/backward/sparse_bw_api.h) set(sparse_bw_api_source_file @@ -78,7 +78,7 @@ set(sparse_bw_api_source_file_tmp ${sparse_bw_api_source_file}.tmp) set(strings_api_gen_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/strings_api_gen.py) set(strings_api_yaml_file - ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/strings_api.yaml) + ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/strings_ops.yaml) set(strings_api_header_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/include/strings_api.h) set(strings_api_source_file @@ -97,8 +97,7 @@ set(wrapped_infermeta_source_file # op extra info file set(ops_extra_info_gen_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/ops_extra_info_gen.py) -set(api_compat_yaml_file - ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/api_compat.yaml) +set(op_compat_yaml_file ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/op_compat.yaml) set(ops_extra_info_file ${CMAKE_SOURCE_DIR}/paddle/fluid/operators/ops_extra_info.cc) @@ -130,10 +129,10 @@ message( execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml COMMAND ${CMAKE_COMMAND} -E make_directory ${parsed_api_dir} - COMMAND ${PYTHON_EXECUTABLE} generator/parse_api.py --api_yaml_path ./api.yaml + COMMAND ${PYTHON_EXECUTABLE} generator/parse_api.py --api_yaml_path ./ops.yaml --output_path ./parsed_apis/api.parsed.yaml COMMAND ${PYTHON_EXECUTABLE} generator/parse_api.py --api_yaml_path - ./legacy_api.yaml --output_path ./parsed_apis/legacy_api.parsed.yaml + ./legacy_ops.yaml --output_path ./parsed_apis/legacy_api.parsed.yaml COMMAND ${PYTHON_EXECUTABLE} generator/parse_api.py --api_yaml_path ./backward.yaml --output_path ./parsed_apis/backward_api.parsed.yaml --backward @@ -175,7 +174,7 @@ execute_process( ${PYTHON_EXECUTABLE} generator/generate_op.py --api_yaml_path ./parsed_apis/api.parsed.yaml --backward_api_yaml_path ./parsed_apis/backward_api.parsed.yaml --api_version_yaml_path - api_version.yaml --api_compat_yaml_path api_compat.yaml --output_op_path + op_version.yaml --op_compat_yaml_path op_compat.yaml --output_op_path "${generated_op_path}.tmp" --output_arg_map_path "${generated_argument_mapping_path}.tmp" RESULT_VARIABLE _result) @@ -221,9 +220,8 @@ endif() # generate ops extra info execute_process( - COMMAND - ${PYTHON_EXECUTABLE} ${ops_extra_info_gen_file} --api_compat_yaml_path - ${api_compat_yaml_file} --ops_extra_info_path ${ops_extra_info_file}) + COMMAND ${PYTHON_EXECUTABLE} ${ops_extra_info_gen_file} --op_compat_yaml_path + ${op_compat_yaml_file} --ops_extra_info_path ${ops_extra_info_file}) message("generate ${ops_extra_info_file}") # generate forward api diff --git a/paddle/phi/api/lib/data_transform.cc b/paddle/phi/api/lib/data_transform.cc index 10b01f94662..363e1f65d0a 100644 --- a/paddle/phi/api/lib/data_transform.cc +++ b/paddle/phi/api/lib/data_transform.cc @@ -40,7 +40,7 @@ inline bool NeedTransformPlace(const paddle::platform::Place& input, const TransformFlag& transform_flag) { // NOTE(dev): The default value of TransformFlag is True, if it is set with // False - // somewhere such as api.yaml or backward.yaml that means we should skip data + // somewhere such as ops.yaml or backward.yaml that means we should skip data // transform. Because "stop_transform_" has highest priority. if (!transform_flag.need_trans_backend()) { return false; diff --git a/paddle/phi/api/yaml/backward.yaml b/paddle/phi/api/yaml/backward.yaml index d2ed2533ae0..9d81435169c 100644 --- a/paddle/phi/api/yaml/backward.yaml +++ b/paddle/phi/api/yaml/backward.yaml @@ -1,4 +1,4 @@ -- backward_api : atan2_grad +- backward_op : atan2_grad forward : atan2 (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -8,7 +8,7 @@ kernel : func : atan2_grad -- backward_api : cholesky_grad +- backward_op : cholesky_grad forward : cholesky (Tensor x, bool upper) -> Tensor(out) args : (Tensor out, Tensor out_grad, bool upper) output : Tensor(x_grad) @@ -18,7 +18,7 @@ kernel : func : cholesky_grad -- backward_api : cholesky_solve_grad +- backward_op : cholesky_solve_grad forward : cholesky_solve (Tensor x, Tensor y, bool upper) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, bool upper) output : Tensor(x_grad), Tensor(y_grad) @@ -28,7 +28,7 @@ kernel : func : cholesky_solve_grad -- backward_api : cross_grad +- backward_op : cross_grad forward : cross (Tensor x, Tensor y, int axis = 9) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis) output : Tensor(x_grad), Tensor(y_grad) @@ -39,7 +39,7 @@ func : cross_grad data_type : out_grad -- backward_api : diag_grad +- backward_op : diag_grad forward : diag (Tensor x, int offset, float padding_value) -> Tensor(out) args : (Tensor x, Tensor out_grad, int offset) output : Tensor(x_grad) @@ -51,7 +51,7 @@ data_type : out_grad no_need_buffer : x -- backward_api : diagonal_grad +- backward_op : diagonal_grad forward : diagonal (Tensor x, int offset, int axis1, int axis2) -> Tensor(out) args : (Tensor x, Tensor out_grad, int offset = 0, int axis1 = 0, int axis2 = 1) output : Tensor(x_grad) @@ -63,7 +63,7 @@ data_type : out_grad no_need_buffer : x -- backward_api : digamma_grad +- backward_op : digamma_grad forward : digamma (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -73,7 +73,7 @@ kernel : func : digamma_grad -- backward_api : dist_grad +- backward_op : dist_grad forward : dist (Tensor x, Tensor y, float p) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, float p) output : Tensor(x_grad), Tensor(y_grad) @@ -83,7 +83,7 @@ kernel : func : dist_grad -- backward_api : dot_grad +- backward_op : dot_grad forward : dot (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -94,7 +94,7 @@ func : dot_grad data_type : out_grad -- backward_api : erf_grad +- backward_op : erf_grad forward : erf (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -105,7 +105,7 @@ func : erf_grad data_type : out_grad -- backward_api : erfinv_grad +- backward_op : erfinv_grad forward : erfinv (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -115,7 +115,7 @@ kernel : func : erfinv_grad -- backward_api : fft_c2c_grad +- backward_op : fft_c2c_grad forward: fft_c2c(Tensor x, int64_t[] axes, str normalization, bool forward) -> Tensor(out) args : (Tensor out_grad, int64_t[] axes, str normalization, bool forward) output: Tensor(x_grad) @@ -125,7 +125,7 @@ kernel : func : fft_c2c_grad -- backward_api : fft_c2r_grad +- backward_op : fft_c2r_grad forward: fft_c2r(Tensor x, int64_t[] axes, str normalization, bool forward, int64_t last_dim_size) -> Tensor(out) args : (Tensor out_grad, int64_t[] axes, str normalization, bool forward, int64_t last_dim_size) output: Tensor(x_grad) @@ -135,7 +135,7 @@ func : fft_c2r_grad data_type: out_grad -- backward_api : fft_r2c_grad +- backward_op : fft_r2c_grad forward: fft_r2c(Tensor x, int64_t[] axes, str normalization, bool forward, bool onesided) -> Tensor(out) args : (Tensor x, Tensor out_grad, int64_t[] axes, str normalization, bool forward, bool onesided) output: Tensor(x_grad) @@ -147,7 +147,7 @@ data_type: out_grad no_need_buffer: x -- backward_api : graph_send_uv_grad +- backward_op : graph_send_uv_grad forward : graph_send_uv (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, str message_op = "ADD") -> Tensor(out) args: (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, Tensor out_grad, str message_op = "ADD") output : Tensor(x_grad), Tensor(y_grad) @@ -158,7 +158,7 @@ func : graph_send_uv_grad data_type : x -- backward_api : lgamma_grad +- backward_op : lgamma_grad forward : lgamma(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -168,7 +168,7 @@ kernel : func : lgamma_grad -- backward_api : mv_grad +- backward_op : mv_grad forward : mv (Tensor x, Tensor vec) -> Tensor(out) args : (Tensor x, Tensor vec, Tensor out_grad) output : Tensor(x_grad), Tensor(vec_grad) @@ -178,7 +178,7 @@ kernel : func : mv_grad -- backward_api : poisson_grad +- backward_op : poisson_grad forward : poisson (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) @@ -188,7 +188,7 @@ kernel : func : poisson_grad -- backward_api : solve_grad +- backward_op : solve_grad forward : solve (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -198,7 +198,7 @@ kernel : func : solve_grad -- backward_api : trace_grad +- backward_op : trace_grad forward : trace (Tensor x, int offset, int axis1, int axis2) -> Tensor(out) args : (Tensor x, Tensor out_grad, int offset, int axis1, int axis2) output : Tensor(x_grad) @@ -210,7 +210,7 @@ data_type : out_grad no_need_buffer : x -- backward_api : trunc_grad +- backward_op : trunc_grad forward : trunc (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) diff --git a/paddle/phi/api/yaml/generator/api_base.py b/paddle/phi/api/yaml/generator/api_base.py index f76bc688ec2..cbee67aaa5c 100644 --- a/paddle/phi/api/yaml/generator/api_base.py +++ b/paddle/phi/api/yaml/generator/api_base.py @@ -50,7 +50,7 @@ class BaseAPI(object): self.inplace_map, self.view_map = {}, {} def get_api_name(self, api_item_yaml): - return api_item_yaml['api'] + return api_item_yaml['op'] def get_api_func_name(self): return self.api @@ -881,7 +881,7 @@ PADDLE_API {self.get_return_type(inplace_flag=True)} {api_func_name}({self.get_d def get_condition_code(self, kernel_name): assert self.kernel['dispatch'][kernel_name], \ - f"{self.api} api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'scale' in api.yaml." + f"{self.api} api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'scale' in ops.yaml." input_types = self.kernel['dispatch'][kernel_name][0] condition_list = [] for i, in_type in enumerate(input_types): diff --git a/paddle/phi/api/yaml/generator/api_gen.py b/paddle/phi/api/yaml/generator/api_gen.py index dc30472f944..80a9d586ca3 100644 --- a/paddle/phi/api/yaml/generator/api_gen.py +++ b/paddle/phi/api/yaml/generator/api_gen.py @@ -319,7 +319,7 @@ def main(): parser.add_argument('--api_yaml_path', help='path to api yaml file', nargs='+', - default='paddle/phi/api/yaml/api.yaml') + default='paddle/phi/api/yaml/ops.yaml') parser.add_argument('--api_header_path', help='output of generated api header code file', diff --git a/paddle/phi/api/yaml/generator/backward_api_gen.py b/paddle/phi/api/yaml/generator/backward_api_gen.py index f2a42be7373..1a8b9cc4d39 100644 --- a/paddle/phi/api/yaml/generator/backward_api_gen.py +++ b/paddle/phi/api/yaml/generator/backward_api_gen.py @@ -28,14 +28,14 @@ class BackwardAPI(BaseAPI): self.no_need_buffer = self.parse_no_need_buffer(backward_item_yaml) def get_api_name(self, api_item_yaml): - return api_item_yaml['backward_api'] + return api_item_yaml['backward_op'] def parse_forward_config(self, forward_config): # api_name (const Tensor& input, ... , int attr, ...) -> Tensor(out) result = re.search( - r"(?P[a-z][a-z0-9_]+)\s*(?P\([^\)]+\))\s*->\s*(?P.+)", + r"(?P[a-z][a-z0-9_]+)\s*(?P\([^\)]+\))\s*->\s*(?P.+)", forward_config) - api = result.group('api') + api = result.group('op') _, outputs, _, = self.parse_output(self.api, result.group('outputs')) outputs = [item.split('@')[0] for item in outputs] fw_inputs, fw_attrs = self.parse_input_and_attr(api, diff --git a/paddle/phi/api/yaml/generator/generate_op.py b/paddle/phi/api/yaml/generator/generate_op.py index 24f30323a93..5fa3be685e4 100644 --- a/paddle/phi/api/yaml/generator/generate_op.py +++ b/paddle/phi/api/yaml/generator/generate_op.py @@ -65,7 +65,7 @@ def replace_compat_name(api_op_map, forward_api_dict, backward_api_dict): return names[0].strip(), names[1].split(')')[0].strip() for api_args in api_op_map: - api_name, op_name = get_api_and_op_name(api_args['api']) + api_name, op_name = get_api_and_op_name(api_args['op']) if api_name not in forward_api_dict: continue forward_api_item = forward_api_dict[api_name] @@ -175,7 +175,7 @@ def replace_compat_name(api_op_map, forward_api_dict, backward_api_dict): ] -def main(api_yaml_path, backward_yaml_path, api_compat_yaml_path, +def main(api_yaml_path, backward_yaml_path, op_compat_yaml_path, api_version_yaml_path, output_op_path, output_arg_map_path): with open(api_yaml_path, "rt") as f: apis = yaml.safe_load(f) @@ -191,9 +191,9 @@ def main(api_yaml_path, backward_yaml_path, api_compat_yaml_path, api_versions = yaml.safe_load(f) # add api version info into api for api_version in api_versions: - forward_api_dict[api_version['api']]['version'] = api_version['version'] + forward_api_dict[api_version['op']]['version'] = api_version['version'] - with open(api_compat_yaml_path, "rt") as f: + with open(op_compat_yaml_path, "rt") as f: api_op_map = yaml.safe_load(f) for api in apis: @@ -244,7 +244,7 @@ if __name__ == "__main__": parser.add_argument('--backward_api_yaml_path', type=str, help="parsed backward api yaml file.") - parser.add_argument('--api_compat_yaml_path', + parser.add_argument('--op_compat_yaml_path', type=str, help="api args compat yaml file.") parser.add_argument('--api_version_yaml_path', @@ -260,5 +260,5 @@ if __name__ == "__main__": args = parser.parse_args() main(args.api_yaml_path, args.backward_api_yaml_path, - args.api_compat_yaml_path, args.api_version_yaml_path, + args.op_compat_yaml_path, args.api_version_yaml_path, args.output_op_path, args.output_arg_map_path) diff --git a/paddle/phi/api/yaml/generator/intermediate_api_gen.py b/paddle/phi/api/yaml/generator/intermediate_api_gen.py index 7834e5c230c..8bec3e8c158 100644 --- a/paddle/phi/api/yaml/generator/intermediate_api_gen.py +++ b/paddle/phi/api/yaml/generator/intermediate_api_gen.py @@ -135,11 +135,11 @@ def main(): parser.add_argument('--api_yaml_path', nargs='+', help='path to api yaml file', - default='paddle/phi/api/yaml/api.yaml') + default='paddle/phi/api/yaml/ops.yaml') parser.add_argument('--sparse_api_yaml_path', help='path to sparse api yaml file', - default='paddle/phi/api/yaml/sparse_api.yaml') + default='paddle/phi/api/yaml/sparse_ops.yaml') parser.add_argument('--dygraph_api_header_path', help='output of generated dygraph api header code file', diff --git a/paddle/phi/api/yaml/generator/ops_extra_info_gen.py b/paddle/phi/api/yaml/generator/ops_extra_info_gen.py index d7ece0d2a45..6f234e494f5 100644 --- a/paddle/phi/api/yaml/generator/ops_extra_info_gen.py +++ b/paddle/phi/api/yaml/generator/ops_extra_info_gen.py @@ -65,9 +65,9 @@ def parse_attr(attr_str): 'name'), result.group('default_val') -def generate_extra_info(api_compat_yaml_path, ops_extra_info_path): +def generate_extra_info(op_compat_yaml_path, ops_extra_info_path): compat_apis = [] - with open(api_compat_yaml_path, 'rt') as f: + with open(op_compat_yaml_path, 'rt') as f: compat_apis = yaml.safe_load(f) def get_op_name(api_item): @@ -80,9 +80,9 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path): extra_map_str_list = [] extra_checker_str_list = [] - for api_compat_args in compat_apis: - if 'extra' in api_compat_args: - extra_args_map = api_compat_args['extra'] + for op_compat_args in compat_apis: + if 'extra' in op_compat_args: + extra_args_map = op_compat_args['extra'] # TODO(chenweihang): add inputs and outputs if 'attrs' in extra_args_map: attr_map_list = [] @@ -103,13 +103,13 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path): api_extra_attr_checkers = ",\n ".join( attr_checker_func_list) extra_map_str_list.append( - f"{{\"{get_op_name(api_compat_args['api'])}\", {{ {api_extra_attr_map} }}}}" + f"{{\"{get_op_name(op_compat_args['op'])}\", {{ {api_extra_attr_map} }}}}" ) extra_checker_str_list.append( - f"{{\"{get_op_name(api_compat_args['api'])}\", {{ {api_extra_attr_checkers} }}}}" + f"{{\"{get_op_name(op_compat_args['op'])}\", {{ {api_extra_attr_checkers} }}}}" ) - if 'backward' in api_compat_args: - for bw_item in api_compat_args['backward'].split(','): + if 'backward' in op_compat_args: + for bw_item in op_compat_args['backward'].split(','): bw_op_name = get_op_name(bw_item) extra_map_str_list.append( f"{{\"{bw_op_name}\", {{ {api_extra_attr_map} }}}}") @@ -127,9 +127,9 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path): def main(): parser = argparse.ArgumentParser( description='Generate PaddlePaddle Extra Param Info for Op') - parser.add_argument('--api_compat_yaml_path', + parser.add_argument('--op_compat_yaml_path', help='path to api compat yaml file', - default='paddle/phi/api/yaml/api_compat.yaml') + default='paddle/phi/api/yaml/op_compat.yaml') parser.add_argument('--ops_extra_info_path', help='output of generated extra_prama_info code file', @@ -137,10 +137,10 @@ def main(): options = parser.parse_args() - api_compat_yaml_path = options.api_compat_yaml_path + op_compat_yaml_path = options.op_compat_yaml_path ops_extra_info_path = options.ops_extra_info_path - generate_extra_info(api_compat_yaml_path, ops_extra_info_path) + generate_extra_info(op_compat_yaml_path, ops_extra_info_path) if __name__ == '__main__': diff --git a/paddle/phi/api/yaml/generator/parse_api.py b/paddle/phi/api/yaml/generator/parse_api.py index fcaf365951e..91fd44b7093 100644 --- a/paddle/phi/api/yaml/generator/parse_api.py +++ b/paddle/phi/api/yaml/generator/parse_api.py @@ -27,7 +27,7 @@ def main(api_yaml_path, output_path, backward): apis = [] else: apis = [ - parse_api_entry(api, "backward_api" if backward else "api") + parse_api_entry(api, "backward_op" if backward else "op") for api in apis ] diff --git a/paddle/phi/api/yaml/generator/parse_utils.py b/paddle/phi/api/yaml/generator/parse_utils.py index 11a0b49eeef..f617f166dd1 100644 --- a/paddle/phi/api/yaml/generator/parse_utils.py +++ b/paddle/phi/api/yaml/generator/parse_utils.py @@ -210,9 +210,9 @@ def extract_type_and_name(records: List[Dict]) -> List[Dict]: def parse_forward(api_name: str, forward_config: str) -> Dict[str, Any]: # api_name (const Tensor& input, ... , int attr, ...) -> Tensor(out) result = re.search( - r"(?P[a-z][a-z0-9_]+)\s*(?P\([^\)]+\))\s*->\s*(?P.+)", + r"(?P[a-z][a-z0-9_]+)\s*(?P\([^\)]+\))\s*->\s*(?P.+)", forward_config) - api = result.group("api") + api = result.group("op") outputs = parse_outputs(api_name, result.group("outputs")) outputs = extract_type_and_name(outputs) @@ -228,7 +228,7 @@ def parse_forward(api_name: str, forward_config: str) -> Dict[str, Any]: return forward_cfg -def parse_api_entry(api_entry: Dict[str, Any], name_field="api"): +def parse_api_entry(api_entry: Dict[str, Any], name_field="op"): api_name = api_entry[name_field] inputs, attrs = parse_input_and_attr(api_name, api_entry["args"]) outputs = parse_outputs(api_name, api_entry["output"]) @@ -334,7 +334,7 @@ def parse_api_entry(api_entry: Dict[str, Any], name_field="api"): api["backward"] = backward # forward for backward_apis - is_backward_api = name_field == "backward_api" + is_backward_api = name_field == "backward_op" if is_backward_api: if "forward" in api_entry: forward = parse_forward(api_name, api_entry["forward"]) diff --git a/paddle/phi/api/yaml/generator/sparse_api_gen.py b/paddle/phi/api/yaml/generator/sparse_api_gen.py index ac98c78f58a..eb36bea8e89 100644 --- a/paddle/phi/api/yaml/generator/sparse_api_gen.py +++ b/paddle/phi/api/yaml/generator/sparse_api_gen.py @@ -160,7 +160,7 @@ class SparseAPI(ForwardAPI): def get_condition_code(self, kernel_name): assert self.kernel['dispatch'][kernel_name], \ - f"{self.api} api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'conv3d' in sparse_api.yaml." + f"{self.api} api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'conv3d' in sparse_ops.yaml." input_types = self.kernel['dispatch'][kernel_name][0] sparse_type_map = { 'sparse_coo': 'DataLayout::SPARSE_COO', @@ -284,7 +284,7 @@ def main(): description='Generate PaddlePaddle C++ Sparse API files') parser.add_argument('--api_yaml_path', help='path to sparse api yaml file', - default='paddle/phi/api/yaml/sparse_api.yaml') + default='paddle/phi/api/yaml/sparse_ops.yaml') parser.add_argument('--api_header_path', help='output of generated api header code file', diff --git a/paddle/phi/api/yaml/generator/sparse_bw_api_gen.py b/paddle/phi/api/yaml/generator/sparse_bw_api_gen.py index 4692ed64513..6845f91c604 100644 --- a/paddle/phi/api/yaml/generator/sparse_bw_api_gen.py +++ b/paddle/phi/api/yaml/generator/sparse_bw_api_gen.py @@ -164,7 +164,7 @@ def main(): description='Generate PaddlePaddle C++ Sparse API files') parser.add_argument('--api_yaml_path', help='path to sparse api yaml file', - default='paddle/phi/api/yaml/sparse_bw_api.yaml') + default='paddle/phi/api/yaml/sparse_backward.yaml') parser.add_argument('--api_header_path', help='output of generated api header code file', diff --git a/paddle/phi/api/yaml/generator/strings_api_gen.py b/paddle/phi/api/yaml/generator/strings_api_gen.py index e8df9425144..94c89580358 100644 --- a/paddle/phi/api/yaml/generator/strings_api_gen.py +++ b/paddle/phi/api/yaml/generator/strings_api_gen.py @@ -351,7 +351,7 @@ def main(): description='Generate PaddlePaddle C++ Strings API files') parser.add_argument('--api_yaml_path', help='path to sparse api yaml file', - default='paddle/phi/api/yaml/strings_api.yaml') + default='paddle/phi/api/yaml/strings_ops.yaml') parser.add_argument('--api_header_path', help='output of generated api header code file', diff --git a/paddle/phi/api/yaml/generator/wrapped_infermeta_gen.py b/paddle/phi/api/yaml/generator/wrapped_infermeta_gen.py index 0504d3fd108..e456f6f5728 100644 --- a/paddle/phi/api/yaml/generator/wrapped_infermeta_gen.py +++ b/paddle/phi/api/yaml/generator/wrapped_infermeta_gen.py @@ -167,7 +167,7 @@ def main(): parser.add_argument('--api_yaml_path', help='path to api yaml file', nargs='+', - default='paddle/phi/api/yaml/api.yaml') + default='paddle/phi/api/yaml/ops.yaml') parser.add_argument( '--wrapped_infermeta_header_path', help='output of generated wrapped_infermeta header code file', diff --git a/paddle/phi/api/yaml/legacy_backward.yaml b/paddle/phi/api/yaml/legacy_backward.yaml index 3028e0c6c73..6267c99e147 100755 --- a/paddle/phi/api/yaml/legacy_backward.yaml +++ b/paddle/phi/api/yaml/legacy_backward.yaml @@ -1,4 +1,4 @@ -- backward_api : abs_double_grad +- backward_op : abs_double_grad forward : abs_grad (Tensor x, Tensor grad_out) -> Tensor(grad_x) args : (Tensor x, Tensor grad_x_grad) output : Tensor(grad_out_grad) @@ -10,7 +10,7 @@ data_transform: skip_transform : grad_x_grad -- backward_api : abs_grad +- backward_op : abs_grad forward : abs (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -23,7 +23,7 @@ skip_transform : out_grad backward : abs_double_grad -- backward_api : acos_grad +- backward_op : acos_grad forward : acos (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -34,7 +34,7 @@ func : acos_grad inplace : (out_grad -> x_grad) -- backward_api : acosh_grad +- backward_op : acosh_grad forward : acosh (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -45,7 +45,7 @@ func : acosh_grad inplace : (out_grad -> x_grad) -- backward_api : add_double_grad +- backward_op : add_double_grad forward : add_grad (Tensor x, Tensor y, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y) args : (Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1) output : Tensor(grad_out_grad) @@ -58,7 +58,7 @@ backward : add_triple_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : add_grad +- backward_op : add_grad forward : add (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis = -1) output : Tensor(x_grad), Tensor(y_grad) @@ -71,7 +71,7 @@ backward : add_double_grad inplace : (out_grad -> x_grad) -- backward_api : add_triple_grad +- backward_op : add_triple_grad forward : add_double_grad (Tensor y, Tensor grad_out, Tensor grad_grad_x, Tensor grad_grad_y, int axis = -1) -> Tensor(grad_grad_out) args : (Tensor grad_grad_x, Tensor grad_grad_y, Tensor grad_grad_out_grad, int axis = -1) output : Tensor(grad_grad_x_grad), Tensor(grad_grad_y_grad) @@ -82,7 +82,7 @@ func : add_triple_grad inplace : (grad_grad_out_grad -> grad_grad_x_grad) -- backward_api : addmm_grad +- backward_op : addmm_grad forward : addmm (Tensor input, Tensor x, Tensor y, float alpha, float beta) -> Tensor(out) args : (Tensor input, Tensor x, Tensor y, Tensor out_grad, float alpha, float beta) output : Tensor(input_grad), Tensor(x_grad), Tensor(y_grad) @@ -92,7 +92,7 @@ kernel : func : addmm_grad -- backward_api : affine_grid_grad +- backward_op : affine_grid_grad forward : affine_grid (Tensor input, IntArray outputShape, bool use_cudnn=true, bool align_corners=true) -> Tensor(output) args : (Tensor output_grad, IntArray outputShape, bool use_cudnn=true, bool align_corners=true) output : Tensor(input_grad) @@ -104,7 +104,7 @@ param : [output_grad, outputShape, align_corners] use_gpudnn: use_cudnn -- backward_api : amax_grad +- backward_op : amax_grad forward: amax (Tensor x, int64_t[] dims={}, bool keep_dim=false) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] dims={}, bool keep_dim=false, bool reduce_all=false) output : Tensor(x_grad) @@ -114,7 +114,7 @@ kernel : func : amax_grad -- backward_api : amin_grad +- backward_op : amin_grad forward: amin (Tensor x, int64_t[] dims={}, bool keep_dim=false) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] dims={}, bool keep_dim=false, bool reduce_all=false) output : Tensor(x_grad) @@ -124,7 +124,7 @@ kernel : func : amin_grad -- backward_api : angle_grad +- backward_op : angle_grad forward : angle (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -136,7 +136,7 @@ data_transform: skip_transform : out_grad -- backward_api : argsort_grad +- backward_op : argsort_grad forward : argsort (Tensor x, int axis, bool descending) -> Tensor(out), Tensor(indices) args : (Tensor indices, Tensor x, Tensor out_grad, int axis, bool descending) output : Tensor(x_grad) @@ -148,19 +148,19 @@ data_type : out_grad no_need_buffer : x -- backward_api : as_complex_grad +- backward_op : as_complex_grad forward : as_complex (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) invoke : as_real(out_grad) -- backward_api : as_real_grad +- backward_op : as_real_grad forward : as_real (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) invoke : as_complex(out_grad) -- backward_api : asin_grad +- backward_op : asin_grad forward : asin (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -171,7 +171,7 @@ func : asin_grad inplace : (out_grad -> x_grad) -- backward_api : asinh_grad +- backward_op : asinh_grad forward : asinh (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -182,29 +182,13 @@ func : asinh_grad inplace : (out_grad -> x_grad) -- backward_api : assign_double_grad - forward : assign_grad (Tensor grad_out) -> Tensor(grad_x) - args : (Tensor grad_x_grad) - output : Tensor(grad_out_grad) - infer_meta : - func : UnchangedInferMeta - kernel : - func : assign - backward: assign_triple_grad - inplace : (grad_x_grad -> grad_out_grad) - -- backward_api : assign_grad +- backward_op : assign_grad forward : assign (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) - infer_meta : - func : UnchangedInferMeta - kernel : - func : assign - backward: assign_double_grad - inplace : (out_grad -> x_grad) + invoke : assign(out_grad) -- backward_api : assign_out__grad +- backward_op : assign_out__grad forward : assign_out_ (Tensor x, Tensor output) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) @@ -214,17 +198,7 @@ func : assign inplace : (out_grad -> x_grad) -- backward_api : assign_triple_grad - forward : assign_double_grad (Tensor grad_out) -> Tensor(grad_x) - args : (Tensor grad_x_grad) - output : Tensor(grad_out_grad) - infer_meta : - func : UnchangedInferMeta - kernel : - func : assign - inplace : (grad_x_grad -> grad_out_grad) - -- backward_api : atan_grad +- backward_op : atan_grad forward : atan (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -235,7 +209,7 @@ func : atan_grad inplace : (out_grad -> x_grad) -- backward_api : atanh_grad +- backward_op : atanh_grad forward : atanh (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -246,7 +220,7 @@ func : atanh_grad inplace : (out_grad -> x_grad) -- backward_api : batch_norm_double_grad +- backward_op : batch_norm_double_grad forward : batch_norm_grad (Tensor x, Tensor scale, Tensor bias, Tensor out_mean, Tensor out_variance, Tensor saved_mean, Tensor saved_variance, Tensor reserve_space, Tensor grad_out, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) -> Tensor(grad_x), Tensor(grad_scale), Tensor(grad_bias) args : (Tensor x, Tensor scale, Tensor out_mean, Tensor out_variance, Tensor saved_mean, Tensor saved_variance, Tensor grad_out, Tensor grad_x_grad, Tensor grad_scale_grad, Tensor grad_bias_grad, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) output : Tensor(x_grad), Tensor(scale_grad), Tensor(grad_out_grad) @@ -259,7 +233,7 @@ optional : out_mean, out_variance inplace : (grad_out -> grad_out_grad) -- backward_api : batch_norm_grad +- backward_op : batch_norm_grad forward : batch_norm (Tensor x, Tensor scale, Tensor bias, Tensor mean, Tensor variance, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) -> Tensor(out), Tensor(mean_out), Tensor(variance_out), Tensor(saved_mean), Tensor(saved_variance), Tensor(reserve_space) args : (Tensor x, Tensor scale, Tensor bias, Tensor mean_out, Tensor variance_out, Tensor saved_mean, Tensor saved_variance, Tensor reserve_space, Tensor out_grad, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad) @@ -272,7 +246,7 @@ optional : mean_out, variance_out, reserve_space backward : batch_norm_double_grad -- backward_api : bce_loss_grad +- backward_op : bce_loss_grad forward : bce_loss (Tensor input, Tensor label) -> Tensor(out) args : (Tensor input, Tensor label, Tensor out_grad) output : Tensor(input_grad) @@ -283,7 +257,7 @@ func : bce_loss_grad inplace : (out_grad -> input_grad) -- backward_api : bicubic_interp_grad +- backward_op : bicubic_interp_grad forward : bicubic_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) -> Tensor(output) args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(x_grad) @@ -295,7 +269,7 @@ func : bicubic_interp_grad data_type : output_grad -- backward_api : bilinear_interp_grad +- backward_op : bilinear_interp_grad forward : bilinear_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) -> Tensor(output) args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(x_grad) @@ -307,7 +281,7 @@ func : bilinear_interp_grad data_type : output_grad -- backward_api : bilinear_tensor_product_grad +- backward_op : bilinear_tensor_product_grad forward : bilinear_tensor_product (Tensor x, Tensor y, Tensor weight, Tensor bias) -> Tensor(out) args : (Tensor x, Tensor y, Tensor weight, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad), Tensor(weight_grad), Tensor(bias_grad) @@ -316,7 +290,7 @@ kernel : func : bilinear_tensor_product_grad -- backward_api : bmm_grad +- backward_op : bmm_grad forward : bmm (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -325,7 +299,7 @@ kernel : func : bmm_grad -- backward_api : brelu_grad +- backward_op : brelu_grad forward : brelu (Tensor x, float t_min, float t_max) -> Tensor(out) args : (Tensor x, Tensor out_grad, float t_min, float t_max) output : Tensor(x_grad) @@ -336,7 +310,7 @@ func : brelu_grad inplace : (out_grad -> x_grad) -- backward_api : broadcast_tensors_grad +- backward_op : broadcast_tensors_grad forward : broadcast_tensors (Tensor[] x) -> Tensor[](out) args : (Tensor[] x, Tensor[] out_grad) output : Tensor[](x_grad) @@ -348,7 +322,7 @@ param : [out_grad] no_need_buffer : x -- backward_api : cast_grad +- backward_op : cast_grad forward : cast (Tensor x, DataType out_dtype) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -360,7 +334,7 @@ data_type : out_grad no_need_buffer : x -- backward_api : ceil_grad +- backward_op : ceil_grad forward : ceil(Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) @@ -371,7 +345,7 @@ func : ceil_grad inplace : (out_grad -> x_grad) -- backward_api : celu_double_grad +- backward_op : celu_double_grad forward : celu_grad(Tensor x, Tensor grad_out, float alpha) -> Tensor(grad_x) args : (Tensor x, Tensor grad_out, Tensor grad_x_grad, float alpha) output : Tensor(x_grad), Tensor(grad_out_grad) @@ -382,7 +356,7 @@ func : celu_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : celu_grad +- backward_op : celu_grad forward : celu(Tensor x, float alpha) -> Tensor(out) args : (Tensor x, Tensor out_grad, float alpha) output : Tensor(x_grad) @@ -394,7 +368,7 @@ backward : celu_double_grad inplace : (out_grad -> x_grad) -- backward_api : clip_double_grad +- backward_op : clip_double_grad forward : clip_grad (Tensor x, Tensor grad_out, Scalar min = 0., Scalar max = 0.) -> Tensor(grad_x) args : (Tensor x, Tensor grad_x_grad, Scalar min = 0., Scalar max = 0.) output : Tensor(grad_out_grad) @@ -404,7 +378,7 @@ kernel : func : clip_grad -- backward_api : clip_grad +- backward_op : clip_grad forward : clip (Tensor x, Scalar min, Scalar max) -> Tensor(out) args : (Tensor x, Tensor out_grad, Scalar min = 0., Scalar max = 0.) output : Tensor(x_grad) @@ -416,7 +390,7 @@ backward : clip_double_grad inplace : (out_grad -> x_grad) -- backward_api : complex_grad +- backward_op : complex_grad forward : complex (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -426,7 +400,7 @@ func : complex_grad data_type : x -- backward_api : concat_double_grad +- backward_op : concat_double_grad forward : concat_grad (Tensor[] x, Tensor grad_out, Scalar axis) -> Tensor[](grad_x) args : (Tensor[] grad_x_grad, Scalar axis = 0) output : Tensor(grad_out_grad) @@ -436,7 +410,7 @@ kernel : func : concat -- backward_api : concat_grad +- backward_op : concat_grad forward : concat (Tensor[] x, Scalar axis) -> Tensor(out) args : (Tensor[] x, Tensor out_grad, Scalar axis = 0) output : Tensor[](x_grad){x.size()} @@ -448,7 +422,7 @@ no_need_buffer : x backward : concat_double_grad -- backward_api : conj_grad +- backward_op : conj_grad forward : conj (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) @@ -458,7 +432,7 @@ kernel : func : conj -- backward_api : conv2d_grad +- backward_op : conv2d_grad forward : conv2d (Tensor input, Tensor filter, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(out) args : (Tensor input, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) output : Tensor(input_grad), Tensor(filter_grad) @@ -470,7 +444,7 @@ use_gpudnn : true backward : conv2d_grad_grad -- backward_api : conv2d_grad_grad +- backward_op : conv2d_grad_grad forward : conv2d_grad (Tensor input, Tensor filter, Tensor grad_out, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(grad_input), Tensor(grad_filter) args : (Tensor input, Tensor filter, Tensor grad_out, Tensor grad_input_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) output : Tensor(input_grad), Tensor(filter_grad), Tensor(grad_out_grad) @@ -482,7 +456,7 @@ use_gpudnn : true optional : grad_input_grad, grad_filter_grad -- backward_api : conv2d_transpose_double_grad +- backward_op : conv2d_transpose_double_grad forward : conv2d_transpose_grad(Tensor x, Tensor filter, Tensor grad_out, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(grad_x), Tensor(grad_filter) args : (Tensor x, Tensor filter, Tensor grad_out, Tensor grad_x_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) output : Tensor(x_grad), Tensor(filter_grad), Tensor(grad_out_grad) @@ -492,7 +466,7 @@ func : conv2d_transpose_grad_grad use_gpudnn : true -- backward_api : conv2d_transpose_grad +- backward_op : conv2d_transpose_grad forward : conv2d_transpose(Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(out) args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) output : Tensor(x_grad), Tensor(filter_grad) @@ -503,7 +477,7 @@ use_gpudnn : true backward : conv2d_transpose_double_grad -- backward_api : conv3d_grad +- backward_op : conv3d_grad forward : conv3d (Tensor input, Tensor filter, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(out) args : (Tensor input, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) output : Tensor(input_grad), Tensor(filter_grad) @@ -515,7 +489,7 @@ use_gpudnn : true backward : conv3d_grad_grad -- backward_api : conv3d_grad_grad +- backward_op : conv3d_grad_grad forward : conv3d_grad (Tensor input, Tensor filter, Tensor grad_out, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(grad_input), Tensor(grad_filter) args : (Tensor input, Tensor filter, Tensor grad_out, Tensor grad_input_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) output : Tensor(input_grad), Tensor(filter_grad), Tensor(grad_out_grad) @@ -527,7 +501,7 @@ use_gpudnn : true optional : grad_input_grad, grad_filter_grad -- backward_api : conv3d_transpose_grad +- backward_op : conv3d_transpose_grad forward : conv3d_transpose(Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(out) args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format) output : Tensor(x_grad), Tensor(filter_grad) @@ -537,7 +511,7 @@ func : conv3d_transpose_grad use_gpudnn : true -- backward_api : cos_grad +- backward_op : cos_grad forward : cos (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -548,7 +522,7 @@ func : cos_grad inplace : (out_grad -> x_grad) -- backward_api : cosh_grad +- backward_op : cosh_grad forward : cosh (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -559,7 +533,7 @@ func : cosh_grad inplace : (out_grad -> x_grad) -- backward_api : crop_tensor_grad +- backward_op : crop_tensor_grad forward : crop_tensor (Tensor x, IntArray shape, IntArray offsets) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray offsets) output : Tensor(x_grad) @@ -569,7 +543,7 @@ func : crop_tensor_grad data_type : x -- backward_api : cross_entropy_with_softmax_grad +- backward_op : cross_entropy_with_softmax_grad forward : cross_entropy_with_softmax (Tensor input, Tensor label, bool soft_label, bool use_softmax, bool numeric_stable_mode, int ignore_index, int axis) -> Tensor(softmax), Tensor(loss) args : (Tensor label, Tensor softmax, Tensor loss_grad, bool soft_label, bool use_softmax, bool numeric_stable_mode, int ignore_index, int axis) output : Tensor(input_grad) @@ -580,7 +554,7 @@ data_type : softmax inplace : (softmax -> input_grad) -- backward_api : cumprod_grad +- backward_op : cumprod_grad forward : cumprod (Tensor x, int dim) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int dim) output : Tensor(x_grad) @@ -590,13 +564,13 @@ kernel : func : cumprod_grad -- backward_api : cumsum_grad +- backward_op : cumsum_grad forward : cumsum(Tensor x, Scalar axis, bool flatten, bool exclusive, bool reverse) -> Tensor(out) args : (Tensor out_grad, Scalar axis, bool flatten, bool exclusive, bool reverse) output : Tensor(x_grad) invoke : cumsum(out_grad, axis, flatten, exclusive, !reverse) -- backward_api : deformable_conv_grad +- backward_op : deformable_conv_grad forward : deformable_conv(Tensor x, Tensor offset, Tensor filter, Tensor mask, int[] strides, int[] paddings, int[] dilations, int deformable_groups, int groups, int im2col_step) -> Tensor(out) args : (Tensor x, Tensor offset, Tensor filter, Tensor mask, Tensor out_grad, int[] strides, int[] paddings, int[] dilations, int deformable_groups, int groups, int im2col_step) output : Tensor(x_grad), Tensor(offset_grad), Tensor(filter_grad), Tensor(mask_grad) @@ -607,7 +581,7 @@ data_type : x optional : mask -- backward_api : depthwise_conv2d_grad +- backward_op : depthwise_conv2d_grad forward : depthwise_conv2d (Tensor input, Tensor filter, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu, bool use_gpudnn) -> Tensor(out) args : (Tensor input, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu, bool use_gpudnn) output : Tensor(input_grad), Tensor(filter_grad) @@ -620,7 +594,7 @@ use_gpudnn : use_gpudnn backward : depthwise_conv2d_grad_grad -- backward_api : depthwise_conv2d_grad_grad +- backward_op : depthwise_conv2d_grad_grad forward : depthwise_conv2d_grad (Tensor input, Tensor filter, Tensor grad_out, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu, bool use_gpudnn) -> Tensor(grad_input), Tensor(grad_filter) args : (Tensor input, Tensor filter, Tensor grad_out, Tensor grad_input_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu) output : Tensor(input_grad), Tensor(filter_grad), Tensor(grad_out_grad) @@ -631,7 +605,7 @@ func : depthwise_conv2d_grad_grad optional : grad_input_grad, grad_filter_grad -- backward_api : depthwise_conv2d_transpose_grad +- backward_op : depthwise_conv2d_transpose_grad forward : depthwise_conv2d_transpose(Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(out) args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) output : Tensor(x_grad), Tensor(filter_grad) @@ -640,7 +614,7 @@ kernel : func : depthwise_conv2d_transpose_grad -- backward_api : det_grad +- backward_op : det_grad forward : det (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -650,7 +624,7 @@ kernel : func : determinant_grad -- backward_api : divide_double_grad +- backward_op : divide_double_grad forward : divide_grad (Tensor x, Tensor y, Tensor out, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y) args : (Tensor y, Tensor out, Tensor grad_x, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1) output : Tensor(y_grad), Tensor(out_grad), Tensor(grad_out_grad) @@ -663,7 +637,7 @@ optional : grad_x_grad, grad_y_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : divide_grad +- backward_op : divide_grad forward : divide (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, int axis = -1) output : Tensor(x_grad), Tensor(y_grad) @@ -674,7 +648,7 @@ func : divide_grad backward : divide_double_grad -- backward_api : dropout_grad +- backward_op : dropout_grad forward : dropout (Tensor x, Tensor seed_tensor, Scalar p, bool is_test, str mode, int seed, bool fix_seed) -> Tensor(out), Tensor(mask) args : (Tensor mask, Tensor out_grad, Scalar p, bool is_test, str mode) output : Tensor(x_grad) @@ -684,7 +658,7 @@ kernel : func : dropout_grad -- backward_api : eig_grad +- backward_op : eig_grad forward : eig (Tensor x) -> Tensor(out_w), Tensor(out_v) args : (Tensor out_w, Tensor out_v, Tensor out_w_grad, Tensor out_v_grad) output : Tensor(x_grad) @@ -697,7 +671,7 @@ data_transform: skip_transform : out_w, out_w_grad -- backward_api : eigh_grad +- backward_op : eigh_grad forward : eigh (Tensor x, str uplo) -> Tensor(out_w), Tensor(out_v) args : (Tensor out_w, Tensor out_v, Tensor out_w_grad, Tensor out_v_grad) output : Tensor(x_grad) @@ -710,7 +684,7 @@ data_transform: skip_transform : out_w, out_w_grad -- backward_api : eigvalsh_grad +- backward_op : eigvalsh_grad forward : eigvalsh (Tensor x, str uplo, bool is_test) -> Tensor(eigenvalues), Tensor(eigenvectors) args : (Tensor eigenvectors, Tensor eigenvalues_grad, str uplo, bool is_test) output : Tensor(x_grad) @@ -722,7 +696,7 @@ data_transform : skip_transform : eigenvalues_grad -- backward_api : einsum_grad +- backward_op : einsum_grad forward : einsum (Tensor[] x, str equation) -> Tensor(out), Tensor[](inner_cache), Tensor[](x_shape) args : (Tensor[] x_shape, Tensor[] inner_cache, Tensor out_grad, str equation) output : Tensor[](x_grad){x.size()} @@ -732,7 +706,7 @@ kernel : func : einsum_grad -- backward_api : elementwise_pow_grad +- backward_op : elementwise_pow_grad forward : elementwise_pow(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis=-1) output : Tensor(x_grad), Tensor(y_grad) @@ -742,7 +716,7 @@ kernel : func : elementwise_pow_grad -- backward_api : elu_double_grad +- backward_op : elu_double_grad forward : elu_grad (Tensor x, Tensor out, Tensor grad_out, float alpha)-> Tensor(grad_x) args : (Tensor x, Tensor grad_out, Tensor grad_x_grad, float alpha) output : Tensor(x_grad), Tensor(grad_out_grad) @@ -753,7 +727,7 @@ func : elu_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : elu_grad +- backward_op : elu_grad forward : elu (Tensor x, float alpha) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, float alpha) output : Tensor(x_grad) @@ -765,13 +739,13 @@ backward : elu_double_grad inplace : (out_grad -> x_grad) -- backward_api : embedding_grad +- backward_op : embedding_grad forward : embedding (Tensor x, Tensor weight, int64_t padding_idx=-1, bool sparse=false) -> Tensor(out) args : (Tensor x, Tensor weight, Tensor out_grad, int64_t padding_idx=-1, bool sparse=false) output : Tensor(weight_grad) invoke : embedding_grad_impl(x, weight, out_grad, padding_idx, sparse, weight_grad) -- backward_api : exp_grad +- backward_op : exp_grad forward : exp (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -782,7 +756,7 @@ func : exp_grad inplace : (out_grad -> x_grad) -- backward_api : expand_as_grad +- backward_op : expand_as_grad forward : expand_as (Tensor x, Tensor y, int[] target_shape) -> Tensor(out) args : (Tensor x, Tensor out_grad, int[] target_shape) output : Tensor(x_grad) @@ -793,7 +767,7 @@ func : expand_as_grad no_need_buffer : x -- backward_api : expand_double_grad +- backward_op : expand_double_grad forward : expand_grad (Tensor x, Tensor grad_out, IntArray shape) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray shape) output : Tensor(grad_out_grad) @@ -802,7 +776,7 @@ kernel : func : expand -- backward_api : expand_grad +- backward_op : expand_grad forward : expand (Tensor x, IntArray shape) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray shape) output : Tensor(x_grad) @@ -814,7 +788,7 @@ no_need_buffer : x backward : expand_double_grad -- backward_api : expm1_grad +- backward_op : expm1_grad forward : expm1 (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -825,7 +799,7 @@ func : expm1_grad inplace : (out_grad -> x_grad) -- backward_api : exponential__grad +- backward_op : exponential__grad forward : exponential_ (Tensor x, float lambda) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) @@ -833,7 +807,7 @@ func : UnchangedInferMeta invoke : zeros_like(out_grad) -- backward_api : fill_diagonal_grad +- backward_op : fill_diagonal_grad forward : fill_diagonal (Tensor x, float value, int offset, bool wrap) -> Tensor(out) args : (Tensor out_grad, float value, int offset, bool wrap) output : Tensor(x_grad) @@ -842,7 +816,7 @@ kernel : func : fill_diagonal_grad -- backward_api : fill_diagonal_tensor_grad +- backward_op : fill_diagonal_tensor_grad forward : fill_diagonal_tensor (Tensor x, Tensor y, int64_t offset, int dim1, int dim2) -> Tensor(out) args : (Tensor out_grad, int64_t offset, int dim1, int dim2) output : Tensor(x_grad) @@ -852,7 +826,7 @@ func : fill_diagonal_tensor_grad inplace : (out_grad -> x_grad) -- backward_api : fill_grad +- backward_op : fill_grad forward : fill (Tensor x, Scalar value) -> Tensor(out) args : (Tensor out_grad, Scalar value) output : Tensor(x_grad) @@ -863,7 +837,7 @@ func : fill_grad inplace : (out_grad -> x_grad) -- backward_api : flatten_grad +- backward_op : flatten_grad forward : flatten(Tensor x, int start_axis, int stop_axis) -> Tensor(out), Tensor(xshape) args : (Tensor xshape, Tensor out_grad) output : Tensor(x_grad) @@ -877,13 +851,13 @@ layout: out_grad inplace : (out_grad -> x_grad) -- backward_api : flip_grad +- backward_op : flip_grad forward : flip (Tensor x, int[] axis) -> Tensor(out) args : (Tensor out_grad, int[] axis) output : Tensor(x_grad) invoke : flip(out_grad, axis) -- backward_api : floor_grad +- backward_op : floor_grad forward : floor(Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) @@ -894,7 +868,7 @@ func : floor_grad inplace : (out_grad -> x_grad) -- backward_api : fmax_grad +- backward_op : fmax_grad forward : fmax(Tensor x, Tensor y, int axis) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis) output : Tensor(x_grad), Tensor(y_grad) @@ -904,7 +878,7 @@ kernel : func : fmax_grad -- backward_api : fmin_grad +- backward_op : fmin_grad forward : fmin(Tensor x, Tensor y, int axis) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis) output : Tensor(x_grad), Tensor(y_grad) @@ -914,7 +888,7 @@ kernel : func : fmin_grad -- backward_api : frame_grad +- backward_op : frame_grad forward : frame(Tensor x, int frame_length, int hop_length, int axis) -> Tensor(out) args : (Tensor x, Tensor out_grad, int frame_length, int hop_length, int axis) output : Tensor(x_grad) @@ -924,7 +898,7 @@ kernel : func : frame_grad -- backward_api : frobenius_norm_grad +- backward_op : frobenius_norm_grad forward : frobenius_norm(Tensor x, int64_t[] axis, bool keep_dim, bool reduce_all) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] axis, bool keep_dim, bool reduce_all) output : Tensor(x_grad) @@ -934,7 +908,7 @@ kernel : func : frobenius_norm_grad -- backward_api : gather_grad +- backward_op : gather_grad forward : gather(Tensor x, Tensor index, Scalar axis=0) -> Tensor(out) args : (Tensor x, Tensor index, Tensor out_grad, Scalar axis=0, bool overwrite=false) output : Tensor(x_grad) @@ -946,7 +920,7 @@ func : gather_grad no_need_buffer : x -- backward_api : gather_nd_grad +- backward_op : gather_nd_grad forward : gather_nd (Tensor x, Tensor index) -> Tensor(out) args : (Tensor x, Tensor index, Tensor out_grad) output : Tensor(x_grad) @@ -957,7 +931,7 @@ func : gather_nd_grad no_need_buffer : x -- backward_api : gelu_grad +- backward_op : gelu_grad forward : gelu(Tensor x, bool approximate) -> Tensor(out) args : (Tensor x, Tensor out_grad, bool approximate) output : Tensor(x_grad) @@ -967,7 +941,7 @@ kernel : func : gelu_grad -- backward_api : graph_send_recv_grad +- backward_op : graph_send_recv_grad forward : graph_send_recv (Tensor x, Tensor src_index, Tensor dst_index, str reduce_op = "SUM", IntArray out_size = {0}) -> Tensor(out), Tensor(dst_count) args : (Tensor x, Tensor src_index, Tensor dst_index, Tensor out, Tensor dst_count, Tensor out_grad, str reduce_op = "SUM") output : Tensor(x_grad) @@ -979,7 +953,7 @@ data_type : out_grad optional: out, dst_count -- backward_api : graph_send_ue_recv_grad +- backward_op : graph_send_ue_recv_grad forward : graph_send_ue_recv (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, str message_op, str reduce_op, IntArray out_size) -> Tensor(out), Tensor(dst_count) args : (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, Tensor out, Tensor dst_count, Tensor out_grad, str message_op, str reduce_op) output : Tensor(x_grad), Tensor(y_grad) @@ -991,7 +965,7 @@ data_type : out_grad optional: out, dst_count -- backward_api : grid_sample_grad +- backward_op : grid_sample_grad forward : grid_sample (Tensor x, Tensor grid, str mode, str padding_mode, bool align_corners) -> Tensor(out) args : (Tensor x, Tensor grid, Tensor out_grad, str mode, str padding_mode, bool align_corners) output : Tensor(x_grad), Tensor(grid_grad) @@ -1002,7 +976,7 @@ func : grid_sample_grad data_type : x -- backward_api : group_norm_grad +- backward_op : group_norm_grad forward : group_norm (Tensor x, Tensor scale, Tensor bias, float epsilon, int groups, str data_layout) -> Tensor(y), Tensor(mean), Tensor(variance) args : (Tensor x, Tensor scale, Tensor bias, Tensor y, Tensor mean, Tensor variance, Tensor y_grad, float epsilon, int groups, str data_layout) output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad) @@ -1015,7 +989,7 @@ optional: scale, bias inplace : (y_grad -> x_grad) -- backward_api : gumbel_softmax_grad +- backward_op : gumbel_softmax_grad forward : gumbel_softmax (Tensor x, float temperature, bool hard, int axis) -> Tensor(out) args : (Tensor out, Tensor out_grad, int axis) output : Tensor(x_grad) @@ -1025,7 +999,7 @@ kernel : func : gumbel_softmax_grad -- backward_api : hard_shrink_grad +- backward_op : hard_shrink_grad forward : hard_shrink (Tensor x, float threshold) -> Tensor(out) args : (Tensor x, Tensor out_grad, float threshold) output : Tensor(x_grad) @@ -1036,7 +1010,7 @@ func : hard_shrink_grad inplace : (out_grad -> x_grad) -- backward_api : hard_sigmoid_grad +- backward_op : hard_sigmoid_grad forward : hard_sigmoid (Tensor x, float slope, float offset) -> Tensor(out) args : (Tensor out, Tensor out_grad, float slope, float offset) output : Tensor(x_grad) @@ -1047,7 +1021,7 @@ func : hard_sigmoid_grad inplace : (out_grad -> x_grad) -- backward_api : hard_swish_grad +- backward_op : hard_swish_grad forward : hard_swish (Tensor x, float threshold = 6.0, float scale = 6.0, float offset = 3.0) -> Tensor(out) args : (Tensor x, Tensor out_grad, float threshold, float scale, float offset) output : Tensor(x_grad) @@ -1058,7 +1032,7 @@ func : hard_swish_grad inplace : (out_grad -> x_grad) -- backward_api : hierarchical_sigmoid_grad +- backward_op : hierarchical_sigmoid_grad forward : hierarchical_sigmoid (Tensor x, Tensor w, Tensor label, Tensor path, Tensor code, Tensor bias, int num_classes, bool remote_prefetch, int trainer_id, int64_t[] height_sections, str[] epmap, str[] table_names, bool is_sparse) -> Tensor(out), Tensor(pre_out), Tensor(w_out) args : (Tensor x, Tensor w, Tensor label, Tensor path, Tensor code, Tensor bias, Tensor pre_out, Tensor out_grad, int num_classes, bool remote_prefetch, int trainer_id, int64_t[] height_sections, str[] epmap, str[] table_names, bool is_sparse) output : Tensor(x_grad), Tensor(w_grad), Tensor(bias_grad) @@ -1069,7 +1043,7 @@ kernel : func : hierarchical_sigmoid_grad -- backward_api : huber_loss_grad +- backward_op : huber_loss_grad forward : huber_loss (Tensor input, Tensor label, float delta) -> Tensor(out), Tensor(residual) args : (Tensor residual, Tensor out_grad, float delta) output : Tensor(input_grad), Tensor(label_grad) @@ -1079,13 +1053,13 @@ kernel : func : huber_loss_grad -- backward_api : imag_grad +- backward_op : imag_grad forward : imag (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) invoke : imag_grad_impl(out_grad, x_grad) -- backward_api : index_add_grad +- 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) output : Tensor(x_grad), Tensor(add_value_grad) @@ -1096,7 +1070,7 @@ data_type : out_grad inplace : (out_grad -> x_grad) -- backward_api : index_sample_grad +- backward_op : index_sample_grad forward : index_sample (Tensor x, Tensor index) -> Tensor(out) args : (Tensor x, Tensor index, Tensor out_grad) output : Tensor(x_grad) @@ -1108,7 +1082,7 @@ data_type : out_grad no_need_buffer : x -- backward_api : index_select_grad +- backward_op : index_select_grad forward : index_select(Tensor x, Tensor index, int dim) -> Tensor(out) args : (Tensor x, Tensor index, Tensor out_grad, int dim) output : Tensor(x_grad) @@ -1120,7 +1094,7 @@ data_type : x no_need_buffer : x -- backward_api : instance_norm_double_grad +- backward_op : instance_norm_double_grad forward : instance_norm_grad(Tensor x, Tensor fwd_scale, Tensor saved_mean, Tensor saved_variance, Tensor grad_y, float epsilon) -> Tensor(grad_x), Tensor(grad_scale), Tensor(grad_bias) args : (Tensor x, Tensor fwd_scale, Tensor saved_mean, Tensor saved_variance, Tensor grad_y, Tensor grad_x_grad, Tensor grad_scale_grad, Tensor grad_bias_grad, float epsilon) output : Tensor(x_grad), Tensor(fwd_scale_grad), Tensor(grad_y_grad) @@ -1131,7 +1105,7 @@ data_type : x optional : fwd_scale, grad_x_grad, grad_scale_grad, grad_bias_grad -- backward_api : instance_norm_grad +- backward_op : instance_norm_grad forward : instance_norm(Tensor x, Tensor scale, Tensor bias, float epsilon) -> Tensor(y), Tensor(saved_mean), Tensor(saved_variance) args : (Tensor x, Tensor scale, Tensor saved_mean, Tensor saved_variance, Tensor y_grad, float epsilon) output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad) @@ -1143,7 +1117,7 @@ optional : scale backward : instance_norm_double_grad -- backward_api : inverse_grad +- backward_op : inverse_grad forward : inverse(Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -1152,7 +1126,7 @@ kernel : func : inverse_grad -- backward_api : kldiv_loss_grad +- backward_op : kldiv_loss_grad forward : kldiv_loss(Tensor x, Tensor label, str reduction) -> Tensor(out) args : (Tensor x, Tensor label, Tensor out_grad, str reduction) output : Tensor(x_grad) @@ -1163,7 +1137,7 @@ func : kldiv_loss_grad no_need_buffer : x -- backward_api : kron_grad +- backward_op : kron_grad forward : kron (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -1174,7 +1148,7 @@ func : kron_grad data_type : out_grad -- backward_api : kthvalue_grad +- backward_op : kthvalue_grad forward : kthvalue(Tensor x, int k, int axis, bool keepdim) -> Tensor(out), Tensor(indices) args : (Tensor x, Tensor indices, Tensor out_grad, int k, int axis, bool keepdim) output : Tensor(x_grad) @@ -1184,7 +1158,7 @@ kernel : func : kthvalue_grad -- backward_api : label_smooth_grad +- backward_op : label_smooth_grad forward : label_smooth (Tensor label, Tensor prior_dist, float epsilon) -> Tensor(out) args : (Tensor out_grad, float epsilon) output : Tensor(label_grad) @@ -1194,7 +1168,7 @@ kernel : func : label_smooth_grad -- backward_api : layer_norm_grad +- backward_op : layer_norm_grad forward : layer_norm (Tensor x, Tensor scale, Tensor bias, float epsilon, int begin_norm_axis, bool is_test) -> Tensor(out), Tensor(mean), Tensor(variance) args : (Tensor x, Tensor scale, Tensor bias, Tensor mean, Tensor variance, Tensor out_grad, float epsilon, int begin_norm_axis, bool is_test) output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad) @@ -1207,7 +1181,7 @@ no_need_buffer : bias optional : scale, bias -- backward_api : leaky_relu_double_grad +- backward_op : leaky_relu_double_grad forward : leaky_relu_grad (Tensor x, Tensor grad_out, float alpha) -> Tensor(grad_x) args : (Tensor x, Tensor grad_x_grad, float alpha) output : Tensor(grad_out_grad) @@ -1218,7 +1192,7 @@ func : leaky_relu_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : leaky_relu_grad +- backward_op : leaky_relu_grad forward : leaky_relu (Tensor x, float alpha) -> Tensor(out) args : (Tensor x, Tensor out_grad, float alpha) output : Tensor(x_grad) @@ -1230,7 +1204,7 @@ backward : leaky_relu_double_grad inplace : (out_grad -> x_grad) -- backward_api : lerp_grad +- backward_op : lerp_grad forward : lerp (Tensor x, Tensor y, Tensor weight) -> Tensor(out) args : (Tensor x, Tensor y, Tensor weight, Tensor out, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -1240,7 +1214,7 @@ kernel : func : lerp_grad -- backward_api : linear_interp_grad +- backward_op : linear_interp_grad forward : linear_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) -> Tensor(output) args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(x_grad) @@ -1252,7 +1226,7 @@ func : linear_interp_grad data_type : output_grad -- backward_api : log10_grad +- backward_op : log10_grad forward : log10 (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -1263,7 +1237,7 @@ func : log10_grad inplace : (out_grad -> x_grad) -- backward_api : log1p_grad +- backward_op : log1p_grad forward : log1p (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -1274,7 +1248,7 @@ func : log1p_grad inplace : (out_grad -> x_grad) -- backward_api : log2_grad +- backward_op : log2_grad forward : log2 (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -1285,7 +1259,7 @@ func : log2_grad inplace : (out_grad -> x_grad) -- backward_api : log_double_grad +- backward_op : log_double_grad forward : log_grad (Tensor x, Tensor grad_out) -> Tensor(grad_x) args : (Tensor x, Tensor grad_out, Tensor grad_x_grad) output : Tensor(x_grad), Tensor(grad_out_grad) @@ -1296,7 +1270,7 @@ func : log_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : log_grad +- backward_op : log_grad forward : log (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -1308,7 +1282,7 @@ backward : log_double_grad inplace : (out_grad -> x_grad) -- backward_api : log_loss_grad +- backward_op : log_loss_grad forward : log_loss (Tensor input, Tensor label, float epsilon) -> Tensor(out) args : (Tensor input, Tensor label, Tensor out_grad, float epsilon) output : Tensor(input_grad) @@ -1318,7 +1292,7 @@ kernel : func : log_loss_grad -- backward_api : log_softmax_grad +- backward_op : log_softmax_grad forward : log_softmax(Tensor x, int axis) -> Tensor(out) args : (Tensor out, Tensor out_grad, int axis) output : Tensor(x_grad) @@ -1328,7 +1302,7 @@ kernel : func : log_softmax_grad -- backward_api : logcumsumexp_grad +- backward_op : logcumsumexp_grad forward : logcumsumexp(Tensor x, int axis, bool flatten, bool exclusive, bool reverse) -> Tensor(out) infer_meta : func : UnchangedInferMeta @@ -1338,7 +1312,7 @@ kernel : func : logcumsumexp_grad -- backward_api : logit_grad +- backward_op : logit_grad forward : logit (Tensor x, float eps = 1e-6f) -> Tensor(out) args : (Tensor x, Tensor out_grad, float eps) output : Tensor(x_grad) @@ -1348,7 +1322,7 @@ kernel : func : logit_grad -- backward_api : logsigmoid_grad +- backward_op : logsigmoid_grad forward : logsigmoid (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -1359,7 +1333,7 @@ func : logsigmoid_grad inplace : (out_grad -> x_grad) -- backward_api : logsumexp_grad +- backward_op : logsumexp_grad forward : logsumexp(Tensor x, int64_t[] axis, bool keepdim, bool reduce_all) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] axis, bool keepdim, bool reduce_all) output : Tensor(x_grad) @@ -1369,7 +1343,7 @@ kernel : func : logsumexp_grad -- backward_api : lu_grad +- backward_op : lu_grad forward : lu (Tensor x, bool pivot) -> Tensor(out), Tensor(pivots), Tensor(infos) args : (Tensor x, Tensor out, Tensor pivots, Tensor out_grad, bool pivot) output : Tensor(x_grad) @@ -1378,7 +1352,7 @@ kernel : func : lu_grad -- backward_api : lu_unpack_grad +- backward_op : lu_unpack_grad forward : lu_unpack (Tensor x, Tensor pivots, bool unpack_ludata, bool unpack_pivots) -> Tensor(pmat), Tensor(l), Tensor(u) args : (Tensor x, Tensor pivots, Tensor l, Tensor u, Tensor pmat, Tensor l_grad, Tensor u_grad, bool unpack_ludata, bool unpack_pivots) output : Tensor(x_grad) @@ -1387,7 +1361,7 @@ kernel : func : lu_unpack_grad -- backward_api : margin_cross_entropy_grad +- backward_op : margin_cross_entropy_grad forward : margin_cross_entropy (Tensor logits, Tensor label, bool return_softmax, int ring_id, int rank, int nranks, float margin1, float margin2, float margin3, float scale) -> Tensor(softmax), Tensor(loss) args : (Tensor logits, Tensor label, Tensor softmax, Tensor loss_grad, bool return_softmax, int ring_id, int rank, int nranks, float margin1, float margin2, float margin3, float scale) output : Tensor(logits_grad) @@ -1398,7 +1372,7 @@ data_type : softmax inplace : (softmax -> logits_grad) -- backward_api : masked_select_grad +- backward_op : masked_select_grad forward : masked_select (Tensor x, Tensor mask) -> Tensor(out) args : (Tensor x, Tensor mask, Tensor out_grad) output : Tensor(x_grad) @@ -1410,7 +1384,7 @@ data_type : x no_need_buffer : x -- backward_api : matmul_double_grad +- backward_op : matmul_double_grad forward : matmul_grad (Tensor x, Tensor y, Tensor grad_out, bool transpose_x=false, bool transpose_y=false) -> Tensor(grad_x), Tensor(grad_y) args : (Tensor x, Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, bool transpose_x=false, bool transpose_y=false) output : Tensor(x_grad), Tensor(y_grad), Tensor(grad_out_grad) @@ -1422,7 +1396,7 @@ backward : matmul_triple_grad optional : grad_x_grad, grad_y_grad -- backward_api : matmul_grad +- backward_op : matmul_grad forward : matmul (Tensor x, Tensor y, bool transpose_x=false, bool transpose_y=false) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, bool transpose_x=false, bool transpose_y=false) output : Tensor(x_grad), Tensor(y_grad) @@ -1433,7 +1407,7 @@ func : matmul_grad backward : matmul_double_grad -- backward_api : matmul_triple_grad +- backward_op : matmul_triple_grad forward : matmul_double_grad (Tensor x, Tensor y, Tensor fwd_grad_out, Tensor fwd_grad_grad_x, Tensor fwd_grad_grad_y, bool transpose_x=false, bool transpose_y=false) -> Tensor(grad_x), Tensor(grad_y), Tensor(grad_grad_out) args : (Tensor x, Tensor y, Tensor fwd_grad_out, Tensor fwd_grad_grad_x, Tensor fwd_grad_grad_y, Tensor grad_x_grad, Tensor grad_y_grad, Tensor grad_grad_out_grad, bool transpose_x=false, bool transpose_y=false) output : Tensor(x_grad), Tensor(y_grad), Tensor(fwd_grad_out_grad), Tensor(fwd_grad_grad_x_grad), Tensor(fwd_grad_grad_y_grad) @@ -1444,7 +1418,7 @@ func : matmul_triple_grad optional : grad_x_grad, grad_y_grad, grad_grad_out_grad -- backward_api : matrix_power_grad +- backward_op : matrix_power_grad forward : matrix_power (Tensor x, int n) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int n) output : Tensor(x_grad) @@ -1454,7 +1428,7 @@ kernel : func : matrix_power_grad -- backward_api : max_grad +- backward_op : max_grad forward: max (Tensor x, IntArray dims={}, bool keep_dim=false) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, IntArray dims={}, bool keep_dim=false, bool reduce_all=false) output : Tensor(x_grad) @@ -1464,7 +1438,7 @@ kernel : func : max_grad -- backward_api : max_pool2d_with_index_grad +- backward_op : max_pool2d_with_index_grad forward : max_pool2d_with_index(Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) -> Tensor(out), Tensor(mask) args : (Tensor x, Tensor mask, Tensor out_grad, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) output : Tensor(x_grad) @@ -1473,7 +1447,7 @@ kernel : func : max_pool2d_with_index_grad -- backward_api : max_pool3d_with_index_grad +- backward_op : max_pool3d_with_index_grad forward : max_pool3d_with_index(Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) -> Tensor(out), Tensor(mask) args : (Tensor x, Tensor mask, Tensor out_grad, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) output : Tensor(x_grad) @@ -1482,7 +1456,7 @@ kernel : func : max_pool3d_with_index_grad -- backward_api : maximum_grad +- backward_op : maximum_grad forward : maximum(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis=-1) output : Tensor(x_grad), Tensor(y_grad) @@ -1492,7 +1466,7 @@ kernel : func : maximum_grad -- backward_api : maxout_grad +- backward_op : maxout_grad forward : maxout(Tensor x, int groups, int axis) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int groups, int axis) output : Tensor(x_grad) @@ -1502,7 +1476,7 @@ kernel : func : maxout_grad -- backward_api : mean_all_grad +- backward_op : mean_all_grad forward : mean_all(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -1512,13 +1486,13 @@ kernel : func : mean_all_grad -- backward_api : mean_double_grad +- backward_op : mean_double_grad forward: mean_grad (Tensor x, Tensor grad_out, IntArray dims={}, bool keep_dim=false, bool reduce_all = false) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray dims={}, bool keep_dim=false) output : Tensor(grad_out_grad) invoke : mean(grad_x_grad, dims, keep_dim) -- backward_api : mean_grad +- backward_op : mean_grad forward: mean (Tensor x, IntArray dims={}, bool keep_dim=false) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray dims={}, bool keep_dim=false, bool reduce_all=false) output : Tensor(x_grad) @@ -1530,7 +1504,7 @@ backward : mean_double_grad no_need_buffer : x -- backward_api : meshgrid_grad +- backward_op : meshgrid_grad forward : meshgrid (Tensor[] inputs) -> Tensor[](outputs) args : (Tensor[] inputs, Tensor[] outputs_grad) output : Tensor[](inputs_grad){inputs.size()} @@ -1539,7 +1513,7 @@ kernel : func : meshgrid_grad -- backward_api : min_grad +- backward_op : min_grad forward: min (Tensor x, IntArray dims={}, bool keep_dim=false) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, IntArray dims={}, bool keep_dim=false, bool reduce_all=false) output : Tensor(x_grad) @@ -1549,7 +1523,7 @@ kernel : func : min_grad -- backward_api : minimum_grad +- backward_op : minimum_grad forward : minimum(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis=-1) output : Tensor(x_grad), Tensor(y_grad) @@ -1559,7 +1533,7 @@ kernel : func : minimum_grad -- backward_api : mish_grad +- backward_op : mish_grad forward : mish (Tensor x, float threshold) -> Tensor(out) args : (Tensor x, Tensor out_grad, float threshold) output : Tensor(x_grad) @@ -1570,7 +1544,7 @@ func : mish_grad inplace : (out_grad -> x_grad) -- backward_api : mode_grad +- backward_op : mode_grad forward : mode(Tensor x, int axis, bool keepdim) -> Tensor(out), Tensor(indices) args : (Tensor x, Tensor indices, Tensor out_grad, int axis, bool keepdim) output : Tensor(x_grad) @@ -1580,7 +1554,7 @@ kernel : func : mode_grad -- backward_api : multi_dot_grad +- backward_op : multi_dot_grad forward : multi_dot (Tensor[] x) -> Tensor(out) args : (Tensor[] x, Tensor out_grad) output : Tensor[](x_grad) {x.size()} @@ -1589,7 +1563,7 @@ kernel : func : multi_dot_grad -- backward_api : multiplex_grad +- backward_op : multiplex_grad forward : multiplex (Tensor[] ins, Tensor ids) -> Tensor(out) args : (Tensor[] ins, Tensor ids, Tensor out_grad) output : Tensor[](ins_grad){ins.size()} @@ -1600,7 +1574,7 @@ func : multiplex_grad param : [ids, out_grad] -- backward_api : multiply_double_grad +- backward_op : multiply_double_grad forward : multiply_grad (Tensor x, Tensor y, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y) args : (Tensor x, Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1) output : Tensor(x_grad), Tensor(y_grad), Tensor(grad_out_grad) @@ -1613,7 +1587,7 @@ backward : multiply_triple_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : multiply_grad +- backward_op : multiply_grad forward : multiply (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis = -1) output : Tensor(x_grad), Tensor(y_grad) @@ -1624,7 +1598,7 @@ func : multiply_grad backward : multiply_double_grad -- backward_api : multiply_triple_grad +- backward_op : multiply_triple_grad forward : multiply_double_grad (Tensor x, Tensor y, Tensor fwd_grad_out, Tensor fwd_grad_grad_x, Tensor fwd_grad_grad_y, int aixs = -1) -> Tensor(grad_x), Tensor(grad_y), Tensor(grad_grad_out) args : (Tensor x, Tensor y, Tensor fwd_grad_out, Tensor fwd_grad_grad_x, Tensor fwd_grad_grad_y, Tensor grad_x_grad, Tensor grad_y_grad, Tensor grad_grad_out_grad, int axis = -1) output : Tensor(x_grad), Tensor(y_grad), Tensor(fwd_grad_out_grad), Tensor(fwd_grad_grad_x_grad), Tensor(fwd_grad_grad_y_grad) @@ -1635,7 +1609,7 @@ func : multiply_triple_grad optional : fwd_grad_grad_x, fwd_grad_grad_y, grad_grad_out_grad -- backward_api : nearest_interp_grad +- backward_op : nearest_interp_grad forward : nearest_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) -> Tensor(output) args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(x_grad) @@ -1647,7 +1621,7 @@ func : nearest_interp_grad data_type : output_grad -- backward_api : nll_loss_grad +- backward_op : nll_loss_grad forward : nll_loss (Tensor input, Tensor label, Tensor weight, int64_t ignore_index, str reduction) -> Tensor(out), Tensor(total_weight) args : (Tensor input, Tensor label, Tensor weight, Tensor total_weight, Tensor out_grad, int64_t ignore_index, str reduction) output : Tensor(input_grad) @@ -1658,7 +1632,7 @@ data_type : input optional : weight -- backward_api : norm_grad +- backward_op : norm_grad forward : norm (Tensor x, int axis, float epsilon, bool is_test) -> Tensor(out), Tensor(norm) args : (Tensor x, Tensor norm, Tensor out_grad, int axis, float epsilon, bool is_test) output : Tensor(x_grad) @@ -1668,7 +1642,7 @@ kernel : func : norm_grad -- backward_api : overlap_add_grad +- backward_op : overlap_add_grad forward : overlap_add(Tensor x, int hop_length, int axis) -> Tensor(out) args : (Tensor x, Tensor out_grad, int hop_length, int axis) output : Tensor(x_grad) @@ -1678,7 +1652,7 @@ func : overlap_add_grad data_type : x -- backward_api : p_norm_grad +- backward_op : p_norm_grad forward : p_norm(Tensor x, float porder, int axis, float epsilon, bool keepdim, bool asvector=false) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, float porder, int axis, float epsilon, bool keepdim, bool asvector) output : Tensor(x_grad) @@ -1688,7 +1662,7 @@ kernel : func : p_norm_grad -- backward_api : pad3d_double_grad +- backward_op : pad3d_double_grad forward : pad3d_grad(Tensor x, Tensor grad_out, IntArray paddings, str mode, float pad_value, str data_format) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray paddings, str mode, float pad_value, str data_format) output : Tensor(grad_out_grad) @@ -1697,7 +1671,7 @@ kernel : func : pad3d -- backward_api : pad3d_grad +- backward_op : pad3d_grad forward : pad3d(Tensor x, IntArray paddings, str mode, float pad_value, str data_format) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray paddings, str mode, float pad_value, str data_format) output : Tensor(x_grad) @@ -1709,7 +1683,7 @@ no_need_buffer : x backward : pad3d_double_grad -- backward_api : pad_double_grad +- backward_op : pad_double_grad forward : pad_grad(Tensor x, Tensor grad_out, int[] paddings, Scalar pad_value) -> Tensor(grad_x) args : (Tensor grad_x_grad, int[] paddings, Scalar pad_value) output : Tensor(grad_out_grad) @@ -1718,7 +1692,7 @@ kernel : func : pad -- backward_api : pad_grad +- backward_op : pad_grad forward : pad(Tensor x, int[] paddings, Scalar pad_value) -> Tensor(out) args : (Tensor x, Tensor out_grad, int[] paddings, Scalar pad_value) output : Tensor(x_grad) @@ -1731,7 +1705,7 @@ no_need_buffer : x backward : pad_double_grad -- backward_api : pixel_shuffle_grad +- backward_op : pixel_shuffle_grad forward : pixel_shuffle (Tensor x, int upscale_factor, str data_format) -> Tensor(out) args : (Tensor out_grad, int upscale_factor, str data_format) output : Tensor(x_grad) @@ -1740,7 +1714,7 @@ kernel : func : pixel_shuffle_grad -- backward_api : pool2d_double_grad +- backward_op : pool2d_double_grad forward : pool2d_grad(Tensor x, Tensor out, Tensor grad_out, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) output : Tensor(grad_out_grad) @@ -1752,7 +1726,7 @@ param : [grad_x_grad, kernel_size, strides, paddings, ceil_mode, exclusive, data_format, pooling_type, global_pooling, adaptive, padding_algorithm] use_gpudnn : use_gpudnn -- backward_api : pool2d_grad +- backward_op : pool2d_grad forward : pool2d(Tensor x, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) output : Tensor(x_grad) @@ -1765,7 +1739,7 @@ use_gpudnn : use_gpudnn backward : pool2d_double_grad -- backward_api : pool3d_grad +- backward_op : pool3d_grad forward : pool3d(Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, int[] kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) output : Tensor(x_grad) @@ -1777,7 +1751,7 @@ param : [x, out, out_grad, kernel_size, strides, paddings, ceil_mode, exclusive, data_format, pooling_type, global_pooling, adaptive, padding_algorithm] use_gpudnn : use_gpudnn -- backward_api : pow_grad +- backward_op : pow_grad forward : pow(Tensor x, Scalar s) -> Tensor(out) args : (Tensor x, Tensor out_grad, Scalar s=-1) output : Tensor(x_grad) @@ -1788,7 +1762,7 @@ func : pow_grad inplace : (out_grad -> x_grad) -- backward_api : prelu_grad +- backward_op : prelu_grad forward : prelu(Tensor x, Tensor alpha, str data_format, str mode) -> Tensor(out) args : (Tensor x, Tensor alpha, Tensor out_grad, str data_format, str mode) output : Tensor(x_grad), Tensor(alpha_grad) @@ -1798,7 +1772,7 @@ kernel : func : prelu_grad -- backward_api : psroi_pool_grad +- backward_op : psroi_pool_grad forward : psroi_pool (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, int output_channels, float spatial_scale) -> Tensor(out) args : (Tensor x, Tensor boxes, Tensor boxes_num, Tensor out_grad, int pooled_height, int pooled_width, int output_channels, float spatial_scale) output : Tensor(x_grad) @@ -1811,7 +1785,7 @@ optional : boxes_num # output is optional -- backward_api : put_along_axis_grad +- backward_op : put_along_axis_grad forward : put_along_axis (Tensor x, Tensor index, Tensor value, int axis, str reduce) -> Tensor(out) args : (Tensor x, Tensor index, Tensor out_grad, int axis, str reduce) output : Tensor(x_grad), Tensor(value_grad) @@ -1821,7 +1795,7 @@ kernel : func : put_along_axis_grad -- backward_api : qr_grad +- backward_op : qr_grad forward : qr (Tensor x, str mode) -> Tensor(q), Tensor(r) args : (Tensor x, Tensor q, Tensor r, Tensor q_grad, Tensor r_grad, str mode) output : Tensor(x_grad) @@ -1831,13 +1805,13 @@ kernel : func : qr_grad -- backward_api : real_grad +- backward_op : real_grad forward : real (Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) invoke : real_grad_impl(out_grad, x_grad) -- backward_api : reciprocal_grad +- backward_op : reciprocal_grad forward : reciprocal (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -1848,7 +1822,7 @@ func : reciprocal_grad inplace : (out_grad -> x_grad) -- backward_api : reduce_prod_grad +- backward_op : reduce_prod_grad forward : reduce_prod (Tensor x, IntArray dims, bool keep_dim, bool reduce_all) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad, IntArray dims, bool keep_dim, bool reduce_all) output : Tensor(x_grad) @@ -1858,7 +1832,7 @@ kernel : func : prod_grad -- backward_api : relu6_grad +- backward_op : relu6_grad forward : relu6 (Tensor x, float threshold) -> Tensor(out) args : (Tensor out, Tensor out_grad, float threshold) output : Tensor(x_grad) @@ -1869,7 +1843,7 @@ func : relu6_grad inplace : (out_grad -> x_grad) -- backward_api : relu_double_grad +- backward_op : relu_double_grad forward : relu_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x) args : (Tensor out, Tensor grad_x_grad) output : Tensor(grad_out_grad) @@ -1880,7 +1854,7 @@ func : relu_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : relu_grad +- backward_op : relu_grad forward : relu (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -1892,7 +1866,7 @@ backward: relu_double_grad inplace : (out_grad -> x_grad) -- backward_api : renorm_grad +- backward_op : renorm_grad forward : renorm (Tensor x, float p, int axis, float max_norm) -> Tensor(out) args : (Tensor x, Tensor out_grad, float p, int axis, float max_norm) output : Tensor(x_grad) @@ -1902,7 +1876,7 @@ kernel : func : renorm_grad -- backward_api : repeat_interleave_grad +- backward_op : repeat_interleave_grad forward : repeat_interleave(Tensor x, int repeats, int dim) -> Tensor(out) args : (Tensor x, Tensor out_grad, int repeats, int dim) output : Tensor(x_grad) @@ -1912,7 +1886,7 @@ kernel : func : repeat_interleave_grad -- backward_api : repeat_interleave_with_tensor_index_grad +- backward_op : repeat_interleave_with_tensor_index_grad forward : repeat_interleave_with_tensor_index(Tensor x, Tensor repeats, int dim) -> Tensor(out) args : (Tensor x, Tensor repeats, Tensor out_grad, int dim) output : Tensor(x_grad) @@ -1923,7 +1897,7 @@ func : repeat_interleave_with_tensor_index_grad data_type : x -- backward_api : reshape_double_grad +- backward_op : reshape_double_grad forward : reshape_grad (Tensor xshape, Tensor grad_out) -> Tensor(grad_x) args : (Tensor grad_out, Tensor grad_x_grad) output : Tensor(grad_out_grad) @@ -1935,7 +1909,7 @@ no_need_buffer : grad_out inplace : (grad_x_grad -> grad_out_grad) -- backward_api : reshape_grad +- backward_op : reshape_grad forward : reshape (Tensor x, IntArray shape) -> Tensor(out), Tensor(xshape) args : (Tensor xshape, Tensor out_grad) output : Tensor(x_grad) @@ -1951,7 +1925,7 @@ backward : reshape_double_grad inplace : (out_grad -> x_grad) -- backward_api : reverse_array_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()} @@ -1960,13 +1934,13 @@ kernel : func : reverse -- backward_api : reverse_grad +- backward_op : reverse_grad forward : reverse (Tensor x, IntArray axis) -> Tensor(out) args : (Tensor out_grad, IntArray axis) output : Tensor(x_grad) invoke : reverse(out_grad, axis) -- backward_api : roi_align_grad +- backward_op : roi_align_grad forward : roi_align (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned) -> Tensor(out) args : (Tensor x, Tensor boxes, Tensor boxes_num, Tensor out_grad, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned) output : Tensor(x_grad) @@ -1979,7 +1953,7 @@ no_need_buffer : x optional : boxes_num -- backward_api : roi_pool_grad +- backward_op : roi_pool_grad forward : roi_pool (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale) -> Tensor(out), Tensor(arg_max) args : (Tensor x, Tensor boxes, Tensor boxes_num, Tensor arg_max, Tensor out_grad, int pooled_height, int pooled_width, float spatial_scale) output : Tensor(x_grad) @@ -1991,7 +1965,7 @@ data_type : x optional : boxes_num -- backward_api : roll_grad +- backward_op : roll_grad forward : roll(Tensor x, IntArray shifts, int64_t[] axis) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray shifts, int64_t[] axis) output : Tensor(x_grad) @@ -2003,7 +1977,7 @@ data_type : x no_need_buffer : x -- backward_api : round_grad +- backward_op : round_grad forward : round(Tensor x) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) @@ -2014,7 +1988,7 @@ func : round_grad inplace : (out_grad -> x_grad) -- backward_api : rsqrt_double_grad +- backward_op : rsqrt_double_grad forward : rsqrt_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x) args : (Tensor out, Tensor grad_x, Tensor grad_x_grad) output : Tensor(out_grad), Tensor(grad_out_grad) @@ -2025,7 +1999,7 @@ func : rsqrt_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : rsqrt_grad +- backward_op : rsqrt_grad forward : rsqrt (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -2037,13 +2011,13 @@ backward : rsqrt_double_grad inplace : (out_grad -> x_grad) -- backward_api : scale_grad +- backward_op : scale_grad forward : scale (Tensor x, Scalar scale, float bias, bool bias_after_scale) -> Tensor(out) args : (Tensor out_grad, Scalar scale=1.0, bool bias_after_scale=true) output : Tensor(x_grad) invoke : scale(out_grad, scale, 0.0, bias_after_scale) -- backward_api : scatter_grad +- backward_op : scatter_grad forward : scatter (Tensor x, Tensor index, Tensor updates, bool overwrite) -> Tensor(out) args : (Tensor index, Tensor updates, Tensor out_grad, bool overwrite) output : Tensor(x_grad), Tensor(updates_grad) @@ -2054,7 +2028,7 @@ func : scatter_grad no_need_buffer : updates -- backward_api : scatter_nd_add_grad +- backward_op : scatter_nd_add_grad forward : scatter_nd_add (Tensor x, Tensor index, Tensor updates) -> Tensor(out) args : (Tensor index, Tensor updates, Tensor out_grad) output : Tensor(x_grad), Tensor(updates_grad) @@ -2065,7 +2039,7 @@ func : scatter_nd_add_grad no_need_buffer : updates -- backward_api : segment_pool_grad +- backward_op : segment_pool_grad forward : segment_pool (Tensor x, Tensor segment_ids, str pooltype) -> Tensor(out), Tensor(summed_ids) args : (Tensor x, Tensor segment_ids, Tensor out, Tensor summed_ids, Tensor out_grad, str pooltype) output : Tensor(x_grad) @@ -2077,7 +2051,7 @@ data_type : x optional : summed_ids -- backward_api : selu_grad +- backward_op : selu_grad forward : selu (Tensor x, float scale, float alpha) -> Tensor(out) args : (Tensor out, Tensor out_grad, float scale, float alpha) output : Tensor(x_grad) @@ -2087,7 +2061,7 @@ kernel : func : selu_grad -- backward_api : sigmoid_cross_entropy_with_logits_grad +- backward_op : sigmoid_cross_entropy_with_logits_grad forward : sigmoid_cross_entropy_with_logits (Tensor x, Tensor label, bool normalize, int ignore_index) -> Tensor(out) args : (Tensor x, Tensor label, Tensor out_grad, bool normalize, int ignore_index) output : Tensor(x_grad) @@ -2098,7 +2072,7 @@ func : sigmoid_cross_entropy_with_logits_grad inplace : (out_grad -> x_grad) -- backward_api : sigmoid_double_grad +- backward_op : sigmoid_double_grad forward : sigmoid_grad (Tensor out, Tensor fwd_grad_out) -> Tensor(grad_x) args : (Tensor out, Tensor fwd_grad_out, Tensor grad_x_grad) output : Tensor(out_grad), Tensor(fwd_grad_out_grad) @@ -2110,7 +2084,7 @@ backward : sigmoid_triple_grad inplace : (grad_x_grad -> fwd_grad_out_grad) -- backward_api : sigmoid_grad +- backward_op : sigmoid_grad forward : sigmoid (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -2122,7 +2096,7 @@ backward : sigmoid_double_grad inplace : (out_grad -> x_grad) -- backward_api : sigmoid_triple_grad +- backward_op : sigmoid_triple_grad forward : sigmoid_double_grad (Tensor out, Tensor fwd_grad_out, Tensor grad_grad_x) -> Tensor(grad_out), Tensor(grad_grad_out) args : (Tensor out, Tensor fwd_grad_out, Tensor grad_grad_x, Tensor grad_out_grad, Tensor grad_grad_out_grad) output : Tensor(out_grad), Tensor(fwd_grad_out_grad), Tensor(grad_grad_x_grad) @@ -2134,7 +2108,7 @@ optional : grad_grad_out_grad inplace : (grad_grad_x -> fwd_grad_out_grad) -- backward_api : silu_grad +- backward_op : silu_grad forward : silu (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2145,7 +2119,7 @@ func : silu_grad inplace : (out_grad -> x_grad) -- backward_api : sin_grad +- backward_op : sin_grad forward : sin (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2156,7 +2130,7 @@ func : sin_grad inplace : (out_grad -> x_grad) -- backward_api : sinh_grad +- backward_op : sinh_grad forward : sinh (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2167,7 +2141,7 @@ func : sinh_grad inplace : (out_grad -> x_grad) -- backward_api : slice_double_grad +- backward_op : slice_double_grad forward : slice_grad (Tensor input, Tensor grad_out, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis) -> Tensor(grad_input) args : (Tensor grad_input_grad, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis) output : Tensor(grad_out_grad) @@ -2177,7 +2151,7 @@ kernel : func : slice -- backward_api : slice_grad +- backward_op : slice_grad forward : slice (Tensor input, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis) -> Tensor(out) args : (Tensor input, Tensor out_grad, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis) output : Tensor(input_grad) @@ -2189,7 +2163,7 @@ backward : slice_double_grad no_need_buffer : input -- backward_api : slogdet_grad +- backward_op : slogdet_grad forward : slogdet (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -2199,7 +2173,7 @@ kernel : func : slogdeterminant_grad -- backward_api : soft_shrink_grad +- backward_op : soft_shrink_grad forward : soft_shrink (Tensor x, float lambda) -> Tensor(out) args : (Tensor x, Tensor out_grad, float lambda) output : Tensor(x_grad) @@ -2210,7 +2184,7 @@ func : soft_shrink_grad inplace : (out_grad -> x_grad) -- backward_api : softmax_grad +- backward_op : softmax_grad forward : softmax (Tensor x, int axis) -> Tensor(out) args : (Tensor out, Tensor out_grad, int axis) output : Tensor(x_grad) @@ -2221,7 +2195,7 @@ func : softmax_grad use_gpudnn : true -- backward_api : softplus_grad +- backward_op : softplus_grad forward : softplus (Tensor x, float beta, float threshold) -> Tensor(out) args : (Tensor x, Tensor out_grad, float beta, float threshold) output : Tensor(x_grad) @@ -2232,7 +2206,7 @@ func : softplus_grad inplace : (out_grad -> x_grad) -- backward_api : softsign_grad +- backward_op : softsign_grad forward : softsign (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2243,7 +2217,7 @@ func : softsign_grad inplace : (out_grad -> x_grad) -- backward_api : spectral_norm_grad +- backward_op : spectral_norm_grad forward : spectral_norm (Tensor weight, Tensor u, Tensor v, int dim, int power_iters, float eps) -> Tensor(out) args : (Tensor weight, Tensor u, Tensor v, Tensor out_grad, int dim, int power_iters, float eps) output : Tensor(weight_grad) @@ -2253,20 +2227,20 @@ func : spectral_norm_grad data_type : out_grad -- backward_api : split_grad +- backward_op : split_grad forward : split (Tensor x, IntArray num_or_sections, Scalar axis) -> Tensor[](out) args : (Tensor[] out_grad, Scalar axis = -1) output : Tensor(x_grad) invoke : concat( out_grad, axis) -- backward_api : split_with_num_grad +- backward_op : split_with_num_grad forward : split_with_num (Tensor x, int num, Scalar axis) -> Tensor[](out) args : (Tensor[] out_grad, Scalar axis = -1) output : Tensor(x_grad) invoke : concat( out_grad, axis) # TODO(zhangyunfei) The config of double grad and triple grad will be supported in the future. -- backward_api : sqrt_double_grad +- backward_op : sqrt_double_grad forward : sqrt_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x) args : (Tensor out, Tensor grad_x, Tensor grad_x_grad) output : Tensor(out_grad), Tensor(grad_out_grad) @@ -2277,7 +2251,7 @@ func : sqrt_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : sqrt_grad +- backward_op : sqrt_grad forward : sqrt (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -2289,7 +2263,7 @@ backward : sqrt_double_grad inplace : (out_grad -> x_grad) -- backward_api : square_double_grad +- backward_op : square_double_grad forward : square_grad (Tensor x, Tensor grad_out) -> Tensor(grad_x) args : (Tensor x, Tensor grad_out, Tensor grad_x_grad) output : Tensor(x_grad), Tensor(grad_out_grad) @@ -2300,7 +2274,7 @@ func : square_double_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : square_grad +- backward_op : square_grad forward : square (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2312,7 +2286,7 @@ backward : square_double_grad inplace : (out_grad -> x_grad) -- backward_api : squared_l2_norm_grad +- backward_op : squared_l2_norm_grad forward : squared_l2_norm(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2322,13 +2296,13 @@ kernel : func : squared_l2_norm_grad -- backward_api : squeeze_double_grad +- backward_op : squeeze_double_grad forward : squeeze_grad(Tensor xshape, Tensor grad_out, IntArray axes) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray axes) output : Tensor(grad_out_grad) invoke: squeeze(grad_x_grad, axes) -- backward_api : squeeze_grad +- backward_op : squeeze_grad forward : squeeze(Tensor x, IntArray axes) -> Tensor(out), Tensor(xshape) args : (Tensor xshape, Tensor out_grad, IntArray axes) output : Tensor(x_grad) @@ -2340,7 +2314,7 @@ inplace : (out_grad -> x_grad) backward: squeeze_double_grad -- backward_api : stack_grad +- backward_op : stack_grad forward : stack (Tensor[] x, int axis) -> Tensor(out) args : (Tensor[] x, Tensor out_grad, int axis) output : Tensor[](x_grad){x.size()} @@ -2352,7 +2326,7 @@ param : [out_grad, axis] no_need_buffer : x -- backward_api : strided_slice_grad +- backward_op : strided_slice_grad forward : strided_slice (Tensor x, int[] axes, IntArray starts, IntArray ends, IntArray strides) -> Tensor(out) args : (Tensor x, Tensor out_grad, int[] axes, IntArray starts, IntArray ends, IntArray strides) output : Tensor(x_grad) @@ -2363,7 +2337,7 @@ func : strided_slice_grad no_need_buffer : x -- backward_api : subtract_double_grad +- backward_op : subtract_double_grad forward : subtract_grad (Tensor x, Tensor y, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y) args : (Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1) output : Tensor(grad_out_grad) @@ -2376,7 +2350,7 @@ no_need_buffer : y, grad_out inplace : (grad_x_grad -> grad_out_grad) -- backward_api : subtract_grad +- backward_op : subtract_grad forward : subtract (Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad, int axis = -1) output : Tensor(x_grad), Tensor(y_grad) @@ -2389,13 +2363,13 @@ backward : subtract_double_grad inplace : (out_grad -> x_grad) -- backward_api : sum_double_grad +- backward_op : sum_double_grad forward : sum_grad (Tensor x, Tensor grad_out, IntArray dims, bool keep_dim, bool reduce_all=false) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray dims={}, bool keep_dim=false) output : Tensor(grad_out_grad) invoke : sum(grad_x_grad, dims, grad_x_grad.dtype(), keep_dim) -- backward_api : sum_grad +- backward_op : sum_grad forward : sum (Tensor x, IntArray dims={}, DataType out_dtype=DataType::UNDEFINED, bool keep_dim=false) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray dims, bool keep_dim, bool reduce_all=false) output : Tensor(x_grad) @@ -2407,7 +2381,7 @@ no_need_buffer : x backward : sum_double_grad -- backward_api : svd_grad +- backward_op : svd_grad forward : svd (Tensor x, bool full) -> Tensor(u), Tensor(s), Tensor(vh) args : (Tensor x, Tensor u, Tensor vh, Tensor s, Tensor u_grad, Tensor vh_grad, Tensor s_grad, bool full) output : Tensor(x_grad) @@ -2418,7 +2392,7 @@ func : svd_grad optional: u_grad, vh_grad, s_grad -- backward_api : swish_grad +- backward_op : swish_grad forward : swish (Tensor x, float beta=1.0) -> Tensor(out) args : (Tensor x, Tensor out_grad, float bete=1.0) output : Tensor(x_grad) @@ -2429,7 +2403,7 @@ func : swish_grad inplace : (out_grad -> x_grad) -- backward_api : sync_batch_norm_grad +- backward_op : sync_batch_norm_grad forward : sync_batch_norm_ (Tensor x, Tensor scale, Tensor bias, Tensor mean, Tensor variance, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) -> Tensor(out), Tensor(mean_out), Tensor(variance_out), Tensor(saved_mean), Tensor(saved_variance), Tensor(reserve_space) args : (Tensor x, Tensor scale, Tensor bias, Tensor saved_mean, Tensor saved_variance, Tensor reserve_space, Tensor out_grad, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad) @@ -2441,7 +2415,7 @@ data_type : out_grad optional : reserve_space -- backward_api : take_along_axis_grad +- backward_op : take_along_axis_grad forward : take_along_axis (Tensor x, Tensor index, int axis) -> Tensor(out) args : (Tensor x, Tensor index, Tensor out_grad, int axis) output : Tensor(x_grad) @@ -2451,7 +2425,7 @@ kernel : func : take_along_axis_grad -- backward_api : tan_grad +- backward_op : tan_grad forward : tan (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2462,7 +2436,7 @@ func : tan_grad inplace : (out_grad -> x_grad) -- backward_api : tanh_double_grad +- backward_op : tanh_double_grad forward : tanh_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x) args : (Tensor out, Tensor grad_out, Tensor grad_x_grad) output : Tensor(out_grad), Tensor(grad_out_grad) @@ -2474,7 +2448,7 @@ backward : tanh_triple_grad inplace : (grad_x_grad -> grad_out_grad) -- backward_api : tanh_grad +- backward_op : tanh_grad forward : tanh (Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -2486,7 +2460,7 @@ backward : tanh_double_grad inplace : (out_grad -> x_grad) -- backward_api : tanh_shrink_grad +- backward_op : tanh_shrink_grad forward : tanh_shrink (Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -2497,7 +2471,7 @@ func : tanh_shrink_grad inplace : (out_grad -> x_grad) -- backward_api : tanh_triple_grad +- backward_op : tanh_triple_grad forward : tanh_double_grad (Tensor out, Tensor grad_out_forward, Tensor grad_x_grad_forward) -> Tensor(grad_out_new), Tensor(grad_out_grad) args : (Tensor out, Tensor grad_out_forward, Tensor grad_x_grad_forward, Tensor grad_out_new_grad, Tensor grad_out_grad_grad) output : Tensor(out_grad), Tensor(grad_out_forward_grad), Tensor(grad_x_grad_forward_grad) @@ -2508,7 +2482,7 @@ func : tanh_triple_grad inplace : (grad_x_grad_forward -> grad_out_forward_grad) -- backward_api : temporal_shift_grad +- backward_op : temporal_shift_grad forward : temporal_shift(Tensor x, int seg_num, float shift_ratio, str data_format_str) -> Tensor(out) args : (Tensor out_grad, int seg_num, float shift_ratio, str data_format_str) output : Tensor(x_grad) @@ -2518,7 +2492,7 @@ kernel : func : temporal_shift_grad -- backward_api : thresholded_relu_grad +- backward_op : thresholded_relu_grad forward : thresholded_relu (Tensor x, float threshold) -> Tensor(out) args : (Tensor x, Tensor out_grad, float threshold) output : Tensor(x_grad) @@ -2529,7 +2503,7 @@ func : thresholded_relu_grad inplace : (out_grad -> x_grad) -- backward_api : tile_double_grad +- backward_op : tile_double_grad forward : tile_grad (Tensor x, Tensor grad_out, IntArray repeat_times) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray repeat_times) output : Tensor(grad_out_grad) @@ -2538,7 +2512,7 @@ kernel : func : tile -- backward_api : tile_grad +- backward_op : tile_grad forward : tile (Tensor x, IntArray repeat_times) -> Tensor(out) args : (Tensor x, Tensor out_grad, IntArray repeat_times) output : Tensor(x_grad) @@ -2550,7 +2524,7 @@ no_need_buffer : x backward : tile_double_grad -- backward_api : top_k_grad +- backward_op : top_k_grad forward : top_k (Tensor x, Scalar k, int axis = -1, bool largest = true, bool sorted = true) -> Tensor(out), Tensor(indices) args : (Tensor x, Tensor indices, Tensor out_grad, Scalar k = -1, int axis = -1, bool largest = true, bool sorted = true) output : Tensor(x_grad) @@ -2560,13 +2534,13 @@ kernel : func : top_k_grad -- backward_api : transpose_double_grad +- backward_op : transpose_double_grad forward : transpose_grad (Tensor grad_out, int[] axis) -> Tensor(grad_x) args : (Tensor grad_x_grad, int[] axis) output : Tensor(grad_out_grad) invoke : transpose(grad_x_grad, axis) -- backward_api : transpose_grad +- backward_op : transpose_grad forward : transpose (Tensor x, int[] axis) -> Tensor(out) args : (Tensor out_grad, int[] axis) output : Tensor(x_grad) @@ -2577,7 +2551,7 @@ func : transpose_grad backward : transpose_double_grad -- backward_api : triangular_solve_grad +- backward_op : triangular_solve_grad forward : triangular_solve (Tensor x, Tensor y, bool upper, bool tranpose, bool unitriangular) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, bool upper, bool tranpose, bool unitriangular) output : Tensor(x_grad), Tensor(y_grad) @@ -2587,7 +2561,7 @@ kernel : func : triangular_solve_grad -- backward_api : tril_triu_grad +- backward_op : tril_triu_grad forward : tril_triu(Tensor x, int diagonal, bool lower) -> Tensor(out) args : (Tensor out_grad, int diagonal, bool lower) output : Tensor(x_grad) @@ -2597,7 +2571,7 @@ kernel : func : tril_triu_grad -- backward_api : trilinear_interp_grad +- backward_op : trilinear_interp_grad forward : trilinear_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) -> Tensor(output) args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(x_grad) @@ -2609,13 +2583,13 @@ func : trilinear_interp_grad data_type : output_grad -- backward_api : unbind_grad +- backward_op : unbind_grad forward : unbind (Tensor input, int axis) -> Tensor[](out) args : (Tensor[] out_grad, int axis) output : Tensor(input_grad) invoke : stack(out_grad, axis) -- backward_api : unfold_grad +- backward_op : unfold_grad forward : unfold (Tensor x, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) -> Tensor(out) args : (Tensor x, Tensor out_grad, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) output : Tensor(x_grad) @@ -2626,7 +2600,7 @@ func : unfold_grad no_need_buffer : x -- backward_api : uniform_random_inplace_grad +- backward_op : uniform_random_inplace_grad forward : uniform_random_inplace(Tensor x, float min, float max, int seed, int diag_num, int diag_step, float diag_val) -> Tensor(out) args : (Tensor out_grad, float min, float max, int seed, int diag_num, int diag_step, float diag_val) output : Tensor(x_grad) @@ -2636,13 +2610,13 @@ func : uniform_random_inplace_grad inplace : (out_grad -> x_grad) -- backward_api : unsqueeze_double_grad +- backward_op : unsqueeze_double_grad forward : unsqueeze_grad(Tensor xshape, Tensor grad_out, IntArray axes) -> Tensor(grad_x) args : (Tensor grad_x_grad, IntArray axes) output : Tensor(grad_out_grad) invoke : unsqueeze(grad_x_grad, axes) -- backward_api : unsqueeze_grad +- backward_op : unsqueeze_grad forward : unsqueeze(Tensor x, IntArray axes) -> Tensor(out), Tensor(xshape) args : (Tensor xshape, Tensor out_grad, IntArray axes) output : Tensor(x_grad) @@ -2655,7 +2629,7 @@ inplace : (out_grad -> x_grad) backward : unsqueeze_double_grad -- backward_api : unstack_grad +- backward_op : unstack_grad forward : unstack (Tensor x, int axis, int num) -> Tensor[](out) args : (Tensor[] out_grad, int axis) output : Tensor(x_grad) @@ -2665,7 +2639,7 @@ kernel : func : unstack_grad -- backward_api : warpctc_grad +- backward_op : warpctc_grad forward : warpctc (Tensor logits, Tensor label, Tensor logits_length, Tensor labels_length, int blank, bool norm_by_times) -> Tensor(loss), Tensor(warpctcgrad) args : (Tensor logits, Tensor logits_length, Tensor warpctcgrad, Tensor loss_grad, int blank, bool norm_by_times) output : Tensor(logits_grad) @@ -2677,7 +2651,7 @@ optional : logits_length no_need_buffer : logits -- backward_api : where_grad +- backward_op : where_grad forward : where (Tensor condition, Tensor x, Tensor y) -> Tensor(out) args : (Tensor condition, Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -2688,7 +2662,7 @@ func : where_grad no_need_buffer : x, y -- backward_api : yolov3_loss_grad +- backward_op : yolov3_loss_grad forward : yolov3_loss(Tensor x, Tensor gt_box, Tensor gt_label, Tensor gt_score, int[] anchors, int[] anchor_mask, int class_num, float ignore_thresh, int downsample_ratio, bool use_label_smooth=true, float scale_x_y=1.0) -> Tensor(loss), Tensor(objectness_mask), Tensor(gt_match_mask) args : (Tensor x, Tensor gt_box, Tensor gt_label, Tensor gt_score, Tensor objectness_mask, Tensor gt_match_mask, Tensor loss_grad, int[] anchors, int[] anchor_mask, int class_num, float ignore_thresh, int downsample_ratio, bool use_label_smooth=true, float scale_x_y=1.0) output : Tensor(x_grad), Tensor(gt_box_grad), Tensor(gt_label_grad), Tensor(gt_score_grad) @@ -2698,7 +2672,7 @@ func : yolov3_loss_grad optional : gt_score -- backward_api: fold_grad +- backward_op: fold_grad forward: fold (Tensor x, int[] output_sizes, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) -> Tensor(out) args: (Tensor x, Tensor out_grad, int[] output_sizes, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) output: Tensor(x_grad) @@ -2709,7 +2683,7 @@ func: fold_grad no_need_buffer : x -- backward_api: unpool3d_grad +- backward_op: unpool3d_grad forward: unpool3d (Tensor x, Tensor indices, int[] ksize, int[] strides, int[] padding, int[] output_size, str data_format) -> Tensor(out) args: (Tensor x, Tensor indices, Tensor out, Tensor out_grad, int[] ksize, int[] strides, int[] padding, int[] output_size, str data_format) output: Tensor(x_grad) @@ -2720,7 +2694,7 @@ func: unpool3d_grad data_type: x -- backward_api: unpool_grad +- backward_op: unpool_grad forward: unpool (Tensor x, Tensor indices, int[] ksize, int[] strides, int[] padding, IntArray output_size, str data_format) -> Tensor(out) args: (Tensor x, Tensor indices, Tensor out, Tensor out_grad, int[] ksize, int[] strides, int[] padding, IntArray output_size, str data_format) output: Tensor(x_grad) diff --git a/paddle/phi/api/yaml/legacy_api.yaml b/paddle/phi/api/yaml/legacy_ops.yaml similarity index 92% rename from paddle/phi/api/yaml/legacy_api.yaml rename to paddle/phi/api/yaml/legacy_ops.yaml index d48e6648586..e69d54eb1e2 100755 --- a/paddle/phi/api/yaml/legacy_api.yaml +++ b/paddle/phi/api/yaml/legacy_ops.yaml @@ -1,7 +1,7 @@ # The apis in this file are unstandardized that may caused by a variety of reasons, -# we are trying to fix these apis and will move standardized apis into api.yaml. +# we are trying to fix these apis and will move standardized apis into ops.yaml. -- api : abs +- op : abs args : (Tensor x) output : Tensor infer_meta : @@ -10,7 +10,7 @@ func : abs backward : abs_grad -- api : accuracy +- op : accuracy args : (Tensor x, Tensor indices, Tensor label) output : Tensor(accuracy), Tensor(correct), Tensor(total) infer_meta : @@ -19,7 +19,7 @@ func : accuracy dtype : x -- api : acos +- op : acos args : (Tensor x) output : Tensor infer_meta : @@ -28,7 +28,7 @@ func : acos backward : acos_grad -- api : acosh +- op : acosh args : (Tensor x) output : Tensor infer_meta : @@ -37,7 +37,7 @@ func : acosh backward : acosh_grad -- api : adadelta_ +- op : adadelta_ args : (Tensor param, Tensor grad, Tensor avg_squared_grad, Tensor avg_squared_update, float rho, float epsilon) output : Tensor(param_out), Tensor(moment_out), Tensor(inf_norm_out) infer_meta : @@ -46,7 +46,7 @@ func : adadelta inplace : (param -> param_out), (avg_squared_grad -> moment_out), (avg_squared_update -> inf_norm_out) -- api : adagrad_ +- op : adagrad_ args : (Tensor param, Tensor grad, Tensor moment, Tensor learning_rate, float epsilon) output : Tensor(param_out), Tensor(moment_out) infer_meta : @@ -57,7 +57,7 @@ data_type : param inplace : (param -> param_out), (moment -> moment_out) -- api : adam_ +- op : adam_ args : (Tensor param, Tensor grad, Tensor learning_rate, Tensor moment1, Tensor moment2, Tensor beta1_pow, Tensor beta2_pow, Tensor master_param, Tensor skip_update, Scalar beta1, Scalar beta2, Scalar epsilon, bool lazy_mode, int64_t min_row_size_to_use_multithread, bool multi_precision, bool use_global_beta_pow) output : Tensor(param_out), Tensor(moment1_out), Tensor(moment2_out), Tensor(beta1_pow_out), Tensor(beta2_pow_out), Tensor(master_param_outs) infer_meta : @@ -69,7 +69,7 @@ optional : master_param, skip_update inplace : (param -> param_out), (moment1 -> moment1_out), (moment2 -> moment2_out), (beta1_pow -> beta1_pow_out), (beta2_pow -> beta2_pow_out), (master_param -> master_param_outs) -- api : adamax_ +- op : adamax_ args : (Tensor param, Tensor grad, Tensor learning_rate, Tensor moment, Tensor inf_norm, Tensor beta1_pow, float beta1, float beta2, float epsilon) output : Tensor(param_out), Tensor(avg_squared_grad_out), Tensor(avg_squared_update_out) infer_meta : @@ -78,7 +78,7 @@ func : adamax inplace : (param -> param_out), (moment -> avg_squared_grad_out), (inf_norm -> avg_squared_update_out) -- api : adamw_ +- op : adamw_ args : (Tensor param, Tensor grad, Tensor learning_rate, Tensor moment1, Tensor moment2, Tensor beta1_pow, Tensor beta2_pow, Tensor master_param, Tensor skip_update, Scalar beta1, Scalar beta2, Scalar epsilon, float lr_ratio, float coeff, bool with_decay, bool lazy_mode, int64_t min_row_size_to_use_multithread, bool multi_precision, bool use_global_beta_pow) output : Tensor(param_out), Tensor(moment1_out), Tensor(moment2_out), Tensor(beta1_pow_out), Tensor(beta2_pow_out), Tensor(master_param_outs) infer_meta : @@ -89,7 +89,7 @@ optional : master_param, skip_update inplace : (param -> param_out), (moment1 -> moment1_out), (moment2 -> moment2_out), (beta1_pow -> beta1_pow_out), (beta2_pow -> beta2_pow_out), (master_param -> master_param_outs) -- api : add +- op : add args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -99,7 +99,7 @@ inplace : (x -> out) backward : add_grad -- api : add_n +- op : add_n args : (Tensor[] x) output : Tensor infer_meta : @@ -108,7 +108,7 @@ func : add_n backward : add_n_grad -- api : addmm +- op : addmm args : (Tensor input, Tensor x, Tensor y, float alpha, float beta) output : Tensor infer_meta : @@ -117,7 +117,7 @@ func : addmm backward : addmm_grad -- api : affine_grid +- op : affine_grid args : (Tensor input, IntArray outputShape, bool use_cudnn=true, bool align_corners=true) output : Tensor infer_meta : @@ -130,7 +130,7 @@ use_gpudnn: use_cudnn backward : affine_grid_grad -- api : all +- op : all args : (Tensor x, int64_t[] dims={}, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -138,7 +138,7 @@ kernel : func : all -- api : allclose +- op : allclose args : (Tensor x, Tensor y, Scalar rtol, Scalar atol, bool equal_nan) output : Tensor(out) infer_meta : @@ -147,7 +147,7 @@ kernel : func : allclose -- api : amax +- op : amax args : (Tensor x, int64_t[] dims={}, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -156,7 +156,7 @@ func : amax backward : amax_grad -- api : amin +- op : amin args : (Tensor x, int64_t[] dims={}, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -165,7 +165,7 @@ func : amin backward : amin_grad -- api : angle +- op : angle args : (Tensor x) output : Tensor infer_meta : @@ -174,7 +174,7 @@ func : angle backward : angle_grad -- api : any +- op : any args : (Tensor x, int64_t[] dims={}, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -182,7 +182,7 @@ kernel : func : any -- api : arange +- op : arange args : (Tensor start, Tensor end, Tensor step, DataType dtype, Place place={}) output : Tensor(out) infer_meta : @@ -196,7 +196,7 @@ data_transform : support_trans_dtype : start, end, step -- api : argmax +- op : argmax args : (Tensor x, Scalar axis, bool keepdims, bool flatten, int dtype) output : Tensor(out) infer_meta : @@ -204,7 +204,7 @@ kernel : func : arg_max -- api : argmin +- op : argmin args : (Tensor x, Scalar axis, bool keepdims, bool flatten, int dtype) output : Tensor(out) infer_meta : @@ -212,7 +212,7 @@ kernel : func : arg_min -- api : argsort +- op : argsort args : (Tensor x, int axis=-1, bool descending=false) output : Tensor(out), Tensor(indices) infer_meta : @@ -221,7 +221,7 @@ func : argsort backward : argsort_grad -- api : as_complex +- op : as_complex args : (Tensor x) output : Tensor infer_meta : @@ -230,7 +230,7 @@ func : as_complex backward : as_complex_grad -- api : as_real +- op : as_real args : (Tensor x) output : Tensor infer_meta : @@ -239,7 +239,7 @@ func : as_real backward : as_real_grad -- api : asin +- op : asin args : (Tensor x) output : Tensor infer_meta : @@ -248,7 +248,7 @@ func : asin backward : asin_grad -- api : asinh +- op : asinh args : (Tensor x) output : Tensor infer_meta : @@ -257,7 +257,7 @@ func : asinh backward : asinh_grad -- api : assign +- op : assign args : (Tensor x) output : Tensor infer_meta : @@ -266,7 +266,7 @@ func : assign backward : assign_grad -- api : assign_out_ +- op : assign_out_ args : (Tensor x, Tensor output) output : Tensor(out) infer_meta : @@ -278,7 +278,7 @@ inplace : (output -> out) backward : assign_out__grad -- api : assign_value_ +- op : assign_value_ args : (Tensor output, int[] shape, DataType dtype, Scalar[] values, Place place = {}) output : Tensor(out) inplace: (output -> out) @@ -291,7 +291,7 @@ data_type : dtype backend : place > output -- api : atan +- op : atan args : (Tensor x) output : Tensor infer_meta : @@ -300,7 +300,7 @@ func : atan backward : atan_grad -- api : atanh +- op : atanh args : (Tensor x) output : Tensor infer_meta : @@ -309,7 +309,7 @@ func : atanh backward : atanh_grad -- api : auc +- op : auc args : (Tensor x, Tensor label, Tensor stat_pos, Tensor stat_neg, Tensor ins_tag_weight, str curve, int num_thresholds, int slide_steps) output : Tensor(auc), Tensor(stat_pos_out), Tensor(stat_neg_out) infer_meta : @@ -318,7 +318,7 @@ func : auc optional : ins_tag_weight -- api : average_accumulates_ +- op : average_accumulates_ args : (Tensor param, Tensor in_sum_1, Tensor in_sum_2, Tensor in_sum_3, Tensor in_num_accumulates, Tensor in_old_num_accumulates, Tensor in_num_updates, float average_window, int64_t max_average_window, int64_t min_average_window) output : Tensor(out_sum_1), Tensor(out_sum_2), Tensor(out_sum_3), Tensor(out_num_accumulates), Tensor(out_old_num_accumulates), Tensor(out_num_updates) infer_meta: @@ -328,13 +328,13 @@ data_type : param inplace : (in_sum_1 -> out_sum_1), (in_sum_2 -> out_sum_2), (in_sum_3 -> out_sum_3), (in_num_accumulates -> out_num_accumulates), (in_old_num_accumulates -> out_old_num_accumulates), (in_num_updates -> out_num_updates) -- api : batch_norm +- op : batch_norm args : (Tensor x, Tensor scale, Tensor bias, Tensor mean, Tensor variance, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) output : Tensor(out), Tensor(mean_out), Tensor(variance_out), Tensor(saved_mean), Tensor(saved_variance), Tensor(reserve_space) invoke : batch_norm_impl(x, scale, bias, mean, variance, momentum, epsilon, data_layout, is_test, use_global_stats, trainable_statistics, fuse_with_relu) backward : batch_norm_grad -- api : bce_loss +- op : bce_loss args : (Tensor input, Tensor label) output : Tensor infer_meta : @@ -343,7 +343,7 @@ func : bce_loss backward : bce_loss_grad -- api : bicubic_interp +- op : bicubic_interp args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(output) infer_meta : @@ -354,7 +354,7 @@ data_type : x backward : bicubic_interp_grad -- api : bilinear_interp +- op : bilinear_interp args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(output) infer_meta : @@ -365,7 +365,7 @@ data_type : x backward : bilinear_interp_grad -- api : bilinear_tensor_product +- op : bilinear_tensor_product args : (Tensor x, Tensor y, Tensor weight, Tensor bias) output : Tensor infer_meta : @@ -375,7 +375,7 @@ optional : bias backward : bilinear_tensor_product_grad -- api : bitwise_and +- op : bitwise_and args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -383,7 +383,7 @@ kernel : func : bitwise_and -- api : bitwise_not +- op : bitwise_not args : (Tensor x) output : Tensor(out) infer_meta : @@ -391,7 +391,7 @@ kernel : func : bitwise_not -- api : bitwise_or +- op : bitwise_or args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -399,7 +399,7 @@ kernel : func : bitwise_or -- api : bitwise_xor +- op : bitwise_xor args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -407,7 +407,7 @@ kernel : func : bitwise_xor -- api : bmm +- op : bmm args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -416,7 +416,7 @@ func : bmm backward : bmm_grad -- api : box_coder +- op : box_coder args : (Tensor prior_box, Tensor prior_box_var, Tensor target_box, str code_type, bool box_normalized, int axis, float[] variance) output : Tensor(output_box) infer_meta : @@ -425,7 +425,7 @@ func : box_coder optional : prior_box_var -- api : brelu +- op : brelu args : (Tensor x, float t_min, float t_max) output : Tensor infer_meta : @@ -435,7 +435,7 @@ func : brelu backward : brelu_grad -- api : cast +- op : cast args : (Tensor x, DataType out_dtype) output : Tensor infer_meta : @@ -446,7 +446,7 @@ data_type : x backward : cast_grad -- api : ceil +- op : ceil args : (Tensor x) output : Tensor(out) infer_meta : @@ -456,7 +456,7 @@ inplace : (x -> out) backward : ceil_grad -- api : celu +- op : celu args : (Tensor x, float alpha) output : Tensor(out) infer_meta : @@ -466,7 +466,7 @@ func : celu backward : celu_grad -- api : class_center_sample +- op : class_center_sample args : (Tensor label, int num_classes, int num_samples, int ring_id, int rank, int nranks, bool fix_seed, int seed) output : Tensor(remapped_label), Tensor(sampled_local_class_center) infer_meta : @@ -474,7 +474,7 @@ kernel : func : class_center_sample -- api : clip +- op : clip args : (Tensor x, Scalar(float) min, Scalar(float) max) output : Tensor(out) inplace : (x -> out) @@ -485,7 +485,7 @@ func : clip backward : clip_grad -- api : clip_by_norm +- op : clip_by_norm args : (Tensor x, float max_norm) output : Tensor(out) infer_meta : @@ -493,7 +493,7 @@ kernel : func : clip_by_norm -- api : coalesce_tensor +- op : coalesce_tensor args : (Tensor[] input, DataType dtype, bool copy_data = false, bool set_constant = false, bool persist_output = false, float constant = 0.0, bool use_align = true, int align_size = -1, int size_of_dtype = -1, int64_t[] concated_shapes = {}, int64_t[] concated_ranks = {}) output : Tensor[](output){input.size()}, Tensor(fused_output) infer_meta : @@ -502,7 +502,7 @@ func : coalesce_tensor data_type : dtype -- api : complex +- op : complex args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -511,7 +511,7 @@ func : complex backward : complex_grad -- api : concat +- op : concat args : (Tensor[] x, Scalar(int64_t) axis) output : Tensor infer_meta : @@ -521,7 +521,7 @@ func : concat backward : concat_grad -- api : conj +- op : conj args : (Tensor x) output : Tensor infer_meta : @@ -530,7 +530,7 @@ func : conj backward : conj_grad -- api : conv2d +- op : conv2d args : (Tensor input, Tensor filter, int[] strides, int[] paddings, str padding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) output : Tensor infer_meta : @@ -540,7 +540,7 @@ use_gpudnn : true backward : conv2d_grad -- api : conv2d_transpose +- op : conv2d_transpose args : (Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) output : Tensor(out) infer_meta : @@ -550,7 +550,7 @@ use_gpudnn : true backward : conv2d_transpose_grad -- api : conv3d +- op : conv3d args : (Tensor input, Tensor filter, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) output : Tensor infer_meta : @@ -560,7 +560,7 @@ use_gpudnn : true backward : conv3d_grad -- api : conv3d_transpose +- op : conv3d_transpose args : (Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format) output : Tensor(out) infer_meta : @@ -570,12 +570,12 @@ use_gpudnn : true backward : conv3d_transpose_grad -- api : copy_to +- op : copy_to args : (Tensor x, Place place, bool blocking) output : Tensor(out) invoke : copy_to_impl(x, place, blocking) -- api : cos +- op : cos args : (Tensor x) output : Tensor infer_meta : @@ -584,7 +584,7 @@ func : cos backward : cos_grad -- api : cosh +- op : cosh args : (Tensor x) output : Tensor infer_meta : @@ -593,7 +593,7 @@ func : cosh backward : cosh_grad -- api : crop_tensor +- op : crop_tensor args : (Tensor x, IntArray shape, IntArray offsets) output : Tensor(out) infer_meta : @@ -604,7 +604,7 @@ backward : crop_tensor_grad # Part of python API paddle.nn.functional.cross_entropy -- api : cross_entropy_with_softmax +- op : cross_entropy_with_softmax args : (Tensor input, Tensor label, bool soft_label, bool use_softmax, bool numeric_stable_mode, int ignore_index, int axis) output : Tensor(softmax), Tensor(loss) infer_meta : @@ -614,7 +614,7 @@ data_type : input backward : cross_entropy_with_softmax_grad -- api : cumprod +- op : cumprod args : (Tensor x, int dim) output : Tensor(out) infer_meta : @@ -624,7 +624,7 @@ func : cumprod backward : cumprod_grad -- api : cumsum +- op : cumsum args : (Tensor x, Scalar axis, bool flatten, bool exclusive, bool reverse) output : Tensor(out) infer_meta : @@ -633,7 +633,7 @@ func : cumsum backward : cumsum_grad -- api : decode_jpeg +- op : decode_jpeg args : (Tensor x, str mode) output : Tensor(out) infer_meta : @@ -641,7 +641,7 @@ kernel : func : decode_jpeg -- api : deformable_conv +- op : deformable_conv args : (Tensor x, Tensor offset, Tensor filter, Tensor mask, int[] strides, int[] paddings, int[] dilations, int deformable_groups, int groups, int im2col_step) output : Tensor(out) infer_meta : @@ -652,7 +652,7 @@ optional : mask backward : deformable_conv_grad -- api : depthwise_conv2d +- op : depthwise_conv2d args : (Tensor x, Tensor filter, int[] strides, int[] paddings, str padding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu, bool use_gpudnn) output : Tensor(out) infer_meta : @@ -664,7 +664,7 @@ use_gpudnn : use_gpudnn backward : depthwise_conv2d_grad -- api : depthwise_conv2d_transpose +- op : depthwise_conv2d_transpose args : (Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) output : Tensor(out) infer_meta : @@ -673,7 +673,7 @@ func : depthwise_conv2d_transpose backward : depthwise_conv2d_transpose_grad -- api : det +- op : det args : (Tensor x) output : Tensor infer_meta : @@ -682,7 +682,7 @@ func : determinant backward : det_grad -- api : diag_embed +- op : diag_embed args : (Tensor x, int offset, int dim1, int dim2) output : Tensor(out) infer_meta : @@ -690,7 +690,7 @@ kernel : func : diag_embed -- api : distribute_fpn_proposals +- op : distribute_fpn_proposals args : (Tensor fpn_rois, Tensor rois_num, int min_level, int max_level, int refer_level, int refer_scale, bool pixel_offset) output : Tensor[](multi_fpn_rois){max_level - min_level + 1}, Tensor[](multi_level_rois_num){max_level - min_level + 1}, Tensor(restore_index) infer_meta : @@ -700,7 +700,7 @@ data_type : fpn_rois optional : rois_num -- api : divide +- op : divide args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -709,7 +709,7 @@ func : divide backward : divide_grad -- api : dropout +- op : dropout args : (Tensor x, Tensor seed_tensor, Scalar p, bool is_test, str mode, int seed, bool fix_seed) output : Tensor(out), Tensor(mask) infer_meta : @@ -720,7 +720,7 @@ optional : seed_tensor backward : dropout_grad -- api : edit_distance +- op : edit_distance args : (Tensor hyps, Tensor refs, Tensor hypslength, Tensor refslength, bool normalized = false) output : Tensor(sequencenum), Tensor(out) infer_meta : @@ -730,7 +730,7 @@ data_type: DataType::FLOAT32 optional : hypslength, refslength -- api : eigh +- op : eigh args : (Tensor x, str uplo) output : Tensor(out_w), Tensor(out_v) infer_meta : @@ -739,7 +739,7 @@ func : eigh backward : eigh_grad -- api : eigvals +- op : eigvals args : (Tensor x) output : Tensor(out) infer_meta : @@ -747,7 +747,7 @@ kernel : func : eigvals -- api : eigvalsh +- op : eigvalsh args : (Tensor x, str uplo, bool is_test) output : Tensor(eigenvalues), Tensor(eigenvectors) infer_meta : @@ -756,7 +756,7 @@ func : eigvalsh backward : eigvalsh_grad -- api : einsum +- op : einsum args : (Tensor[] x, str equation) output : Tensor, Tensor[]{x.size()}, Tensor[]{x.size()} infer_meta : @@ -766,7 +766,7 @@ func : einsum_raw backward : einsum_grad -- api : elementwise_pow +- op : elementwise_pow args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -775,7 +775,7 @@ func : elementwise_pow backward : elementwise_pow_grad -- api : elu +- op : elu args : (Tensor x, float alpha) output : Tensor(out) infer_meta : @@ -786,13 +786,13 @@ inplace : (x -> out) backward : elu_grad -- api : embedding +- op : embedding args : (Tensor x, Tensor weight, int64_t padding_idx=-1, bool sparse=false) output : Tensor invoke : embedding_impl(x, weight, padding_idx, sparse) backward : embedding_grad -- api : empty +- op : empty args : (IntArray shape, DataType dtype=DataType::FLOAT32, Place place=CPUPlace()) output: Tensor(out) infer_meta : @@ -804,7 +804,7 @@ data_type : dtype backend : place -- api : empty_like +- op : empty_like args : (Tensor x, DataType dtype = DataType::UNDEFINED, Place place = {}) output: Tensor(out) infer_meta : @@ -816,7 +816,7 @@ data_type : dtype > x backend : place > x -- api : equal +- op : equal args : (Tensor x, Tensor y, int axis = -1) output : Tensor(out) infer_meta : @@ -824,7 +824,7 @@ kernel : func : equal -- api : equal_all +- op : equal_all args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -832,7 +832,7 @@ kernel : func : equal_all -- api : exp +- op : exp args : (Tensor x) output : Tensor(out) infer_meta : @@ -842,7 +842,7 @@ inplace : (x -> out) backward : exp_grad -- api : expand +- op : expand args : (Tensor x, IntArray shape) output : Tensor infer_meta : @@ -851,7 +851,7 @@ func : expand backward : expand_grad -- api : expand_as +- op : expand_as args : (Tensor x, Tensor y, int[] target_shape) output : Tensor infer_meta : @@ -861,7 +861,7 @@ optional : y backward : expand_as_grad -- api : expm1 +- op : expm1 args : (Tensor x) output : Tensor infer_meta : @@ -871,7 +871,7 @@ func : expm1 backward : expm1_grad -- api : exponential_ +- op : exponential_ args : (Tensor x, float lambda) output : Tensor(out) infer_meta : @@ -882,7 +882,7 @@ inplace : (x -> out) backward : exponential__grad -- api : eye +- op : eye args : (Scalar num_rows, Scalar num_columns, DataType dtype=DataType::FLOAT32, Place place={}) output : Tensor(out) infer_meta : @@ -894,7 +894,7 @@ data_type : dtype backend : place -- api : fill +- op : fill args : (Tensor x, Scalar value) output : Tensor(out) infer_meta : @@ -905,7 +905,7 @@ inplace : (x -> out) backward: fill_grad -- api : fill_diagonal +- op : fill_diagonal args : (Tensor x, float value, int offset, bool wrap) output : Tensor(out) infer_meta : @@ -915,7 +915,7 @@ inplace : (x -> out) backward : fill_diagonal_grad -- api : fill_diagonal_tensor +- op : fill_diagonal_tensor args : (Tensor x, Tensor y, int64_t offset, int dim1, int dim2) output : Tensor(out) infer_meta : @@ -925,7 +925,7 @@ inplace : (x -> out) backward : fill_diagonal_tensor_grad -- api : flatten +- op : flatten args : (Tensor x, int start_axis, int stop_axis) output : Tensor(out), Tensor(xshape) infer_meta : @@ -938,7 +938,7 @@ intermediate : xshape backward : flatten_grad -- api : flip +- op : flip args : (Tensor x, int[] axis) output : Tensor infer_meta : @@ -947,7 +947,7 @@ func : flip backward : flip_grad -- api : floor +- op : floor args : (Tensor x) output : Tensor(out) infer_meta : @@ -957,7 +957,7 @@ inplace : (x -> out) backward : floor_grad -- api : floor_divide +- op : floor_divide args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -965,7 +965,7 @@ kernel : func : floor_divide -- api : fmax +- op : fmax args : (Tensor x, Tensor y, int axis) output : Tensor(out) infer_meta : @@ -975,7 +975,7 @@ func : fmax backward : fmax_grad -- api : fmin +- op : fmin args : (Tensor x, Tensor y, int axis) output : Tensor(out) infer_meta : @@ -985,7 +985,7 @@ func : fmin backward : fmin_grad -- api : frame +- op : frame args : (Tensor x, int frame_length, int hop_length, int axis) output : Tensor(out) infer_meta : @@ -994,7 +994,7 @@ func : frame backward : frame_grad -- api : frobenius_norm +- op : frobenius_norm args : (Tensor x, int64_t[] axis, bool keep_dim, bool reduce_all) output : Tensor(out) infer_meta : @@ -1003,7 +1003,7 @@ func : frobenius_norm backward : frobenius_norm_grad -- api : full +- op : full args : (IntArray shape, Scalar value, DataType dtype=DataType::FLOAT32, Place place=CPUPlace()) output: Tensor(out) infer_meta : @@ -1015,7 +1015,7 @@ data_type : dtype backend : place -- api : full_ +- op : full_ args : (Tensor output, IntArray shape, Scalar value, DataType dtype=DataType::FLOAT32, Place place=CPUPlace()) output : Tensor(out) inplace : (output -> out) @@ -1028,7 +1028,7 @@ data_type : dtype backend : place -- api : full_batch_size_like +- op : full_batch_size_like args : (Tensor input, int[] shape, DataType dtype, Scalar value, int input_dim_idx, int output_dim_idx, Place place=CPUPlace()) output: Tensor(out) infer_meta : @@ -1040,7 +1040,7 @@ data_type : dtype backend : place -- api : full_like +- op : full_like args : (Tensor x, Scalar value, DataType dtype = DataType::UNDEFINED, Place place = {}) output: Tensor(out) infer_meta : @@ -1054,7 +1054,7 @@ data_transform : skip_transform : x -- api : gather +- op : gather args : (Tensor x, Tensor index, Scalar(int) axis=0) output : Tensor(out) infer_meta : @@ -1064,7 +1064,7 @@ data_type: x backward : gather_grad -- api : gather_nd +- op : gather_nd args : (Tensor x, Tensor index) output : Tensor infer_meta : @@ -1074,7 +1074,7 @@ data_type : x backward : gather_nd_grad -- api : gather_tree +- op : gather_tree args : (Tensor ids, Tensor parents) output : Tensor(out) infer_meta : @@ -1082,7 +1082,7 @@ kernel : func : gather_tree -- api : gaussian_random +- op : gaussian_random args : (IntArray shape, float mean, float std, int seed, DataType dtype, Place place={}) output: Tensor(out) infer_meta : @@ -1094,7 +1094,7 @@ data_type : dtype backend : place -- api : gelu +- op : gelu args : (Tensor x, bool approximate) output : Tensor(out) infer_meta : @@ -1104,7 +1104,7 @@ func : gelu backward : gelu_grad -- api : generate_proposals_v2 +- op : generate_proposals_v2 args : (Tensor scores, Tensor bbox_deltas, Tensor im_shape, Tensor anchors, Tensor variances, int pre_nms_top_n, int post_nms_top_n, float nms_thresh, float min_size, float eta, bool pixel_offset=true) output : Tensor(rpn_rois), Tensor(rpn_roi_probs), Tensor(rpn_rois_num) infer_meta : @@ -1112,7 +1112,7 @@ kernel : func : generate_proposals_v2 -- api : graph_send_recv +- op : graph_send_recv args : (Tensor x, Tensor src_index, Tensor dst_index, str reduce_op = "SUM", IntArray out_size = {0}) output : Tensor(out), Tensor(dst_count) infer_meta : @@ -1123,7 +1123,7 @@ intermediate : dst_count backward : graph_send_recv_grad -- api : graph_send_ue_recv +- op : graph_send_ue_recv args : (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, str message_op, str reduce_op, IntArray out_size) output : Tensor(out), Tensor(dst_count) infer_meta : @@ -1134,7 +1134,7 @@ intermediate : dst_count backward : graph_send_ue_recv_grad -- api : greater_equal +- op : greater_equal args : (Tensor x, Tensor y, int axis = -1) output : Tensor(out) infer_meta : @@ -1142,7 +1142,7 @@ kernel : func : greater_equal -- api : greater_than +- op : greater_than args : (Tensor x, Tensor y, int axis = -1) output : Tensor(out) infer_meta : @@ -1150,7 +1150,7 @@ kernel : func : greater_than -- api : grid_sample +- op : grid_sample args : (Tensor x, Tensor grid, str mode, str padding_mode, bool align_corners) output : Tensor(out) infer_meta : @@ -1161,7 +1161,7 @@ data_type : x backward : grid_sample_grad -- api : group_norm +- op : group_norm args : (Tensor x, Tensor scale, Tensor bias, float epsilon, int groups, str data_layout) output : Tensor(y), Tensor(mean), Tensor(variance) infer_meta : @@ -1172,7 +1172,7 @@ intermediate : mean, variance backward : group_norm_grad -- api : gumbel_softmax +- op : gumbel_softmax args : (Tensor x, float temperature, bool hard, int axis) output : Tensor infer_meta : @@ -1181,7 +1181,7 @@ func : gumbel_softmax backward : gumbel_softmax_grad -- api : hard_shrink +- op : hard_shrink args : (Tensor x, float threshold) output : Tensor infer_meta : @@ -1191,7 +1191,7 @@ func : hard_shrink backward : hard_shrink_grad -- api : hard_sigmoid +- op : hard_sigmoid args : (Tensor x, float slope, float offset) output : Tensor infer_meta : @@ -1201,7 +1201,7 @@ func : hard_sigmoid backward : hard_sigmoid_grad -- api : hard_swish +- op : hard_swish args : (Tensor x, float threshold = 6.0, float scale = 6.0, float offset = 3.0) output : Tensor infer_meta : @@ -1211,7 +1211,7 @@ func : hard_swish backward : hard_swish_grad -- api : hierarchical_sigmoid +- op : hierarchical_sigmoid args : (Tensor x, Tensor w, Tensor label, Tensor path, Tensor code, Tensor bias, int num_classes, bool remote_prefetch, int trainer_id, int64_t[] height_sections, str[] epmap, str[] table_names, bool is_sparse) output : Tensor(out), Tensor(pre_out), Tensor(w_out) infer_meta : @@ -1222,7 +1222,7 @@ data_type : x backward : hierarchical_sigmoid_grad -- api : histogram +- op : histogram args : (Tensor x, int64_t bins, int min, int max) output : Tensor(out) infer_meta : @@ -1230,7 +1230,7 @@ kernel : func : histogram -- api : huber_loss +- op : huber_loss args : (Tensor input, Tensor label, float delta) output : Tensor(out), Tensor(residual) infer_meta : @@ -1239,7 +1239,7 @@ func : huber_loss backward : huber_loss_grad -- api : imag +- op : imag args : (Tensor x) output : Tensor infer_meta : @@ -1248,7 +1248,7 @@ func : imag backward : imag_grad -- api : increment +- op : increment args : (Tensor x, float value) output : Tensor(out) infer_meta : @@ -1257,7 +1257,7 @@ func : increment inplace : (x -> out) -- api : index_add +- op : index_add args : (Tensor x, Tensor index, Tensor add_value, int axis) output : Tensor(out) infer_meta : @@ -1268,7 +1268,7 @@ inplace : (x -> out) backward : index_add_grad -- api : index_sample +- op : index_sample args : (Tensor x, Tensor index) output : Tensor infer_meta : @@ -1278,7 +1278,7 @@ data_type : x backward : index_sample_grad -- api : index_select +- op : index_select args : (Tensor x, Tensor index, int dim) output : Tensor(out) infer_meta : @@ -1288,7 +1288,7 @@ data_type : x backward : index_select_grad -- api : instance_norm +- op : instance_norm args : (Tensor x, Tensor scale, Tensor bias, float epsilon) output : Tensor(y), Tensor(saved_mean), Tensor(saved_variance) infer_meta : @@ -1300,7 +1300,7 @@ intermediate : saved_mean, saved_variance backward : instance_norm_grad -- api : inverse +- op : inverse args : (Tensor x) output : Tensor(out) infer_meta : @@ -1309,7 +1309,7 @@ func : inverse backward : inverse_grad -- api : is_empty +- op : is_empty args : (Tensor x) output : Tensor(out) infer_meta : @@ -1317,7 +1317,7 @@ kernel : func : is_empty -- api : isclose +- op : isclose args : (Tensor x, Tensor y, Scalar rtol, Scalar atol, bool equal_nan) output : Tensor(out) infer_meta : @@ -1326,7 +1326,7 @@ kernel : func : isclose -- api : isfinite +- op : isfinite args : (Tensor x) output : Tensor(out) infer_meta : @@ -1335,7 +1335,7 @@ func : isfinite {dense -> dense}, infinite_sr {selected_rows -> selected_rows} -- api : isinf +- op : isinf args : (Tensor x) output : Tensor(out) infer_meta : @@ -1344,7 +1344,7 @@ func : isinf {dense -> dense}, isinf_sr {selected_rows -> selected_rows} -- api : isnan +- op : isnan args : (Tensor x) output : Tensor(out) infer_meta : @@ -1353,7 +1353,7 @@ func : isnan {dense -> dense}, isnan_sr {selected_rows -> selected_rows} -- api : kldiv_loss +- op : kldiv_loss args : (Tensor x, Tensor label, str reduction) output : Tensor(out) infer_meta : @@ -1363,7 +1363,7 @@ data_type : x backward : kldiv_loss_grad -- api : kron +- op : kron args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -1372,7 +1372,7 @@ func : kron backward : kron_grad -- api : kthvalue +- op : kthvalue args : (Tensor x, int k, int axis, bool keepdim) output : Tensor(out), Tensor(indices) infer_meta : @@ -1381,7 +1381,7 @@ func : kthvalue backward : kthvalue_grad -- api : label_smooth +- op : label_smooth args : (Tensor label, Tensor prior_dist, float epsilon) output : Tensor infer_meta : @@ -1393,7 +1393,7 @@ optional : prior_dist backward : label_smooth_grad -- api : lamb_ +- op : lamb_ args : (Tensor param, Tensor grad, Tensor learning_rate, Tensor moment1, Tensor moment2, Tensor beta1_pow, Tensor beta2_pow, Tensor master_param, Tensor skip_update, float weight_decay, float beta1, float beta2, float epsilon, bool multi_precision) output : Tensor(param_out), Tensor(moment1_out), Tensor(moment2_out), Tensor(beta1_pow_out), Tensor(beta2_pow_out), Tensor(master_param_outs) infer_meta : @@ -1405,7 +1405,7 @@ optional : master_param, skip_update inplace : (param -> param_out), (moment1 -> moment1_out), (moment2 -> moment2_out), (beta1_pow -> beta1_pow_out), (beta2_pow -> beta2_pow_out), (master_param -> master_param_outs) -- api : layer_norm +- op : layer_norm args : (Tensor x, Tensor scale, Tensor bias, float epsilon, int begin_norm_axis, bool is_test) output : Tensor(out), Tensor(mean), Tensor(variance) infer_meta : @@ -1416,7 +1416,7 @@ backward : layer_norm_grad optional : scale, bias -- api : leaky_relu +- op : leaky_relu args : (Tensor x, float alpha) output : Tensor infer_meta : @@ -1426,7 +1426,7 @@ func : leaky_relu backward : leaky_relu_grad -- api : lerp +- op : lerp args : (Tensor x, Tensor y, Tensor weight) output : Tensor(out) infer_meta : @@ -1436,7 +1436,7 @@ inplace : (x -> out) backward : lerp_grad -- api : less_equal +- op : less_equal args : (Tensor x, Tensor y, int axis = -1) output : Tensor(out) infer_meta : @@ -1444,7 +1444,7 @@ kernel : func : less_equal -- api : less_than +- op : less_than args : (Tensor x, Tensor y, int axis = -1) output : Tensor(out) infer_meta : @@ -1452,7 +1452,7 @@ kernel : func : less_than -- api : linear_interp +- op : linear_interp args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(output) infer_meta : @@ -1463,7 +1463,7 @@ data_type : x backward : linear_interp_grad -- api : linspace +- op : linspace args : (Tensor start, Tensor stop, Tensor number, DataType dtype) output : Tensor(out) infer_meta : @@ -1472,7 +1472,7 @@ func : linspace data_type : dtype -- api : log +- op : log args : (Tensor x) output : Tensor infer_meta : @@ -1481,7 +1481,7 @@ func : log backward: log_grad -- api : log10 +- op : log10 args : (Tensor x) output : Tensor infer_meta : @@ -1490,7 +1490,7 @@ func : log10 backward: log10_grad -- api : log1p +- op : log1p args : (Tensor x) output : Tensor infer_meta : @@ -1499,7 +1499,7 @@ func : log1p backward: log1p_grad -- api : log2 +- op : log2 args : (Tensor x) output : Tensor infer_meta : @@ -1508,7 +1508,7 @@ func : log2 backward: log2_grad -- api : log_loss +- op : log_loss args : (Tensor input, Tensor label, float epsilon) output : Tensor infer_meta : @@ -1517,7 +1517,7 @@ func : log_loss backward : log_loss_grad -- api : log_softmax +- op : log_softmax args : (Tensor x, int axis) output : Tensor(out) infer_meta : @@ -1526,7 +1526,7 @@ func : log_softmax backward : log_softmax_grad -- api : logcumsumexp +- op : logcumsumexp args : (Tensor x, int axis, bool flatten, bool exclusive, bool reverse) output : Tensor(out) infer_meta : @@ -1535,7 +1535,7 @@ func : logcumsumexp backward : logcumsumexp_grad -- api : logical_and +- op : logical_and args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -1543,7 +1543,7 @@ kernel : func : logical_and -- api : logical_not +- op : logical_not args : (Tensor x) output : Tensor(out) infer_meta : @@ -1551,7 +1551,7 @@ kernel : func : logical_not -- api : logical_or +- op : logical_or args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -1559,7 +1559,7 @@ kernel : func : logical_or -- api : logical_xor +- op : logical_xor args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -1567,7 +1567,7 @@ kernel : func : logical_xor -- api : logit +- op : logit args : (Tensor x, float eps = 1e-6f) output : Tensor infer_meta : @@ -1577,7 +1577,7 @@ func : logit backward : logit_grad -- api : logsigmoid +- op : logsigmoid args : (Tensor x) output : Tensor infer_meta : @@ -1586,7 +1586,7 @@ func : logsigmoid backward : logsigmoid_grad -- api : logsumexp +- op : logsumexp args : (Tensor x, int64_t[] axis, bool keepdim, bool reduce_all) output : Tensor(out) infer_meta : @@ -1595,7 +1595,7 @@ func : logsumexp backward : logsumexp_grad -- api : lstsq +- op : lstsq args : (Tensor x, Tensor y, Scalar rcond, str driver) output : Tensor(solution), Tensor(residuals), Tensor(rank), Tensor(singular_values) infer_meta : @@ -1604,7 +1604,7 @@ kernel : func : lstsq -- api : lu +- op : lu args : (Tensor x, bool pivot) output : Tensor(out), Tensor(pivots), Tensor(infos) infer_meta : @@ -1613,7 +1613,7 @@ func : lu backward : lu_grad -- api : lu_unpack +- op : lu_unpack args : (Tensor x, Tensor pivots, bool unpack_ludata, bool unpack_pivots) output : Tensor(pmat), Tensor(l), Tensor(u) infer_meta : @@ -1623,7 +1623,7 @@ data_type : x backward : lu_unpack_grad -- api : margin_cross_entropy +- op : margin_cross_entropy args : (Tensor logits, Tensor label, bool return_softmax, int ring_id, int rank, int nranks, float margin1, float margin2, float margin3, float scale) output : Tensor(softmax), Tensor(loss) infer_meta : @@ -1633,7 +1633,7 @@ data_type : logits backward : margin_cross_entropy_grad -- api : masked_select +- op : masked_select args : (Tensor x, Tensor mask) output : Tensor infer_meta : @@ -1643,7 +1643,7 @@ data_type : x backward : masked_select_grad -- api : matmul +- op : matmul args : (Tensor x, Tensor y, bool transpose_x = false, bool transpose_y = false) output : Tensor infer_meta : @@ -1652,7 +1652,7 @@ func : matmul backward : matmul_grad -- api : matrix_nms +- op : matrix_nms args : (Tensor bboxes, Tensor scores, float score_threshold, int nms_top_k, int keep_top_k, float post_threshold=0., bool use_gaussian = false, float gaussian_sigma = 2.0, int background_label = 0, bool normalized = true) output : Tensor(out), Tensor(index), Tensor(roisnum) infer_meta : @@ -1660,7 +1660,7 @@ kernel : func : matrix_nms -- api : matrix_power +- op : matrix_power args : (Tensor x, int n) output : Tensor infer_meta : @@ -1670,7 +1670,7 @@ func : matrix_power backward : matrix_power_grad -- api : matrix_rank +- op : matrix_rank args : (Tensor x, float tol, bool use_default_tol=true, bool hermitian=false) output : Tensor(out) infer_meta : @@ -1679,7 +1679,7 @@ kernel : func : matrix_rank -- api : matrix_rank_tol +- op : matrix_rank_tol args : (Tensor x, Tensor atol_tensor, bool use_default_tol=true, bool hermitian=false) output : Tensor(out) infer_meta : @@ -1687,7 +1687,7 @@ kernel : func : matrix_rank_tol -- api : max +- op : max args : (Tensor x, IntArray dims={}, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -1696,7 +1696,7 @@ func : max backward : max_grad -- api : max_pool2d_with_index +- op : max_pool2d_with_index args : (Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) output : Tensor(out), Tensor(mask) infer_meta : @@ -1705,7 +1705,7 @@ func : max_pool2d_with_index backward : max_pool2d_with_index_grad -- api : max_pool3d_with_index +- op : max_pool3d_with_index args : (Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) output : Tensor(out), Tensor(mask) infer_meta : @@ -1714,7 +1714,7 @@ func : max_pool3d_with_index backward : max_pool3d_with_index_grad -- api : maximum +- op : maximum args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -1723,7 +1723,7 @@ func : maximum backward : maximum_grad -- api : maxout +- op : maxout args : (Tensor x, int groups, int axis) output : Tensor(out) infer_meta : @@ -1732,7 +1732,7 @@ func : maxout backward : maxout_grad -- api : mean +- op : mean args : (Tensor x, IntArray dims={}, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -1741,7 +1741,7 @@ func : mean backward : mean_grad -- api : mean_all +- op : mean_all args : (Tensor x) output : Tensor infer_meta : @@ -1750,7 +1750,7 @@ func : mean_all backward : mean_all_grad -- api : merged_adam_ +- op : merged_adam_ args : (Tensor[] param, Tensor[] grad, Tensor[] learning_rate, Tensor[] moment1, Tensor[] moment2, Tensor[] beta1_pow, Tensor[] beta2_pow, Tensor[] master_param, Scalar beta1, Scalar beta2, Scalar epsilon, bool multi_precision, bool use_global_beta_pow) output : Tensor[](param_out){param.size()}, Tensor[](moment1_out){param.size()}, Tensor[](moment2_out){param.size()}, Tensor[](beta1_pow_out){param.size()}, Tensor[](beta2_pow_out){param.size()}, Tensor[](master_param_out){param.size()} infer_meta : @@ -1761,7 +1761,7 @@ data_type : param inplace : (param -> param_out), (moment1 -> moment1_out), (moment2 -> moment2_out), (beta1_pow -> beta1_pow_out), (beta2_pow -> beta2_pow_out), (master_param -> master_param_out) -- api : merged_momentum_ +- op : merged_momentum_ args : (Tensor[] param, Tensor[] grad, Tensor[] velocity, Tensor[] learning_rate, Tensor[] master_param, float mu, bool use_nesterov = false, str[] regularization_method = {}, float[] regularization_coeff = {}, bool multi_precision = false, float rescale_grad = 1.0f) output : Tensor[](param_out){param.size()}, Tensor[](velocity_out){param.size()}, Tensor[](master_param_out){param.size()} infer_meta : @@ -1772,7 +1772,7 @@ data_type : param inplace : (param -> param_out), (velocity -> velocity_out), (master_param -> master_param_out) -- api : meshgrid +- op : meshgrid args : (Tensor[] inputs) output : Tensor[]{inputs.size()} infer_meta : @@ -1781,7 +1781,7 @@ func : meshgrid backward : meshgrid_grad -- api : min +- op : min args : (Tensor x, IntArray dims={}, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -1790,7 +1790,7 @@ func : min backward : min_grad -- api : minimum +- op : minimum args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -1799,7 +1799,7 @@ func : minimum backward : minimum_grad -- api : mish +- op : mish args : (Tensor x, float lambda) output : Tensor infer_meta : @@ -1809,7 +1809,7 @@ func : mish backward : mish_grad -- api : mode +- op : mode args : (Tensor x, int axis, bool keepdim) output : Tensor(out), Tensor(indices) infer_meta : @@ -1818,7 +1818,7 @@ func : mode backward : mode_grad -- api : momentum_ +- op : momentum_ args : (Tensor param, Tensor grad, Tensor velocity, Tensor learning_rate, Tensor master_param, float mu, bool use_nesterov = false, str regularization_method = "", float regularization_coeff = 0.0, bool multi_precision = false, float rescale_grad = 1.0f) output : Tensor(param_out), Tensor(velocity_out), Tensor(master_param_out) infer_meta: @@ -1829,7 +1829,7 @@ optional : master_param inplace : (param -> param_out), (velocity -> velocity_out), (master_param -> master_param_out) -- api : multi_dot +- op : multi_dot args : (Tensor[] x) output : Tensor infer_meta : @@ -1838,7 +1838,7 @@ func : multi_dot backward : multi_dot_grad -- api : multiclass_nms3 +- op : multiclass_nms3 args : (Tensor bboxes, Tensor scores, Tensor rois_num, float score_threshold, int nms_top_k, int keep_top_k, float nms_threshold=0.3, bool normalized=true, float nms_eta=1.0, int background_label=0) output : Tensor(out), Tensor(index), Tensor(nms_rois_num) infer_meta : @@ -1847,7 +1847,7 @@ func : multiclass_nms3 optional : rois_num -- api : multinomial +- op : multinomial args : (Tensor x, Scalar num_samples, bool replacement) output : Tensor(out) infer_meta : @@ -1855,7 +1855,7 @@ kernel : func : multinomial -- api : multiplex +- op : multiplex args : (Tensor[] ins, Tensor ids) output : Tensor infer_meta : @@ -1865,7 +1865,7 @@ data_type : ins backward : multiplex_grad -- api : multiply +- op : multiply args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -1875,7 +1875,7 @@ multiply_sr {selected_rows, dense -> selected_rows} backward : multiply_grad -- api : nearest_interp +- op : nearest_interp args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(output) infer_meta : @@ -1886,7 +1886,7 @@ data_type : x backward : nearest_interp_grad -- api : nll_loss +- op : nll_loss args : (Tensor input, Tensor label, Tensor weight, int64_t ignore_index, str reduction) output : Tensor(out), Tensor(total_weight) infer_meta : @@ -1897,7 +1897,7 @@ optional : weight backward : nll_loss_grad -- api : nms +- op : nms args : (Tensor x, float threshold) output : Tensor(out) infer_meta : @@ -1906,7 +1906,7 @@ func : nms data_type : x -- api : norm +- op : norm args : (Tensor x, int axis, float epsilon, bool is_test) output : Tensor(out), Tensor(norm) infer_meta : @@ -1915,7 +1915,7 @@ func : norm backward : norm_grad -- api : not_equal +- op : not_equal args : (Tensor x, Tensor y, int axis = -1) output : Tensor(out) infer_meta : @@ -1923,7 +1923,7 @@ kernel : func : not_equal -- api : one_hot +- op : one_hot args : (Tensor x, Scalar(int) num_classes) output : Tensor(out) infer_meta : @@ -1931,17 +1931,17 @@ kernel : func : one_hot -- api : ones +- op : ones args : (IntArray shape, DataType dtype=DataType::FLOAT32, Place place=CPUPlace()) output : Tensor(out) invoke : full(shape, 1, dtype, place) -- api : ones_like +- op : ones_like args : (Tensor x, DataType dtype=DataType::UNDEFINED, Place place={}) output : Tensor(out) invoke : full_like(x, 1, dtype, place) -- api : p_norm +- op : p_norm args : (Tensor x, float porder, int axis, float epsilon, bool keepdim, bool asvector=false) output : Tensor(out) infer_meta : @@ -1950,7 +1950,7 @@ func : p_norm backward : p_norm_grad -- api : pad +- op : pad args : (Tensor x, int[] paddings, Scalar pad_value) output : Tensor infer_meta : @@ -1959,7 +1959,7 @@ func : pad backward : pad_grad -- api : pad3d +- op : pad3d args : (Tensor x, IntArray paddings, str mode, float pad_value, str data_format) output : Tensor(out) infer_meta : @@ -1968,7 +1968,7 @@ func : pad3d backward : pad3d_grad -- api : pixel_shuffle +- op : pixel_shuffle args : (Tensor x, int upscale_factor, str data_format) output : Tensor infer_meta : @@ -1977,7 +1977,7 @@ func : pixel_shuffle backward : pixel_shuffle_grad -- api : pool2d +- op : pool2d args : (Tensor x, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) output : Tensor(out) infer_meta : @@ -1989,7 +1989,7 @@ use_gpudnn : use_gpudnn backward : pool2d_grad -- api : pool3d +- op : pool3d args : (Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm, bool use_gpudnn) output : Tensor(out) infer_meta : @@ -2001,7 +2001,7 @@ use_gpudnn : use_gpudnn backward : pool3d_grad -- api : pow +- op : pow args : (Tensor x, Scalar s) output : Tensor(out) infer_meta : @@ -2011,7 +2011,7 @@ func : pow backward : pow_grad -- api : prelu +- op : prelu args : (Tensor x, Tensor alpha, str data_format, str mode) output : Tensor(out) infer_meta : @@ -2020,7 +2020,7 @@ func : prelu backward : prelu_grad -- api : prior_box +- op : prior_box args : (Tensor input, Tensor image, float[] min_sizes, float[] aspect_ratios, float[] variances, float[] max_sizes = {}, bool flip=true, bool clip=true, float step_w=0.0, float step_h=0.0, float offset=0.5, bool min_max_aspect_ratios_order=false) output : Tensor(out), Tensor(var) infer_meta : @@ -2028,7 +2028,7 @@ kernel : func : prior_box -- api : psroi_pool +- op : psroi_pool args : (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, int output_channels, float spatial_scale) output : Tensor infer_meta : @@ -2039,7 +2039,7 @@ optional : boxes_num backward : psroi_pool_grad -- api : put_along_axis +- op : put_along_axis args : (Tensor x, Tensor index, Tensor value, int axis, str reduce) output : Tensor(out) infer_meta : @@ -2051,7 +2051,7 @@ inplace : (x -> out) backward : put_along_axis_grad -- api : qr +- op : qr args : (Tensor x, str mode) output : Tensor(q), Tensor(r) infer_meta : @@ -2060,7 +2060,7 @@ func : qr backward : qr_grad -- api : randint +- op : randint args : (int low, int high, IntArray shape, DataType dtype=DataType::INT64, Place place={}) output : Tensor(out) infer_meta : @@ -2072,7 +2072,7 @@ data_type : dtype backend : place -- api : randperm +- op : randperm args : (int n, DataType dtype, Place place={}) output : Tensor(out) infer_meta : @@ -2084,7 +2084,7 @@ data_type : dtype backend : place -- api : real +- op : real args : (Tensor x) output : Tensor infer_meta : @@ -2093,7 +2093,7 @@ func : real backward : real_grad -- api : reciprocal +- op : reciprocal args : (Tensor x) output : Tensor(out) infer_meta : @@ -2103,7 +2103,7 @@ inplace : (x -> out) backward : reciprocal_grad -- api : reduce_prod +- op : reduce_prod args : (Tensor x, IntArray dims, bool keep_dim, bool reduce_all) output : Tensor infer_meta : @@ -2112,7 +2112,7 @@ func : prod_raw backward : reduce_prod_grad -- api : relu +- op : relu args : (Tensor x) output : Tensor(out) infer_meta : @@ -2122,7 +2122,7 @@ inplace : (x -> out) backward : relu_grad -- api : relu6 +- op : relu6 args : (Tensor x, float threshold) output : Tensor infer_meta : @@ -2132,7 +2132,7 @@ func : relu6 backward : relu6_grad -- api : remainder +- op : remainder args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -2141,7 +2141,7 @@ func : remainder inplace : (x -> out) -- api : renorm +- op : renorm args : (Tensor x, float p, int axis, float max_norm) output : Tensor infer_meta : @@ -2151,7 +2151,7 @@ func : renorm backward : renorm_grad -- api : repeat_interleave +- op : repeat_interleave args : (Tensor x, int repeats, int dim) output : Tensor(out) infer_meta : @@ -2161,7 +2161,7 @@ func : repeat_interleave backward: repeat_interleave_grad -- api : repeat_interleave_with_tensor_index +- op : repeat_interleave_with_tensor_index args : (Tensor x, Tensor repeats, int dim) output : Tensor(out) infer_meta : @@ -2172,7 +2172,7 @@ data_type : x backward: repeat_interleave_with_tensor_index_grad -- api : reshape +- op : reshape args : (Tensor x, IntArray shape) output : Tensor(out), Tensor(xshape) infer_meta : @@ -2184,7 +2184,7 @@ intermediate : xshape backward: reshape_grad -- api : reverse +- op : reverse args : (Tensor x, IntArray axis) output : Tensor infer_meta : @@ -2193,7 +2193,7 @@ func : reverse backward : reverse_grad -- api : rmsprop_ +- op : rmsprop_ args : (Tensor param, Tensor mean_square, Tensor grad, Tensor moment, Tensor learning_rate, Tensor mean_grad, float epsilon, float decay, float momentum, bool centered) output : Tensor(param_out), Tensor(moment_out), Tensor(mean_square_out), Tensor(mean_grad_out) infer_meta : @@ -2204,7 +2204,7 @@ optional : mean_grad inplace : (param -> param_out), (moment -> moment_out), (mean_square -> mean_square_out), (mean_grad -> mean_grad_out) -- api : roi_align +- op : roi_align args : (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned) output : Tensor infer_meta : @@ -2215,7 +2215,7 @@ optional : boxes_num backward : roi_align_grad -- api : roi_pool +- op : roi_pool args : (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale) output : Tensor(out), Tensor(arg_max) infer_meta : @@ -2227,7 +2227,7 @@ intermediate : arg_max backward : roi_pool_grad -- api : roll +- op : roll args : (Tensor x, IntArray shifts, int64_t[] axis) output : Tensor(out) infer_meta : @@ -2236,7 +2236,7 @@ func : roll backward : roll_grad -- api : round +- op : round args : (Tensor x) output : Tensor(out) infer_meta : @@ -2246,7 +2246,7 @@ inplace : (x -> out) backward : round_grad -- api : rsqrt +- op : rsqrt args : (Tensor x) output : Tensor(out) infer_meta : @@ -2256,7 +2256,7 @@ inplace : (x -> out) backward : rsqrt_grad -- api : scale +- op : scale args : (Tensor x, Scalar scale, float bias, bool bias_after_scale) output : Tensor(out) infer_meta : @@ -2268,7 +2268,7 @@ inplace : (x -> out) backward : scale_grad -- api : scatter +- op : scatter args : (Tensor x, Tensor index, Tensor updates, bool overwrite) output : Tensor(out) infer_meta : @@ -2279,7 +2279,7 @@ inplace : (x -> out) backward : scatter_grad -- api : scatter_nd_add +- op : scatter_nd_add args : (Tensor x, Tensor index, Tensor updates) output : Tensor infer_meta : @@ -2289,7 +2289,7 @@ func : scatter_nd_add backward : scatter_nd_add_grad -- api : searchsorted +- op : searchsorted args : (Tensor sorted_sequence, Tensor value, bool out_int32, bool right) output : Tensor(out) infer_meta : @@ -2298,7 +2298,7 @@ func : searchsorted data_type : sorted_sequence -- api : segment_pool +- op : segment_pool args : (Tensor x, Tensor segment_ids, str pooltype) output : Tensor(out), Tensor(summed_ids) infer_meta : @@ -2308,7 +2308,7 @@ data_type : x backward : segment_pool_grad -- api : selu +- op : selu args : (Tensor x, float scale, float alpha) output : Tensor infer_meta : @@ -2318,7 +2318,7 @@ func : selu backward : selu_grad -- api : sgd_ +- op : sgd_ args : (Tensor param, Tensor learning_rate, Tensor grad, Tensor master_param, bool multi_precision) output : Tensor(param_out), Tensor(master_param_out) infer_meta : @@ -2333,7 +2333,7 @@ optional : master_param inplace : (param -> param_out), (master_param -> master_param_out) -- api : shape +- op : shape args : (Tensor input) output : Tensor(out) infer_meta : @@ -2344,7 +2344,7 @@ data_transform: skip_transform : input -- api : shard_index +- op : shard_index args : (Tensor in, int index_num, int nshards, int shard_id, int ignore_value) output : Tensor(out) infer_meta : @@ -2352,7 +2352,7 @@ kernel : func : shard_index -- api : sigmoid +- op : sigmoid args : (Tensor x) output : Tensor infer_meta : @@ -2361,7 +2361,7 @@ func : sigmoid backward : sigmoid_grad -- api : sigmoid_cross_entropy_with_logits +- op : sigmoid_cross_entropy_with_logits args : (Tensor x, Tensor label, bool normalize, int ignore_index) output : Tensor infer_meta : @@ -2370,7 +2370,7 @@ func : sigmoid_cross_entropy_with_logits backward : sigmoid_cross_entropy_with_logits_grad -- api : sign +- op : sign args : (Tensor x) output : Tensor(out) infer_meta : @@ -2378,7 +2378,7 @@ kernel : func : sign -- api : silu +- op : silu args : (Tensor x) output : Tensor infer_meta : @@ -2387,7 +2387,7 @@ func : silu backward : silu_grad -- api : sin +- op : sin args : (Tensor x) output : Tensor infer_meta : @@ -2396,7 +2396,7 @@ func : sin backward : sin_grad -- api : sinh +- op : sinh args : (Tensor x) output : Tensor infer_meta : @@ -2405,7 +2405,7 @@ func : sinh backward : sinh_grad -- api : size +- op : size args : (Tensor x) output : Tensor(size) infer_meta : @@ -2415,7 +2415,7 @@ data_transform: skip_transform : x -- api : slice +- op : slice args : (Tensor input, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis) output : Tensor infer_meta : @@ -2424,7 +2424,7 @@ func : slice backward : slice_grad -- api : slogdet +- op : slogdet args : (Tensor x) output : Tensor infer_meta : @@ -2433,7 +2433,7 @@ func : slogdeterminant backward : slogdet_grad -- api : soft_shrink +- op : soft_shrink args : (Tensor x, float lambda) output : Tensor infer_meta : @@ -2443,7 +2443,7 @@ func : soft_shrink backward : soft_shrink_grad -- api : softmax +- op : softmax args : (Tensor x, int axis) output : Tensor(out) infer_meta : @@ -2454,7 +2454,7 @@ inplace : (x -> out) backward : softmax_grad -- api : softplus +- op : softplus args : (Tensor x, float beta, float threshold) output : Tensor infer_meta : @@ -2464,7 +2464,7 @@ func : softplus backward : softplus_grad -- api : softsign +- op : softsign args : (Tensor x) output : Tensor infer_meta : @@ -2474,7 +2474,7 @@ func : softsign backward : softsign_grad -- api : spectral_norm +- op : spectral_norm args : (Tensor weight, Tensor u, Tensor v, int dim, int power_iters, float eps) output : Tensor infer_meta : @@ -2484,7 +2484,7 @@ data_type : weight backward : spectral_norm_grad -- api : split +- op : split args : (Tensor x, IntArray sections, Scalar(int) axis) output : Tensor[]{sections.size()} infer_meta : @@ -2493,7 +2493,7 @@ func : split backward : split_grad -- api : split_with_num +- op : split_with_num args : (Tensor x, int num, Scalar(int) axis) output : Tensor[]{num} infer_meta : @@ -2502,7 +2502,7 @@ func : split_with_num backward : split_with_num_grad -- api : sqrt +- op : sqrt args : (Tensor x) output : Tensor(out) infer_meta : @@ -2512,7 +2512,7 @@ inplace : (x -> out) backward : sqrt_grad -- api : square +- op : square args : (Tensor x) output : Tensor infer_meta : @@ -2521,7 +2521,7 @@ func : square backward : square_grad -- api : squared_l2_norm +- op : squared_l2_norm args : (Tensor x) output : Tensor infer_meta : @@ -2530,7 +2530,7 @@ func : squared_l2_norm backward : squared_l2_norm_grad -- api : squeeze +- op : squeeze args : (Tensor x, IntArray axes) output : Tensor(out), Tensor(xshape) infer_meta : @@ -2542,7 +2542,7 @@ intermediate : xshape backward : squeeze_grad -- api : stack +- op : stack args : (Tensor[] x, int axis) output : Tensor infer_meta : @@ -2551,7 +2551,7 @@ func : stack backward : stack_grad -- api : strided_slice +- op : strided_slice args : (Tensor x, int[] axes, IntArray starts, IntArray ends, IntArray strides) output : Tensor infer_meta : @@ -2560,7 +2560,7 @@ func : strided_slice backward : strided_slice_grad -- api : subtract +- op : subtract args : (Tensor x, Tensor y) output : Tensor(out) infer_meta : @@ -2570,7 +2570,7 @@ inplace : (x -> out) backward : subtract_grad -- api : sum +- op : sum args : (Tensor x, IntArray dims={}, DataType out_dtype=DataType::UNDEFINED, bool keep_dim=false) output : Tensor(out) infer_meta : @@ -2580,7 +2580,7 @@ data_type : x backward : sum_grad -- api : svd +- op : svd args : (Tensor x, bool full_metrices) output : Tensor(u), Tensor(s), Tensor(vh) infer_meta : @@ -2590,7 +2590,7 @@ backward : svd_grad # The python API paddle.nn.functional.swish has no `bete` argument, it may be removed later -- api : swish +- op : swish args : (Tensor x, float beta=1.0) output : Tensor(out) infer_meta : @@ -2600,7 +2600,7 @@ func : swish backward : swish_grad -- api : sync_batch_norm_ +- op : sync_batch_norm_ args : (Tensor x, Tensor scale, Tensor bias, Tensor mean, Tensor variance, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) output : Tensor(out), Tensor(mean_out), Tensor(variance_out), Tensor(saved_mean), Tensor(saved_variance), Tensor(reserve_space) infer_meta : @@ -2611,7 +2611,7 @@ backward : sync_batch_norm_grad inplace : (mean -> mean_out), (variance -> variance_out) -- api : take_along_axis +- op : take_along_axis args : (Tensor x, Tensor index, int axis) output : Tensor infer_meta : @@ -2622,7 +2622,7 @@ data_type : x backward : take_along_axis_grad -- api : tan +- op : tan args : (Tensor x) output : Tensor infer_meta : @@ -2631,7 +2631,7 @@ func : tan backward : tan_grad -- api : tanh +- op : tanh args : (Tensor x) output : Tensor(out) infer_meta : @@ -2641,7 +2641,7 @@ inplace : (x -> out) backward : tanh_grad -- api : tanh_shrink +- op : tanh_shrink args : (Tensor x) output : Tensor infer_meta : @@ -2650,7 +2650,7 @@ func : tanh_shrink backward : tanh_shrink_grad -- api : temporal_shift +- op : temporal_shift args : (Tensor x, int seg_num, float shift_ratio, str data_format_str) output : Tensor infer_meta : @@ -2659,7 +2659,7 @@ func : temporal_shift backward : temporal_shift_grad -- api : thresholded_relu +- op : thresholded_relu args : (Tensor x, float threshold) output : Tensor infer_meta : @@ -2669,7 +2669,7 @@ func : thresholded_relu backward : thresholded_relu_grad -- api : tile +- op : tile args : (Tensor x, IntArray repeat_times) output : Tensor infer_meta : @@ -2678,7 +2678,7 @@ func : tile backward : tile_grad -- api : top_k +- op : top_k args : (Tensor x, Scalar k, int axis = -1, bool largest = true, bool sorted = true) output : Tensor(out), Tensor(indices) infer_meta : @@ -2687,7 +2687,7 @@ func : top_k backward : top_k_grad -- api : transpose +- op : transpose args : (Tensor x, int[] axis) output : Tensor infer_meta : @@ -2696,7 +2696,7 @@ func : transpose backward : transpose_grad -- api : triangular_solve +- op : triangular_solve args : (Tensor x, Tensor y, bool upper, bool transpose, bool unitriangular) output : Tensor infer_meta : @@ -2705,7 +2705,7 @@ func : triangular_solve backward : triangular_solve_grad -- api : tril_indices +- op : tril_indices args : (int rows, int cols, int offset, DataType dtype, Place place={}) output : Tensor(out) infer_meta : @@ -2717,7 +2717,7 @@ data_type : dtype backend : place -- api : tril_triu +- op : tril_triu args : (Tensor x, int diagonal, bool lower) output : Tensor(out) infer_meta : @@ -2726,7 +2726,7 @@ func : tril_triu backward : tril_triu_grad -- api : trilinear_interp +- op : trilinear_interp args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode) output : Tensor(output) infer_meta : @@ -2737,7 +2737,7 @@ data_type : x backward : trilinear_interp_grad -- api : triu_indices +- op : triu_indices args : (int row, int col, int offset, DataType dtype, Place place={}) output : Tensor(out) infer_meta : @@ -2750,7 +2750,7 @@ backend : place # python API: paddle.nn.initializer.TruncatedNormal -- api : truncated_gaussian_random +- op : truncated_gaussian_random args : (int[] shape, float mean, float std, int seed, DataType dtype=DataType::FLOAT32, Place place={}) output : Tensor(out) infer_meta : @@ -2762,7 +2762,7 @@ backend : place data_type : dtype -- api : unbind +- op : unbind args : (Tensor input, int axis) output : Tensor[] {axis<0 ? input.dims()[input.dims().size()+axis]:input.dims()[axis]} infer_meta : @@ -2771,7 +2771,7 @@ func : unbind backward : unbind_grad -- api : unfold +- op : unfold args : (Tensor x, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) output : Tensor infer_meta : @@ -2780,7 +2780,7 @@ func : unfold backward : unfold_grad -- api : uniform_random +- op : uniform_random args : (IntArray shape, DataType dtype, Scalar min, Scalar max, int seed, Place place={}) output : Tensor(out) infer_meta : @@ -2793,7 +2793,7 @@ backend : place # The `axis` argument of Python API paddle.unique is not vector -- api : unique +- op : unique args : (Tensor x, bool return_index, bool return_inverse, bool return_counts, int[] axis, DataType dtype=DataType::INT64) output : Tensor(out), Tensor(indices), Tensor(inverse), Tensor(counts) infer_meta : @@ -2802,7 +2802,7 @@ func : unique data_type : x -- api : unique_consecutive +- op : unique_consecutive args : (Tensor x, bool return_inverse, bool return_counts, int[] axis, int dtype) output : Tensor(out), Tensor(index), Tensor(counts) infer_meta : @@ -2811,7 +2811,7 @@ func : unique_consecutive data_type : x -- api : unsqueeze +- op : unsqueeze args : (Tensor x, IntArray axis) output : Tensor(out), Tensor(xshape) infer_meta : @@ -2823,7 +2823,7 @@ intermediate : xshape backward : unsqueeze_grad -- api : unstack +- op : unstack args : (Tensor x, int axis, int num) output : Tensor[]{num} infer_meta : @@ -2832,7 +2832,7 @@ func : unstack backward : unstack_grad -- api : viterbi_decode +- op : viterbi_decode args : (Tensor input, Tensor transition, Tensor length, bool include_bos_eos_tag) output : Tensor(scores), Tensor(path) infer_meta : @@ -2841,7 +2841,7 @@ func : viterbi_decode data_type : input -- api : warpctc +- op : warpctc args : (Tensor logits, Tensor label, Tensor logits_length, Tensor labels_length, int blank, bool norm_by_times) output : Tensor(loss), Tensor(warpctcgrad) infer_meta : @@ -2853,7 +2853,7 @@ intermediate: warpctcgrad backward : warpctc_grad -- api : where +- op : where args : (Tensor condition, Tensor x, Tensor y) output : Tensor infer_meta : @@ -2862,7 +2862,7 @@ func : where backward : where_grad -- api : where_index +- op : where_index args : (Tensor condition) output : Tensor(out) infer_meta : @@ -2870,7 +2870,7 @@ kernel : func : where_index -- api : yolo_box +- op : yolo_box args : (Tensor x, Tensor img_size, int[] anchors, int class_num, float conf_thresh, int downsample_ratio, bool clip_bbox, float scale_x_y=1.0, bool iou_aware=false, float iou_aware_factor=0.5) output : Tensor(boxes), Tensor(scores) infer_meta : @@ -2879,7 +2879,7 @@ func : yolo_box data_type : x -- api : yolov3_loss +- op : yolov3_loss args : (Tensor x, Tensor gt_box, Tensor gt_label, Tensor gt_score, int[] anchors, int[] anchor_mask, int class_num, float ignore_thresh, int downsample_ratio, bool use_label_smooth=true, float scale_x_y=1.0) output : Tensor(loss), Tensor(objectness_mask), Tensor(gt_match_mask) infer_meta : @@ -2890,17 +2890,17 @@ optional : gt_score backward : yolov3_loss_grad -- api : zeros +- op : zeros args : (IntArray shape, DataType dtype=DataType::FLOAT32, Place place=CPUPlace()) output : Tensor(out) invoke : full(shape, 0, dtype, place) -- api : zeros_like +- op : zeros_like args : (Tensor x, DataType dtype=DataType::UNDEFINED, Place place = {}) output : Tensor(out) invoke : full_like(x, 0, dtype, place) -- api: broadcast_tensors +- op: broadcast_tensors args: (Tensor[] x) output: Tensor[]{x.size()} infer_meta: @@ -2909,7 +2909,7 @@ func: broadcast_tensors backward: broadcast_tensors_grad -- api: dirichlet +- op: dirichlet args: (Tensor alpha) output: Tensor(out) infer_meta: @@ -2917,7 +2917,7 @@ kernel: func: dirichlet -- api: eig +- op: eig args: (Tensor x) output: Tensor(out_w), Tensor(out_v) infer_meta: @@ -2926,7 +2926,7 @@ func: eig backward: eig_grad -- api: fold +- op: fold args: (Tensor x, int[] output_sizes, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) output: Tensor(out) infer_meta: @@ -2935,7 +2935,7 @@ func: fold backward: fold_grad -- api: overlap_add +- op: overlap_add args: (Tensor x, int hop_length, int axis) output: Tensor infer_meta: @@ -2944,7 +2944,7 @@ func: overlap_add backward: overlap_add_grad -- api: uniform_random_inplace +- op: uniform_random_inplace args: (Tensor x, float min, float max, int seed, int diag_num, int diag_step, float diag_val) output: Tensor(out) infer_meta: @@ -2955,7 +2955,7 @@ inplace: (x -> out) backward: uniform_random_inplace_grad -- api: unpool +- op: unpool args: (Tensor x, Tensor indices, int[] ksize, int[] strides, int[] padding, IntArray output_size, str data_format) output: Tensor(out) infer_meta: @@ -2965,7 +2965,7 @@ data_type: x backward: unpool_grad -- api: unpool3d +- op: unpool3d args: (Tensor x, Tensor indices, int[] ksize, int[] strides, int[] padding, int[] output_size, str data_format) output: Tensor(out) infer_meta: diff --git a/paddle/phi/api/yaml/api_compat.yaml b/paddle/phi/api/yaml/op_compat.yaml similarity index 63% rename from paddle/phi/api/yaml/api_compat.yaml rename to paddle/phi/api/yaml/op_compat.yaml index 2f34993e7ff..b7ce9900b6f 100644 --- a/paddle/phi/api/yaml/api_compat.yaml +++ b/paddle/phi/api/yaml/op_compat.yaml @@ -1,73 +1,93 @@ -- api : abs +- op : abs backward : abs_grad extra : attrs : [bool use_cudnn = false, bool use_mkldnn = false] -- api : addmm +- op : acosh + backward : acosh_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : addmm backward : addmm_grad extra : attrs : [bool use_mkldnn = false] -- api : affine_grid +- op : affine_grid backward : affine_grid_grad extra : attrs : [bool use_cudnn = true] -- api : angle +- op : angle backward : angle_grad extra : attrs : [bool use_cudnn = false, bool use_mkldnn = false] -- api : atan2 +- op : asinh + backward : asinh_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : atan2 inputs : {x : X1, y : X2} outputs : out : Out -- api : batch_norm +- op : atanh + backward : atanh_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : batch_norm backward : batch_norm_grad extra : attrs : [bool use_mkldnn = false, bool fuse_with_relu = false] -- api : bernoulli +- op : bernoulli inputs : x : X outputs : out : Out -- api : bicubic_interp (bicubic_interp_v2) +- op : bicubic_interp (bicubic_interp_v2) backward : bicubic_interp_grad (bicubic_interp_v2_grad) extra : attrs : [bool use_mkldnn = false] -- api : bilinear_interp (bilinear_interp_v2) +- op : bilinear_interp (bilinear_interp_v2) backward : bilinear_interp_grad (bilinear_interp_v2_grad) extra : attrs : [bool use_mkldnn = false] -- api : cholesky +- op : ceil + backward : ceil_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : cholesky inputs : x : X outputs : out : Out -- api : cholesky_solve +- op : cholesky_solve inputs : {x : X, y : Y} outputs : out : Out -- api : clip +- op : clip backward : clip_grad extra : attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"] -- api : concat +- op : concat backward : concat_grad extra : attrs : [bool use_mkldnn = false, bool use_quantizer = false, str mkldnn_data_type = "float32"] -- api : conv2d +- op : conv2d backward : conv2d_grad extra : attrs : [bool is_test = false, bool use_cudnn = true, bool fuse_relu_before_depthwise_conv = false, bool use_mkldnn = false, @@ -77,7 +97,7 @@ float Scale_in_eltwise = 1.0f, 'float[] Scale_weights = {1.0f}', bool force_fp32_output = false, int workspace_size_MB = platform::GetDefaultConvWorkspaceSizeLimitMB(), bool exhaustive_search = false] -- api : conv2d_fusion +- op : conv2d_fusion extra : attrs : [bool is_test = false, bool use_cudnn = false, bool fuse_relu_before_depthwise_conv = false, bool use_mkldnn = false, bool use_quantizer = false, str mkldnn_data_type = "float32", bool fuse_relu = false, @@ -86,7 +106,7 @@ float Scale_in_eltwise = 1.0f, 'float[] Scale_weights = {1.0f}', bool force_fp32_output = false, int workspace_size_MB = platform::GetDefaultConvWorkspaceSizeLimitMB(), bool exhaustive_search = false] -- api : conv2d_transpose +- op : conv2d_transpose backward : conv2d_transpose_grad extra : attrs : [bool is_test = false, bool use_cudnn = true, bool use_mkldnn = false, bool force_fp32_output = false, @@ -94,7 +114,7 @@ str fuse_activation = "", float fuse_alpha = 0.0f, float fuse_beta = 0.0f, int workspace_size_MB = platform::GetDefaultConvWorkspaceSizeLimitMB()] -- api : conv3d +- op : conv3d backward : conv3d_grad extra : attrs : [bool is_test = false, bool use_cudnn = true, bool use_mkldnn = false, str mkldnn_data_type = "float32", bool fuse_relu = false, @@ -102,12 +122,22 @@ bool use_addto = false, bool fuse_residual_connection = false, bool force_fp32_output = false, int workspace_size_MB = platform::GetDefaultConvWorkspaceSizeLimitMB(), bool exhaustive_search = false] -- api : conv3d_transpose +- op : conv3d_transpose backward : conv3d_transpose_grad extra : attrs : [bool use_cudnn = true, bool use_mkldnn = false, int workspace_size_MB = platform::GetDefaultConvWorkspaceSizeLimitMB()] -- api : cross +- op : cos + backward : cos_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : cosh + backward : cosh_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : cross inputs : {x : X, y : Y} attrs : @@ -115,12 +145,12 @@ outputs : out : Out -- api : data_norm +- op : data_norm backward : data_norm_grad extra : attrs : [bool use_mkldnn = false] -- api : depthwise_conv2d +- op : depthwise_conv2d backward : depthwise_conv2d_grad extra : attrs : [bool is_test = false, bool fuse_relu_before_depthwise_conv = false, bool use_mkldnn = false, @@ -130,7 +160,7 @@ float Scale_in_eltwise = 1.0f, 'float[] Scale_weights = {1.0f}', bool force_fp32_output = false, int workspace_size_MB = platform::GetDefaultConvWorkspaceSizeLimitMB(), bool exhaustive_search = false] -- api : depthwise_conv2d_transpose +- op : depthwise_conv2d_transpose backward : depthwise_conv2d_transpose_grad extra : attrs : [bool is_test = false, bool use_cudnn = false, bool use_mkldnn = false, bool force_fp32_output = false, @@ -138,274 +168,421 @@ str fuse_activation = "", float fuse_alpha = 0.0f, float fuse_beta = 0.0f, int workspace_size_MB = platform::GetDefaultConvWorkspaceSizeLimitMB()] -- api : diag (diag_v2) +- op : diag (diag_v2) backward : diag_grad (diag_v2_grad) inputs : x : X outputs : out : Out -- api : diagonal +- op : diagonal inputs : x : Input outputs : out : Out -- api : digamma +- op : digamma inputs : x : X outputs : out : Out -- api : dist +- op : dist inputs : {x : X, y : Y} outputs : out : Out -- api : dot +- op : dot inputs : {x : X, y : Y} outputs : out : Out -- api : dropout +- op : dropout backward : dropout_grad extra : attrs : [bool fix_seed = false, int seed = 0] -- api : dropout_nd +- op : dropout_nd backward : dropout_nd_grad extra : attrs : [bool fix_seed = false, int seed = 0] -- api : erf +- op : elu + backward : elu_grad + extra : + attrs : [bool use_mkldnn = false] + +- op : erf inputs : x : X outputs : out : Out -- api : erfinv +- op : erfinv inputs : x : X outputs : out : Out -- api : fft_c2c +- op : exp + backward : exp_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : expm1 + backward : expm1_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : fft_c2c inputs: {x: X} outputs: {out: Out} -- api : fft_c2r +- op : fft_c2r inputs: {x: X} outputs: {out: Out} -- api : fft_r2c +- op : fft_r2c inputs: {x: X} outputs: {out: Out} -- api : frobenius_norm +- op : floor + backward : floor_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : frobenius_norm backward : frobenius_norm_grad extra : attrs : [bool use_mkldnn = false] -- api : gelu +- op : gelu backward : gelu_grad extra : attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool use_cudnn = false] -- api : grid_sampler +- op : grid_sampler backward : grid_sampler_grad extra : attrs : [bool use_cudnn = true] -- api : gru +- op : gru backward : gru_grad extra : attrs : [bool is_test = false] -- api : inplace_abn +- op : hard_swish + backward : hard_swish_grad + extra : + attrs : [bool use_mkldnn = false] + +- op : inplace_abn backward : inplace_abn_grad extra : attrs : [bool use_mkldnn = false, bool fuse_with_relu = false] -- api : layer_norm +- op : layer_norm backward : layer_norm_grad extra : attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] -- api : lgamma +- op : leaky_relu + backward : leaky_relu_grad + extra : + attrs : [bool use_mkldnn = false] + +- op : lgamma inputs : x : X outputs : out : Out -- api : linear_interp (linear_interp_v2) +- op : linear_interp (linear_interp_v2) backward : linear_interp_grad (linear_interp_v2_grad) extra : attrs : [bool use_mkldnn = false] -- api : log_softmax +- op : log + backward : log_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : log10 + backward : log10_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : log1p + backward : log1p_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : log2 + backward : log2_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : log_softmax backward : log_softmax_grad extra : attrs : [bool use_mkldnn = false] -- api : lrn +- op : logsigmoid + backward : logsigmoid_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : lrn backward : lrn_grad extra : attrs : [bool use_mkldnn = false, bool is_test = false] -- api : matmul (matmul_v2) +- op : matmul (matmul_v2) backward : matmul_grad (matmul_v2_grad) extra : attrs : [bool use_mkldnn = false, 'int[] fused_reshape_Out = {}', 'int[] fused_transpose_Out = {}', str mkldnn_data_type = "float32", 'int[] fused_reshape_X = {}', 'int[] fused_reshape_Y = {}', 'int[] fused_transpose_X = {}', 'int[] fused_transpose_Y = {}',] -- api : mv +- op : mish + backward : mish_grad + extra : + attrs : [bool use_mkldnn = false] + +- op : mv inputs : {x : X, vec : Vec} outputs : out : Out -- api : nearest_interp (nearest_interp_v2) +- op : nearest_interp (nearest_interp_v2) backward : nearest_interp_grad (nearest_interp_v2_grad) extra : attrs : [bool use_mkldnn = false] -- api : pad2d +- op : pad2d backward : pad2d_grad extra : attrs : [bool use_mkldnn = false] -- api : pad3d +- op : pad3d backward : pad3d_grad extra : attrs : [bool use_mkldnn = false] -- api : partial_sum +- op : partial_sum backward : partial_sum_grad extra : attrs : [bool use_mkldnn = false] -- api : poisson +- op : poisson inputs : x : X outputs : out : Out -- api : reduce_all +- op : prelu + backward : prelu_grad + extra : + attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] + +- op : reciprocal + backward : reciprocal_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : reduce_all extra : attrs : [bool use_mkldnn = false] -- api : reduce_amax +- op : reduce_amax backward : reduce_amax_grad extra : attrs : [bool use_mkldnn = false] -- api : reduce_amin +- op : reduce_amin backward : reduce_amin_grad extra : attrs : [bool use_mkldnn = false] -- api : reduce_any +- op : reduce_any extra : attrs : [bool use_mkldnn = false] -- api : reduce_max +- op : reduce_max backward : reduce_max_grad extra : attrs : [bool use_mkldnn = false] -- api : reduce_mean +- op : reduce_mean backward : reduce_mean_grad extra : attrs : [bool use_mkldnn = false] -- api : reduce_min +- op : reduce_min backward : reduce_min_grad extra : attrs : [bool use_mkldnn = false] -- api : reduce_prod +- op : reduce_prod backward : reduce_prod_grad extra : attrs : [bool use_mkldnn = false] -- api : reduce_sum +- op : reduce_sum backward : reduce_sum_grad extra : attrs : [bool use_mkldnn = false] -- api : renorm +- op : relu + backward : relu_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : relu6 + backward : relu6_grad + extra : + attrs : [bool use_mkldnn = false] + +- op : renorm backward : renorm_grad extra : attrs : [bool use_mkldnn = false, bool use_cudnn = false] -- api : rnn +- op : rnn backward : rnn_grad extra : attrs : [bool is_test = false] -- api : seed +- op : round + backward : round_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : rsqrt + backward : rsqrt_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : seed extra : attrs : [bool deterministic = false, str rng_name = "", bool force_cpu = false] -- api : shape +- op : shape extra : attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"] -- api : shuffle_channel +- op : shuffle_channel backward : shuffle_channel_grad extra : attrs : [bool use_mkldnn = false] -- api : slice +- op : sigmoid + backward : sigmoid_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : silu + backward : silu_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : sin + backward : sin_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : sinh + backward : sinh_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : slice backward : slice_grad extra : attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"] -- api : softmax +- op : softmax backward : softmax_grad extra : attrs : [bool use_cudnn = false, bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] -- api : prelu - backward : prelu_grad + +- op : softplus + backward : softplus_grad extra : - attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] + attrs : [bool use_mkldnn = false, bool use_cudnn = false, str fuse_activation_type = "", float fuse_activation_alpha = 0.0f, + float fuse_activation_beta = 0.0f, float fuse_activation_scale = 1.0f] + +- op : softsign + backward : softsign_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] -- api : solve +- op : solve inputs : {x : X, y : Y} outputs : out : Out -- api : squeeze (squeeze2) +- op : sqrt + backward : sqrt_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : square + backward : square_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : squeeze (squeeze2) backward : squeeze_grad (squeeze2_grad) extra : attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32"] -- api : stack +- op : stack backward : stack_grad extra : attrs : [bool use_mkldnn = false] -- api : sync_batch_norm +- op : swish + backward : swish_grad + extra : + attrs : [bool use_mkldnn = false] + +- op : sync_batch_norm backward : sync_batch_norm_grad extra : attrs : [bool use_mkldnn = false, bool fuse_with_relu = false] -- api : trace +- op : tan + backward : tan_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : tanh + backward : tanh_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : tanh_shrink + backward : tanh_shrink_grad + extra : + attrs : [bool use_mkldnn = false, bool use_cudnn = false] + +- op : trace inputs : x : Input outputs : out : Out -- api : trilinear_interp (trilinear_interp_v2) +- op : trilinear_interp (trilinear_interp_v2) backward : trilinear_interp_grad (trilinear_interp_v2_grad) extra : attrs : [bool use_mkldnn = false] -- api : trunc +- op : trunc inputs : x : X outputs : diff --git a/paddle/phi/api/yaml/api_version.yaml b/paddle/phi/api/yaml/op_version.yaml similarity index 97% rename from paddle/phi/api/yaml/api_version.yaml rename to paddle/phi/api/yaml/op_version.yaml index eb2ae4b2c82..5702884533a 100644 --- a/paddle/phi/api/yaml/api_version.yaml +++ b/paddle/phi/api/yaml/op_version.yaml @@ -1,4 +1,4 @@ -- api : trace +- op : trace version : - checkpoint : Upgrade trace add a new attribute [axis2] action : diff --git a/paddle/phi/api/yaml/api.yaml b/paddle/phi/api/yaml/ops.yaml similarity index 91% rename from paddle/phi/api/yaml/api.yaml rename to paddle/phi/api/yaml/ops.yaml index 2218532fd8c..02bcd1f0040 100644 --- a/paddle/phi/api/yaml/api.yaml +++ b/paddle/phi/api/yaml/ops.yaml @@ -1,4 +1,4 @@ -- api : atan2 +- op : atan2 args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -7,7 +7,7 @@ func : atan2 backward : atan2_grad -- api : bernoulli +- op : bernoulli args : (Tensor x) output : Tensor(out) infer_meta : @@ -15,7 +15,7 @@ kernel : func : bernoulli -- api : cholesky +- op : cholesky args : (Tensor x, bool upper=false) output : Tensor infer_meta : @@ -24,7 +24,7 @@ func : cholesky backward : cholesky_grad -- api : cholesky_solve +- op : cholesky_solve args : (Tensor x, Tensor y, bool upper=false) output : Tensor infer_meta : @@ -33,7 +33,7 @@ func : cholesky_solve backward : cholesky_solve_grad -- api : cross +- op : cross args : (Tensor x, Tensor y, int axis = 9) output : Tensor infer_meta : @@ -43,7 +43,7 @@ data_type : x backward : cross_grad -- api : diag +- op : diag args : (Tensor x, int offset = 0, float padding_value = 0.0) output : Tensor infer_meta : @@ -52,7 +52,7 @@ func : diag backward : diag_grad -- api : diagonal +- op : diagonal args : (Tensor x, int offset = 0, int axis1 = 0, int axis2 = 1) output : Tensor infer_meta : @@ -61,7 +61,7 @@ func : diagonal backward : diagonal_grad -- api : digamma +- op : digamma args : (Tensor x) output : Tensor infer_meta : @@ -70,7 +70,7 @@ func : digamma backward : digamma_grad -- api : dist +- op : dist args : (Tensor x, Tensor y, float p = 2.0) output : Tensor infer_meta : @@ -79,7 +79,7 @@ func : dist backward : dist_grad -- api : dot +- op : dot args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -89,7 +89,7 @@ data_type : x backward : dot_grad -- api : erf +- op : erf args : (Tensor x) output : Tensor infer_meta : @@ -98,7 +98,7 @@ func : erf backward : erf_grad -- api : erfinv +- op : erfinv args : (Tensor x) output : Tensor(out) infer_meta : @@ -108,7 +108,7 @@ inplace : (x -> out) backward : erfinv_grad -- api : fft_c2c +- op : fft_c2c args : (Tensor x, int64_t[] axes, str normalization, bool forward) output : Tensor infer_meta : @@ -117,7 +117,7 @@ func : fft_c2c backward : fft_c2c_grad -- api : fft_c2r +- op : fft_c2r args : (Tensor x, int64_t[] axes, str normalization, bool forward, int64_t last_dim_size=0L) output : Tensor infer_meta : @@ -126,7 +126,7 @@ func : fft_c2r backward : fft_c2r_grad -- api : fft_r2c +- op : fft_r2c args : (Tensor x, int64_t[] axes, str normalization, bool forward, bool onesided) output : Tensor infer_meta : @@ -135,7 +135,7 @@ func : fft_r2c backward : fft_r2c_grad -- api : graph_send_uv +- op : graph_send_uv args : (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, str message_op = "ADD") output : Tensor(out) infer_meta : @@ -145,7 +145,7 @@ data_type : x backward : graph_send_uv_grad -- api : lgamma +- op : lgamma args : (Tensor x) output : Tensor(out) infer_meta : @@ -154,7 +154,7 @@ func : lgamma backward : lgamma_grad -- api : mv +- op : mv args : (Tensor x, Tensor vec) output : Tensor infer_meta : @@ -163,7 +163,7 @@ func : mv backward : mv_grad -- api : poisson +- op : poisson args : (Tensor x) output : Tensor infer_meta : @@ -172,7 +172,7 @@ func : poisson backward : poisson_grad -- api : solve +- op : solve args : (Tensor x, Tensor y) output : Tensor infer_meta : @@ -182,7 +182,7 @@ data_type : x backward : solve_grad -- api : trace +- op : trace args : (Tensor x, int offset = 0, int axis1 = 0, int axis2 = 1) output : Tensor infer_meta : @@ -191,7 +191,7 @@ func : trace backward : trace_grad -- api : trunc +- op : trunc args : (Tensor x) output : Tensor infer_meta : diff --git a/paddle/phi/api/yaml/sparse_bw_api.yaml b/paddle/phi/api/yaml/sparse_backward.yaml similarity index 90% rename from paddle/phi/api/yaml/sparse_bw_api.yaml rename to paddle/phi/api/yaml/sparse_backward.yaml index e6242f178e5..4bc306388d1 100644 --- a/paddle/phi/api/yaml/sparse_bw_api.yaml +++ b/paddle/phi/api/yaml/sparse_backward.yaml @@ -1,4 +1,4 @@ -- backward_api : abs_grad +- backward_op : abs_grad forward : tanh(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -6,7 +6,7 @@ func : abs_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, abs_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : acos_grad +- backward_op : acos_grad forward : acos(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -14,7 +14,7 @@ func : acos_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, acos_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : acosh_grad +- backward_op : acosh_grad forward : acosh(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -22,7 +22,7 @@ func : acosh_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, acosh_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : add_grad +- backward_op : add_grad forward : add(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -30,7 +30,7 @@ func : add_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo}, add_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr} -- backward_api : addmm_grad +- backward_op : addmm_grad forward : addmm(Tensor input, Tensor x, Tensor y, float alpha=1.0, float beta=1.0) -> Tensor(out) args : (Tensor input, Tensor x, Tensor y, Tensor out_grad, float alpha=1.0, float beta=1.0) output : Tensor(input_grad), Tensor(x_grad), Tensor(y_grad) @@ -40,7 +40,7 @@ addmm_coo_dense_grad {dense, sparse_coo, dense, dense -> dense, sparse_coo, dense}, addmm_coo_coo_grad {sparse_coo, sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo, sparse_coo} -- backward_api : asin_grad +- backward_op : asin_grad forward : asin(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -48,7 +48,7 @@ func : asin_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, asin_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : asinh_grad +- backward_op : asinh_grad forward : asinh(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -56,7 +56,7 @@ func : asinh_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, asinh_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : atan_grad +- backward_op : atan_grad forward : atan(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -64,7 +64,7 @@ func : atan_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, atan_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : atanh_grad +- backward_op : atanh_grad forward : atanh(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -72,7 +72,7 @@ func : atanh_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, atanh_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : cast_grad +- backward_op : cast_grad forward : cast(Tensor x, DataType index_dtype, DataType value_dtype) -> Tensor(out) args : (Tensor x, Tensor out_grad, DataType value_dtype) output : Tensor(x_grad) @@ -81,14 +81,14 @@ cast_csr_grad {sparse_csr, sparse_csr -> sparse_csr} data_type : out_grad -- backward_api : conv3d_coo_grad +- backward_op : conv3d_coo_grad forward : conv3d_coo (Tensor x, Tensor kernel, int[] paddings, int[] dilations, int[] strides, int groups, bool subm, str key) -> Tensor(out), Tensor(rulebook), Tensor(counter) args : (Tensor x, Tensor kernel, Tensor out, Tensor rulebook, Tensor counter, Tensor out_grad, int[] paddings, int[] dilations, int[] strides, int groups, bool subm, str key) output : Tensor(x_grad), Tensor(kernel_grad) kernel : func : conv3d_coo_grad{sparse_coo, dense, sparse_coo, dense, dense, sparse_coo -> sparse_coo, dense} -- backward_api : divide_grad +- backward_op : divide_grad forward : divide(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -96,13 +96,13 @@ func : divide_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo}, divide_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr} -- backward_api : divide_scalar_grad +- backward_op : divide_scalar_grad forward : divide_scalar (Tensor x, float scalar) -> Tensor(out) args : (Tensor out_grad, float scalar) output : Tensor(x_grad) invoke : divide_scalar(out_grad, scalar) -- backward_api : expm1_grad +- backward_op : expm1_grad forward : expm1(Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -110,7 +110,7 @@ func : expm1_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, expm1_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : leaky_relu_grad +- backward_op : leaky_relu_grad forward : leaky_relu(Tensor x, float alpha) -> Tensor(out) args : (Tensor x, Tensor out_grad, float alpha) output : Tensor(x_grad) @@ -118,7 +118,7 @@ func : leaky_relu_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, leaky_relu_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : log1p_grad +- backward_op : log1p_grad forward : log1p(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -126,14 +126,14 @@ func : log1p_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, log1p_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : masked_matmul_grad +- backward_op : masked_matmul_grad forward : masked_matmul(Tensor x, Tensor y, Tensor mask) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) kernel : func : masked_matmul_csr_grad{dense, dense, sparse_csr -> dense, dense} -- backward_api : matmul_grad +- backward_op : matmul_grad forward : matmul(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -143,14 +143,14 @@ matmul_coo_dense_grad {sparse_coo, dense, dense -> sparse_coo, dense}, matmul_coo_coo_grad {sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo} -- backward_api : maxpool_grad +- backward_op : maxpool_grad forward : maxpool(Tensor x, int[] kernel_sizes, int[] paddings, int[] dilations, int[] strides) -> Tensor(out), Tensor(rulebook), Tensor(counter) args : (Tensor x, Tensor rulebook, Tensor counter, Tensor out, Tensor out_grad, int[] kernel_sizes) output : Tensor(x_grad) kernel : func : maxpool_coo_grad {sparse_coo, dense, dense, sparse_coo, sparse_coo -> sparse_coo} -- backward_api : multiply_grad +- backward_op : multiply_grad forward : multiply(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -158,7 +158,7 @@ func : multiply_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo}, multiply_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr} -- backward_api : mv_grad +- backward_op : mv_grad forward : mv(Tensor x, Tensor vec) -> Tensor(out) args : (Tensor x, Tensor vec, Tensor out_grad) output : Tensor(x_grad), Tensor(vec_grad) @@ -166,7 +166,7 @@ func : mv_coo_grad{sparse_coo, dense, dense -> sparse_coo, dense}, mv_csr_grad{sparse_csr, dense, dense -> sparse_csr, dense} -- backward_api : pow_grad +- backward_op : pow_grad forward : pow(Tensor x, float factor) -> Tensor(out) args : (Tensor x, Tensor out_grad, float factor) output : Tensor(x_grad) @@ -174,7 +174,7 @@ func : pow_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, pow_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : relu6_grad +- backward_op : relu6_grad forward : relu6(Tensor x, float threshold) -> Tensor(out) args : (Tensor out, Tensor out_grad, float threshold) output : Tensor(x_grad) @@ -182,7 +182,7 @@ func : relu6_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, relu6_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : relu_grad +- backward_op : relu_grad forward : relu(Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -190,13 +190,13 @@ func : relu_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, relu_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : scale_grad +- backward_op : scale_grad forward : scale(Tensor x, float scale, float bias, bool bias_after_scale) -> Tensor(out) args : (Tensor out_grad, float scale) output : Tensor(x_grad) invoke : scale(out_grad, scale, 0.0, true) -- backward_api : sin_grad +- backward_op : sin_grad forward : sin(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -204,7 +204,7 @@ func : sin_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, sin_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : sinh_grad +- backward_op : sinh_grad forward : sinh(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -212,21 +212,21 @@ func : sinh_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, sinh_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : softmax_grad +- backward_op : softmax_grad forward : softmax(Tensor x, int axis=-1) -> Tensor(out) args : (Tensor out, Tensor out_grad, int axis) output : Tensor(x_grad) kernel : func : softmax_csr_grad{sparse_csr, sparse_csr -> sparse_csr} -- backward_api : sparse_coo_tensor_grad +- backward_op : sparse_coo_tensor_grad forward : sparse_coo_tensor(Tensor values, Tensor indices, IntArray dense_shape) -> Tensor(out) args : (Tensor indices, Tensor out_grad) output : Tensor(values_grad) kernel : func : sparse_coo_tensor_grad{dense, sparse_coo -> dense} -- backward_api : sqrt_grad +- backward_op : sqrt_grad forward : sqrt(Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -234,7 +234,7 @@ func : sqrt_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, sqrt_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : square_grad +- backward_op : square_grad forward : square(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -242,7 +242,7 @@ func : square_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, square_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : subtract_grad +- backward_op : subtract_grad forward : subtract(Tensor x, Tensor y) -> Tensor(out) args : (Tensor x, Tensor y, Tensor out_grad) output : Tensor(x_grad), Tensor(y_grad) @@ -250,7 +250,7 @@ func : subtract_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo}, subtract_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr} -- backward_api : tan_grad +- backward_op : tan_grad forward : tan(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) @@ -258,7 +258,7 @@ func : tan_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, tan_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : tanh_grad +- backward_op : tanh_grad forward : tanh(Tensor x) -> Tensor(out) args : (Tensor out, Tensor out_grad) output : Tensor(x_grad) @@ -266,28 +266,28 @@ func : tanh_coo_grad {sparse_coo, sparse_coo -> sparse_coo}, tanh_csr_grad {sparse_csr, sparse_csr -> sparse_csr} -- backward_api : to_dense_grad +- backward_op : to_dense_grad forward : to_dense(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) kernel : func : coo_to_dense_grad{sparse_coo, dense -> sparse_coo} -- backward_api : to_sparse_coo_grad +- backward_op : to_sparse_coo_grad forward : to_sparse_coo(Tensor x, int64_t sparse_dim) -> Tensor(out) args : (Tensor out_grad) output : Tensor(x_grad) kernel : func : coo_to_dense { sparse_coo -> dense } -- backward_api : values_grad +- backward_op : values_grad forward : values_coo(Tensor x) -> Tensor(out) args : (Tensor x, Tensor out_grad) output : Tensor(x_grad) kernel : func : values_coo_grad{sparse_coo, dense-> sparse_coo} -- backward_api: fused_attention_grad +- backward_op: fused_attention_grad forward : fused_attention_csr(Tensor query, Tensor key, Tensor value, Tensor sparse_mask, Tensor key_padding_mask, Tensor attn_mask) -> Tensor(out), Tensor(softmax) args: (Tensor query, Tensor key, Tensor value, Tensor softmax, Tensor out_grad) output : Tensor(query_grad), Tensor(key_grad), Tensor(value_grad) diff --git a/paddle/phi/api/yaml/sparse_api.yaml b/paddle/phi/api/yaml/sparse_ops.yaml similarity index 93% rename from paddle/phi/api/yaml/sparse_api.yaml rename to paddle/phi/api/yaml/sparse_ops.yaml index ca40d10b496..c36181e0e8a 100644 --- a/paddle/phi/api/yaml/sparse_api.yaml +++ b/paddle/phi/api/yaml/sparse_ops.yaml @@ -1,4 +1,4 @@ -- api : abs +- op : abs args : (Tensor x) output : Tensor(out) kernel : @@ -7,7 +7,7 @@ layout : x backward : abs_grad -- api : acos +- op : acos args : (Tensor x) output : Tensor(out) kernel : @@ -16,7 +16,7 @@ layout : x backward : acos_grad -- api : acosh +- op : acosh args : (Tensor x) output : Tensor(out) kernel : @@ -25,7 +25,7 @@ layout : x backward : acosh_grad -- api : add +- op : add args : (Tensor x, Tensor y) output : Tensor(out) kernel : @@ -34,7 +34,7 @@ layout : x backward : add_grad -- api : asin +- op : asin args : (Tensor x) output : Tensor(out) kernel : @@ -43,7 +43,7 @@ layout : x backward : asin_grad -- api : asinh +- op : asinh args : (Tensor x) output : Tensor(out) kernel : @@ -52,7 +52,7 @@ layout : x backward : asinh_grad -- api : atan +- op : atan args : (Tensor x) output : Tensor(out) kernel : @@ -61,7 +61,7 @@ layout : x backward : atan_grad -- api : atanh +- op : atanh args : (Tensor x) output : Tensor(out) kernel : @@ -70,7 +70,7 @@ layout : x backward : atanh_grad -- api : cast +- op : cast args : (Tensor x, DataType index_dtype=DataType::UNDEFINED, DataType value_dtype=DataType::UNDEFINED) output : Tensor(out) kernel : @@ -80,7 +80,7 @@ data_type : x backward : cast_grad -- api : conv3d +- op : conv3d args : (Tensor x, Tensor kernel, int[] paddings, int[] dilations, int[] strides, int groups, bool subm, str key) output : Tensor(out), Tensor(rulebook), Tensor(counter) kernel : @@ -89,7 +89,7 @@ intermediate: rulebook, counter backward : conv3d_coo_grad -- api : divide +- op : divide args : (Tensor x, Tensor y) output : Tensor(out) kernel : @@ -98,7 +98,7 @@ layout : x backward : divide_grad -- api : divide_scalar +- op : divide_scalar args : (Tensor x, float scalar) output : Tensor(out) kernel : @@ -106,7 +106,7 @@ divide_csr_scalar{sparse_csr -> sparse_csr} backward : divide_scalar_grad -- api : expm1 +- op : expm1 args : (Tensor x) output : Tensor(out) kernel : @@ -115,7 +115,7 @@ layout : x backward : expm1_grad -- api : leaky_relu +- op : leaky_relu args : (Tensor x, float alpha) output : Tensor(out) kernel : @@ -124,7 +124,7 @@ layout : x backward : leaky_relu_grad -- api : log1p +- op : log1p args : (Tensor x) output : Tensor(out) kernel : @@ -133,7 +133,7 @@ layout : x backward : log1p_grad -- api : multiply +- op : multiply args : (Tensor x, Tensor y) output : Tensor(out) kernel : @@ -142,7 +142,7 @@ layout : x backward : multiply_grad -- api : pow +- op : pow args : (Tensor x, float factor) output : Tensor(out) kernel : @@ -151,7 +151,7 @@ layout : x backward : pow_grad -- api : relu +- op : relu args : (Tensor x) output : Tensor(out) kernel : @@ -160,7 +160,7 @@ layout : x backward : relu_grad -- api : relu6 +- op : relu6 args : (Tensor x, float threshold) output : Tensor(out) kernel : @@ -169,7 +169,7 @@ layout : x backward : relu6_grad -- api : scale +- op : scale args : (Tensor x, float scale, float bias, bool bias_after_scale) output : Tensor(out) kernel : @@ -177,7 +177,7 @@ scale_csr{sparse_csr -> sparse_csr} backward : scale_grad -- api : sin +- op : sin args : (Tensor x) output : Tensor(out) kernel : @@ -186,7 +186,7 @@ layout : x backward : sin_grad -- api : sinh +- op : sinh args : (Tensor x) output : Tensor(out) kernel : @@ -195,7 +195,7 @@ layout : x backward : sinh_grad -- api : softmax +- op : softmax args : (Tensor x, int axis=-1) output : Tensor(out) kernel : @@ -203,7 +203,7 @@ layout : x backward : softmax_grad -- api : sparse_coo_tensor +- op : sparse_coo_tensor args : (Tensor values, Tensor indices, IntArray dense_shape) output : Tensor(out) kernel : @@ -212,7 +212,7 @@ data_type : values backward : sparse_coo_tensor_grad -- api : sqrt +- op : sqrt args : (Tensor x) output : Tensor(out) kernel : @@ -221,7 +221,7 @@ layout : x backward : sqrt_grad -- api : square +- op : square args : (Tensor x) output : Tensor(out) kernel : @@ -230,7 +230,7 @@ layout : x backward : square_grad -- api : subtract +- op : subtract args : (Tensor x, Tensor y) output : Tensor(out) kernel : @@ -239,7 +239,7 @@ layout : x backward : subtract_grad -- api : tan +- op : tan args : (Tensor x) output : Tensor(out) kernel : @@ -248,7 +248,7 @@ layout : x backward : tan_grad -- api : tanh +- op : tanh args : (Tensor x) output : Tensor(out) kernel : @@ -257,7 +257,7 @@ layout : x backward : tanh_grad -- api : to_dense +- op : to_dense args : (Tensor x) output : Tensor(out) kernel : @@ -265,7 +265,7 @@ csr_to_dense {sparse_csr -> dense} backward : to_dense_grad -- api : to_sparse_coo +- op : to_sparse_coo args : (Tensor x, int64_t sparse_dim) output : Tensor(out) kernel : @@ -273,14 +273,14 @@ csr_to_coo { sparse_csr -> sparse_coo} backward : to_sparse_coo_grad -- api : to_sparse_csr +- op : to_sparse_csr args : (Tensor x) output : Tensor(out) kernel : func : dense_to_csr {dense -> sparse_csr}, coo_to_csr {sparse_coo -> sparse_csr} -- api : values +- op : values args : (Tensor x) output : Tensor(out) kernel : @@ -289,7 +289,7 @@ layout : x backward : values_grad -- api: addmm +- op: addmm args : (Tensor input, Tensor x, Tensor y, float alpha=1.0, float beta=1.0) output : Tensor(out) kernel : @@ -300,14 +300,14 @@ layout : x backward: addmm_grad -- api: coalesce +- op: coalesce args : (Tensor x) output : Tensor(out) kernel : func: coalesce{sparse_coo -> sparse_coo} layout : x -- api: full_like +- op: full_like args : (Tensor x, Scalar value, DataType dtype=DataType::UNDEFINED) output : Tensor(out) kernel : @@ -316,7 +316,7 @@ layout : x data_type : dtype -- api: fused_attention +- op: fused_attention args : (Tensor query, Tensor key, Tensor value, Tensor sparse_mask, Tensor key_padding_mask, Tensor attn_mask) output : Tensor(out), Tensor(softmax) kernel : @@ -327,7 +327,7 @@ intermediate : softmax backward: fused_attention_grad -- api: masked_matmul +- op: masked_matmul args : (Tensor x, Tensor y, Tensor mask) output : Tensor(out) kernel : @@ -335,7 +335,7 @@ layout : x backward: masked_matmul_grad -- api: matmul +- op: matmul args : (Tensor x, Tensor y) output : Tensor(out) kernel : @@ -346,7 +346,7 @@ layout : x backward: matmul_grad -- api: maxpool +- op: maxpool args : (Tensor x, int[] kernel_sizes, int[] paddings, int[] dilations, int[] strides) output : Tensor(out), Tensor(rulebook), Tensor(counter) kernel : @@ -355,7 +355,7 @@ intermediate : rulebook, counter backward : maxpool_grad -- api: mv +- op: mv args : (Tensor x, Tensor vec) output : Tensor(out) kernel : diff --git a/paddle/phi/api/yaml/strings_api.yaml b/paddle/phi/api/yaml/strings_ops.yaml similarity index 93% rename from paddle/phi/api/yaml/strings_api.yaml rename to paddle/phi/api/yaml/strings_ops.yaml index 34dac9221a4..aef16d85d28 100644 --- a/paddle/phi/api/yaml/strings_api.yaml +++ b/paddle/phi/api/yaml/strings_ops.yaml @@ -1,4 +1,4 @@ -- api : empty +- op : empty args : (IntArray shape, Place place=CPUPlace()) output : Tensor(out@StringTensor) infer_meta : @@ -9,7 +9,7 @@ param : [shape] backend : place -- api : empty_like +- op : empty_like args : (Tensor x, Place place = {}) output : Tensor(out@StringTensor) infer_meta : @@ -20,7 +20,7 @@ param : [x] backend : place > x -- api : lower +- op : lower args : (Tensor x, bool use_utf8_encoding) output : Tensor(out@StringTensor) infer_meta : @@ -29,7 +29,7 @@ kernel : func : strings_lower -- api : upper +- op : upper args : (Tensor x, bool use_utf8_encoding) output : Tensor(out@StringTensor) infer_meta : diff --git a/paddle/phi/infermeta/unary.cc b/paddle/phi/infermeta/unary.cc index d07df3d36aa..006f77132f0 100644 --- a/paddle/phi/infermeta/unary.cc +++ b/paddle/phi/infermeta/unary.cc @@ -3537,7 +3537,7 @@ void StridedSliceInferMeta(const MetaTensor& x, /* Why not use SumRawInferMeta directly? Because we need make InferMetaFunction's args follow the design of - api.yaml + ops.yaml */ void SumInferMeta(const MetaTensor& x, const IntArray& axis, diff --git a/python/paddle/fluid/tests/unittests/test_assign_op.py b/python/paddle/fluid/tests/unittests/test_assign_op.py index fa902542f16..9721cca5bf9 100644 --- a/python/paddle/fluid/tests/unittests/test_assign_op.py +++ b/python/paddle/fluid/tests/unittests/test_assign_op.py @@ -24,6 +24,9 @@ import paddle.fluid as fluid from paddle.fluid import compiler, Program, program_guard from paddle.fluid.backward import append_backward import paddle.fluid.framework as framework +import gradient_checker +from decorator_helper import prog_scope +import paddle.fluid.layers as layers class TestAssignOp(op_test.OpTest): @@ -258,5 +261,79 @@ class TestAssignOpErrorApi(unittest.TestCase): paddle.disable_static() +class TestAssignDoubleGradCheck(unittest.TestCase): + + def assign_wrapper(self, x): + return paddle.fluid.layers.assign(x[0]) + + @prog_scope() + def func(self, place): + # the shape of input variable should be clearly specified, not inlcude -1. + eps = 0.005 + dtype = np.float32 + + data = layers.data('data', [3, 4, 5], False, dtype) + data.persistable = True + out = paddle.fluid.layers.assign(data) + data_arr = np.random.uniform(-1, 1, data.shape).astype(dtype) + + gradient_checker.double_grad_check([data], + out, + x_init=[data_arr], + place=place, + eps=eps) + fluid.set_flags({"FLAGS_retain_grad_for_all_tensor": True}) + gradient_checker.double_grad_check_for_dygraph(self.assign_wrapper, + [data], + out, + x_init=[data_arr], + place=place) + + def test_grad(self): + paddle.enable_static() + places = [fluid.CPUPlace()] + if core.is_compiled_with_cuda(): + places.append(fluid.CUDAPlace(0)) + for p in places: + self.func(p) + + +class TestAssignTripleGradCheck(unittest.TestCase): + + def assign_wrapper(self, x): + return paddle.fluid.layers.assign(x[0]) + + @prog_scope() + def func(self, place): + # the shape of input variable should be clearly specified, not inlcude -1. + eps = 0.005 + dtype = np.float32 + + data = layers.data('data', [3, 4, 5], False, dtype) + data.persistable = True + out = paddle.fluid.layers.assign(data) + data_arr = np.random.uniform(-1, 1, data.shape).astype(dtype) + + gradient_checker.triple_grad_check([data], + out, + x_init=[data_arr], + place=place, + eps=eps) + fluid.set_flags({"FLAGS_retain_grad_for_all_tensor": True}) + gradient_checker.triple_grad_check_for_dygraph(self.assign_wrapper, + [data], + out, + x_init=[data_arr], + place=place) + + def test_grad(self): + paddle.enable_static() + places = [fluid.CPUPlace()] + if core.is_compiled_with_cuda(): + places.append(fluid.CUDAPlace(0)) + for p in places: + self.func(p) + + if __name__ == '__main__': unittest.main() diff --git a/tools/infrt/generate_phi_kernel_dialect.py b/tools/infrt/generate_phi_kernel_dialect.py index 39b0d5484a8..379525c1a7a 100644 --- a/tools/infrt/generate_phi_kernel_dialect.py +++ b/tools/infrt/generate_phi_kernel_dialect.py @@ -64,7 +64,7 @@ def get_skipped_kernel_list(): for api in infer_meta_data: if "kernel" not in api or "infer_meta" not in api: continue - if api["api"] in skiped_api_list["phi_apis"]: + if api["op"] in skiped_api_list["phi_apis"]: skiped_kernel_list.append(api["kernel"]["func"]) skiped_kernel_list += skiped_api_list["phi_kernels"] return skiped_kernel_list diff --git a/tools/infrt/get_phi_kernel_info.py b/tools/infrt/get_phi_kernel_info.py index 4837ca58213..6309197a10f 100644 --- a/tools/infrt/get_phi_kernel_info.py +++ b/tools/infrt/get_phi_kernel_info.py @@ -39,7 +39,7 @@ def get_skipped_kernel_list(): for api in infer_meta_data: if "kernel" not in api or "infer_meta" not in api: continue - if api["api"] in skiped_api_list["phi_apis"]: + if api["op"] in skiped_api_list["phi_apis"]: skiped_kernel_list.append(api["kernel"]["func"]) skiped_kernel_list += skiped_api_list["phi_kernels"] return skiped_kernel_list -- GitLab