Skip to content

Commit 3f94211

Browse files
authored
Code changes to add PluggableDevice support for Inference (#605)
* Code changes to add PluggableDevice support for Inference Enable TF_LoadPluggableDeviceLibrary API for PluggableDevices Signed-off-by: rjauhari2 <[email protected]> * Add genrated code from c_api_experimental.h * Add JavaCPP files to build TF-Java. - Add TF_AttrBuilder, TF_ShapeAndTypeList, TF_CheckpointReader classes. * Add Windows stub for missing TFE_GetServerDef symbol * Add Windows stub in seperate file. * Add header file for windows stub to enable pluggable device support. --------- Signed-off-by: rjauhari2 <[email protected]>
1 parent 76640d1 commit 3f94211

File tree

8 files changed

+583
-1
lines changed

8 files changed

+583
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Targeted by JavaCPP version 1.5.10: DO NOT EDIT THIS FILE
2+
3+
package org.tensorflow.internal.c_api;
4+
5+
import java.nio.*;
6+
import org.bytedeco.javacpp.*;
7+
import org.bytedeco.javacpp.annotation.*;
8+
9+
import static org.tensorflow.internal.c_api.global.tensorflow.*;
10+
11+
12+
// TF_NewAttrBuilder() returns an object that you can set attributes on as
13+
// though it were an op. This allows querying properties of that op for
14+
// type-checking purposes like if the op will run on a particular device type.
15+
@Opaque @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
16+
public class TF_AttrBuilder extends Pointer {
17+
/** Empty constructor. Calls {@code super((Pointer)null)}. */
18+
public TF_AttrBuilder() { super((Pointer)null); }
19+
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
20+
public TF_AttrBuilder(Pointer p) { super(p); }
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Targeted by JavaCPP version 1.5.10: DO NOT EDIT THIS FILE
2+
3+
package org.tensorflow.internal.c_api;
4+
5+
import java.nio.*;
6+
import org.bytedeco.javacpp.*;
7+
import org.bytedeco.javacpp.annotation.*;
8+
9+
import static org.tensorflow.internal.c_api.global.tensorflow.*;
10+
11+
12+
// TF_NewCheckpointReader() return the CheckpointReader that can be use to
13+
// investigate or load the variable from the checkpoint file
14+
@Opaque @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
15+
public class TF_CheckpointReader extends Pointer {
16+
/** Empty constructor. Calls {@code super((Pointer)null)}. */
17+
public TF_CheckpointReader() { super((Pointer)null); }
18+
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
19+
public TF_CheckpointReader(Pointer p) { super(p); }
20+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Targeted by JavaCPP version 1.5.10: DO NOT EDIT THIS FILE
2+
3+
package org.tensorflow.internal.c_api;
4+
5+
import java.nio.*;
6+
import org.bytedeco.javacpp.*;
7+
import org.bytedeco.javacpp.annotation.*;
8+
9+
import static org.tensorflow.internal.c_api.global.tensorflow.*;
10+
11+
12+
// Information about the shape of a Tensor and its type.
13+
@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
14+
public class TF_ShapeAndType extends Pointer {
15+
static { Loader.load(); }
16+
/** Default native constructor. */
17+
public TF_ShapeAndType() { super((Pointer)null); allocate(); }
18+
/** Native array allocator. Access with {@link Pointer#position(long)}. */
19+
public TF_ShapeAndType(long size) { super((Pointer)null); allocateArray(size); }
20+
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
21+
public TF_ShapeAndType(Pointer p) { super(p); }
22+
private native void allocate();
23+
private native void allocateArray(long size);
24+
@Override public TF_ShapeAndType position(long position) {
25+
return (TF_ShapeAndType)super.position(position);
26+
}
27+
@Override public TF_ShapeAndType getPointer(long i) {
28+
return new TF_ShapeAndType((Pointer)this).offsetAddress(i);
29+
}
30+
31+
// Number of dimensions. -1 indicates unknown rank.
32+
public native int num_dims(); public native TF_ShapeAndType num_dims(int setter);
33+
// Array of dimensions. -1 indicates unknown dim.
34+
public native @Cast("int64_t*") LongPointer dims(); public native TF_ShapeAndType dims(LongPointer setter);
35+
// The data type. May be 0 to denote unknown type.
36+
public native @Cast("TF_DataType") int dtype(); public native TF_ShapeAndType dtype(int setter);
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Targeted by JavaCPP version 1.5.10: DO NOT EDIT THIS FILE
2+
3+
package org.tensorflow.internal.c_api;
4+
5+
import java.nio.*;
6+
import org.bytedeco.javacpp.*;
7+
import org.bytedeco.javacpp.annotation.*;
8+
9+
import static org.tensorflow.internal.c_api.global.tensorflow.*;
10+
11+
12+
// A list of TF_ShapeAndType elements..
13+
@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
14+
public class TF_ShapeAndTypeList extends Pointer {
15+
static { Loader.load(); }
16+
/** Default native constructor. */
17+
public TF_ShapeAndTypeList() { super((Pointer)null); allocate(); }
18+
/** Native array allocator. Access with {@link Pointer#position(long)}. */
19+
public TF_ShapeAndTypeList(long size) { super((Pointer)null); allocateArray(size); }
20+
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
21+
public TF_ShapeAndTypeList(Pointer p) { super(p); }
22+
private native void allocate();
23+
private native void allocateArray(long size);
24+
@Override public TF_ShapeAndTypeList position(long position) {
25+
return (TF_ShapeAndTypeList)super.position(position);
26+
}
27+
@Override public TF_ShapeAndTypeList getPointer(long i) {
28+
return new TF_ShapeAndTypeList((Pointer)this).offsetAddress(i);
29+
}
30+
31+
public native int num_items(); public native TF_ShapeAndTypeList num_items(int setter);
32+
public native TF_ShapeAndType items(); public native TF_ShapeAndTypeList items(TF_ShapeAndType setter);
33+
}

0 commit comments

Comments
 (0)