/
generated_reduction.go
61 lines (47 loc) · 2.38 KB
/
generated_reduction.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
package cudnn
/* Generated by gencudnn. DO NOT EDIT */
// #include <cudnn.h>
import "C"
import "runtime"
// Reduction is a representation of cudnnReduceTensorDescriptor_t.
type Reduction struct {
internal C.cudnnReduceTensorDescriptor_t
reduceTensorOp ReduceTensorOp
reduceTensorCompType DataType
reduceTensorNanOpt NanPropagation
reduceTensorIndices ReduceTensorIndices
reduceTensorIndicesType IndicesType
}
// NewReduction creates a new Reduction.
func NewReduction(reduceTensorOp ReduceTensorOp, reduceTensorCompType DataType, reduceTensorNanOpt NanPropagation, reduceTensorIndices ReduceTensorIndices, reduceTensorIndicesType IndicesType) (retVal *Reduction, err error) {
var internal C.cudnnReduceTensorDescriptor_t
if err := result(C.cudnnCreateReduceTensorDescriptor(&internal)); err != nil {
return nil, err
}
if err := result(C.cudnnSetReduceTensorDescriptor(internal, reduceTensorOp.C(), reduceTensorCompType.C(), reduceTensorNanOpt.C(), reduceTensorIndices.C(), reduceTensorIndicesType.C())); err != nil {
return nil, err
}
retVal = &Reduction{
internal: internal,
reduceTensorOp: reduceTensorOp,
reduceTensorCompType: reduceTensorCompType,
reduceTensorNanOpt: reduceTensorNanOpt,
reduceTensorIndices: reduceTensorIndices,
reduceTensorIndicesType: reduceTensorIndicesType,
}
runtime.SetFinalizer(retVal, destroyReduction)
return retVal, nil
}
// C returns the internal cgo representation.
func (r *Reduction) C() C.cudnnReduceTensorDescriptor_t { return r.internal }
// ReduceTensorOp returns the internal reduceTensorOp.
func (r *Reduction) ReduceTensorOp() ReduceTensorOp { return r.reduceTensorOp }
// ReduceTensorCompType returns the internal reduceTensorCompType.
func (r *Reduction) ReduceTensorCompType() DataType { return r.reduceTensorCompType }
// ReduceTensorNanOpt returns the internal reduceTensorNanOpt.
func (r *Reduction) ReduceTensorNanOpt() NanPropagation { return r.reduceTensorNanOpt }
// ReduceTensorIndices returns the internal reduceTensorIndices.
func (r *Reduction) ReduceTensorIndices() ReduceTensorIndices { return r.reduceTensorIndices }
// ReduceTensorIndicesType returns the internal reduceTensorIndicesType.
func (r *Reduction) ReduceTensorIndicesType() IndicesType { return r.reduceTensorIndicesType }
func destroyReduction(obj *Reduction) { C.cudnnDestroyReduceTensorDescriptor(obj.internal) }