-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOperation.java
79 lines (65 loc) · 1.85 KB
/
Operation.java
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
package org.tensorflow;
public final class Operation {
private final Graph graph;
private final long unsafeNativeHandle;
private static native int dtype(long j, long j2, int i);
private static native String name(long j);
private static native int numOutputs(long j);
private static native long[] shape(long j, long j2, int i);
private static native String type(long j);
Operation(Graph graph, long j) {
this.graph = graph;
this.unsafeNativeHandle = j;
}
public String name() {
Reference ref = this.graph.ref();
try {
String name = name(this.unsafeNativeHandle);
return name;
} finally {
ref.close();
}
}
public String type() {
Reference ref = this.graph.ref();
try {
String type = type(this.unsafeNativeHandle);
return type;
} finally {
ref.close();
}
}
public int numOutputs() {
Reference ref = this.graph.ref();
try {
int numOutputs = numOutputs(this.unsafeNativeHandle);
return numOutputs;
} finally {
ref.close();
}
}
public Output output(int i) {
return new Output(this, i);
}
long getUnsafeNativeHandle() {
return this.unsafeNativeHandle;
}
long[] shape(int i) {
Reference ref = this.graph.ref();
try {
long[] shape = shape(ref.nativeHandle(), this.unsafeNativeHandle, i);
return shape;
} finally {
ref.close();
}
}
DataType dtype(int i) {
Reference ref = this.graph.ref();
try {
DataType fromC = DataType.fromC(dtype(ref.nativeHandle(), this.unsafeNativeHandle, i));
return fromC;
} finally {
ref.close();
}
}
}