Skip to content

Commit b92eee8

Browse files
authored
Revert "Implement Op Annotation's for ONNX (#1648)" (#1812)
This reverts commit 0628582.
1 parent 61f1e9e commit b92eee8

File tree

13 files changed

+75
-442
lines changed

13 files changed

+75
-442
lines changed

docs/OpSchema.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

onnx/common/ir.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "onnx/common/interned_strings.h"
2222
#include "onnx/common/graph_node_list.h"
2323
#include "onnx/common/tensor.h"
24-
#include "onnx/defs/schema.h"
2524

2625

2726
#define ONNX_DISALLOW_COPY_AND_ASSIGN(TypeName) \
@@ -465,13 +464,6 @@ struct Node : public Attributes<Node> {
465464
stage_ = s;
466465
return this;
467466
}
468-
inline bool containsOpAnnotation(OpAnnotationFlag flag) const{
469-
auto op_schema = OpSchemaRegistry::Instance()->Schema(this->kind().toString());
470-
if (nullptr != op_schema) {
471-
return op_schema->ContainsOpAnnotation(flag);
472-
}
473-
return false;
474-
}
475467
// NB: This returns an ArrayRef; that means that it will
476468
// get invalidated if you resize inputs (e.g., using addInput)
477469
// We can't return a std::vector<Node*>& because there's no

onnx/defs/math/defs.cc

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ will throw errors.
8181
"T",
8282
{"tensor(float16)", "tensor(float)", "tensor(double)"},
8383
"Constrain input and output types to float tensors.");
84-
schema.AddOpAnnotation(OpAnnotationFlag::ElementwiseDependent);
85-
schema.AddOpAnnotation(
86-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing);
8784
schema.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput);
8885
};
8986
}
@@ -226,10 +223,7 @@ ONNX_OPERATOR_SET_SCHEMA(
226223
"T",
227224
{"tensor(float16)", "tensor(float)", "tensor(double)"},
228225
"Constrain input and output types to float tensors.")
229-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
230-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
231-
.AddOpAnnotation(
232-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing));
226+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
233227

234228
static const char* Relu_ver6_doc = R"DOC(
235229
Relu takes one input data (Tensor<T>) and produces one output data
@@ -248,9 +242,7 @@ ONNX_OPERATOR_SET_SCHEMA(
248242
"T",
249243
{"tensor(float16)", "tensor(float)", "tensor(double)"},
250244
"Constrain input and output types to float tensors.")
251-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
252-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
253-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseWeakMonotonicIncreasing));
245+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
254246

255247
static const char* LeakyRelu_ver6_doc = R"DOC(
256248
LeakyRelu takes input data (Tensor<T>) and an argument alpha, and produces one
@@ -270,9 +262,7 @@ ONNX_OPERATOR_SET_SCHEMA(
270262
"T",
271263
{"tensor(float16)", "tensor(float)", "tensor(double)"},
272264
"Constrain input and output types to float tensors.")
273-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
274-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
275-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseWeakMonotonicIncreasing));
265+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
276266

277267
static const char* Selu_ver6_doc = R"DOC(
278268
Selu takes one input data (Tensor<T>) and produces one output data
@@ -304,10 +294,7 @@ ONNX_OPERATOR_SET_SCHEMA(
304294
"T",
305295
{"tensor(float16)", "tensor(float)", "tensor(double)"},
306296
"Constrain input and output types to float tensors.")
307-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
308-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
309-
.AddOpAnnotation(
310-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing));
297+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
311298

312299
static const char* Elu_ver6_doc = R"DOC(
313300
Elu takes one input data (Tensor<T>) and produces one output data
@@ -328,10 +315,7 @@ ONNX_OPERATOR_SET_SCHEMA(
328315
"T",
329316
{"tensor(float16)", "tensor(float)", "tensor(double)"},
330317
"Constrain input and output types to float tensors.")
331-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
332-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
333-
.AddOpAnnotation(
334-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing));
318+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
335319

336320
static const char* Exp_ver6_doc = R"DOC(
337321
Calculates the exponential of the given input tensor, element-wise.
@@ -353,10 +337,7 @@ ONNX_OPERATOR_SET_SCHEMA(
353337
"T",
354338
{"tensor(float16)", "tensor(float)", "tensor(double)"},
355339
"Constrain input and output types to float tensors.")
356-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
357-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
358-
.AddOpAnnotation(
359-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing));
340+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
360341

361342
static const char* Log_ver6_doc = R"DOC(
362343
Calculates the natural log of the given input tensor, element-wise.
@@ -378,10 +359,7 @@ ONNX_OPERATOR_SET_SCHEMA(
378359
"T",
379360
{"tensor(float16)", "tensor(float)", "tensor(double)"},
380361
"Constrain input and output types to float tensors.")
381-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
382-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
383-
.AddOpAnnotation(
384-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing));
362+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
385363

386364
static const char* Tanh_ver6_doc = R"DOC(
387365
Calculates the hyperbolic tangent of the given input tensor element-wise.
@@ -403,10 +381,7 @@ ONNX_OPERATOR_SET_SCHEMA(
403381
"T",
404382
{"tensor(float16)", "tensor(float)", "tensor(double)"},
405383
"Constrain input and output types to float tensors.")
406-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
407-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
408-
.AddOpAnnotation(
409-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing));
384+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
410385

411386
static const char* Pow_ver7_doc = R"DOC(
412387
Pow takes input data (Tensor<T>) and exponent Tensor, and
@@ -485,10 +460,7 @@ ONNX_OPERATOR_SET_SCHEMA(
485460
"T",
486461
{"tensor(float16)", "tensor(float)", "tensor(double)"},
487462
"Constrain input and output types to float tensors.")
488-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
489-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
490-
.AddOpAnnotation(
491-
OpAnnotationFlag::ElementwiseStrictMonotonicIncreasing));
463+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
492464

493465
static const char* HardSigmoid_ver6_doc = R"DOC(
494466
HardSigmoid takes one input data (Tensor<T>) and produces one output data
@@ -509,9 +481,7 @@ ONNX_OPERATOR_SET_SCHEMA(
509481
"T",
510482
{"tensor(float16)", "tensor(float)", "tensor(double)"},
511483
"Constrain input and output types to float tensors.")
512-
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput)
513-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseIndependent)
514-
.AddOpAnnotation(OpAnnotationFlag::ElementwiseWeakMonotonicIncreasing));
484+
.TypeAndShapeInferenceFunction(propagateShapeAndTypeFromFirstInput));
515485

516486
std::function<void(OpSchema&)> ElementwiseMultiOpDocGenerator(
517487
const char* name) {

onnx/defs/op_annotation.cc

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)