Caffe2 - C++ API
A deep learning, cross platform ML framework
defs.cc
1 // Copyright (c) Facebook Inc. and Microsoft Corporation.
2 // Licensed under the MIT license.
3 
4 #include "./schema.h"
5 
6 namespace ONNX_NAMESPACE {
7 
8 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
9  SparseLengthsSumFused8BitRowwise,
10  1,
11  OpSchema()
12  .SetDoc("Mirror Caffe2 SparseLengthsSumFused8BitRowwise operator")
13  .Input(0, "DATA", "data tensor", "T1")
14  .Input(1, "INDICES", "indices tensor", "T2")
15  .Input(2, "LENGTHS", "lengths tensor", "T2")
16  .Output(0, "output", "Output tensor", "T2")
17  .TypeConstraint(
18  "T1",
19  {"tensor(uint8)"},
20  "Constrain input data to uint8 tensors.")
21  .TypeConstraint(
22  "T2",
23  {"tensor(int8)",
24  "tensor(int16)",
25  "tensor(int32)",
26  "tensor(int64)",
27  "tensor(uint8)",
28  "tensor(uint16)",
29  "tensor(uint32)",
30  "tensor(uint64)"},
31  "Constrain index and length to integral tensors."));
32 
33 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
34  SparseLengthsSum,
35  1,
36  OpSchema()
37  .SetDoc("Mirror Caffe2 SparseLengthsSum operator")
38  .Input(0, "DATA", "data tensor", "T1")
39  .Input(1, "INDICES", "indices tensor", "T2")
40  .Input(2, "LENGTHS", "lengths tensor", "T2")
41  .Output(0, "output", "Output tensor", "T1")
42  .TypeConstraint(
43  "T1",
44  {"tensor(float16)", "tensor(float)", "tensor(double)"},
45  "Constrain input and output types to float tensors.")
46  .TypeConstraint(
47  "T2",
48  {"tensor(int8)",
49  "tensor(int16)",
50  "tensor(int32)",
51  "tensor(int64)",
52  "tensor(uint8)",
53  "tensor(uint16)",
54  "tensor(uint32)",
55  "tensor(uint64)"},
56  "Constrain index and length to integral tensors."));
57 
58 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
59  SparseLengthsWeightedSum,
60  1,
61  OpSchema()
62  .SetDoc("Mirror Caffe2 SparseLengthsWeightedSum operator")
63  .Input(0, "DATA", "data tensor", "T1")
64  .Input(1, "WEIGHTS", "data tensor", "T1")
65  .Input(2, "INDICES", "indices tensor", "T2")
66  .Input(3, "LENGTHS", "lengths tensor", "T2")
67  .Output(0, "output", "Output tensor", "T1")
68  .TypeConstraint(
69  "T1",
70  {"tensor(float16)", "tensor(float)", "tensor(double)"},
71  "Constrain input and output types to float tensors.")
72  .TypeConstraint(
73  "T2",
74  {"tensor(int8)",
75  "tensor(int16)",
76  "tensor(int32)",
77  "tensor(int64)",
78  "tensor(uint8)",
79  "tensor(uint16)",
80  "tensor(uint32)",
81  "tensor(uint64)"},
82  "Constrain index and length to integral tensors."));
83 
84 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
85  BatchGather,
86  1,
87  OpSchema()
88  .SetDoc("Mirror Caffe2 BatchGather operator")
89  .Input(0, "DATA", "data tensor", "T1")
90  .Input(1, "INDICES", "indices tensor", "T2")
91  .Output(0, "output", "Output tensor", "T1")
92  .TypeConstraint(
93  "T1",
94  {"tensor(float16)", "tensor(float)", "tensor(double)"},
95  "Constrain input and output types to float tensors.")
96  .TypeConstraint(
97  "T2",
98  {"tensor(int8)",
99  "tensor(int16)",
100  "tensor(int32)",
101  "tensor(int64)",
102  "tensor(uint8)",
103  "tensor(uint16)",
104  "tensor(uint32)",
105  "tensor(uint64)"},
106  "Constrain index and length to integral tensors."));
107 
108 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
109  DotProduct,
110  1,
111  OpSchema()
112  .SetDoc("Mirror Caffe2 DotProduct operator")
113  .Input(0, "X", "Input 1 tensor", "T")
114  .Input(1, "Y", "Input 2 tensor", "T")
115  .Output(0, "Z", "Output tensor", "T")
116  .TypeConstraint(
117  "T",
118  {"tensor(float16)", "tensor(float)", "tensor(double)"},
119  "Constrain input and output types to float tensors."));
120 
121 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
122  FCTransposed,
123  1,
124  OpSchema()
125  .SetDoc("Mirror Caffe2 FCTransposed operator")
126  .Input(0, "X", "Input tensor", "T")
127  .Input(1, "W", "Weight tensor", "T")
128  .Input(2, "B", "Bias tensor", "T")
129  .Output(0, "Z", "Output tensor", "T")
130  .TypeConstraint(
131  "T",
132  {"tensor(float16)", "tensor(float)", "tensor(double)"},
133  "Constrain input and output types to float tensors."));
134 
135 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
136  BatchMatMul,
137  1,
138  OpSchema()
139  .SetDoc("Mirror Caffe2 BatchMatMul operator")
140  .Input(0, "X", "tensor of shape (dim0, dim1 ... M, K)", "T")
141  .Input(1, "Y", "tensor of shpae (dim0, dim2 ... K, N)", "T")
142  .Output(0, "Z", "tensor of shape (dim0, dim1 ... M, N)", "T")
143  .TypeConstraint(
144  "T",
145  {"tensor(float16)", "tensor(float)", "tensor(double)"},
146  "Constrain input and output types to float tensors."));
147 
148 ONNX_PYTORCH_OPERATOR_SET_SCHEMA(
149  ExpandDims,
150  1,
151  OpSchema()
152  .SetDoc("Mirror Caffe2 ExpandDims operator")
153  .Input(0, "X", "Input tensor", "T")
154  .Output(0, "Y", "Output tensor", "T")
155  .TypeConstraint(
156  "T",
157  {"tensor(float16)", "tensor(float)", "tensor(double)"},
158  "Constrain input and output types to float tensors."));
159 
160 } // namespace ONNX_NAMESPACE