mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/34280 To have prim ops searchable for lite interpreter, overloaded names need to be added for the operators with the same name but different schema. For example, aten::add in register_prim_ops.cpp. The difference is a combination of args and output type. `"aten::add(str a, str b) ->str"` `"aten::add(int a, int b) ->int"` `"aten::add(float a, float b) ->float"` `"aten::add(int a, float b) ->float"` `"aten::add(float a, int b) ->float"` `"aten::add(Scalar a, Scalar b) ->Scalar"` Solution: Use the argument type and/or output type (the same to the existing overloaded names). The overloaded name should be minimum as long as the operators can be differentiated. For other operators please look into the source code change for details. `"aten::add.str(str a, str b) ->str"` `"aten::add.int(int a, int b) ->int"` `"aten::add.float(float a, float b) ->float"` `"aten::add.int_float(int a, float b) ->float"` `"aten::add.float_int(float a, int b) ->float"` `"aten::add.Scalar_Scalar(Scalar a, Scalar b) ->Scalar"` Test Plan: Imported from OSS Differential Revision: D20456997 Pulled By: iseeyuan fbshipit-source-id: 2c3dc324b4a4e045559f62c6cc2a10fbb9a72dcf
114 lines
4.1 KiB
C++
114 lines
4.1 KiB
C++
#pragma once
|
|
|
|
/**
|
|
* See README.md for instructions on how to add a new test.
|
|
*/
|
|
#include <torch/csrc/WindowsTorchApiMacro.h>
|
|
#include <c10/macros/Export.h>
|
|
|
|
namespace torch {
|
|
namespace jit {
|
|
#define TH_FORALL_TESTS(_) \
|
|
_(ADFormulas) \
|
|
_(Attributes) \
|
|
_(Blocks) \
|
|
_(CallStack) \
|
|
_(CallStackCaching) \
|
|
_(CodeTemplate) \
|
|
_(ControlFlow) \
|
|
_(CreateAutodiffSubgraphs) \
|
|
_(CustomOperators) \
|
|
_(CustomOperatorAliasing) \
|
|
_(IValueKWargs) \
|
|
_(CustomFusion) \
|
|
_(SchemaMatching) \
|
|
_(Differentiate) \
|
|
_(DifferentiateWithRequiresGrad) \
|
|
_(FromQualString) \
|
|
_(InternedStrings) \
|
|
_(IValue) \
|
|
_(IValueFuture) \
|
|
_(PassManagement) \
|
|
_(Proto) \
|
|
_(RegisterFusionCachesKernel) \
|
|
_(SchemaParser) \
|
|
_(TopologicalIndex) \
|
|
_(TopologicalMove) \
|
|
_(SubgraphUtils) \
|
|
_(AliasAnalysis) \
|
|
_(ContainerAliasing) \
|
|
_(AliasRegistration) \
|
|
_(WriteTracking) \
|
|
_(Wildcards) \
|
|
_(MemoryDAG) \
|
|
_(IRParser) \
|
|
_(ConstantPooling) \
|
|
_(THNNConv) \
|
|
_(ATenNativeBatchNorm) \
|
|
_(NoneSchemaMatch) \
|
|
_(ClassParser) \
|
|
_(UnifyTypes) \
|
|
_(Profiler) \
|
|
_(InsertAndEliminateRedundantGuards) \
|
|
_(InsertBailOuts) \
|
|
_(PeepholeOptimize) \
|
|
_(RecordFunction) \
|
|
_(ThreadLocalDebugInfo) \
|
|
_(SubgraphMatching) \
|
|
_(SubgraphRewriter) \
|
|
_(ModuleClone) \
|
|
_(ModuleCloneInstance) \
|
|
_(ModuleConstant) \
|
|
_(ModuleParameter) \
|
|
_(ModuleDefine) \
|
|
_(QualifiedName) \
|
|
_(ClassImport) \
|
|
_(ProfiledTensorTypeHashing) \
|
|
_(ScriptObject) \
|
|
_(SaveExtraFilesHook) \
|
|
_(TypeTags) \
|
|
_(DCE) \
|
|
_(CustomFusionNestedBlocks) \
|
|
_(ClassDerive) \
|
|
_(SaveLoadTorchbind) \
|
|
_(ModuleInterfaceSerialization) \
|
|
_(ClassTypeAddRemoveAttr) \
|
|
_(Inliner) \
|
|
_(LiteInterpreterAdd) \
|
|
_(LiteInterpreterConv) \
|
|
_(LiteInterpreterInline) \
|
|
_(LiteInterpreterTuple) \
|
|
_(LiteInterpreterUpsampleNearest2d) \
|
|
_(CommonAncestor) \
|
|
_(AutogradSymbols) \
|
|
_(MobileTypeParser) \
|
|
_(LiteInterpreterBuiltinFunction) \
|
|
_(LiteInterpreterPrim) \
|
|
_(LiteInterpreterLoadOrigJit) \
|
|
_(LiteInterpreterWrongMethodName) \
|
|
_(LiteInterpreterParams) \
|
|
_(LiteInterpreterSetState)
|
|
|
|
#define TH_FORALL_TESTS_CUDA(_) \
|
|
_(ArgumentSpec) \
|
|
_(CompleteArgumentSpec) \
|
|
_(Fusion) \
|
|
_(GraphExecutor) \
|
|
_(ModuleConversion) \
|
|
_(Interp)
|
|
|
|
#define DECLARE_JIT_TEST(name) void test##name();
|
|
TH_FORALL_TESTS(DECLARE_JIT_TEST)
|
|
TH_FORALL_TESTS_CUDA(DECLARE_JIT_TEST)
|
|
#undef DECLARE_JIT_TEST
|
|
|
|
// This test is special since it requires prior setup in python.
|
|
// So it is not part of the general test list (which is shared between the gtest
|
|
// and python test runners), but is instead invoked manually by the
|
|
// torch_python_test.cpp
|
|
void testEvalModeForLoadedModule();
|
|
void testSerializationInterop();
|
|
void testTorchSaveError();
|
|
|
|
} // namespace jit
|
|
} // namespace torch
|