diff --git a/tensorflow-core/pom.xml b/tensorflow-core/pom.xml
index aa8d828064e..580cd5c82fc 100644
--- a/tensorflow-core/pom.xml
+++ b/tensorflow-core/pom.xml
@@ -61,7 +61,7 @@
macosx-x86_64${javacpp.platform.extension}
windows-x86${javacpp.platform.extension}
windows-x86_64${javacpp.platform.extension}
- 1.5.4
+ 1.5.5
diff --git a/tensorflow-core/tensorflow-core-api/pom.xml b/tensorflow-core/tensorflow-core-api/pom.xml
index 5f4829f95c8..df5c6a2bd4c 100644
--- a/tensorflow-core/tensorflow-core-api/pom.xml
+++ b/tensorflow-core/tensorflow-core-api/pom.xml
@@ -141,6 +141,19 @@
+
+ maven-resources-plugin
+ 3.1.0
+
+
+ javacpp-parser
+ generate-sources
+
+ resources
+
+
+
+
maven-compiler-plugin
3.8.0
@@ -209,7 +222,15 @@
${project.build.outputDirectory}
${project.basedir}/
+ ${project.basedir}/bazel-bin/external/llvm-project/llvm/include/
+ ${project.basedir}/bazel-bin/external/org_tensorflow/
+ ${project.basedir}/bazel-${project.artifactId}/external/eigen_archive/
+ ${project.basedir}/bazel-${project.artifactId}/external/com_google_absl/
+ ${project.basedir}/bazel-${project.artifactId}/external/com_google_protobuf/src/
+ ${project.basedir}/bazel-${project.artifactId}/external/farmhash_archive/src/
+ ${project.basedir}/bazel-${project.artifactId}/external/llvm-project/llvm/include/
${project.basedir}/bazel-${project.artifactId}/external/org_tensorflow/
+ ${project.basedir}/target/classes/org/tensorflow/internal/c_api/include/
${project.basedir}/bazel-bin/external/llvm_openmp/
@@ -315,6 +336,10 @@
${project.build.directory}/native/org/tensorflow/internal/c_api/${native.classifier}/
${javacpp.compiler.skip}
org.tensorflow.internal.c_api.**
+
+
+ ${project.basedir}/bazel-${project.artifactId}/external/org_tensorflow/tensorflow/c/eager/gradients.cc
+
true
true
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractContext.java
new file mode 100644
index 00000000000..8ff667ef18b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractContext.java
@@ -0,0 +1,49 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Abstract interface to a context.
+//
+// This serves as a factory for creating `AbstractOperation`s and for
+// registering traced functions.
+// Operations creation within a context can only be executed in that context
+// (for now at least).
+// Implementations of the context may contain some state e.g. an execution
+// environment, a traced representation etc.
+@Namespace("tensorflow") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractContext extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractContext(Pointer p) { super(p); }
+
+ public native int getKind();
+
+ // Release any underlying resources, including the interface object.
+ //
+ // WARNING: The destructor of this class is marked as protected to disallow
+ // clients from directly destroying this object since it may manage it's own
+ // lifetime through ref counting. Thus clients MUST call Release() in order to
+ // destroy an instance of this class.
+ public native void Release();
+
+ // Creates an operation builder and ties it to this context.
+ // The returned object can be used for setting operation's attributes,
+ // adding inputs and finally executing (immediately or lazily as in tracing)
+ // it in this context.
+ public native AbstractOperation CreateOperation();
+
+ // Registers a function with this context, after this the function is
+ // available to be called/referenced by its name in this context.
+ public native @ByVal Status RegisterFunction(AbstractFunction arg0);
+ // Remove a function. 'func' argument is the name of a previously added
+ // FunctionDef. The name is in fdef.signature.name.
+ public native @ByVal Status RemoveFunction(@StdString BytePointer func);
+ public native @ByVal Status RemoveFunction(@StdString String func);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractContextDeleter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractContextDeleter.java
new file mode 100644
index 00000000000..6187fbde887
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractContextDeleter.java
@@ -0,0 +1,30 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Namespace("tensorflow::internal") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractContextDeleter extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public AbstractContextDeleter() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public AbstractContextDeleter(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractContextDeleter(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public AbstractContextDeleter position(long position) {
+ return (AbstractContextDeleter)super.position(position);
+ }
+ @Override public AbstractContextDeleter getPointer(long i) {
+ return new AbstractContextDeleter((Pointer)this).position(position + i);
+ }
+
+ public native @Name("operator ()") void apply(AbstractContext p);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractFunction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractFunction.java
new file mode 100644
index 00000000000..df562399f5d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractFunction.java
@@ -0,0 +1,27 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// A traced function: this hides the complexity of converting the serialized
+// representation between various supported formats e.g. FunctionDef and Mlir
+// function.
+@Namespace("tensorflow") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractFunction extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractFunction(Pointer p) { super(p); }
+
+ // Returns which subclass is this instance of.
+ public native int getKind();
+
+ // Returns the AbstractFunction as a FunctionDef.
+ public native @ByVal Status GetFunctionDef(@Cast("tensorflow::FunctionDef**") PointerPointer arg0);
+ public native @ByVal Status GetFunctionDef(@Cast("tensorflow::FunctionDef**") @ByPtrPtr Pointer arg0);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractOperation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractOperation.java
new file mode 100644
index 00000000000..55b13cb6c0d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractOperation.java
@@ -0,0 +1,181 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Abstract interface to an operation.
+// This interface allows building and executing an operation in either
+// tracing or immediate execution mode.
+@Namespace("tensorflow") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractOperation extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractOperation(Pointer p) { super(p); }
+
+ public native int getKind();
+
+ // Release any underlying resources, including the interface object.
+ //
+ // WARNING: The destructor of this class is marked as protected to disallow
+ // clients from directly destroying this object since it may manage it's own
+ // lifetime through ref counting. Thus this must be allocated on the heap and
+ // clients MUST call Release() in order to destroy an instance of this class.
+ public native void Release();
+
+ public native @ByVal Status Reset(@Cast("const char*") BytePointer op, @Cast("const char*") BytePointer raw_device_name);
+ public native @ByVal Status Reset(String op, String raw_device_name);
+
+ public native @StdString BytePointer Name();
+
+ // Returns the operation's device name.
+ //
+ // The value returned may be different from the one set by SetDeviceName, but
+ // it will be compatible with it: the name will be updated by device placement
+ // logic to refer to the specific device chosen.
+ //
+ // Example: If one calls `op->SetDeviceName("/device:GPU")`, the value
+ // returned by DeviceName should be "/device:GPU:*" until a particular GPU is
+ // chosen for the operation by the device placement logic in the
+ // executor. After that, the value returned by DeviceName will be a full
+ // device name such as "/job:localhost/replica:0/task:0/device:GPU:1".
+ public native @StdString BytePointer DeviceName();
+
+ // Sets the operation device name.
+ //
+ // The given `name` must be parseable by DeviceNameUtils::ParseFullName, and
+ // the result will be used as a constraint for device placement. See the
+ // documentation for DeviceName for more details.
+ //
+ // The value will override the previous value - that is, no "merging" of
+ // existing and given constraints will be performed.
+ public native @ByVal Status SetDeviceName(@Cast("const char*") BytePointer name);
+ public native @ByVal Status SetDeviceName(String name);
+
+ public native @ByVal Status AddInput(AbstractTensorHandle input);
+ public native @ByVal Status AddInputList(
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer inputs);
+ public native @ByVal Status Execute(@Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer retvals,
+ IntPointer num_retvals);
+
+ public native @ByVal Status SetAttrString(@Cast("const char*") BytePointer attr_name, @Cast("const char*") BytePointer data,
+ @Cast("size_t") long length);
+ public native @ByVal Status SetAttrString(String attr_name, String data,
+ @Cast("size_t") long length);
+ public native @ByVal Status SetAttrInt(@Cast("const char*") BytePointer attr_name, @Cast("int64_t") long value);
+ public native @ByVal Status SetAttrInt(String attr_name, @Cast("int64_t") long value);
+ public native @ByVal Status SetAttrFloat(@Cast("const char*") BytePointer attr_name, float value);
+ public native @ByVal Status SetAttrFloat(String attr_name, float value);
+ public native @ByVal Status SetAttrBool(@Cast("const char*") BytePointer attr_name, @Cast("bool") boolean value);
+ public native @ByVal Status SetAttrBool(String attr_name, @Cast("bool") boolean value);
+ public native @ByVal Status SetAttrType(@Cast("const char*") BytePointer attr_name, @Cast("tensorflow::DataType") int value);
+ public native @ByVal Status SetAttrType(String attr_name, @Cast("tensorflow::DataType") int value);
+ public native @ByVal Status SetAttrShape(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t*") LongPointer dims,
+ int num_dims);
+ public native @ByVal Status SetAttrShape(String attr_name, @Cast("const int64_t*") LongBuffer dims,
+ int num_dims);
+ public native @ByVal Status SetAttrShape(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t*") long[] dims,
+ int num_dims);
+ public native @ByVal Status SetAttrShape(String attr_name, @Cast("const int64_t*") LongPointer dims,
+ int num_dims);
+ public native @ByVal Status SetAttrShape(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t*") LongBuffer dims,
+ int num_dims);
+ public native @ByVal Status SetAttrShape(String attr_name, @Cast("const int64_t*") long[] dims,
+ int num_dims);
+ public native @ByVal Status SetAttrFunction(@Cast("const char*") BytePointer attr_name,
+ @Const AbstractOperation value);
+ public native @ByVal Status SetAttrFunction(String attr_name,
+ @Const AbstractOperation value);
+ public native @ByVal Status SetAttrFunctionName(@Cast("const char*") BytePointer attr_name, @Cast("const char*") BytePointer value,
+ @Cast("size_t") long length);
+ public native @ByVal Status SetAttrFunctionName(String attr_name, String value,
+ @Cast("size_t") long length);
+ public native @ByVal Status SetAttrTensor(@Cast("const char*") BytePointer attr_name,
+ AbstractTensorInterface tensor);
+ public native @ByVal Status SetAttrTensor(String attr_name,
+ AbstractTensorInterface tensor);
+ public native @ByVal Status SetAttrStringList(@Cast("const char*") BytePointer attr_name,
+ @Cast("const void*const*") PointerPointer values,
+ @Cast("const size_t*") SizeTPointer lengths, int num_values);
+ public native @ByVal Status SetAttrStringList(@Cast("const char*") BytePointer attr_name,
+ @Cast("const void*const*") @ByPtrPtr Pointer values,
+ @Cast("const size_t*") SizeTPointer lengths, int num_values);
+ public native @ByVal Status SetAttrStringList(String attr_name,
+ @Cast("const void*const*") @ByPtrPtr Pointer values,
+ @Cast("const size_t*") SizeTPointer lengths, int num_values);
+ public native @ByVal Status SetAttrFloatList(@Cast("const char*") BytePointer attr_name, @Const FloatPointer values,
+ int num_values);
+ public native @ByVal Status SetAttrFloatList(String attr_name, @Const FloatBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrFloatList(@Cast("const char*") BytePointer attr_name, @Const float[] values,
+ int num_values);
+ public native @ByVal Status SetAttrFloatList(String attr_name, @Const FloatPointer values,
+ int num_values);
+ public native @ByVal Status SetAttrFloatList(@Cast("const char*") BytePointer attr_name, @Const FloatBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrFloatList(String attr_name, @Const float[] values,
+ int num_values);
+ public native @ByVal Status SetAttrIntList(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t*") LongPointer values,
+ int num_values);
+ public native @ByVal Status SetAttrIntList(String attr_name, @Cast("const int64_t*") LongBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrIntList(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t*") long[] values,
+ int num_values);
+ public native @ByVal Status SetAttrIntList(String attr_name, @Cast("const int64_t*") LongPointer values,
+ int num_values);
+ public native @ByVal Status SetAttrIntList(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t*") LongBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrIntList(String attr_name, @Cast("const int64_t*") long[] values,
+ int num_values);
+ public native @ByVal Status SetAttrTypeList(@Cast("const char*") BytePointer attr_name, @Cast("const tensorflow::DataType*") IntPointer values,
+ int num_values);
+ public native @ByVal Status SetAttrTypeList(String attr_name, @Cast("const tensorflow::DataType*") IntBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrTypeList(@Cast("const char*") BytePointer attr_name, @Cast("const tensorflow::DataType*") int[] values,
+ int num_values);
+ public native @ByVal Status SetAttrTypeList(String attr_name, @Cast("const tensorflow::DataType*") IntPointer values,
+ int num_values);
+ public native @ByVal Status SetAttrTypeList(@Cast("const char*") BytePointer attr_name, @Cast("const tensorflow::DataType*") IntBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrTypeList(String attr_name, @Cast("const tensorflow::DataType*") int[] values,
+ int num_values);
+ public native @ByVal Status SetAttrBoolList(@Cast("const char*") BytePointer attr_name,
+ @Cast("const unsigned char*") BytePointer values,
+ int num_values);
+ public native @ByVal Status SetAttrBoolList(String attr_name,
+ @Cast("const unsigned char*") ByteBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrBoolList(@Cast("const char*") BytePointer attr_name,
+ @Cast("const unsigned char*") byte[] values,
+ int num_values);
+ public native @ByVal Status SetAttrBoolList(String attr_name,
+ @Cast("const unsigned char*") BytePointer values,
+ int num_values);
+ public native @ByVal Status SetAttrBoolList(@Cast("const char*") BytePointer attr_name,
+ @Cast("const unsigned char*") ByteBuffer values,
+ int num_values);
+ public native @ByVal Status SetAttrBoolList(String attr_name,
+ @Cast("const unsigned char*") byte[] values,
+ int num_values);
+ public native @ByVal Status SetAttrShapeList(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") PointerPointer dims,
+ @Const IntPointer num_dims, int num_values);
+ public native @ByVal Status SetAttrShapeList(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") @ByPtrPtr LongPointer dims,
+ @Const IntPointer num_dims, int num_values);
+ public native @ByVal Status SetAttrShapeList(String attr_name, @Cast("const int64_t**") @ByPtrPtr LongBuffer dims,
+ @Const IntBuffer num_dims, int num_values);
+ public native @ByVal Status SetAttrShapeList(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") @ByPtrPtr long[] dims,
+ @Const int[] num_dims, int num_values);
+ public native @ByVal Status SetAttrShapeList(String attr_name, @Cast("const int64_t**") @ByPtrPtr LongPointer dims,
+ @Const IntPointer num_dims, int num_values);
+ public native @ByVal Status SetAttrShapeList(@Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") @ByPtrPtr LongBuffer dims,
+ @Const IntBuffer num_dims, int num_values);
+ public native @ByVal Status SetAttrShapeList(String attr_name, @Cast("const int64_t**") @ByPtrPtr long[] dims,
+ @Const int[] num_dims, int num_values);
+ public native @ByVal Status SetAttrFunctionList(
+ @Cast("const char*") BytePointer attr_name, @Cast("const tensorflow::AbstractOperation**") @Span PointerPointer values);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractOperationDeleter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractOperationDeleter.java
new file mode 100644
index 00000000000..560f134c9e9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractOperationDeleter.java
@@ -0,0 +1,30 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Namespace("tensorflow::internal") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractOperationDeleter extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public AbstractOperationDeleter() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public AbstractOperationDeleter(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractOperationDeleter(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public AbstractOperationDeleter position(long position) {
+ return (AbstractOperationDeleter)super.position(position);
+ }
+ @Override public AbstractOperationDeleter getPointer(long i) {
+ return new AbstractOperationDeleter((Pointer)this).position(position + i);
+ }
+
+ public native @Name("operator ()") void apply(AbstractOperation p);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandle.java
new file mode 100644
index 00000000000..a388b7174ff
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandle.java
@@ -0,0 +1,24 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Abstract interface to a Tensor handle in either tracing or immediate
+// execution mode.
+@Namespace("tensorflow") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractTensorHandle extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractTensorHandle(Pointer p) { super(p); }
+
+ // Returns tensor dtype.
+ public native @Cast("tensorflow::DataType") int DataType();
+
+ public native int getKind();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandleDeleter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandleDeleter.java
new file mode 100644
index 00000000000..b0cac35e89c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandleDeleter.java
@@ -0,0 +1,30 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Namespace("tensorflow::internal") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractTensorHandleDeleter extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public AbstractTensorHandleDeleter() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public AbstractTensorHandleDeleter(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractTensorHandleDeleter(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public AbstractTensorHandleDeleter position(long position) {
+ return (AbstractTensorHandleDeleter)super.position(position);
+ }
+ @Override public AbstractTensorHandleDeleter getPointer(long i) {
+ return new AbstractTensorHandleDeleter((Pointer)this).position(position + i);
+ }
+
+ public native @Name("operator ()") void apply(AbstractTensorHandle p);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandleVector.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandleVector.java
new file mode 100644
index 00000000000..8f41d63df25
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorHandleVector.java
@@ -0,0 +1,79 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Name("std::vector") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractTensorHandleVector extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractTensorHandleVector(Pointer p) { super(p); }
+ public AbstractTensorHandleVector(AbstractTensorHandle value) { this(1); put(0, value); }
+ public AbstractTensorHandleVector(AbstractTensorHandle ... array) { this(array.length); put(array); }
+ public AbstractTensorHandleVector() { allocate(); }
+ public AbstractTensorHandleVector(long n) { allocate(n); }
+ private native void allocate();
+ private native void allocate(@Cast("size_t") long n);
+ public native @Name("operator =") @ByRef AbstractTensorHandleVector put(@ByRef AbstractTensorHandleVector x);
+
+ public boolean empty() { return size() == 0; }
+ public native long size();
+ public void clear() { resize(0); }
+ public native void resize(@Cast("size_t") long n);
+
+ @Index(function = "at") public native AbstractTensorHandle get(@Cast("size_t") long i);
+ public native AbstractTensorHandleVector put(@Cast("size_t") long i, AbstractTensorHandle value);
+
+ public native @ByVal Iterator insert(@ByVal Iterator pos, AbstractTensorHandle value);
+ public native @ByVal Iterator erase(@ByVal Iterator pos);
+ public native @ByVal Iterator begin();
+ public native @ByVal Iterator end();
+ @NoOffset @Name("iterator") public static class Iterator extends Pointer {
+ public Iterator(Pointer p) { super(p); }
+ public Iterator() { }
+
+ public native @Name("operator ++") @ByRef Iterator increment();
+ public native @Name("operator ==") boolean equals(@ByRef Iterator it);
+ public native @Name("operator *") @Const AbstractTensorHandle get();
+ }
+
+ public AbstractTensorHandle[] get() {
+ AbstractTensorHandle[] array = new AbstractTensorHandle[size() < Integer.MAX_VALUE ? (int)size() : Integer.MAX_VALUE];
+ for (int i = 0; i < array.length; i++) {
+ array[i] = get(i);
+ }
+ return array;
+ }
+ @Override public String toString() {
+ return java.util.Arrays.toString(get());
+ }
+
+ public AbstractTensorHandle pop_back() {
+ long size = size();
+ AbstractTensorHandle value = get(size - 1);
+ resize(size - 1);
+ return value;
+ }
+ public AbstractTensorHandleVector push_back(AbstractTensorHandle value) {
+ long size = size();
+ resize(size + 1);
+ return put(size, value);
+ }
+ public AbstractTensorHandleVector put(AbstractTensorHandle value) {
+ if (size() != 1) { resize(1); }
+ return put(0, value);
+ }
+ public AbstractTensorHandleVector put(AbstractTensorHandle ... array) {
+ if (size() != array.length) { resize(array.length); }
+ for (int i = 0; i < array.length; i++) {
+ put(i, array[i]);
+ }
+ return this;
+ }
+}
+
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorInterface.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorInterface.java
new file mode 100644
index 00000000000..98bc0a6f965
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorInterface.java
@@ -0,0 +1,44 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Abstract interface to a Tensor.
+//
+// This allows us to hide concrete implementations of Tensor from header
+// files. The interface lists the common functionality that must be provided by
+// any concrete implementation. However, in cases where the true concrete class
+// is needed a static_cast can be applied.
+@Namespace("tensorflow") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractTensorInterface extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractTensorInterface(Pointer p) { super(p); }
+
+ // Release any underlying resources, including the interface object.
+ public native void Release();
+
+ // Returns tensor dtype.
+ public native @Cast("tensorflow::DataType") int Type();
+ // Returns number of dimensions.
+ public native int NumDims();
+ // Returns size of specified dimension
+ public native @Cast("int64_t") long Dim(int dim_index);
+ // Returns number of elements across all dimensions.
+ public native @Cast("int64_t") long NumElements();
+ // Return size in bytes of the Tensor
+ public native @Cast("size_t") long ByteSize();
+ // Returns a pointer to tensor data
+ public native Pointer Data();
+
+ // Returns if the tensor is aligned
+ public native @Cast("bool") boolean IsAligned();
+ // Returns if their is sole ownership of this Tensor and thus it can be moved.
+ public native @Cast("bool") boolean CanMove();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorInterfaceDeleter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorInterfaceDeleter.java
new file mode 100644
index 00000000000..52aa9828b95
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AbstractTensorInterfaceDeleter.java
@@ -0,0 +1,30 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Namespace("tensorflow::internal") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AbstractTensorInterfaceDeleter extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public AbstractTensorInterfaceDeleter() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public AbstractTensorInterfaceDeleter(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AbstractTensorInterfaceDeleter(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public AbstractTensorInterfaceDeleter position(long position) {
+ return (AbstractTensorInterfaceDeleter)super.position(position);
+ }
+ @Override public AbstractTensorInterfaceDeleter getPointer(long i) {
+ return new AbstractTensorInterfaceDeleter((Pointer)this).position(position + i);
+ }
+
+ public native @Name("operator ()") void apply(AbstractTensorInterface p);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AllZerosDefaultGradients.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AllZerosDefaultGradients.java
new file mode 100644
index 00000000000..19832a183d4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/AllZerosDefaultGradients.java
@@ -0,0 +1,33 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Returns zeros for any `nullptr` in `grad_inputs`.
+//
+// This may require keeping track of all of forward op's output
+// tensors and hence may incur a higher memory footprint. Use sparingly.
+//
+// Multiple calls to `AllZerosDefaultGradients::get` return the same tensor
+// handle.
+//
+// The destructor of this class `Unref`'s any cached tensor handles so users of
+// those tensor handles should `Ref` them in order to keep them alive if needed.
+@Namespace("tensorflow::gradients") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class AllZerosDefaultGradients extends DefaultGradientFunction {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public AllZerosDefaultGradients(Pointer p) { super(p); }
+
+ public AllZerosDefaultGradients(@Const @ByRef ForwardOperation op) { super((Pointer)null); allocate(op); }
+ private native void allocate(@Const @ByRef ForwardOperation op);
+ public native AbstractTensorHandle get(Context ctx,
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer grad_inputs,
+ int i);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/BackwardFunction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/BackwardFunction.java
new file mode 100644
index 00000000000..a971428f65c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/BackwardFunction.java
@@ -0,0 +1,26 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// A `BackwardFunction` wraps a `GradientFunction` and a
+// `DefaultGradientFunction`. Both are owned by this class' instance.
+@Namespace("tensorflow::gradients") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class BackwardFunction extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public BackwardFunction(Pointer p) { super(p); }
+
+ public BackwardFunction(GradientFunction gradient_function,
+ DefaultGradientFunction default_gradients) { super((Pointer)null); allocate(gradient_function, default_gradients); }
+ private native void allocate(GradientFunction gradient_function,
+ DefaultGradientFunction default_gradients);
+ public native GradientFunction GetGradientFunction();
+ public native DefaultGradientFunction GetDefaultGradientFunction();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Compute_func_Pointer_TF_OpKernelContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Compute_func_Pointer_TF_OpKernelContext.java
index fd70471e100..1f76baf7704 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Compute_func_Pointer_TF_OpKernelContext.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Compute_func_Pointer_TF_OpKernelContext.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Context.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Context.java
new file mode 100644
index 00000000000..0bbdaf1fd9c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Context.java
@@ -0,0 +1,57 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// =============== Experimental C++ API for computing gradients ===============
+
+// Sample gradient function:
+//
+// class AddGradientFunction : public GradientFunction {
+// public:
+// Status Compute(Context* ctx,
+// absl::Span grad_inputs,
+// std::vector* grad_outputs) override {
+// grad_outputs->resize(2);
+// (*grad_outputs)[0] = grad_inputs[0];
+// (*grad_outputs)[1] = grad_inputs[0];
+// return Status::OK();
+// }
+// ~AddGradientFunction() override {}
+// };
+//
+// GradientFunction* AddRegisterer(const ForwardOperation& op) {
+// // More complex gradient functions can use inputs/attrs etc. from the
+// // forward `op`.
+// return new AddGradientFunction;
+// }
+//
+// Status RegisterGradients(GradientRegistry* registry) {
+// return registry->Register("Add", AddRegisterer);
+// }
+@Namespace("tensorflow::gradients") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class Context extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public Context() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public Context(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public Context(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public Context position(long position) {
+ return (Context)super.position(position);
+ }
+ @Override public Context getPointer(long i) {
+ return new Context((Pointer)this).position(position + i);
+ }
+
+ public native AbstractContext ctx(); public native Context ctx(AbstractContext setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Create_func_TF_OpKernelConstruction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Create_func_TF_OpKernelConstruction.java
index 8f951ea6a73..f412e6623c1 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Create_func_TF_OpKernelConstruction.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Create_func_TF_OpKernelConstruction.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Deallocator_Pointer_long_Pointer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Deallocator_Pointer_long_Pointer.java
index 168135a5b14..7bb718e4a87 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Deallocator_Pointer_long_Pointer.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Deallocator_Pointer_long_Pointer.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/DefaultGradientFunction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/DefaultGradientFunction.java
new file mode 100644
index 00000000000..1a5b976374a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/DefaultGradientFunction.java
@@ -0,0 +1,27 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Interface for building default zeros gradients for op outputs which are
+// missing incoming gradients. Custom implementations of this can be used to
+// control which of the forward op's output tensors/their metadata needs to
+// be kept around in memory to build the default zeros grad.
+//
+// Some common helper implementations are provided below.
+@Namespace("tensorflow::gradients") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class DefaultGradientFunction extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public DefaultGradientFunction(Pointer p) { super(p); }
+
+ public native AbstractTensorHandle get(Context ctx,
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer grad_inputs,
+ int i);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Delete_func_Pointer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Delete_func_Pointer.java
index 734040f20f4..6af16c575bd 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Delete_func_Pointer.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Delete_func_Pointer.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/ForwardOperation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/ForwardOperation.java
new file mode 100644
index 00000000000..9d795168869
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/ForwardOperation.java
@@ -0,0 +1,36 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Metadata from the forward operation that is made available to the
+// gradient registerer to instantiate a BackwardFunction.
+@Namespace("tensorflow::gradients") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class ForwardOperation extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public ForwardOperation() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public ForwardOperation(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public ForwardOperation(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public ForwardOperation position(long position) {
+ return (ForwardOperation)super.position(position);
+ }
+ @Override public ForwardOperation getPointer(long i) {
+ return new ForwardOperation((Pointer)this).position(position + i);
+ }
+
+ public native @StdString BytePointer op_name(); public native ForwardOperation op_name(BytePointer setter);
+ public native @ByRef AbstractTensorHandleVector inputs(); public native ForwardOperation inputs(AbstractTensorHandleVector setter);
+ public native @ByRef AbstractTensorHandleVector outputs(); public native ForwardOperation outputs(AbstractTensorHandleVector setter);
+ public native @ByRef @Cast("tensorflow::AttrBuilder*") Pointer attrs(); public native ForwardOperation attrs(Pointer setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/GradientFunction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/GradientFunction.java
new file mode 100644
index 00000000000..ed7d510fe8d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/GradientFunction.java
@@ -0,0 +1,22 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Namespace("tensorflow::gradients") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class GradientFunction extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public GradientFunction(Pointer p) { super(p); }
+
+ // TODO(srbs): How we support CompositeTensors e.g. IndexedSlices in
+ // `grad_inputs`.
+ public native @ByVal Status Compute(Context ctx, @Const @ByRef IncomingGradients grad_inputs,
+ AbstractTensorHandleVector grad_outputs);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/GradientRegistry.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/GradientRegistry.java
new file mode 100644
index 00000000000..d3b507fa6c8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/GradientRegistry.java
@@ -0,0 +1,37 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Map from op name to a `BackwardFunctionFactory`.
+@Namespace("tensorflow::gradients") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class GradientRegistry extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public GradientRegistry() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public GradientRegistry(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public GradientRegistry(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public GradientRegistry position(long position) {
+ return (GradientRegistry)super.position(position);
+ }
+ @Override public GradientRegistry getPointer(long i) {
+ return new GradientRegistry((Pointer)this).position(position + i);
+ }
+
+ public native @ByVal Status Register(@StdString BytePointer op,
+ @ByVal BackwardFunctionFactory backward_function_factory);
+ public native @ByVal Status Register(@StdString String op,
+ @ByVal BackwardFunctionFactory backward_function_factory);
+ public native @ByVal Status Lookup(@Const @ByRef ForwardOperation op,
+ @UniquePtr BackwardFunction backward_function);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/IncomingGradients.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/IncomingGradients.java
new file mode 100644
index 00000000000..e86dd62909c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/IncomingGradients.java
@@ -0,0 +1,20 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Namespace("tensorflow::gradients") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class IncomingGradients extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public IncomingGradients(Pointer p) { super(p); }
+
+ public native @Name("operator []") AbstractTensorHandle get(int i);
+ public native @Cast("size_t") long size();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/IntSet.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/IntSet.java
new file mode 100644
index 00000000000..ff2d3781df7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/IntSet.java
@@ -0,0 +1,36 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Name("std::unordered_set") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class IntSet extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public IntSet(Pointer p) { super(p); }
+ public IntSet() { allocate(); }
+ private native void allocate();
+ public native @Name("operator =") @ByRef IntSet put(@ByRef IntSet x);
+
+ public boolean empty() { return size() == 0; }
+ public native long size();
+
+ public native void insert(int value);
+ public native void erase(int value);
+ public native @ByVal Iterator begin();
+ public native @ByVal Iterator end();
+ @NoOffset @Name("iterator") public static class Iterator extends Pointer {
+ public Iterator(Pointer p) { super(p); }
+ public Iterator() { }
+
+ public native @Name("operator ++") @ByRef Iterator increment();
+ public native @Name("operator ==") boolean equals(@ByRef Iterator it);
+ public native @Name("operator *") int get();
+ }
+}
+
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_BytePointer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_BytePointer.java
index f1775998256..cf5310de68d 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_BytePointer.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_BytePointer.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_String.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_String.java
index a4114f23dbe..439c87fba23 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_String.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Listener_String.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/LongTapeTensorMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/LongTapeTensorMap.java
new file mode 100644
index 00000000000..b3cc1ef6303
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/LongTapeTensorMap.java
@@ -0,0 +1,37 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Name("std::unordered_map") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class LongTapeTensorMap extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public LongTapeTensorMap(Pointer p) { super(p); }
+ public LongTapeTensorMap() { allocate(); }
+ private native void allocate();
+
+
+ public boolean empty() { return size() == 0; }
+ public native long size();
+
+ @Index(function = "at") public native @ByRef TapeTensor get(@Cast("tensorflow::int64") long i);
+
+ public native @ByVal Iterator begin();
+ public native @ByVal Iterator end();
+ @NoOffset @Name("iterator") public static class Iterator extends Pointer {
+ public Iterator(Pointer p) { super(p); }
+ public Iterator() { }
+
+ public native @Name("operator ++") @ByRef Iterator increment();
+ public native @Name("operator ==") boolean equals(@ByRef Iterator it);
+ public native @Name("operator *().first") @MemberGetter @Cast("tensorflow::int64") long first();
+ public native @Name("operator *().second") @MemberGetter @ByRef @Const TapeTensor second();
+ }
+}
+
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/OpEntry.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/OpEntry.java
new file mode 100644
index 00000000000..bcc891c7af5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/OpEntry.java
@@ -0,0 +1,42 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Represents an entry in the tape.
+@NoOffset @Name("tensorflow::eager::OpTapeEntry") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class OpEntry extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public OpEntry() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public OpEntry(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public OpEntry(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public OpEntry position(long position) {
+ return (OpEntry)super.position(position);
+ }
+ @Override public OpEntry getPointer(long i) {
+ return new OpEntry((Pointer)this).position(position + i);
+ }
+
+ public native @StdString BytePointer op_type(); public native OpEntry op_type(BytePointer setter);
+ public native @StdVector TapeTensor output_tensor_info(); public native OpEntry output_tensor_info(TapeTensor setter);
+ public native @Cast("tensorflow::int64*") @StdVector LongPointer input_tensor_id(); public native OpEntry input_tensor_id(LongPointer setter);
+
+ // TODO(apassos) consider narrowing down this interface.
+ public native BackwardFunction backward_function(); public native OpEntry backward_function(BackwardFunction setter);
+
+ // Should be called before deleting the backward function. TODO(apassos) use
+ // unique_ptrs to ensure this happens.
+ public native @ByRef @Cast("std::function*") Pointer backward_function_deleter(); public native OpEntry backward_function_deleter(Pointer setter);
+ public native @MemberSetter OpEntry backward_function_deleter(BackwardFunctionDeleter setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/OpTape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/OpTape.java
new file mode 100644
index 00000000000..fd7e78cbecf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/OpTape.java
@@ -0,0 +1,38 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Name("std::unordered_map >") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class OpTape extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public OpTape(Pointer p) { super(p); }
+ public OpTape() { allocate(); }
+ private native void allocate();
+ public native @Name("operator =") @ByRef OpTape put(@ByRef OpTape x);
+
+ public boolean empty() { return size() == 0; }
+ public native long size();
+
+ @Index public native @NoOffset @ByVal OpEntry get(@Cast("tensorflow::int64") long i);
+ public native OpTape put(@Cast("tensorflow::int64") long i, OpEntry value);
+
+ public native @ByVal Iterator begin();
+ public native @ByVal Iterator end();
+ @NoOffset @Name("iterator") public static class Iterator extends Pointer {
+ public Iterator(Pointer p) { super(p); }
+ public Iterator() { }
+
+ public native @Name("operator ++") @ByRef Iterator increment();
+ public native @Name("operator ==") boolean equals(@ByRef Iterator it);
+ public native @Name("operator *().first") @MemberGetter @Cast("tensorflow::int64") long first();
+ public native @Name("operator *().second") @MemberGetter @NoOffset @ByVal OpEntry second();
+ }
+}
+
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/PassThroughDefaultGradients.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/PassThroughDefaultGradients.java
new file mode 100644
index 00000000000..448051df038
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/PassThroughDefaultGradients.java
@@ -0,0 +1,25 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Passes through `grad_inputs` as-is. The `GradientFunction`
+// will be expected to deal with nullptr in `grad_inputs` if any.
+@Namespace("tensorflow::gradients") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class PassThroughDefaultGradients extends DefaultGradientFunction {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public PassThroughDefaultGradients(Pointer p) { super(p); }
+
+ public PassThroughDefaultGradients(@Const @ByRef ForwardOperation op) { super((Pointer)null); allocate(op); }
+ private native void allocate(@Const @ByRef ForwardOperation op);
+ public native AbstractTensorHandle get(Context ctx,
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer grad_inputs,
+ int i);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java
index 56e99923a0b..d84d900214f 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StackFrame.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StackFrame.java
new file mode 100644
index 00000000000..33733cd0a69
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StackFrame.java
@@ -0,0 +1,34 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// A struct representing a frame in a stack trace.
+@Namespace("tensorflow") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class StackFrame extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public StackFrame() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public StackFrame(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public StackFrame(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public StackFrame position(long position) {
+ return (StackFrame)super.position(position);
+ }
+ @Override public StackFrame getPointer(long i) {
+ return new StackFrame((Pointer)this).position(position + i);
+ }
+
+ public native @StdString BytePointer file_name(); public native StackFrame file_name(BytePointer setter);
+ public native int line_number(); public native StackFrame line_number(int setter);
+ public native @StdString BytePointer function_name(); public native StackFrame function_name(BytePointer setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StackFrameVector.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StackFrameVector.java
new file mode 100644
index 00000000000..b6579c4834d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StackFrameVector.java
@@ -0,0 +1,79 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Name("std::vector") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class StackFrameVector extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public StackFrameVector(Pointer p) { super(p); }
+ public StackFrameVector(StackFrame value) { this(1); put(0, value); }
+ public StackFrameVector(StackFrame ... array) { this(array.length); put(array); }
+ public StackFrameVector() { allocate(); }
+ public StackFrameVector(long n) { allocate(n); }
+ private native void allocate();
+ private native void allocate(@Cast("size_t") long n);
+ public native @Name("operator =") @ByRef StackFrameVector put(@ByRef @StdMove StackFrameVector x);
+
+ public boolean empty() { return size() == 0; }
+ public native long size();
+ public void clear() { resize(0); }
+ public native void resize(@Cast("size_t") long n);
+
+ @Index(function = "at") public native @ByRef StackFrame get(@Cast("size_t") long i);
+ public native StackFrameVector put(@Cast("size_t") long i, StackFrame value);
+
+ public native @ByVal Iterator insert(@ByVal Iterator pos, @ByRef StackFrame value);
+ public native @ByVal Iterator erase(@ByVal Iterator pos);
+ public native @ByVal Iterator begin();
+ public native @ByVal Iterator end();
+ @NoOffset @Name("iterator") public static class Iterator extends Pointer {
+ public Iterator(Pointer p) { super(p); }
+ public Iterator() { }
+
+ public native @Name("operator ++") @ByRef Iterator increment();
+ public native @Name("operator ==") boolean equals(@ByRef Iterator it);
+ public native @Name("operator *") @ByRef @Const StackFrame get();
+ }
+
+ public StackFrame[] get() {
+ StackFrame[] array = new StackFrame[size() < Integer.MAX_VALUE ? (int)size() : Integer.MAX_VALUE];
+ for (int i = 0; i < array.length; i++) {
+ array[i] = get(i);
+ }
+ return array;
+ }
+ @Override public String toString() {
+ return java.util.Arrays.toString(get());
+ }
+
+ public StackFrame pop_back() {
+ long size = size();
+ StackFrame value = get(size - 1);
+ resize(size - 1);
+ return value;
+ }
+ public StackFrameVector push_back(StackFrame value) {
+ long size = size();
+ resize(size + 1);
+ return put(size, value);
+ }
+ public StackFrameVector put(StackFrame value) {
+ if (size() != 1) { resize(1); }
+ return put(0, value);
+ }
+ public StackFrameVector put(StackFrame ... array) {
+ if (size() != array.length) { resize(array.length); }
+ for (int i = 0; i < array.length; i++) {
+ put(i, array[i]);
+ }
+ return this;
+ }
+}
+
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Status.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Status.java
new file mode 100644
index 00000000000..16b0fe2fbd7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Status.java
@@ -0,0 +1,96 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+// #endif
+
+/** \ingroup core
+ * Denotes success or failure of a call in Tensorflow. */
+@Namespace("tensorflow") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class Status extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public Status(Pointer p) { super(p); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public Status(long size) { super((Pointer)null); allocateArray(size); }
+ private native void allocateArray(long size);
+ @Override public Status position(long position) {
+ return (Status)super.position(position);
+ }
+ @Override public Status getPointer(long i) {
+ return new Status((Pointer)this).position(position + i);
+ }
+
+ /** Create a success status. */
+ public Status() { super((Pointer)null); allocate(); }
+ private native void allocate();
+
+ /** \brief Create a status with the specified error code and msg as a
+ * human-readable string containing more detailed information. */
+ public Status(@Cast("tensorflow::error::Code") int code, @StdString BytePointer msg) { super((Pointer)null); allocate(code, msg); }
+ private native void allocate(@Cast("tensorflow::error::Code") int code, @StdString BytePointer msg);
+ public Status(@Cast("tensorflow::error::Code") int code, @StdString String msg) { super((Pointer)null); allocate(code, msg); }
+ private native void allocate(@Cast("tensorflow::error::Code") int code, @StdString String msg);
+
+ /** \brief Create a status with the specified error code, msg, and stack trace
+ * as a human-readable string containing more detailed information. */
+// #ifndef SWIG
+ public Status(@Cast("tensorflow::error::Code") int code, @StdString BytePointer msg,
+ @StdMove StackFrameVector stack_trace) { super((Pointer)null); allocate(code, msg, stack_trace); }
+ private native void allocate(@Cast("tensorflow::error::Code") int code, @StdString BytePointer msg,
+ @StdMove StackFrameVector stack_trace);
+ public Status(@Cast("tensorflow::error::Code") int code, @StdString String msg,
+ @StdMove StackFrameVector stack_trace) { super((Pointer)null); allocate(code, msg, stack_trace); }
+ private native void allocate(@Cast("tensorflow::error::Code") int code, @StdString String msg,
+ @StdMove StackFrameVector stack_trace);
+// #endif
+
+ /** Copy the specified status. */
+ public Status(@Const @ByRef Status s) { super((Pointer)null); allocate(s); }
+ private native void allocate(@Const @ByRef Status s);
+ public native @ByRef @Name("operator =") Status put(@Const @ByRef Status s);
+// #ifndef SWIG
+// #endif // SWIG
+
+ public static native @ByVal Status OK();
+
+ /** Returns true iff the status indicates success. */
+ public native @Cast("bool") boolean ok();
+
+ public native @Cast("tensorflow::error::Code") int code();
+
+ public native @StdString BytePointer error_message();
+
+ public native @StdMove StackFrameVector stack_trace();
+
+ public native @Cast("bool") @Name("operator ==") boolean equals(@Const @ByRef Status x);
+
+ ///
+ public native @Cast("bool") @Name("operator !=") boolean notEquals(@Const @ByRef Status x);
+
+ /** \brief If {@code ok()}, stores {@code new_status} into {@code *this}. If {@code !ok()},
+ * preserves the current status, but may augment with additional
+ * information about {@code new_status}.
+ *
+ * Convenient way of keeping track of the first error encountered.
+ * Instead of:
+ * {@code if (overall_status.ok()) overall_status = new_status}
+ * Use:
+ * {@code overall_status.Update(new_status);} */
+ public native void Update(@Const @ByRef Status new_status);
+
+ /** \brief Return a string representation of this status suitable for
+ * printing. Returns the string {@code "OK"} for success. */
+ public native @StdString BytePointer ToString();
+
+ // Ignores any errors. This method does nothing except potentially suppress
+ // complaints from any tools that are checking that errors are not dropped on
+ // the floor.
+ public native void IgnoreError();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StatusGroup.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StatusGroup.java
new file mode 100644
index 00000000000..aa82e03e25e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StatusGroup.java
@@ -0,0 +1,54 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Helper class to manage multiple child status values.
+@Namespace("tensorflow") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class StatusGroup extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public StatusGroup() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public StatusGroup(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public StatusGroup(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public StatusGroup position(long position) {
+ return (StatusGroup)super.position(position);
+ }
+ @Override public StatusGroup getPointer(long i) {
+ return new StatusGroup((Pointer)this).position(position + i);
+ }
+
+ // Utility function to mark a Status as derived. By marking derived status,
+ // Derived status messages are ignored when reporting errors to end users.
+ public static native @ByVal Status MakeDerived(@Const @ByRef Status s);
+ public static native @Cast("bool") boolean IsDerived(@Const @ByRef Status s);
+
+ // Enable warning and error log collection for appending to the aggregated
+ // status. This function may be called more than once.
+ public static native void ConfigureLogHistory();
+
+ // Return a merged status with combined child status messages with a summary.
+ public native @ByVal Status as_summary_status();
+ // Return a merged status with combined child status messages with
+ // concatenation.
+ public native @ByVal Status as_concatenated_status();
+
+ public native @Cast("bool") boolean ok();
+
+ // Augment this group with the child status `status`.
+ public native void Update(@Const @ByRef Status status);
+
+ // Attach recent warning and error log messages
+ public native void AttachLogMessages();
+ public native @Cast("bool") boolean HasLogMessages();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StringIntSetMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StringIntSetMap.java
new file mode 100644
index 00000000000..57991b64c2a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/StringIntSetMap.java
@@ -0,0 +1,38 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Name("std::unordered_map >") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class StringIntSetMap extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public StringIntSetMap(Pointer p) { super(p); }
+ public StringIntSetMap() { allocate(); }
+ private native void allocate();
+ public native @Name("operator =") @ByRef StringIntSetMap put(@ByRef StringIntSetMap x);
+
+ public boolean empty() { return size() == 0; }
+ public native long size();
+
+ @Index public native @ByRef IntSet get(@StdString BytePointer i);
+ public native StringIntSetMap put(@StdString BytePointer i, IntSet value);
+
+ public native @ByVal Iterator begin();
+ public native @ByVal Iterator end();
+ @NoOffset @Name("iterator") public static class Iterator extends Pointer {
+ public Iterator(Pointer p) { super(p); }
+ public Iterator() { }
+
+ public native @Name("operator ++") @ByRef Iterator increment();
+ public native @Name("operator ==") boolean equals(@ByRef Iterator it);
+ public native @Name("operator *().first") @MemberGetter @StdString BytePointer first();
+ public native @Name("operator *().second") @MemberGetter @ByRef @Const IntSet second();
+ }
+}
+
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Context.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Context.java
index 886782d2e0b..c37ee036815 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Context.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Context.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_ContextOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_ContextOptions.java
index 7d986372863..5e460a4ece9 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_ContextOptions.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_ContextOptions.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Op.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Op.java
index b960617ab40..e303d3c8598 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Op.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_Op.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorDebugInfo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorDebugInfo.java
index e42ebf581b8..c00a37567a5 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorDebugInfo.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorDebugInfo.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorHandle.java
index 00fab08ff54..c2c860ac0ac 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorHandle.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TFE_TensorHandle.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AllocatorAttributes.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AllocatorAttributes.java
index 4a7968111e1..82922a0e3e3 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AllocatorAttributes.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AllocatorAttributes.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -26,7 +26,7 @@ public class TF_AllocatorAttributes extends Pointer {
return (TF_AllocatorAttributes)super.position(position);
}
@Override public TF_AllocatorAttributes getPointer(long i) {
- return new TF_AllocatorAttributes(this).position(position + i);
+ return new TF_AllocatorAttributes((Pointer)this).position(position + i);
}
public native @Cast("size_t") long struct_size(); public native TF_AllocatorAttributes struct_size(long setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ApiDefMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ApiDefMap.java
index cfe167e125a..84a38a9e040 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ApiDefMap.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ApiDefMap.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AttrMetadata.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AttrMetadata.java
index 50d82309003..636dc3df4f4 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AttrMetadata.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AttrMetadata.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -25,7 +25,7 @@ public class TF_AttrMetadata extends Pointer {
return (TF_AttrMetadata)super.position(position);
}
@Override public TF_AttrMetadata getPointer(long i) {
- return new TF_AttrMetadata(this).position(position + i);
+ return new TF_AttrMetadata((Pointer)this).position(position + i);
}
// A boolean: 1 if the attribute value is a list, 0 otherwise.
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Buffer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Buffer.java
index a3d80f3b50e..b3eb39b09b6 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Buffer.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Buffer.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -32,7 +32,7 @@ public class TF_Buffer extends org.tensorflow.internal.c_api.AbstractTF_Buffer {
return (TF_Buffer)super.position(position);
}
@Override public TF_Buffer getPointer(long i) {
- return new TF_Buffer(this).position(position + i);
+ return new TF_Buffer((Pointer)this).position(position + i);
}
public native @Const Pointer data(); public native TF_Buffer data(Pointer data);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeprecatedSession.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeprecatedSession.java
index fdaab8327a9..381e491bd13 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeprecatedSession.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeprecatedSession.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeviceList.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeviceList.java
index e56d93340c1..d4f35235d6e 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeviceList.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DeviceList.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DimensionHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DimensionHandle.java
index 2eb78c52b75..3d266edaf6a 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DimensionHandle.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DimensionHandle.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Function.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Function.java
index e370b2f9f08..ab5744e0516 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Function.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Function.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_FunctionOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_FunctionOptions.java
index 5610e784a6f..6277e4401a5 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_FunctionOptions.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_FunctionOptions.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Graph.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Graph.java
index 0a287cd5642..98b85c15073 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Graph.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Graph.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefOptions.java
index 442488d561d..0bb6ce1f1f6 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefOptions.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefOptions.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefResults.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefResults.java
index ac800f534e1..6b36e75f711 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefResults.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ImportGraphDefResults.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Input.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Input.java
index aa03e503d3a..e93a447d717 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Input.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Input.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -25,7 +25,7 @@ public class TF_Input extends Pointer {
return (TF_Input)super.position(position);
}
@Override public TF_Input getPointer(long i) {
- return new TF_Input(this).position(position + i);
+ return new TF_Input((Pointer)this).position(position + i);
}
public native TF_Operation oper(); public native TF_Input oper(TF_Operation setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_KernelBuilder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_KernelBuilder.java
index 796bfa5aefc..fc6a85b9655 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_KernelBuilder.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_KernelBuilder.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Library.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Library.java
index 128efd99025..5ff52a92f1c 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Library.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Library.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpDefinitionBuilder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpDefinitionBuilder.java
index ef8a6b7d7f1..dd17a11295a 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpDefinitionBuilder.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpDefinitionBuilder.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelConstruction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelConstruction.java
index 6a984f2a25d..67774f95832 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelConstruction.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelConstruction.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelContext.java
index 9c145e89bdf..1881914eb08 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelContext.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelContext.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Operation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Operation.java
index 0cd1c90ecae..d4639998b96 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Operation.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Operation.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OperationDescription.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OperationDescription.java
index 64a577c28de..76160ca75b7 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OperationDescription.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OperationDescription.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Output.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Output.java
index b990302d373..1b5046095f9 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Output.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Output.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -25,7 +25,7 @@ public class TF_Output extends Pointer {
return (TF_Output)super.position(position);
}
@Override public TF_Output getPointer(long i) {
- return new TF_Output(this).position(position + i);
+ return new TF_Output((Pointer)this).position(position + i);
}
public native TF_Operation oper(); public native TF_Output oper(TF_Operation setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Server.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Server.java
index c34d6dd2eab..1f941d44158 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Server.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Server.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Session.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Session.java
index 10818f6b59f..6ff05ef101c 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Session.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Session.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_SessionOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_SessionOptions.java
index c96017ab554..34e1440e4e4 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_SessionOptions.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_SessionOptions.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeHandle.java
index 7fc4dd37276..4a6ef7ccb58 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeHandle.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeHandle.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeInferenceContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeInferenceContext.java
index 4d2bd0c7441..42ffb5b4c1c 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeInferenceContext.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeInferenceContext.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Status.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Status.java
index 0ea4e3415c3..f8b83294749 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Status.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Status.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_StringView.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_StringView.java
index 3300f6416b1..81fea1b8bfd 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_StringView.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_StringView.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -27,7 +27,7 @@ public class TF_StringView extends Pointer {
return (TF_StringView)super.position(position);
}
@Override public TF_StringView getPointer(long i) {
- return new TF_StringView(this).position(position + i);
+ return new TF_StringView((Pointer)this).position(position + i);
}
public native @Cast("const char*") BytePointer data(); public native TF_StringView data(BytePointer setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString.java
index 1952ad9267d..eec4ebaae2e 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -24,7 +24,7 @@ public class TF_TString extends Pointer {
return (TF_TString)super.position(position);
}
@Override public TF_TString getPointer(long i) {
- return new TF_TString(this).position(position + i);
+ return new TF_TString((Pointer)this).position(position + i);
}
// NOLINT
// small conflicts with '#define small char' in RpcNdr.h for MSVC, so we use
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Large.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Large.java
index 2edcc0e3808..5aafe962503 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Large.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Large.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -24,7 +24,7 @@ public class TF_TString_Large extends Pointer {
return (TF_TString_Large)super.position(position);
}
@Override public TF_TString_Large getPointer(long i) {
- return new TF_TString_Large(this).position(position + i);
+ return new TF_TString_Large((Pointer)this).position(position + i);
}
// NOLINT
public native @Cast("size_t") long size(); public native TF_TString_Large size(long setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Offset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Offset.java
index d46c62ec004..94e579559f8 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Offset.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Offset.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -24,7 +24,7 @@ public class TF_TString_Offset extends Pointer {
return (TF_TString_Offset)super.position(position);
}
@Override public TF_TString_Offset getPointer(long i) {
- return new TF_TString_Offset(this).position(position + i);
+ return new TF_TString_Offset((Pointer)this).position(position + i);
}
// NOLINT
public native @Cast("uint32_t") int size(); public native TF_TString_Offset size(int setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Raw.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Raw.java
index ffe3b6b087a..e204796baf3 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Raw.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Raw.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -24,7 +24,7 @@ public class TF_TString_Raw extends Pointer {
return (TF_TString_Raw)super.position(position);
}
@Override public TF_TString_Raw getPointer(long i) {
- return new TF_TString_Raw(this).position(position + i);
+ return new TF_TString_Raw((Pointer)this).position(position + i);
}
// NOLINT
public native @Cast("uint8_t") byte raw(int i); public native TF_TString_Raw raw(int i, byte setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Small.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Small.java
index 7ce9d5f9caf..7c30f0b4056 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Small.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Small.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -24,7 +24,7 @@ public class TF_TString_Small extends Pointer {
return (TF_TString_Small)super.position(position);
}
@Override public TF_TString_Small getPointer(long i) {
- return new TF_TString_Small(this).position(position + i);
+ return new TF_TString_Small((Pointer)this).position(position + i);
}
// NOLINT
public native @Cast("uint8_t") byte size(); public native TF_TString_Small size(byte setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Union.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Union.java
index ffa3cfeb5db..9f62596c8a4 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Union.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Union.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -24,7 +24,7 @@ public class TF_TString_Union extends Pointer {
return (TF_TString_Union)super.position(position);
}
@Override public TF_TString_Union getPointer(long i) {
- return new TF_TString_Union(this).position(position + i);
+ return new TF_TString_Union((Pointer)this).position(position + i);
}
// NOLINT
public native @ByRef TF_TString_Large large(); public native TF_TString_Union large(TF_TString_Large setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_View.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_View.java
index bec84468a53..f2a59515ee9 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_View.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_View.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
@@ -24,7 +24,7 @@ public class TF_TString_View extends Pointer {
return (TF_TString_View)super.position(position);
}
@Override public TF_TString_View getPointer(long i) {
- return new TF_TString_View(this).position(position + i);
+ return new TF_TString_View((Pointer)this).position(position + i);
}
// NOLINT
public native @Cast("size_t") long size(); public native TF_TString_View size(long setter);
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java
index d96c2757dc6..f7364f0f28c 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_WhileParams.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_WhileParams.java
index 4c6dc486d52..8d761ae9f5c 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_WhileParams.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_WhileParams.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Tape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Tape.java
new file mode 100644
index 00000000000..71acad6ee84
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Tape.java
@@ -0,0 +1,91 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Traces the execution of operations, doing eager garbage collection, and
+// exporting a full trace so other code can do backpropagation. Not thread-safe.
+@Name("tensorflow::eager::GradientTape") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class Tape extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public Tape(Pointer p) { super(p); }
+
+ // If `persistent` is true, GradientTape will not eagerly delete backward
+ // functions (and hence the tensors they keep alive). Instead, everything
+ // is deleted in ~GradientTape. Persistent GradientTapes are useful when
+ // users want to compute multiple gradients over the same tape.
+ public Tape(@Cast("bool") boolean persistent) { super((Pointer)null); allocate(persistent); }
+ private native void allocate(@Cast("bool") boolean persistent);
+
+ public native @Cast("bool") boolean ShouldRecord(@Cast("tensorflow::int64*") @Span LongPointer tensor_ids,
+ @Cast("tensorflow::DataType*") @Span IntPointer dtypes);
+ public native @Cast("bool") boolean ShouldRecord(@Cast("tensorflow::int64*") @Span LongBuffer tensor_ids,
+ @Cast("tensorflow::DataType*") @Span IntBuffer dtypes);
+ public native @Cast("bool") boolean ShouldRecord(@Cast("tensorflow::int64*") @Span long[] tensor_ids,
+ @Cast("tensorflow::DataType*") @Span int[] dtypes);
+
+ public native void Watch(@Cast("tensorflow::int64") long tensor_id);
+
+ public native void RecordOperation(
+ @StdString BytePointer op_type, @StdVector TapeTensor output_tensors,
+ @Cast("tensorflow::int64*") @Span LongPointer input_tensor_id,
+ @Cast("tensorflow::DataType*") @Span IntPointer input_dtypes,
+ @Const @ByRef BackwardFunctionGetter backward_function_getter,
+ @Const @ByRef BackwardFunctionDeleter backward_function_deleter);
+ public native void RecordOperation(
+ @StdString String op_type, @StdVector TapeTensor output_tensors,
+ @Cast("tensorflow::int64*") @Span LongBuffer input_tensor_id,
+ @Cast("tensorflow::DataType*") @Span IntBuffer input_dtypes,
+ @Const @ByRef BackwardFunctionGetter backward_function_getter,
+ @Const @ByRef BackwardFunctionDeleter backward_function_deleter);
+ public native void RecordOperation(
+ @StdString BytePointer op_type, @StdVector TapeTensor output_tensors,
+ @Cast("tensorflow::int64*") @Span long[] input_tensor_id,
+ @Cast("tensorflow::DataType*") @Span int[] input_dtypes,
+ @Const @ByRef BackwardFunctionGetter backward_function_getter,
+ @Const @ByRef BackwardFunctionDeleter backward_function_deleter);
+ public native void RecordOperation(
+ @StdString String op_type, @StdVector TapeTensor output_tensors,
+ @Cast("tensorflow::int64*") @Span LongPointer input_tensor_id,
+ @Cast("tensorflow::DataType*") @Span IntPointer input_dtypes,
+ @Const @ByRef BackwardFunctionGetter backward_function_getter,
+ @Const @ByRef BackwardFunctionDeleter backward_function_deleter);
+ public native void RecordOperation(
+ @StdString BytePointer op_type, @StdVector TapeTensor output_tensors,
+ @Cast("tensorflow::int64*") @Span LongBuffer input_tensor_id,
+ @Cast("tensorflow::DataType*") @Span IntBuffer input_dtypes,
+ @Const @ByRef BackwardFunctionGetter backward_function_getter,
+ @Const @ByRef BackwardFunctionDeleter backward_function_deleter);
+ public native void RecordOperation(
+ @StdString String op_type, @StdVector TapeTensor output_tensors,
+ @Cast("tensorflow::int64*") @Span long[] input_tensor_id,
+ @Cast("tensorflow::DataType*") @Span int[] input_dtypes,
+ @Const @ByRef BackwardFunctionGetter backward_function_getter,
+ @Const @ByRef BackwardFunctionDeleter backward_function_deleter);
+
+ public native void DeleteTrace(@Cast("tensorflow::int64") long tensor_id);
+
+ // Consumes the internal state of the tape (so cannot be called more than
+ // once) and produces the gradient of the target tensors with respect to the
+ // source tensors. The output gradients are used if not empty and not
+ // null. The result is populated with one tensor per target element.
+ // When running backward functions, builds zeros-like tensors for
+ // incoming grads which are nullptrs, unless `build_default_zeros_grads`
+ // is set to false.
+ public native @ByVal Status ComputeGradient(
+ @Const @ByRef TapeVSpaceBase vspace,
+ @Cast("tensorflow::int64*") @Span LongPointer target_tensor_ids,
+ @Cast("tensorflow::int64*") @Span LongPointer source_tensor_ids,
+ @Const @ByRef LongTapeTensorMap sources_that_are_targets,
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer output_gradients,
+ AbstractTensorHandleVector result, @Cast("bool") boolean build_default_zeros_grads/*=true*/);
+
+ public native @Cast("bool") boolean IsPersistent();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeTensor.java
new file mode 100644
index 00000000000..bc0dce1942b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeTensor.java
@@ -0,0 +1,47 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Wrapper for a tensor output of an operation executing under a tape.
+//
+// `GetID` returns a unique id for the wrapped tensor which is used to maintain
+// a map (`tensorflow::eager::TensorTape`) from the wrapped tensor to the id of
+// the op that produced it (or -1 if this tensor was watched using
+// `GradientTape::Watch`.) The op_id is simply a unique index assigned to each
+// op executed under the tape. A separate map (`tensorflow::eager::OpTape`)
+// maintains the map from `op_id` to a `OpTapeEntry` which stores the `op_type`,
+// inputs and outputs and the gradient function These data structures combined
+// allow us to trace the data dependencies between operations and hence compute
+// gradients.
+//
+// `ZerosLike` is not expected to be called and returns a nullptr. The creation
+// of default zeros grads is handled by the `DefaultGradientFunction` registered
+// for each op.
+// TODO(srbs): We need to define `ZerosLike` here to keep the compiler happy.
+// Figure out a way to avoid this.
+// TODO(srbs): Should ZerosLike check-fail instead of returning nullptr?
+@Namespace("tensorflow::gradients") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TapeTensor extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TapeTensor(Pointer p) { super(p); }
+
+ public TapeTensor(AbstractTensorHandle handle) { super((Pointer)null); allocate(handle); }
+ private native void allocate(AbstractTensorHandle handle);
+ public TapeTensor(@Const @ByRef TapeTensor other) { super((Pointer)null); allocate(other); }
+ private native void allocate(@Const @ByRef TapeTensor other);
+
+ public native @Cast("tensorflow::int64") long GetID();
+ public native @Cast("tensorflow::DataType") int GetDType();
+
+ public native AbstractTensorHandle ZerosLike();
+
+ public native AbstractTensorHandle GetHandle();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeVSpace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeVSpace.java
new file mode 100644
index 00000000000..578381ee077
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeVSpace.java
@@ -0,0 +1,53 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Vector space for actually computing gradients. Implements methods for calling
+// the backward function with incoming gradients and returning the outgoing
+// gradient and for performing gradient aggregation.
+// See `tensorflow::eager::VSpace` for more details.
+@Namespace("tensorflow::gradients") @NoOffset @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TapeVSpace extends TapeVSpaceBase {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TapeVSpace(Pointer p) { super(p); }
+
+ public TapeVSpace(AbstractContext ctx) { super((Pointer)null); allocate(ctx); }
+ private native void allocate(AbstractContext ctx);
+
+ // Returns the number of elements in the gradient tensor.
+ public native @Cast("tensorflow::int64") long NumElements(AbstractTensorHandle tensor);
+
+ // Consumes references to the tensors in the gradient_tensors list and returns
+ // a tensor with the result.
+ public native AbstractTensorHandle AggregateGradients(
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer gradient_tensors);
+
+ // Calls the passed-in backward function.
+ public native @ByVal Status CallBackwardFunction(
+ BackwardFunction backward_function,
+ @Cast("tensorflow::int64*") @StdVector LongPointer unneeded_gradients,
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer output_gradients,
+ @Cast("tensorflow::AbstractTensorHandle**") @StdVector PointerPointer result);
+
+ // Builds a tensor filled with ones with the same shape and dtype as `t`.
+ public native @ByVal Status BuildOnesLike(@Const @ByRef TapeTensor t,
+ @Cast("tensorflow::AbstractTensorHandle**") PointerPointer result);
+
+ // Looks up the ID of a Gradient.
+ public native @Cast("tensorflow::int64") long TensorId(AbstractTensorHandle tensor);
+
+ // Converts a Gradient to a TapeTensor.
+ public native @ByVal TapeTensor TapeTensorFromGradient(AbstractTensorHandle g);
+
+ public native void MarkAsResult(AbstractTensorHandle gradient);
+
+ public native void DeleteGradient(AbstractTensorHandle gradient);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeVSpaceBase.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeVSpaceBase.java
new file mode 100644
index 00000000000..10b98352f53
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TapeVSpaceBase.java
@@ -0,0 +1,69 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// Operations the tape needs to perform on tensors to do backpropagation. Named
+// "vspace" because a subset of these are related to a vector space, such as
+// adding gradients, getting zeroes, etc. Currently cannot be implemented
+// without using tensorflow python code, hence left unspecified here.
+//
+// Gradient is the type returned by gradient functions. In Python TF it's either
+// Tensor or IndexedSlices or None, which here we map to nullptr. Gradients need
+// to allow their size to be computed and they need to be passable to a backward
+// function and deleted (as the backprop code creates lots of gradients the user
+// is not interested in).
+//
+// BackwardFunction needs to be a closure which stores intermediate activations
+// from the forward computation and calls a vector-jacobian product function
+// (also known as adjoint function) to compute, given downstream gradients,
+// upstream gradients.
+//
+// TODO(apassos) provide concrete template instantiations for TFE_TensorHandle
+// specialization, which is blocked by quite a few things needing to loop back
+// into python now.
+@Name("tensorflow::eager::VSpace") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TapeVSpaceBase extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TapeVSpaceBase(Pointer p) { super(p); }
+
+
+ // Returns the number of elements in the gradient tensor.
+ public native @Cast("tensorflow::int64") long NumElements(AbstractTensorHandle tensor);
+
+ // Consumes references to the tensors in the gradient_tensors list and returns
+ // a tensor with the result.
+ public native AbstractTensorHandle AggregateGradients(
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer gradient_tensors);
+
+ // Calls the passed-in backward function.
+ public native @ByVal Status CallBackwardFunction(
+ BackwardFunction backward_function,
+ @Cast("tensorflow::int64*") @StdVector LongPointer unneeded_gradients,
+ @Cast("tensorflow::AbstractTensorHandle**") @Span PointerPointer output_gradients,
+ @Cast("tensorflow::AbstractTensorHandle**") @StdVector PointerPointer result);
+
+ // Builds a tensor filled with ones with the same shape and dtype as `t`.
+ public native @ByVal Status BuildOnesLike(@Const @ByRef TapeTensor t,
+ @Cast("tensorflow::AbstractTensorHandle**") PointerPointer result);
+
+ // Looks up the ID of a Gradient.
+ public native @Cast("tensorflow::int64") long TensorId(AbstractTensorHandle tensor);
+
+ // Converts a Gradient to a TapeTensor.
+ public native @ByVal TapeTensor TapeTensorFromGradient(AbstractTensorHandle gradient);
+
+ // Marks the following gradient as a result so it's not consumed by backward
+ // functions.
+ public native void MarkAsResult(AbstractTensorHandle gradient);
+
+ // Deletes the input tensor.
+ public native void DeleteGradient(AbstractTensorHandle gradient);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Tensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Tensor.java
index 0a9efa65762..c11153e5e49 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Tensor.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Tensor.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api;
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TensorTape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TensorTape.java
new file mode 100644
index 00000000000..d339dc3ce7b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TensorTape.java
@@ -0,0 +1,38 @@
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+@Name("std::unordered_map") @Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TensorTape extends Pointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TensorTape(Pointer p) { super(p); }
+ public TensorTape() { allocate(); }
+ private native void allocate();
+ public native @Name("operator =") @ByRef TensorTape put(@ByRef TensorTape x);
+
+ public boolean empty() { return size() == 0; }
+ public native long size();
+
+ @Index public native @Cast("tensorflow::int64") long get(@Cast("tensorflow::int64") long i);
+ public native TensorTape put(@Cast("tensorflow::int64") long i, long value);
+
+ public native @ByVal Iterator begin();
+ public native @ByVal Iterator end();
+ @NoOffset @Name("iterator") public static class Iterator extends Pointer {
+ public Iterator(Pointer p) { super(p); }
+ public Iterator() { }
+
+ public native @Name("operator ++") @ByRef Iterator increment();
+ public native @Name("operator ==") boolean equals(@ByRef Iterator it);
+ public native @Name("operator *().first") @MemberGetter @Cast("tensorflow::int64") long first();
+ public native @Name("operator *().second") @MemberGetter @Cast("tensorflow::int64") long second();
+ }
+}
+
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java
index f83bc6c1394..d762053b338 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java
@@ -1,4 +1,4 @@
-// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+// Targeted by JavaCPP version 1.5.5: DO NOT EDIT THIS FILE
package org.tensorflow.internal.c_api.global;
@@ -11,6 +11,27 @@
public class tensorflow extends org.tensorflow.internal.c_api.presets.tensorflow {
static { Loader.load(); }
+// Targeting ../AbstractTensorHandleVector.java
+
+
+// Targeting ../StackFrameVector.java
+
+
+// Targeting ../LongTapeTensorMap.java
+
+
+// Targeting ../StringIntSetMap.java
+
+
+// Targeting ../TensorTape.java
+
+
+// Targeting ../OpTape.java
+
+
+// Targeting ../IntSet.java
+
+
// Parsed from tensorflow/core/platform/ctstring_internal.h
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
@@ -4379,4 +4400,657 @@ public static native void TFE_ContextExportRunMetadata(TFE_Context ctx,
// #endif // TENSORFLOW_C_EAGER_C_API_H_
+// Parsed from tensorflow_adapters.h
+
+/*
+ Copyright 2021 The TensorFlow Authors. All Rights Reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ =======================================================================
+ */
+
+// #include "absl/types/span.h"
+
+
+
+// Parsed from tensorflow/core/platform/errors.h
+
+/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// #ifndef TENSORFLOW_CORE_PLATFORM_ERRORS_H_
+// #define TENSORFLOW_CORE_PLATFORM_ERRORS_H_
+
+// #include
+
+// #include "absl/strings/str_join.h"
+// #include "tensorflow/core/platform/status.h"
+// #include "tensorflow/core/platform/logging.h"
+// #include "tensorflow/core/platform/macros.h"
+// #include "tensorflow/core/platform/str_util.h"
+// #include "tensorflow/core/platform/strcat.h"
+
+// The DECLARE_ERROR macro below only supports types that can be converted
+// into StrCat's AlphaNum. For the other types we rely on a slower path
+// through std::stringstream. To add support of a new type, it is enough to
+// make sure there is an operator<<() for it:
+//
+// std::ostream& operator<<(std::ostream& os, const MyType& foo) {
+// os << foo.ToString();
+// return os;
+// }
+// Eventually absl::strings will have native support for this and we will be
+// able to completely remove PrepareForStrCat().
+
+
+
+ // namespace internal
+
+// Append some context to an error message. Each time we append
+// context put it on a new line, since it is possible for there
+// to be several layers of additional context.
+
+// For propagating errors when calling a function.
+// #define TF_RETURN_IF_ERROR(...)
+// do {
+// ::tensorflow::Status _status = (__VA_ARGS__);
+// if (TF_PREDICT_FALSE(!_status.ok())) return _status;
+// } while (0)
+
+// #define TF_RETURN_WITH_CONTEXT_IF_ERROR(expr, ...)
+// do {
+// ::tensorflow::Status _status = (expr);
+// if (TF_PREDICT_FALSE(!_status.ok())) {
+// ::tensorflow::errors::AppendToMessage(&_status, __VA_ARGS__);
+// return _status;
+// }
+// } while (0)
+
+// Convenience functions for generating and using error status.
+// Example usage:
+// status.Update(errors::InvalidArgument("The ", foo, " isn't right."));
+// if (errors::IsInvalidArgument(status)) { ... }
+// switch (status.code()) { case error::INVALID_ARGUMENT: ... }
+
+// #define DECLARE_ERROR(FUNC, CONST)
+// template
+// ::tensorflow::Status FUNC(Args... args) {
+// return ::tensorflow::Status(
+// ::tensorflow::error::CONST,
+// ::tensorflow::strings::StrCat(
+// ::tensorflow::errors::internal::PrepareForStrCat(args)...));
+// }
+// inline bool Is##FUNC(const ::tensorflow::Status& status) {
+// return status.code() == ::tensorflow::error::CONST;
+// }
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsCancelled(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsInvalidArgument(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsNotFound(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsAlreadyExists(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsResourceExhausted(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsUnavailable(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsFailedPrecondition(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsOutOfRange(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsUnimplemented(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsInternal(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsAborted(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsDeadlineExceeded(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsDataLoss(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsUnknown(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsPermissionDenied(@Const @ByRef Status status);
+ @Namespace("tensorflow::errors") public static native @Cast("bool") boolean IsUnauthenticated(@Const @ByRef Status status);
+
+// #undef DECLARE_ERROR
+
+// Produces a formatted string pattern from the name which can uniquely identify
+// this node upstream to produce an informative error message. The pattern
+// followed is: {{node }}
+// Note: The pattern below determines the regex _NODEDEF_NAME_RE in the file
+// tensorflow/python/client/session.py
+// LINT.IfChange
+@Namespace("tensorflow::errors") public static native @StdString BytePointer FormatNodeNameForError(@StdString BytePointer name);
+@Namespace("tensorflow::errors") public static native @StdString String FormatNodeNameForError(@StdString String name);
+// LINT.ThenChange(//tensorflow/python/client/session.py)
+// LINT.IfChange
+@Namespace("tensorflow::errors") public static native @StdString BytePointer FormatColocationNodeForError(@StdString BytePointer name);
+@Namespace("tensorflow::errors") public static native @StdString String FormatColocationNodeForError(@StdString String name);
+// LINT.ThenChange(//tensorflow/python/framework/error_interpolation.py)
+
+@Namespace("tensorflow::errors") public static native @StdString BytePointer FormatFunctionForError(@StdString BytePointer name);
+@Namespace("tensorflow::errors") public static native @StdString String FormatFunctionForError(@StdString String name);
+
+// The CanonicalCode() for non-errors.
+
+ // namespace errors
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_CORE_PLATFORM_ERRORS_H_
+
+
+// Parsed from tensorflow/core/platform/status.h
+
+/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// #ifndef TENSORFLOW_CORE_PLATFORM_STATUS_H_
+// #define TENSORFLOW_CORE_PLATFORM_STATUS_H_
+
+// #include
+// #include
+// #include
+// #include
+
+// #include "tensorflow/core/platform/logging.h"
+// #include "tensorflow/core/platform/macros.h"
+// #include "tensorflow/core/platform/stringpiece.h"
+// #include "tensorflow/core/platform/types.h"
+// #include "tensorflow/core/protobuf/error_codes.pb.h"
+// Targeting ../StackFrame.java
+
+
+
+// #if defined(__clang__)
+// Only clang supports warn_unused_result as a type annotation.
+// Targeting ../Status.java
+
+
+// Targeting ../StatusGroup.java
+
+
+
+
+
+
+
+// #ifndef SWIG
+
+
+
+// #endif // SWIG
+
+
+
+
+
+/** \ingroup core */
+@Namespace("tensorflow") public static native @Cast("std::ostream*") @ByRef @Name("operator <<") Pointer shiftLeft(@Cast("std::ostream*") @ByRef Pointer os, @Const @ByRef Status x);
+
+@Namespace("tensorflow") public static native @StdString BytePointer TfCheckOpHelperOutOfLine(
+ @Const @ByRef Status v, @Cast("const char*") BytePointer msg);
+@Namespace("tensorflow") public static native @StdString BytePointer TfCheckOpHelperOutOfLine(
+ @Const @ByRef Status v, String msg);
+
+@Namespace("tensorflow") public static native @StdString BytePointer TfCheckOpHelper(@ByVal Status v,
+ @Cast("const char*") BytePointer msg);
+@Namespace("tensorflow") public static native @StdString BytePointer TfCheckOpHelper(@ByVal Status v,
+ String msg);
+
+// #define TF_DO_CHECK_OK(val, level)
+// while (auto _result = ::tensorflow::TfCheckOpHelper(val, #val))
+// LOG(level) << *(_result)
+
+// #define TF_CHECK_OK(val) TF_DO_CHECK_OK(val, FATAL)
+// #define TF_QCHECK_OK(val) TF_DO_CHECK_OK(val, QFATAL)
+
+// DEBUG only version of TF_CHECK_OK. Compiler still parses 'val' even in opt
+// mode.
+// #ifndef NDEBUG
+// #define TF_DCHECK_OK(val) TF_CHECK_OK(val)
+// #else
+// #define TF_DCHECK_OK(val)
+// while (false && (::tensorflow::Status::OK() == (val))) LOG(FATAL)
+// #endif
+
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_CORE_PLATFORM_STATUS_H_
+
+
+// Parsed from tensorflow/c/tensor_interface.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// #ifndef TENSORFLOW_C_TENSOR_INTERFACE_H_
+// #define TENSORFLOW_C_TENSOR_INTERFACE_H_
+
+// #include "tensorflow/core/framework/types.pb.h"
+// #include "tensorflow/core/platform/status.h"
+// Targeting ../AbstractTensorInterface.java
+
+
+// Targeting ../AbstractTensorInterfaceDeleter.java
+
+
+ // namespace internal
+
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_C_TENSOR_INTERFACE_H_
+
+
+// Parsed from tensorflow/c/eager/abstract_tensor_handle.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// #ifndef TENSORFLOW_C_EAGER_ABSTRACT_TENSOR_HANDLE_H_
+// #define TENSORFLOW_C_EAGER_ABSTRACT_TENSOR_HANDLE_H_
+
+// #include
+
+// #include "tensorflow/core/framework/types.pb.h"
+// #include "tensorflow/core/platform/refcount.h"
+// Targeting ../AbstractTensorHandle.java
+
+
+// Targeting ../AbstractTensorHandleDeleter.java
+
+
+ // namespace internal
+
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_C_EAGER_ABSTRACT_TENSOR_HANDLE_H_
+
+
+// Parsed from tensorflow/c/eager/abstract_function.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// #ifndef TENSORFLOW_C_EAGER_ABSTRACT_FUNCTION_H_
+// #define TENSORFLOW_C_EAGER_ABSTRACT_FUNCTION_H_
+
+// #include "tensorflow/core/framework/function.pb.h"
+// #include "tensorflow/core/platform/status.h"
+// Targeting ../AbstractFunction.java
+
+
+
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_C_EAGER_ABSTRACT_FUNCTION_H_
+
+
+// Parsed from tensorflow/c/eager/abstract_operation.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// #ifndef TENSORFLOW_C_EAGER_ABSTRACT_OPERATION_H_
+// #define TENSORFLOW_C_EAGER_ABSTRACT_OPERATION_H_
+
+// #include
+
+// #include "absl/types/span.h"
+// #include "tensorflow/c/eager/abstract_tensor_handle.h"
+// #include "tensorflow/c/tensor_interface.h"
+// #include "tensorflow/core/framework/types.pb.h"
+// #include "tensorflow/core/platform/status.h"
+// Targeting ../AbstractOperation.java
+
+
+// Targeting ../AbstractOperationDeleter.java
+
+
+ // namespace internal
+
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_C_EAGER_ABSTRACT_OPERATION_H_
+
+
+// Parsed from tensorflow/c/eager/abstract_context.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// #ifndef TENSORFLOW_C_EAGER_ABSTRACT_CONTEXT_H_
+// #define TENSORFLOW_C_EAGER_ABSTRACT_CONTEXT_H_
+
+// #include
+
+// #include "tensorflow/c/eager/abstract_function.h"
+// #include "tensorflow/c/eager/abstract_operation.h"
+// Targeting ../AbstractContext.java
+
+
+// Targeting ../AbstractContextDeleter.java
+
+
+ // namespace internal
+
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_C_EAGER_ABSTRACT_CONTEXT_H_
+
+
+// Parsed from tensorflow/c/eager/tape.h
+
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// #ifndef TENSORFLOW_C_EAGER_TAPE_H_
+// #define TENSORFLOW_C_EAGER_TAPE_H_
+
+// Language-agnostic gradient tape. Does not perform backpropagation, just
+// maintains the data structures required to do so.
+
+// #include
+// #include
+// #include
+// #include
+
+// #include "tensorflow/core/framework/tensor_shape.h"
+// #include "tensorflow/core/framework/types.h"
+// #include "tensorflow/core/lib/gtl/array_slice.h"
+// #include "tensorflow/core/lib/gtl/cleanup.h"
+// #include "tensorflow/core/lib/gtl/flatmap.h"
+// #include "tensorflow/core/lib/gtl/flatset.h"
+// #include "tensorflow/core/platform/errors.h"
+// #include "tensorflow/core/platform/types.h"
+// Targeting ../OpEntry.java
+
+
+
+// Map from tensor_id to internally-defined operation-id of the operation which
+// produced this tensor. A value of -1 means that the tensor was directly
+// watched and not the result of any operation in the tape.
+
+// Map from operation-id to tape entry.
+// Targeting ../TapeVSpaceBase.java
+
+
+// Targeting ../Tape.java
+
+
+
+// Describes a callback for special-cased and more efficient jvp computation.
+//
+// Could just be a simple typedef in ForwardAccumulator, but MSVC chokes on
+// that.
+
+// Computes Jacobian-vector products using forward-mode automatic
+// differentiation.
+//
+// While GradientTape's RecordOperation is trivial, ForwardAccumulator's
+// Accumulate runs the gradient computation immediately.
+//
+// Keeps references to Tensors watched via Watch and computed in Accumulate
+// corresponding to output_tensors, and releases these references in its
+// destructor. However, waiting until the destructor runs loses the memory
+// efficiency of forward-mode autodiff. Instead, language bindings should call
+// DeleteGradient as soon as a Tensor which was `Watch`ed or was an output
+// Tensor passed to Accumulate goes out of scope.
+//
+// Not thread-safe.
+
+// Template instantiations here
+
+@Namespace("tensorflow::eager") public static native @Cast("bool") boolean IsDtypeTrainable(@Cast("tensorflow::DataType") int dtype);
+
+
+
+
+
+
+
+
+
+// Terminology:
+//
+// - op: a possibly composite operation, which has an entry in the tape
+// - target: dy in dx/dy
+// - source: dx in dx/dy
+// - tensor: one of the many inputs or outputs of an operation
+//
+// Below here we do the gradient algorithm. It works as follows:
+//
+// First we filter the tape to just the subset of operations we want to
+// differentiate. In the process of doing so we count how many times each Tensor
+// is used as an input to an op (so we know when we're done computing gradients
+// for that Tensor). We also count, for each tape entry, how many of its output
+// Tensors need gradients to be computed (Tensors which are not used do not need
+// any gradients to be computed).
+//
+// Finally, we start a backprop stack with a set of tape entries for which we
+// have all gradients available. This set usually is a subset of the set of
+// targets (not all since targets which have outputs in the tape will not have
+// gradients available initially).
+//
+// Then we repeatedly pop an entry from the stack, run its backprop, and update
+// the gradients of its inputs. Once we have computed all gradients for a single
+// input we can mark this input as done, and this can trigger adding an entry to
+// the stack if all outputs of that entry are now done.
+//
+// When the stack is empty we have gradients for all tensors we're interested
+// in.
+
+// If `persistent_tape` is true, op_tape is not changed and none of the
+// backwards functions are deleted.
+// If `persistent_tape` is false, op_tape is cleared and backwards functions
+// not needed for gradient computation are deleted. Backwards functions that
+// are needed, are copied and returned in BackpropInitialState.
+
+// TODO(agarwal): use an automatic mechanism for handling None arguments to
+// gradient functions.
+//
+// Some gradient functions can accept None arguments for gradients. The
+// following maps the operation name to the indices at which the corresponding
+// gradient function can accept None values. e.g. FusedBatchNorm outputs 5
+// values and hence receives 5 gradient values during backprop. However the
+// gradient function uses only the first of those values and ignores the rest.
+// The entry, "FusedBatchNorm": [1, 2, 3, 4], indicates that only the gradient
+// corresponding to index 0 is used, and the gradient values at indices 1-4 are
+// ignored (and hence can be None). The backprop algorithm can then leverage
+// this by not constructing zeros to pass for those indices.
+@Namespace("tensorflow::eager") public static native StringIntSetMap FunctionsAcceptingNoneForIndicesMap();
+
+ // namespace
+
+// If over kMinAggregateCount gradients are accumulated and the total
+// memory consumption is over kMinAggregateBytes, do an early aggregation
+// so as to release the gradient tensor to save memory.
+@Namespace("tensorflow::eager") @MemberGetter public static native int kMinAggregateCount();
+@Namespace("tensorflow::eager") @MemberGetter public static native int kMinAggregateBytes();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // namespace eager
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_C_EAGER_TAPE_H_
+
+
+// Parsed from tensorflow/c/eager/gradients.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// #ifndef TENSORFLOW_C_EAGER_GRADIENTS_H_
+// #define TENSORFLOW_C_EAGER_GRADIENTS_H_
+
+// #include "absl/container/flat_hash_map.h"
+// #include "tensorflow/c/eager/abstract_context.h"
+// #include "tensorflow/c/eager/abstract_tensor_handle.h"
+// #include "tensorflow/c/eager/tape.h"
+// #include "tensorflow/core/common_runtime/eager/attr_builder.h"
+// Targeting ../Context.java
+
+
+// Targeting ../IncomingGradients.java
+
+
+// Targeting ../GradientFunction.java
+
+
+// Targeting ../ForwardOperation.java
+
+
+// Targeting ../DefaultGradientFunction.java
+
+
+// Targeting ../AllZerosDefaultGradients.java
+
+
+// Targeting ../PassThroughDefaultGradients.java
+
+
+// Targeting ../BackwardFunction.java
+
+
+// Targeting ../GradientRegistry.java
+
+
+
+// Returns a unique id for the tensor which is used by the tape to build
+// the gradient graph. See documentation of `TapeTensor` for more details.
+@Namespace("tensorflow::gradients") public static native @Cast("tensorflow::int64") long ToId(AbstractTensorHandle t);
+// Targeting ../TapeTensor.java
+
+
+// Targeting ../TapeVSpace.java
+
+
+
+// A tracing/immediate-execution agnostic tape.
+//
+// Gradient functions defined for this library support handling null incoming
+// gradients. `Tape::ComputeGradient` should be called with
+// `build_default_zeros_grads=false`. Calling with
+// `build_default_zeros_grads=true` (the default) is equivalent but just results
+// in extra work because `TapeTensor::ZerosLike` returns a `nullptr` anyway.
+
+ // namespace gradients
+ // namespace tensorflow
+
+// #endif // TENSORFLOW_C_EAGER_GRADIENTS_H_
+
+
}
diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/c_api/presets/tensorflow.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/c_api/presets/tensorflow.java
index 17bf9dbf79a..19aae5b9857 100644
--- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/c_api/presets/tensorflow.java
+++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/c_api/presets/tensorflow.java
@@ -17,10 +17,20 @@
package org.tensorflow.internal.c_api.presets;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
import java.util.List;
import org.bytedeco.javacpp.ClassProperties;
+import org.bytedeco.javacpp.FunctionPointer;
import org.bytedeco.javacpp.LoadEnabled;
import org.bytedeco.javacpp.Loader;
+import org.bytedeco.javacpp.Pointer;
+import org.bytedeco.javacpp.annotation.Adapter;
+import org.bytedeco.javacpp.annotation.ByRef;
+import org.bytedeco.javacpp.annotation.Cast;
import org.bytedeco.javacpp.annotation.NoException;
import org.bytedeco.javacpp.annotation.Platform;
import org.bytedeco.javacpp.annotation.Properties;
@@ -36,7 +46,8 @@
value = {
@Platform(
value = {"linux", "macosx", "windows"},
- compiler = "cpp11",
+ compiler = "cpp14",
+ define = {"NDEBUG", "UNIQUE_PTR_NAMESPACE std", "SHARED_PTR_NAMESPACE std"},
include = {
"tensorflow/core/platform/ctstring_internal.h",
"tensorflow/core/platform/ctstring.h",
@@ -51,7 +62,25 @@
// "tensorflow/c/env.h",
"tensorflow/c/kernels.h",
"tensorflow/c/ops.h",
- "tensorflow/c/eager/c_api.h"
+ "tensorflow/c/eager/c_api.h",
+ "tensorflow_adapters.h",
+// "tensorflow/core/common_runtime/eager/attr_builder.h",
+// "tensorflow/core/framework/types.pb.h",
+// "tensorflow/core/framework/function.pb.h",
+// "tensorflow/core/framework/tensor_shape.h",
+// "tensorflow/core/framework/types.h",
+// "tensorflow/core/protobuf/error_codes.pb.h",
+ "tensorflow/core/platform/errors.h",
+ "tensorflow/core/platform/status.h",
+// "tensorflow/core/platform/refcount.h",
+// "tensorflow/core/platform/types.h",
+ "tensorflow/c/tensor_interface.h",
+ "tensorflow/c/eager/abstract_tensor_handle.h",
+ "tensorflow/c/eager/abstract_function.h",
+ "tensorflow/c/eager/abstract_operation.h",
+ "tensorflow/c/eager/abstract_context.h",
+ "tensorflow/c/eager/tape.h",
+ "tensorflow/c/eager/gradients.h",
},
link = "tensorflow_cc@.2",
preload = {"iomp5", "mklml", "mklml_intel", "tensorflow_framework@.2"},
@@ -196,7 +225,7 @@ public class tensorflow implements LoadEnabled, InfoMapper {
}
public void map(InfoMap infoMap) {
- infoMap.put(new Info("TF_CAPI_EXPORT", "TF_Bool").cppTypes().annotations())
+ infoMap.put(new Info("TF_CAPI_EXPORT", "TF_Bool", "TF_MUST_USE_RESULT").cppTypes().annotations())
.put(new Info("TF_Buffer::data").javaText("public native @Const Pointer data(); public native TF_Buffer data(Pointer data);"))
.put(new Info("TF_Status").pointerTypes("TF_Status").base("org.tensorflow.internal.c_api.AbstractTF_Status"))
.put(new Info("TF_Buffer").pointerTypes("TF_Buffer").base("org.tensorflow.internal.c_api.AbstractTF_Buffer"))
@@ -226,6 +255,109 @@ public void map(InfoMap infoMap) {
.put(new Info("TFE_Op").pointerTypes("TFE_Op").base("org.tensorflow.internal.c_api.AbstractTFE_Op"))
.put(new Info("TFE_Op::operation").javaText("@MemberGetter public native @ByRef EagerOperation operation();"))
.put(new Info("TFE_TensorHandle").pointerTypes("TFE_TensorHandle").base("org.tensorflow.internal.c_api.AbstractTFE_TensorHandle"))
- .put(new Info("TF_ShapeInferenceContextDimValueKnown", "TFE_NewTensorHandle(const tensorflow::Tensor&, TF_Status*)").skip());
+ .put(new Info("TF_ShapeInferenceContextDimValueKnown", "TFE_NewTensorHandle(const tensorflow::Tensor&, TF_Status*)",
+ "tensorflow::errors::internal::PrepareForStrCat").skip())
+
+ .put(new Info("absl::Span", "tensorflow::gtl::ArraySlice").annotations("@Span"))
+ .put(new Info("std::unordered_set").pointerTypes("IntSet").define())
+ .put(new Info("std::unordered_map >").pointerTypes("StringIntSetMap").define())
+ .put(new Info("std::unordered_map").pointerTypes("TensorTape").define())
+ .put(new Info("const std::unordered_map").pointerTypes("LongTapeTensorMap").define())
+ .put(new Info("std::unordered_map >").pointerTypes("OpTape").define())
+ .put(new Info("std::vector").pointerTypes("AbstractTensorHandleVector").define())
+ .put(new Info("std::vector").valueTypes("@StdMove StackFrameVector").pointerTypes("StackFrameVector").define())
+ .put(new Info("tensorflow::error::Code", "tensorflow::DataType").cast().valueTypes("int").pointerTypes("IntPointer", "IntBuffer", "int[]"))
+ .put(new Info("tensorflow::AbstractTensorHandle::AbstractTensorHandleKind",
+ "tensorflow::AbstractFunction::AbstractFunctionKind",
+ "tensorflow::AbstractOperation::AbstractOperationKind",
+ "tensorflow::AbstractContext::AbstractContextKind").valueTypes("int").pointerTypes("IntPointer", "IntBuffer", "int[]"))
+ .put(new Info("tensorflow::int64").cast().valueTypes("long").pointerTypes("LongPointer", "LongBuffer", "long[]"))
+ .put(new Info("tensorflow::string", "absl::string_view", "tensorflow::StringPiece").annotations("@StdString").valueTypes("BytePointer", "String").pointerTypes("BytePointer"))
+ .put(new Info("tensorflow::AttrBuilder", "tensorflow::FunctionDef", "tensorflow::core::RefCounted").cast().pointerTypes("Pointer"))
+
+ .put(new Info("tensorflow::AbstractOperation::AddInputList").javaText(
+ "public native @ByVal Status AddInputList(\n"
+ + " @Cast(\"tensorflow::AbstractTensorHandle**\") @Span PointerPointer inputs);"))
+ .put(new Info("tensorflow::AbstractOperation::Execute").javaText(
+ "public native @ByVal Status Execute(@Cast(\"tensorflow::AbstractTensorHandle**\") @Span PointerPointer retvals,\n"
+ + " IntPointer num_retvals);"))
+ .put(new Info("tensorflow::AbstractOperation::SetAttrFunctionList").javaText(
+ "public native @ByVal Status SetAttrFunctionList(\n"
+ + " @Cast(\"const char*\") BytePointer attr_name, @Cast(\"const tensorflow::AbstractOperation**\") @Span PointerPointer values);"))
+
+ .put(new Info("tensorflow::eager::OpTapeEntry").annotations("@NoOffset").valueTypes("@ByVal OpEntry").pointerTypes("OpEntry"))
+ .put(new Info("tensorflow::eager::OpTapeEntry::backward_function_deleter").javaText(
+ "public native @ByRef @Cast(\"std::function*\") Pointer backward_function_deleter(); public native OpEntry backward_function_deleter(Pointer setter);\n"
+ + "public native @MemberSetter OpEntry backward_function_deleter(BackwardFunctionDeleter setter);"))
+
+ .put(new Info("tensorflow::eager::VSpace").pointerTypes("TapeVSpaceBase"))
+ .put(new Info("tensorflow::eager::VSpace::AggregateGradients",
+ "tensorflow::gradients::TapeVSpace::AggregateGradients").javaText(
+ "public native AbstractTensorHandle AggregateGradients(\n"
+ + " @Cast(\"tensorflow::AbstractTensorHandle**\") @Span PointerPointer gradient_tensors);"))
+ .put(new Info("tensorflow::eager::VSpace::CallBackwardFunction",
+ "tensorflow::gradients::TapeVSpace::CallBackwardFunction").javaText(
+ "public native @ByVal Status CallBackwardFunction(\n"
+ + " BackwardFunction backward_function,\n"
+ + " @Cast(\"tensorflow::int64*\") @StdVector LongPointer unneeded_gradients,\n"
+ + " @Cast(\"tensorflow::AbstractTensorHandle**\") @Span PointerPointer output_gradients,\n"
+ + " @Cast(\"tensorflow::AbstractTensorHandle**\") @StdVector PointerPointer result);"))
+ .put(new Info("tensorflow::eager::VSpace::BuildOnesLike",
+ "tensorflow::gradients::TapeVSpace::BuildOnesLike").javaText(
+ "public native @ByVal Status BuildOnesLike(@Const @ByRef TapeTensor t,\n"
+ + " @Cast(\"tensorflow::AbstractTensorHandle**\") PointerPointer result);"))
+
+ .put(new Info("tensorflow::gradients::DefaultGradientFunction::get",
+ "tensorflow::gradients::AllZerosDefaultGradients::get",
+ "tensorflow::gradients::PassThroughDefaultGradients::get").javaText(
+ "public native AbstractTensorHandle get(Context ctx,\n"
+ + " @Cast(\"tensorflow::AbstractTensorHandle**\") @Span PointerPointer grad_inputs,\n"
+ + " int i);"))
+
+ .put(new Info("tensorflow::eager::GradientTape").pointerTypes("Tape"))
+ .put(new Info("tensorflow::eager::GradientTape::ComputeGradient").javaText(
+ "public native @ByVal Status ComputeGradient(\n"
+ + " @Const @ByRef TapeVSpaceBase vspace,\n"
+ + " @Cast(\"tensorflow::int64*\") @Span LongPointer target_tensor_ids,\n"
+ + " @Cast(\"tensorflow::int64*\") @Span LongPointer source_tensor_ids,\n"
+ + " @Const @ByRef LongTapeTensorMap sources_that_are_targets,\n"
+ + " @Cast(\"tensorflow::AbstractTensorHandle**\") @Span PointerPointer output_gradients,\n"
+ + " AbstractTensorHandleVector result, @Cast(\"bool\") boolean build_default_zeros_grads/*=true*/);"))
+
+ .put(new Info("std::function").pointerTypes("BackwardFunctionFactory"))
+ .put(new Info("std::function").pointerTypes("BackwardFunctionGetter"))
+ .put(new Info("std::function").pointerTypes("BackwardFunctionDeleter"));
+ }
+
+ @Documented @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.METHOD, ElementType.PARAMETER})
+ @Cast({"absl::Span", "&"}) @Adapter("SpanAdapter")
+ public @interface Span { String value() default ""; }
+
+ public static class BackwardFunctionFactory extends FunctionPointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public BackwardFunctionFactory(Pointer p) { super(p); }
+ protected BackwardFunctionFactory() { allocate(); }
+ private native void allocate();
+ public native @Cast("tensorflow::gradients::BackwardFunction*") Pointer call(@ByRef @Cast("const tensorflow::gradients::ForwardOperation*") Pointer op);
+ }
+
+ public static class BackwardFunctionGetter extends FunctionPointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public BackwardFunctionGetter(Pointer p) { super(p); }
+ protected BackwardFunctionGetter() { allocate(); }
+ private native void allocate();
+ public native @Cast("tensorflow::gradients::BackwardFunction*") Pointer call();
+ }
+
+ public static class BackwardFunctionDeleter extends FunctionPointer {
+ static { Loader.load(); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public BackwardFunctionDeleter(Pointer p) { super(p); }
+ protected BackwardFunctionDeleter() { allocate(); }
+ private native void allocate();
+ public native void call(@Cast("tensorflow::gradients::BackwardFunction*") Pointer op);
}
}
diff --git a/tensorflow-core/tensorflow-core-api/src/main/resources/org/tensorflow/internal/c_api/include/tensorflow_adapters.h b/tensorflow-core/tensorflow-core-api/src/main/resources/org/tensorflow/internal/c_api/include/tensorflow_adapters.h
new file mode 100644
index 00000000000..f0ed46ab125
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/main/resources/org/tensorflow/internal/c_api/include/tensorflow_adapters.h
@@ -0,0 +1,45 @@
+/*
+ Copyright 2021 The TensorFlow Authors. All Rights Reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ =======================================================================
+ */
+
+#include "absl/types/span.h"
+
+using namespace absl;
+
+template class SpanAdapter {
+public:
+ SpanAdapter(T const * ptr, typename Span::size_type size, void* owner) : ptr((T*)ptr), size(size), owner(owner),
+ arr2(ptr ? Span((T*)ptr, size) : Span()), arr(arr2) { }
+ SpanAdapter(const Span& arr) : ptr(0), size(0), owner(0), arr2(arr), arr(arr2) { }
+ SpanAdapter( Span& arr) : ptr(0), size(0), owner(0), arr(arr) { }
+ SpanAdapter(const Span* arr) : ptr(0), size(0), owner(0), arr(*(Span*)arr) { }
+ void assign(T* ptr, typename Span::size_type size, void* owner) {
+ this->ptr = ptr;
+ this->size = size;
+ this->owner = owner;
+ arr.set(ptr, size);
+ }
+ static void deallocate(void* owner) { free(owner); }
+ operator T*() { size = arr.size(); return (T*)arr.data(); }
+ operator Span&() { return arr; }
+ operator Span*() { return ptr ? &arr : 0; }
+ T* ptr;
+ typename Span::size_type size;
+ void* owner;
+ Span arr2;
+ Span& arr;
+};
+