-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
dense_cmp.go
347 lines (315 loc) · 12.4 KB
/
dense_cmp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
// Code generated by genlib2. DO NOT EDIT.
package tensor
import "github.com/pkg/errors"
// Gt performs t > other elementwise. Both t and other must have the same shape.
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
//UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) Gt(other *Dense, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.Gt(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Gt()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Gt")
}
return
}
if gter, ok := t.e.(Gter); ok {
if ret, err = gter.Gt(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Gt()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Gt")
}
return
}
return nil, errors.Errorf("Engine does not support Gt()")
}
// Gte performs t ≥ other elementwise. Both t and other must have the same shape.
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
//UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) Gte(other *Dense, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.Gte(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Gte()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Gte")
}
return
}
if gteer, ok := t.e.(Gteer); ok {
if ret, err = gteer.Gte(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Gte()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Gte")
}
return
}
return nil, errors.Errorf("Engine does not support Gte()")
}
// Lt performs t < other elementwise. Both t and other must have the same shape.
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
//UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) Lt(other *Dense, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.Lt(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Lt()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Lt")
}
return
}
if lter, ok := t.e.(Lter); ok {
if ret, err = lter.Lt(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Lt()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Lt")
}
return
}
return nil, errors.Errorf("Engine does not support Lt()")
}
// Lte performs t ≤ other elementwise. Both t and other must have the same shape.
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
//UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) Lte(other *Dense, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.Lte(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Lte()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Lte")
}
return
}
if lteer, ok := t.e.(Lteer); ok {
if ret, err = lteer.Lte(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Lte()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Lte")
}
return
}
return nil, errors.Errorf("Engine does not support Lte()")
}
// ElEq performs t == other elementwise. Both t and other must have the same shape.
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
//UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) ElEq(other *Dense, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.ElEq(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Eq()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Eq")
}
return
}
if eleqer, ok := t.e.(ElEqer); ok {
if ret, err = eleqer.ElEq(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Eq()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Eq")
}
return
}
return nil, errors.Errorf("Engine does not support Eq()")
}
// ElNe performs t ≠ other elementwise. Both t and other must have the same shape.
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
//UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) ElNe(other *Dense, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.ElNe(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Ne()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Ne")
}
return
}
if eleqer, ok := t.e.(ElEqer); ok {
if ret, err = eleqer.ElNe(t, other, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do Ne()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "Ne")
}
return
}
return nil, errors.Errorf("Engine does not support Ne()")
}
// GtScalar performs t > other elementwise. The leftTensor parameter indicates if the tensor is the left operand. Only scalar types are accepted in other
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
// UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) GtScalar(other interface{}, leftTensor bool, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.GtScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do GtScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "GtScalar")
}
return
}
if gter, ok := t.e.(Gter); ok {
if ret, err = gter.GtScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do GtScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "GtScalar")
}
return
}
return nil, errors.Errorf("Engine does not support GtScalar()")
}
// GteScalar performs t ≥ other elementwise. The leftTensor parameter indicates if the tensor is the left operand. Only scalar types are accepted in other
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
// UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) GteScalar(other interface{}, leftTensor bool, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.GteScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do GteScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "GteScalar")
}
return
}
if gteer, ok := t.e.(Gteer); ok {
if ret, err = gteer.GteScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do GteScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "GteScalar")
}
return
}
return nil, errors.Errorf("Engine does not support GteScalar()")
}
// LtScalar performs t < other elementwise. The leftTensor parameter indicates if the tensor is the left operand. Only scalar types are accepted in other
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
// UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) LtScalar(other interface{}, leftTensor bool, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.LtScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do LtScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "LtScalar")
}
return
}
if lter, ok := t.e.(Lter); ok {
if ret, err = lter.LtScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do LtScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "LtScalar")
}
return
}
return nil, errors.Errorf("Engine does not support LtScalar()")
}
// LteScalar performs t ≤ other elementwise. The leftTensor parameter indicates if the tensor is the left operand. Only scalar types are accepted in other
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
// UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) LteScalar(other interface{}, leftTensor bool, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.LteScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do LteScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "LteScalar")
}
return
}
if lteer, ok := t.e.(Lteer); ok {
if ret, err = lteer.LteScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do LteScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "LteScalar")
}
return
}
return nil, errors.Errorf("Engine does not support LteScalar()")
}
// EqScalar performs t == other elementwise. The leftTensor parameter indicates if the tensor is the left operand. Only scalar types are accepted in other
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
// UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) ElEqScalar(other interface{}, leftTensor bool, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.EqScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do EqScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "EqScalar")
}
return
}
if eleqer, ok := t.e.(ElEqer); ok {
if ret, err = eleqer.EqScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do EqScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "EqScalar")
}
return
}
return nil, errors.Errorf("Engine does not support EqScalar()")
}
// NeScalar performs t ≠ other elementwise. The leftTensor parameter indicates if the tensor is the left operand. Only scalar types are accepted in other
// Acceptable FuncOpts are: UseUnsafe(), AsSameType(), WithReuse().
// UseUnsafe() will ensure that the same type is returned.
// Tensors used in WithReuse has to have the same Dtype as the return value's Dtype.
func (t *Dense) ElNeScalar(other interface{}, leftTensor bool, opts ...FuncOpt) (retVal *Dense, err error) {
var ret Tensor
if t.oe != nil {
if ret, err = t.oe.NeScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do NeScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "NeScalar")
}
return
}
if eleqer, ok := t.e.(ElEqer); ok {
if ret, err = eleqer.NeScalar(t, other, leftTensor, opts...); err != nil {
return nil, errors.Wrapf(err, "Unable to do NeScalar()")
}
if retVal, err = assertDense(ret); err != nil {
return nil, errors.Wrapf(err, opFail, "NeScalar")
}
return
}
return nil, errors.Errorf("Engine does not support NeScalar()")
}