diff --git a/README.md b/README.md index 025d25759a7..abfea573d98 100644 --- a/README.md +++ b/README.md @@ -24,20 +24,20 @@ migrated from Bazel to Maven, which is more familiar for most Java developers. The following describes the layout of the repository and its different artifacts: -* `core` +* `tensorflow-core` * All artifacts that build up the core language bindings of TensorFlow for Java. * Those artifacts provide the minimal support required to use the TensorFlow runtime on a JVM. -* `utils` +* `tensorflow-utils` * Utility libraries that do not depend on the TensorFlow runtime but are useful for machine learning purposes -* `frameworks` +* `tensorflow-frameworks` * High-level APIs built on top of the core libraries for simplifying the usage of TensorFlow in Java. -* `starters` +* `tensorflow-starters` * Artifacts aggregating others for simplifying dependency management with TensorFlow -*Note: Right now, only the `core` component is present* +*Note: Right now, only the `tensorflow-core` component is present* ## Building Sources @@ -48,26 +48,27 @@ Note that in some cases, if a version of the TensorFlow runtime library is not f this process will fetch TensorFlow sources and trigger a build of all the native code (which can take many hours on a standard laptop). In this case, you will also need to have a valid environment for building TensorFlow, including the [bazel](https://bazel.build/) build tool and a few python dependencies. Please -read [TensorFlow documentation](https://www.tensorflow.org/install) for more details. +read [TensorFlow documentation](https://www.tensorflow.org/install/source) for more details. ## Using Maven Artifacts -To include TensorFlow in your Maven application, you first need to add a dependency on both -`tensorflow-core` and `tensorflow-core-native` artifacts. The later could be included multiple times -for different targeted systems by their classifiers. +To include TensorFlow in your Maven application, you first need to add a dependency on either the +`tensorflow-core` or `tensorflow-core-platform` artifacts. The former could be included multiple times +for different targeted systems by their classifiers, while the later includes them as dependencies for +`linux-x86_64`, `macosx-x86_64`, and `windows-x86_64`, with more to come in the future. For example, for building a JAR that uses TensorFlow and is targeted to be deployed only on Linux systems, you should add the following dependencies: ```xml org.tensorflow - tensorflow-core - 2.0.0-SNAPSHOT + tensorflow-core-api + 0.1.0-SNAPSHOT org.tensorflow - tensorflow-core-native - 2.0.0-SNAPSHOT + tensorflow-core-api + 0.1.0-SNAPSHOT linux-x86_64 ``` @@ -77,37 +78,37 @@ native dependencies as follows: ```xml org.tensorflow - tensorflow-core - 2.0.0-SNAPSHOT + tensorflow-core-api + 0.1.0-SNAPSHOT org.tensorflow - tensorflow-core-native - 2.0.0-SNAPSHOT + tensorflow-core-api + 0.1.0-SNAPSHOT linux-x86_64 org.tensorflow - tensorflow-core-native - 2.0.0-SNAPSHOT - windows-x86_64 + tensorflow-core-api + 0.1.0-SNAPSHOT + macosx-x86_64 org.tensorflow - tensorflow-core-native - 2.0.0-SNAPSHOT - darwin-x86_64 + tensorflow-core-api + 0.1.0-SNAPSHOT + windows-x86_64 ``` In some cases, pre-configured starter artifacts can help to automatically include all versions of -the native library for a given configuration. For example, the `tensorflow` artifact includes +the native library for a given configuration. For example, the `tensorflow-core-platform` artifact includes transitively all the artifacts above as a single dependency: ```xml org.tensorflow - tensorflow - 2.0.0-SNAPSHOT + tensorflow-core-platform + 0.1.0-SNAPSHOT ``` @@ -115,7 +116,7 @@ Be aware though that the native library is quite large and including too many ve significantly increase the size of your JAR. So it is good practice to limit your dependencies to the platforms you are targeting. -*Note: the `tensorflow` starter artifact is not available at this moment* +*Note: the `tensorflow-starters` artifact is not available at this moment* ## How to Contribute? diff --git a/core/pom.xml b/core/pom.xml deleted file mode 100644 index ac6b62c0ad4..00000000000 --- a/core/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - 4.0.0 - - - org.tensorflow - parent - 2.0.0-SNAPSHOT - - parent-core - pom - - Core Parent - Parent POM of TensorFlow core artifacts - - - annotation-processor - tensorflow-core-native - tensorflow-core - - - - - linux - - - unix - Linux - - - - linux - - - - darwin - - - unix - Mac OS X - - - - darwin - - - - windows - - - windows - - - - windows - - - - - - ${os.adjusted.name}-${os.arch} - - - - diff --git a/core/tensorflow-core-native/BUILD b/core/tensorflow-core-native/BUILD deleted file mode 100644 index 7903f09ad77..00000000000 --- a/core/tensorflow-core-native/BUILD +++ /dev/null @@ -1,67 +0,0 @@ -load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts") - -LINKER_VERSION_SCRIPT = ":config/version_script.lds" -LINKER_EXPORTED_SYMBOLS = ":config/exported_symbols.lds" - -cc_binary( - name = "libtensorflow_jni.so", - # Set linker options to strip out anything except the JNI - # symbols from the library. This reduces the size of the library - # considerably (~50% as of January 2017). - linkopts = select({ - "@org_tensorflow//tensorflow:debug": [], # Disable all custom linker options in debug mode - "//conditions:default": [ - "-z defs", - "-s", - "-Wl,--version-script,$(location {})".format(LINKER_VERSION_SCRIPT), - ], - }), - linkshared = 1, - linkstatic = 1, - copts = tf_copts(), - deps = [ - "@org_tensorflow//tensorflow/core/distributed_runtime/rpc:grpc_server_lib", - "//src/main/native", - LINKER_VERSION_SCRIPT, - LINKER_EXPORTED_SYMBOLS, - ], -) - -cc_binary( - name = "libtensorflow_jni.dylib", - # Set linker options to strip out anything except the JNI - # symbols from the library. This reduces the size of the library - # considerably (~50% as of January 2017). - linkopts = select({ - "@org_tensorflow//tensorflow:debug": [], # Disable all custom linker options in debug mode - "//conditions:default": [ - "-Wl,-exported_symbols_list,$(location {})".format(LINKER_EXPORTED_SYMBOLS), - ], - }), - linkshared = 1, - linkstatic = 1, - copts = tf_copts(), - deps = [ - "@org_tensorflow//tensorflow/core/distributed_runtime/rpc:grpc_server_lib", - "//src/main/native", - LINKER_VERSION_SCRIPT, - LINKER_EXPORTED_SYMBOLS, - ], -) - -cc_binary( - name = "tensorflow_jni.dll", - # Set linker options to strip out anything except the JNI - # symbols from the library. This reduces the size of the library - # considerably (~50% as of January 2017). - linkopts = [], - linkshared = 1, - linkstatic = 1, - copts = tf_copts(), - deps = [ - "@org_tensorflow//tensorflow/core/distributed_runtime/rpc:grpc_server_lib", - "//src/main/native", - LINKER_VERSION_SCRIPT, - LINKER_EXPORTED_SYMBOLS, - ], -) diff --git a/core/tensorflow-core-native/WORKSPACE b/core/tensorflow-core-native/WORKSPACE deleted file mode 100644 index e886d7adbaa..00000000000 --- a/core/tensorflow-core-native/WORKSPACE +++ /dev/null @@ -1,42 +0,0 @@ -workspace(name = "tensorflow_core_native") - -#local_repository( -# name = "tensorflow", -# path = "/Users/klessard/Documents/Projects/MachineLearning/Sources/tensorflow", -#) - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "org_tensorflow", - urls = [ - "https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/v2.0.0-rc0.tar.gz", - "https://github.com/tensorflow/tensorflow/archive/v2.0.0-rc0.tar.gz", - ], - sha256 = "48ddba718da76df56fd4c48b4bbf4f97f254ba269ec4be67f783684c75563ef8", - strip_prefix = "tensorflow-2.0.0-rc0" -) - -# START: Upstream TensorFlow dependencies -# TensorFlow build depends on these dependencies. -# Needs to be in-sync with TensorFlow sources. -http_archive( - name = "io_bazel_rules_closure", - sha256 = "ddce3b3a3909f99b28b25071c40b7fec7e2e1d1d1a4b2e933f3082aa99517105", - strip_prefix = "rules_closure-316e6133888bfc39fb860a4f1a31cfcbae485aef", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/316e6133888bfc39fb860a4f1a31cfcbae485aef.tar.gz", - "https://github.com/bazelbuild/rules_closure/archive/316e6133888bfc39fb860a4f1a31cfcbae485aef.tar.gz", # 2019-03-21 - ], -) -http_archive( - name = "bazel_skylib", - sha256 = "2c62d8cd4ab1e65c08647eb4afe38f51591f43f7f0885e7769832fa137633dcb", - strip_prefix = "bazel-skylib-0.7.0", - urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.7.0.tar.gz"], -) -# END: Upstream TensorFlow dependencies - -load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace") - -tf_workspace() diff --git a/core/tensorflow-core-native/config/exported_symbols.lds b/core/tensorflow-core-native/config/exported_symbols.lds deleted file mode 100644 index 4b79b8c333a..00000000000 --- a/core/tensorflow-core-native/config/exported_symbols.lds +++ /dev/null @@ -1,3 +0,0 @@ -*Java_org_tensorflow_* -*JNI_OnLoad -*JNI_OnUnload diff --git a/core/tensorflow-core-native/config/version_script.lds b/core/tensorflow-core-native/config/version_script.lds deleted file mode 100644 index 38c93dda730..00000000000 --- a/core/tensorflow-core-native/config/version_script.lds +++ /dev/null @@ -1,11 +0,0 @@ -VERS_1.0 { - # Export JNI symbols. - global: - Java_*; - JNI_OnLoad; - JNI_OnUnload; - - # Hide everything else. - local: - *; -}; diff --git a/core/tensorflow-core-native/pom.xml b/core/tensorflow-core-native/pom.xml deleted file mode 100644 index fb26ec7502e..00000000000 --- a/core/tensorflow-core-native/pom.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - 4.0.0 - - - org.tensorflow - parent-core - 2.0.0-SNAPSHOT - - tensorflow-core-native - jar - - Core JNI Library - Platform-dependent native code for the TensorFlow Java library. - - - - linux - - - unix - Linux - - - - libtensorflow_jni.so - - - - darwin - - - unix - Mac OS X - - - - libtensorflow_jni.dylib - - - - windows - - - windows - - - - tensorflow_jni.dll - - - - - - bazel-clean - - - bazel.clean - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - bazel-clean - clean - - exec - - - bazel - - clean - - - - - - - - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - compile-jni - compile - - exec - - - bazel - build -c opt --define=grpc_no_ares=true :${native.lib} - - - - - - maven-resources-plugin - 3.1.0 - - - prepare-package - - copy-resources - - - ${basedir}/target/classes/org/tensorflow/native/${os.adjusted.name}-x86_64 - - - ${basedir}/bazel-bin - - ${native.lib} - - - - - - - - - maven-jar-plugin - - ${native.classifier} - - - - - - diff --git a/core/tensorflow-core-native/src/main/native/BUILD b/core/tensorflow-core-native/src/main/native/BUILD deleted file mode 100644 index 752133bd01c..00000000000 --- a/core/tensorflow-core-native/src/main/native/BUILD +++ /dev/null @@ -1,57 +0,0 @@ -# Description: -# Java Native Interface (JNI) library intended for implementing the -# TensorFlow Java API using the TensorFlow C library. - -package(default_visibility = [ - "//:__pkg__", -]) - -licenses(["notice"]) # Apache 2.0 - -load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts", "tf_gpu_library") - -tf_gpu_library( - name = "native", - srcs = glob(["*.cc"]) + [ - ":copy_jni_h", - ":copy_jni_md_h" - ], - hdrs = glob(["*.h"]), - includes = ["."], - deps = [ - "@org_tensorflow//tensorflow/c:c_api", - "@org_tensorflow//tensorflow/c/eager:c_api", - "@org_tensorflow//tensorflow/core:all_kernels", - "@org_tensorflow//tensorflow/core:direct_session", - "@org_tensorflow//tensorflow/core:ops", - ], - copts = tf_copts(), - alwayslink = 1 -) - -# Silly rules to make -# #include -# in the source headers work -# (in combination with the "includes" attribute of the tf_gpu_library rule -# above. Not needed when using the Android toolchain). -# -# Inspired from: -# https://github.com/bazelbuild/bazel/blob/f99a0543f8d97339d32075c7176b79f35be84606/src/main/native/BUILD -# but hopefully there is a simpler alternative to this. -genrule( - name = "copy_jni_h", - srcs = ["@bazel_tools//tools/jdk:jni_header"], - outs = ["jni.h"], - cmd = "cp -f $< $@", -) - -genrule( - name = "copy_jni_md_h", - srcs = select({ - "@org_tensorflow//tensorflow:windows": ["@bazel_tools//tools/jdk:jni_md_header-windows"], - "@org_tensorflow//tensorflow:macos": ["@bazel_tools//tools/jdk:jni_md_header-darwin"], - "//conditions:default": ["@bazel_tools//tools/jdk:jni_md_header-linux"], - }), - outs = ["jni_md.h"], - cmd = "cp -f $< $@", -) diff --git a/core/tensorflow-core/pom.xml b/core/tensorflow-core/pom.xml deleted file mode 100644 index efba4b66327..00000000000 --- a/core/tensorflow-core/pom.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - 4.0.0 - - - org.tensorflow - parent-core - 2.0.0-SNAPSHOT - - tensorflow-core - jar - - Core Java Client - Pure-Java code for the TensorFlow machine intelligence library. - - - - org.tensorflow - annotation-processor - ${project.version} - true - - - junit - junit - 4.12 - test - - - org.tensorflow - tensorflow-core-native - ${project.version} - ${native.classifier} - test - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - extract-ops - generate-sources - - exec - - - - - jar - - xf - ${project.basedir}/src/external/java_op_gen_sources.srcjar - - ${project.build.directory}/generated-sources - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.1 - - 1.7 - 1.7 - - - org.tensorflow.processor.operator.OperatorProcessor - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - -Xdoclint:none - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/src/main/ - ${project.build.directory}/generated-sources/annotations/ - - - - - - - - diff --git a/core/tensorflow-core/src/external/java_op_gen_sources.srcjar b/core/tensorflow-core/src/external/java_op_gen_sources.srcjar deleted file mode 100644 index 5ded1c52b8c..00000000000 Binary files a/core/tensorflow-core/src/external/java_op_gen_sources.srcjar and /dev/null differ diff --git a/pom.xml b/pom.xml index 62243f7f6be..9cae184350a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,11 +4,11 @@ 4.0.0 org.tensorflow - parent - 2.0.0-SNAPSHOT + tensorflow-java + 0.1.0-SNAPSHOT pom - Parent Artifact + TensorFlow Java Parent Parent POM of TensorFlow artifacts https://www.tensorflow.org @@ -29,10 +29,10 @@ - - core - - + tensorflow-core + + + + + + 4.0.0 + + + org.tensorflow + tensorflow-java + 0.1.0-SNAPSHOT + + tensorflow-core + pom + + TensorFlow Core Parent + Parent POM of TensorFlow core artifacts + + + tensorflow-core-generator + tensorflow-core-api + tensorflow-core-platform + + + + ${os.adjusted.name}-${os.arch} + false + false + false + + ${javacpp.platform} + linux-armhf${javacpp.platform.extension} + linux-arm64${javacpp.platform.extension} + linux-ppc64le${javacpp.platform.extension} + linux-x86${javacpp.platform.extension} + linux-x86_64${javacpp.platform.extension} + macosx-x86_64${javacpp.platform.extension} + windows-x86${javacpp.platform.extension} + windows-x86_64${javacpp.platform.extension} + 1.5.1 + 0.20-${javacpp.version} + + + + + javacpp-platform-default + + + !javacpp.platform + + + + ${os.name}-${os.arch} + + + + + javacpp-platform-custom + + + javacpp.platform + + + + ${javacpp.platform}${javacpp.platform.extension} + ${javacpp.platform}${javacpp.platform.extension} + ${javacpp.platform}${javacpp.platform.extension} + ${javacpp.platform}${javacpp.platform.extension} + ${javacpp.platform}${javacpp.platform.extension} + ${javacpp.platform}${javacpp.platform.extension} + ${javacpp.platform}${javacpp.platform.extension} + ${javacpp.platform}${javacpp.platform.extension} + + + + + javacpp-platform-host + + + javacpp.platform.host + + + + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + ${os.name}-${os.arch}${javacpp.platform.extension} + + + + + javacpp.platform.custom-true + + + javacpp.platform.custom + + + + + + + + + + + + + + + + + javacpp-platform-none + + + javacpp.platform.none + + + + + + + + + + + + + + + + + javacpp-platform-linux-armhf + + + javacpp.platform + linux-armhf + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + + + + + + + javacpp-platform-linux-arm64 + + + javacpp.platform + linux-arm64 + + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + + + + + + javacpp-platform-linux-ppc64le + + + javacpp.platform + linux-ppc64le + + + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + + + + + javacpp-platform-linux-x86 + + + javacpp.platform + linux-x86 + + + + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + + + + javacpp-platform-linux-x86_64 + + + javacpp.platform + linux-x86_64 + + + + + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + + + javacpp-platform-macosx-x86_64 + + + javacpp.platform + macosx-x86_64 + + + + + + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + + javacpp-platform-windows-x86 + + + javacpp.platform + windows-x86 + + + + + + + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + javacpp-platform-windows-x86_64 + + + javacpp.platform + windows-x86_64 + + + + + + + + + + + ${javacpp.platform}${javacpp.platform.extension} + + + + + + no-platform-dependency + + + ${basedir} + + + + + + + + + + + + + + + + + javacpp.platform.linux-armhf-true + + + javacpp.platform.linux-armhf + + + + linux-armhf + + + + + javacpp.platform.linux-arm64-true + + + javacpp.platform.linux-arm64 + + + + linux-arm64 + + + + + javacpp.platform.linux-ppc64le-true + + + javacpp.platform.linux-ppc64le + + + + linux-ppc64le + + + + + javacpp.platform.linux-x86-true + + + javacpp.platform.linux-x86 + + + + linux-x86 + + + + + javacpp.platform.linux-x86_64-true + + + javacpp.platform.linux-x86_64 + + + + linux-x86_64 + + + + + javacpp.platform.macosx-x86_64-true + + + javacpp.platform.macosx-x86_64 + + + + macosx-x86_64 + + + + + javacpp.platform.windows-x86-true + + + javacpp.platform.windows-x86 + + + + windows-x86 + + + + + javacpp.platform.windows-x86_64-true + + + javacpp.platform.windows-x86_64 + + + + windows-x86_64 + + + + + javacpp.platform.custom-linux-arm + + + javacpp.platform.host + + linuxarm + + + linux-armhf + + + + + javacpp.platform.custom-linux-armhf + + + javacpp.platform.host + + linuxarmhf + + + linux-armhf + + + + + javacpp.platform.custom-linux-aarch64 + + + javacpp.platform.host + + linuxaarch64 + + + linux-arm64 + + + + + javacpp.platform.custom-linux-armv8 + + + javacpp.platform.host + + linuxarmv8 + + + linux-arm64 + + + + + javacpp.platform.custom-linux-arm64 + + + javacpp.platform.host + + linuxarm64 + + + linux-arm64 + + + + + javacpp.platform.custom-linux-ppc64le + + + javacpp.platform.host + + linuxppc64le + + + linux-ppc64le + + + + + javacpp.platform.custom-linux-amd64 + + + javacpp.platform.host + + linuxamd64 + + + linux-x86_64 + + + + + javacpp.platform.custom-linux-x86-64 + + + javacpp.platform.host + + linuxx86-64 + + + linux-x86_64 + + + + + javacpp.platform.custom-linux-x86_64 + + + javacpp.platform.host + + linuxx86_64 + + + linux-x86_64 + + + + + javacpp.platform.custom-macosx-amd64 + + + javacpp.platform.host + + mac os xamd64 + + + macosx-x86_64 + + + + + javacpp.platform.custom-macosx-x86-64 + + + javacpp.platform.host + + mac os xx86-64 + + + macosx-x86_64 + + + + + javacpp.platform.custom-macosx-x86_64 + + + javacpp.platform.host + + mac os xx86_64 + + + macosx-x86_64 + + + + + javacpp.platform.custom-windows-amd64 + + + javacpp.platform.host + + windowsamd64 + + + windows-x86_64 + + + + + javacpp.platform.custom-windows-x86-64 + + + javacpp.platform.host + + windowsx86-64 + + + windows-x86_64 + + + + + javacpp.platform.custom-windows-x86_64 + + + javacpp.platform.host + + windowsx86_64 + + + windows-x86_64 + + + + + + linuxos + + linux + + + linux + linux + + + + macosx + + mac os x + + + darwin + macosx + + + + windowsos + + windows + + + windows + windows + + + + arm + + arm + + + armhf + + + + aarch64 + + aarch64 + + + arm64 + + + + armv8 + + armv8 + + + arm64 + + + + i386 + + i386 + + + x86 + + + + i486 + + i486 + + + x86 + + + + i586 + + i586 + + + x86 + + + + i686 + + i686 + + + x86 + + + + amd64 + + amd64 + + + x86_64 + + + + x86-64 + + x86-64 + + + x86_64 + + + + + linux + + + unix + Linux + + + + linux + + + + darwin + + + unix + Mac OS X + + + + darwin + + + + windows + + + windows + + + + windows + + + + + + diff --git a/tensorflow-core/tensorflow-core-api/.bazelrc b/tensorflow-core/tensorflow-core-api/.bazelrc new file mode 100644 index 00000000000..4b673d3fcfb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/.bazelrc @@ -0,0 +1,172 @@ +# Android configs. Bazel needs to have --cpu and --fat_apk_cpu both set to the +# target CPU to build transient dependencies correctly. See +# https://docs.bazel.build/versions/master/user-manual.html#flag--fat_apk_cpu +build:android --crosstool_top=//external:android/crosstool +build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain +build:android_arm --config=android +build:android_arm --cpu=armeabi-v7a +build:android_arm --fat_apk_cpu=armeabi-v7a +build:android_arm64 --config=android +build:android_arm64 --cpu=arm64-v8a +build:android_arm64 --fat_apk_cpu=arm64-v8a +build:android_x86 --config=android +build:android_x86 --cpu=x86 +build:android_x86 --fat_apk_cpu=x86 +build:android_x86_64 --config=android +build:android_x86_64 --cpu=x86_64 +build:android_x86_64 --fat_apk_cpu=x86_64 + +# Sets the default Apple platform to macOS. +build --apple_platform_type=macos + +# Config to use a mostly-static build and disable modular op registration +# support (this will revert to loading TensorFlow with RTLD_GLOBAL in Python). +# By default, TensorFlow will build with a dependence on +# //tensorflow:libtensorflow_framework.so. +build:monolithic --define framework_shared_object=false + +# For projects which use TensorFlow as part of a Bazel build process, putting +# nothing in a bazelrc will default to a monolithic build. The following line +# opts in to modular op registration support by default. +build --define framework_shared_object=true + +# Flags for open source build, always set to be true. +build --define open_source_build=true +test --define open_source_build=true + +# Please note that MKL on MacOS or windows is still not supported. +# If you would like to use a local MKL instead of downloading, please set the +# environment variable "TF_MKL_ROOT" every time before build. +build:mkl --define=build_with_mkl=true --define=enable_mkl=true +build:mkl --define=tensorflow_mkldnn_contraction_kernel=0 +build:mkl -c opt + +# This config option is used to enable MKL-DNN open source library only, +# without depending on MKL binary version. +build:mkl_open_source_only --define=build_with_mkl_dnn_only=true +build:mkl_open_source_only --define=build_with_mkl_dnn_v1_only=true +build:mkl_open_source_only --define=build_with_mkl=true --define=enable_mkl=true +build:mkl_open_source_only --define=tensorflow_mkldnn_contraction_kernel=0 + +build:download_clang --crosstool_top=@local_config_download_clang//:toolchain +build:download_clang --define=using_clang=true +build:download_clang --action_env TF_DOWNLOAD_CLANG=1 +# Instruct clang to use LLD for linking. +# This only works with GPU builds currently, since Bazel sets -B/usr/bin in +# auto-generated CPU crosstool, forcing /usr/bin/ld.lld to be preferred over +# the downloaded one. +build:download_clang_use_lld --linkopt='-fuse-ld=lld' + +# This config refers to building with CUDA available. It does not necessarily +# mean that we build CUDA op kernels. +build:using_cuda --define=using_cuda=true +build:using_cuda --action_env TF_NEED_CUDA=1 +build:using_cuda --crosstool_top=@local_config_cuda//crosstool:toolchain + +# This config refers to building CUDA op kernels with nvcc. +build:cuda --config=using_cuda +build:cuda --define=using_cuda_nvcc=true + +# This config refers to building CUDA op kernels with clang. +build:cuda_clang --config=using_cuda +build:cuda_clang --define=using_cuda_clang=true +build:cuda_clang --define=using_clang=true + +build:tensorrt --action_env TF_NEED_TENSORRT=1 + +build:rocm --crosstool_top=@local_config_rocm//crosstool:toolchain +build:rocm --define=using_rocm=true --define=using_rocm_hipcc=true +build:rocm --action_env TF_NEED_ROCM=1 + +build:sycl --crosstool_top=@local_config_sycl//crosstool:toolchain +build:sycl --define=using_sycl=true +build:sycl --action_env TF_NEED_OPENCL_SYCL=1 + +build:sycl_nodouble --config=sycl +build:sycl_nodouble --cxxopt -DTENSORFLOW_SYCL_NO_DOUBLE + +build:sycl_nodouble --config=sycl +build:sycl_asan --copt -fno-omit-frame-pointer --copt -fsanitize-coverage=3 --copt -DGPR_NO_DIRECT_SYSCALLS --linkopt -fPIC --linkopt -fsanitize=address + +build:sycl_nodouble --config=sycl +build:sycl_trisycl --define=using_trisycl=true + +# Options extracted from configure script +build:gdr --define=with_gdr_support=true +build:ngraph --define=with_ngraph_support=true +build:verbs --define=with_verbs_support=true +build:numa --define=with_numa_support=true + +# Options to disable default on features +build:noaws --define=no_aws_support=true +build:nogcp --define=no_gcp_support=true +build:nohdfs --define=no_hdfs_support=true +build:nokafka --define=no_kafka_support=true +build:noignite --define=no_ignite_support=true +build:nonccl --define=no_nccl_support=true + +build --define=use_fast_cpp_protos=true +build --define=allow_oversize_protos=true + +build --spawn_strategy=standalone +build --strategy=Genrule=standalone +build -c opt + +# Make Bazel print out all options from rc files. +build --announce_rc + +# Other build flags. +build --define=grpc_no_ares=true + +# Modular TF build options +build:dynamic_kernels --define=dynamic_loaded_kernels=true +build:dynamic_kernels --copt=-DAUTOLOAD_DYNAMIC_KERNELS + +# Build TF with C++ 17 features. +build:c++17 --cxxopt=-std=c++1z +build:c++17 --cxxopt=-stdlib=libc++ +build:c++1z --config=c++17 + +# Default paths for TF_SYSTEM_LIBS +build --define=PREFIX=/usr +build --define=LIBDIR=$(PREFIX)/lib +build --define=INCLUDEDIR=$(PREFIX)/include + +# Suppress all warning messages. +build:short_logs --output_filter=DONT_MATCH_ANYTHING + +# Options when using remote execution +build:rbe --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 +build:rbe --auth_enabled=true +build:rbe --auth_scope=https://www.googleapis.com/auth/cloud-source-tools +build:rbe --define=EXECUTOR=remote +build:rbe --flaky_test_attempts=3 +build:rbe --jobs=200 +build:rbe --remote_accept_cached=true +build:rbe --remote_cache=remotebuildexecution.googleapis.com +build:rbe --remote_executor=remotebuildexecution.googleapis.com +build:rbe --remote_local_fallback=false +build:rbe --remote_timeout=600 +build:rbe --spawn_strategy=remote +build:rbe --strategy=Genrule=remote +build:rbe --strategy=Closure=remote +build:rbe --strategy=Javac=remote +build:rbe --strategy=TestRunner=remote +build:rbe --tls_enabled +test:rbe --test_env=USER=anon + +# Options to build TensorFlow 1.x or 2.x. +build:v1 --define=tf_api_version=1 +build:v2 --define=tf_api_version=2 +test:v1 --test_env=TF2_BEHAVIOR=0 +test:v2 --test_env=TF2_BEHAVIOR=1 +build --config=v2 +test --config=v2 + +# Default options should come above this line + +# Options from ./configure +try-import %workspace%/.tf_configure.bazelrc + +# Put user-specific options in .bazelrc.user +try-import %workspace%/.bazelrc.user diff --git a/tensorflow-core/tensorflow-core-api/BUILD b/tensorflow-core/tensorflow-core-api/BUILD new file mode 100644 index 00000000000..dc3ef3784e5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/BUILD @@ -0,0 +1 @@ +load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts") diff --git a/tensorflow-core/tensorflow-core-api/WORKSPACE b/tensorflow-core/tensorflow-core-api/WORKSPACE new file mode 100644 index 00000000000..5821d0db5d8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/WORKSPACE @@ -0,0 +1,48 @@ +workspace(name = "tensorflow_core_api") + +#local_repository( +# name = "tensorflow", +# path = "/Users/klessard/Documents/Projects/MachineLearning/Sources/tensorflow", +#) + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "org_tensorflow", + # https://github.com/tensorflow/tensorflow/issues/25213 + patches = [":tensorflow-windows.patch"], + patch_args = ["-p1"], + urls = [ + "https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/v2.0.0.tar.gz", + "https://github.com/tensorflow/tensorflow/archive/v2.0.0.tar.gz", + ], + sha256 = "49b5f0495cd681cbcb5296a4476853d4aea19a43bdd9f179c928a977308a0617", + strip_prefix = "tensorflow-2.0.0" +) + +# START: Upstream TensorFlow dependencies +# TensorFlow build depends on these dependencies. +# Needs to be in-sync with TensorFlow sources. +http_archive( + name = "io_bazel_rules_closure", + sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9", + strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149", + urls = [ + "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", + "https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13 + ], +) +http_archive( + name = "bazel_skylib", + sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e", + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz"], +) +# END: Upstream TensorFlow dependencies +load("@org_tensorflow//tensorflow:workspace.bzl", "tf_repositories") +tf_repositories() + +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories") +closure_repositories() + +load("@org_tensorflow//tensorflow:workspace.bzl", "tf_bind") +tf_bind() diff --git a/tensorflow-core/tensorflow-core-api/build.sh b/tensorflow-core/tensorflow-core-api/build.sh new file mode 100755 index 00000000000..c7e5e8e8c5f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/build.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Script to build native TensorFlow libraries +set -eu + +# Allows us to use ccache with Bazel on Mac +export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 + +export BAZEL_VC="${VCINSTALLDIR:-}" +if [[ -d $BAZEL_VC ]]; then + # Work around compiler issues on Windows documented mainly in configure.py + export BUILD_FLAGS="--copt=//arch:AVX `#--copt=//arch:AVX2` --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --define=override_eigen_strong_inline=true" + # https://software.intel.com/en-us/articles/intel-optimization-for-tensorflow-installation-guide#wind_B_S + export PATH=$PATH:$(pwd)/bazel-tensorflow-core-api/external/mkl_windows/lib/ + export PYTHON_BIN_PATH=$(which python.exe) +else + export BUILD_FLAGS="--copt=-msse4.1 --copt=-msse4.2 --copt=-mavx `#--copt=-mavx2 --copt=-mfma`" + export PYTHON_BIN_PATH=$(which python3) +fi + +# Build C API of TensorFlow itself including a target to generate ops for Java +bazel build $BUILD_FLAGS --python_path="$PYTHON_BIN_PATH" --config=monolithic --config=mkl --output_filter=DONT_MATCH_ANYTHING --verbose_failures @org_tensorflow//tensorflow:tensorflow @org_tensorflow//tensorflow/java:tensorflow + +# Normalize some paths with symbolic links +TENSORFLOW_SO=(bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.so.?.?.?) +if [[ -f $TENSORFLOW_SO ]]; then + ln -sf $(basename $TENSORFLOW_SO) bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.so + ln -sf $(basename $TENSORFLOW_SO) bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.so.2 +fi +TENSORFLOW_DYLIB=(bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.?.?.?.dylib) +if [[ -f $TENSORFLOW_DYLIB ]]; then + ln -sf $(basename $TENSORFLOW_DYLIB) bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.dylib + ln -sf $(basename $TENSORFLOW_DYLIB) bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.2.dylib +fi +TENSORFLOW_LIB=(bazel-bin/external/org_tensorflow/tensorflow/tensorflow.dll.if.lib) +if [[ -f $TENSORFLOW_LIB ]]; then + ln -sf $(basename $TENSORFLOW_LIB) bazel-bin/external/org_tensorflow/tensorflow/tensorflow.lib +fi + +# Copy only main generated Java source files for ops +mkdir -p src/gen/java/ +cp -r bazel-genfiles/external/org_tensorflow/tensorflow/java/ops/src/main/java/* src/gen/java/ diff --git a/tensorflow-core/tensorflow-core-api/external/tensorflow-windows.patch b/tensorflow-core/tensorflow-core-api/external/tensorflow-windows.patch new file mode 100644 index 00000000000..df96098954f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/external/tensorflow-windows.patch @@ -0,0 +1,30 @@ +diff -ruN tensorflow-1.14.0-rc1/third_party/mkl/mkl.BUILD tensorflow-1.14.0-rc1-windows/third_party/mkl/mkl.BUILD +--- tensorflow-1.14.0-rc1/third_party/mkl/mkl.BUILD 2019-06-08 11:23:20.000000000 +0900 ++++ tensorflow-1.14.0-rc1-windows/third_party/mkl/mkl.BUILD 2019-06-12 08:30:41.232683854 +0900 +@@ -35,11 +35,23 @@ + visibility = ["//visibility:public"], + ) + ++cc_import( ++ name = "iomp5", ++ interface_library = "lib/libiomp5md.lib", ++ system_provided = 1, ++) ++ ++cc_import( ++ name = "mklml", ++ interface_library = "lib/mklml.lib", ++ system_provided = 1, ++) ++ + cc_library( + name = "mkl_libs_windows", +- srcs = [ +- "lib/libiomp5md.lib", +- "lib/mklml.lib", ++ deps = [ ++ "iomp5", ++ "mklml", + ], + linkopts = ["/FORCE:MULTIPLE"], + visibility = ["//visibility:public"], diff --git a/tensorflow-core/tensorflow-core-api/pom.xml b/tensorflow-core/tensorflow-core-api/pom.xml new file mode 100644 index 00000000000..35bed91f824 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/pom.xml @@ -0,0 +1,312 @@ + + + 4.0.0 + + + org.tensorflow + tensorflow-core + 0.1.0-SNAPSHOT + + tensorflow-core-api + jar + + TensorFlow Core API Library + Platform-dependent native code and pure-Java code for the TensorFlow machine intelligence library. + + + + org.bytedeco + javacpp + ${javacpp.version} + + + org.bytedeco + mkl-dnn + ${mkl-dnn.version} + + + org.tensorflow + tensorflow-core-generator + ${project.version} + true + + + junit + junit + 4.12 + test + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add-source + generate-sources + + add-source + + + + ${project.basedir}/src/gen/java + + + + + + + maven-resources-plugin + 3.1.0 + + + javacpp-parser + generate-sources + + resources + + + + + + maven-compiler-plugin + 3.8.0 + + 1.7 + 1.7 + + + + default-compile + + + org.tensorflow.processor.operator.OperatorProcessor + + + ${project.basedir}/src/gen/annotations + + + + javacpp-parser + generate-sources + + compile + + + + org/tensorflow/c_api/presets/*.java + + + + + + + org.bytedeco + javacpp + ${javacpp.version} + + ${javacpp.platform.properties} + + + platform.root + ${javacpp.platform.root} + + + platform.compiler + ${javacpp.platform.compiler} + + + platform.extension + ${javacpp.platform.extension} + + + ${project.build.outputDirectory} + + ${project.basedir}/ + ${project.basedir}/bazel-tensorflow-core-api/external/org_tensorflow/ + + + ${project.basedir}/bazel-bin/external/org_tensorflow/tensorflow/ + + + ${project.basedir}/bazel-tensorflow-core-api/external/mkl_linux/lib/ + ${project.basedir}/bazel-tensorflow-core-api/external/mkl_darwin/lib/ + ${project.basedir}/bazel-tensorflow-core-api/external/mkl_windows/lib/ + + + ${project.basedir}/src/main/native/eager_operation_builder_jni.cc + ${project.basedir}/src/main/native/eager_operation_jni.cc + ${project.basedir}/src/main/native/eager_session_jni.cc + ${project.basedir}/src/main/native/exception_jni.cc + ${project.basedir}/src/main/native/graph_jni.cc + ${project.basedir}/src/main/native/graph_operation_builder_jni.cc + ${project.basedir}/src/main/native/graph_operation_jni.cc + ${project.basedir}/src/main/native/saved_model_bundle_jni.cc + ${project.basedir}/src/main/native/server_jni.cc + ${project.basedir}/src/main/native/session_jni.cc + ${project.basedir}/src/main/native/tensorflow_jni.cc + ${project.basedir}/src/main/native/tensor_jni.cc + ${project.basedir}/src/main/native/utils_jni.cc + + + + + javacpp-validate + validate + + build + + + + javacpp-build + initialize + + build + + + ${javacpp.build.skip} + + bash + ${project.basedir}/build.sh + + ${project.basedir} + + + + javacpp-clean + clean + + build + + + ${javacpp.build.skip} + + bazel + clean + + ${project.basedir} + + + + javacpp-parser + generate-sources + + parse + + + ${javacpp.parser.skip} + ${project.basedir}/src/gen/java + org.tensorflow.c_api.presets.* + + + + javacpp-compiler + process-classes + + build + + + ${project.build.directory}/native/org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/ + ${javacpp.compiler.skip} + org.tensorflow.c_api.** + true + true + + + + + + maven-surefire-plugin + 2.22.0 + + ${project.build.directory}/native/ + + + + maven-jar-plugin + 3.1.0 + + + default-jar + package + + jar + + + + org/tensorflow/** + + + + + javacpp-${javacpp.platform}${javacpp.platform.extension} + package + + jar + + + ${javacpp.platform}${javacpp.platform.extension} + true + + + org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/ + + ${project.build.directory}/native + + org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/*.exp + org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/*.lib + org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/*.obj + org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/*mklml* + org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/*iomp5* + org/tensorflow/c_api/${javacpp.platform}${javacpp.platform.extension}/*msvcr120* + + + + + + + maven-source-plugin + 3.0.1 + + + attach-sources + leave-disabled-to-not-generate-sources-twice-on-release + + + attach-source + + jar-no-fork + + + + + + maven-javadoc-plugin + 3.0.1 + + + attach-javadocs + + jar + + + false + 256m + 2048m + + http://bytedeco.org/javacpp/apidocs + + + + + + + + diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/AudioOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/AudioOps.java new file mode 100644 index 00000000000..e284ca9edb6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/AudioOps.java @@ -0,0 +1,73 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.audio.AudioSpectrogram; +import org.tensorflow.op.audio.DecodeWav; +import org.tensorflow.op.audio.EncodeWav; +import org.tensorflow.op.audio.Mfcc; + +/** + * An API for building {@code audio} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class AudioOps { + private final Scope scope; + + AudioOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link AudioSpectrogram} operation + * + * @param input Float representation of audio data. + * @param windowSize How wide the input window is in samples. For the highest efficiency + * @param stride How widely apart the center of adjacent sample windows should be. + * @param options carries optional attributes values + * @return a new instance of AudioSpectrogram + * @see org.tensorflow.op.audio.AudioSpectrogram + */ + public AudioSpectrogram audioSpectrogram(Operand input, Long windowSize, Long stride, + AudioSpectrogram.Options... options) { + return AudioSpectrogram.create(scope, input, windowSize, stride, options); + } + + /** + * Builds an {@link EncodeWav} operation + * + * @param audio 2-D with shape `[length, channels]`. + * @param sampleRate Scalar containing the sample frequency. + * @return a new instance of EncodeWav + * @see org.tensorflow.op.audio.EncodeWav + */ + public EncodeWav encodeWav(Operand audio, Operand sampleRate) { + return EncodeWav.create(scope, audio, sampleRate); + } + + /** + * Builds an {@link DecodeWav} operation + * + * @param contents The WAV-encoded audio, usually from a file. + * @param options carries optional attributes values + * @return a new instance of DecodeWav + * @see org.tensorflow.op.audio.DecodeWav + */ + public DecodeWav decodeWav(Operand contents, DecodeWav.Options... options) { + return DecodeWav.create(scope, contents, options); + } + + /** + * Builds an {@link Mfcc} operation + * + * @param spectrogram Typically produced by the Spectrogram op, with magnitude_squared + * @param sampleRate How many samples per second the source audio used. + * @param options carries optional attributes values + * @return a new instance of Mfcc + * @see org.tensorflow.op.audio.Mfcc + */ + public Mfcc mfcc(Operand spectrogram, Operand sampleRate, + Mfcc.Options... options) { + return Mfcc.create(scope, spectrogram, sampleRate, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/BitwiseOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/BitwiseOps.java new file mode 100644 index 00000000000..51798c83e24 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/BitwiseOps.java @@ -0,0 +1,93 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.bitwise.BitwiseAnd; +import org.tensorflow.op.bitwise.BitwiseOr; +import org.tensorflow.op.bitwise.BitwiseXor; +import org.tensorflow.op.bitwise.Invert; +import org.tensorflow.op.bitwise.LeftShift; +import org.tensorflow.op.bitwise.RightShift; + +/** + * An API for building {@code bitwise} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class BitwiseOps { + private final Scope scope; + + BitwiseOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link Invert} operation + * + * @param x + * @return a new instance of Invert + * @see org.tensorflow.op.bitwise.Invert + */ + public Invert invert(Operand x) { + return Invert.create(scope, x); + } + + /** + * Builds an {@link BitwiseAnd} operation + * + * @param x + * @param y + * @return a new instance of BitwiseAnd + * @see org.tensorflow.op.bitwise.BitwiseAnd + */ + public BitwiseAnd bitwiseAnd(Operand x, Operand y) { + return BitwiseAnd.create(scope, x, y); + } + + /** + * Builds an {@link BitwiseOr} operation + * + * @param x + * @param y + * @return a new instance of BitwiseOr + * @see org.tensorflow.op.bitwise.BitwiseOr + */ + public BitwiseOr bitwiseOr(Operand x, Operand y) { + return BitwiseOr.create(scope, x, y); + } + + /** + * Builds an {@link LeftShift} operation + * + * @param x + * @param y + * @return a new instance of LeftShift + * @see org.tensorflow.op.bitwise.LeftShift + */ + public LeftShift leftShift(Operand x, Operand y) { + return LeftShift.create(scope, x, y); + } + + /** + * Builds an {@link RightShift} operation + * + * @param x + * @param y + * @return a new instance of RightShift + * @see org.tensorflow.op.bitwise.RightShift + */ + public RightShift rightShift(Operand x, Operand y) { + return RightShift.create(scope, x, y); + } + + /** + * Builds an {@link BitwiseXor} operation + * + * @param x + * @param y + * @return a new instance of BitwiseXor + * @see org.tensorflow.op.bitwise.BitwiseXor + */ + public BitwiseXor bitwiseXor(Operand x, Operand y) { + return BitwiseXor.create(scope, x, y); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DataOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DataOps.java new file mode 100644 index 00000000000..6bb3e67e93f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DataOps.java @@ -0,0 +1,176 @@ +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Shape; +import org.tensorflow.op.data.AnonymousIterator; +import org.tensorflow.op.data.DeserializeIterator; +import org.tensorflow.op.data.IteratorGetNext; +import org.tensorflow.op.data.IteratorGetNextAsOptional; +import org.tensorflow.op.data.IteratorGetNextSync; +import org.tensorflow.op.data.IteratorToStringHandle; +import org.tensorflow.op.data.MakeIterator; +import org.tensorflow.op.data.OptionalFromValue; +import org.tensorflow.op.data.OptionalGetValue; +import org.tensorflow.op.data.OptionalHasValue; +import org.tensorflow.op.data.OptionalNone; +import org.tensorflow.op.data.SerializeIterator; + +/** + * An API for building {@code data} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class DataOps { + private final Scope scope; + + DataOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link OptionalNone} operation + * + * @return a new instance of OptionalNone + * @see org.tensorflow.op.data.OptionalNone + */ + public OptionalNone optionalNone() { + return OptionalNone.create(scope); + } + + /** + * Builds an {@link AnonymousIterator} operation + * + * @param outputTypes + * @param outputShapes + * @return a new instance of AnonymousIterator + * @see org.tensorflow.op.data.AnonymousIterator + */ + public AnonymousIterator anonymousIterator(List> outputTypes, List outputShapes) { + return AnonymousIterator.create(scope, outputTypes, outputShapes); + } + + /** + * Builds an {@link OptionalGetValue} operation + * + * @param optional + * @param outputTypes + * @param outputShapes + * @return a new instance of OptionalGetValue + * @see org.tensorflow.op.data.OptionalGetValue + */ + public OptionalGetValue optionalGetValue(Operand optional, List> outputTypes, + List outputShapes) { + return OptionalGetValue.create(scope, optional, outputTypes, outputShapes); + } + + /** + * Builds an {@link IteratorGetNext} operation + * + * @param iterator + * @param outputTypes + * @param outputShapes + * @return a new instance of IteratorGetNext + * @see org.tensorflow.op.data.IteratorGetNext + */ + public IteratorGetNext iteratorGetNext(Operand iterator, List> outputTypes, + List outputShapes) { + return IteratorGetNext.create(scope, iterator, outputTypes, outputShapes); + } + + /** + * Builds an {@link OptionalFromValue} operation + * + * @param components + * @return a new instance of OptionalFromValue + * @see org.tensorflow.op.data.OptionalFromValue + */ + public OptionalFromValue optionalFromValue(Iterable> components) { + return OptionalFromValue.create(scope, components); + } + + /** + * Builds an {@link IteratorGetNextAsOptional} operation + * + * @param iterator + * @param outputTypes + * @param outputShapes + * @return a new instance of IteratorGetNextAsOptional + * @see org.tensorflow.op.data.IteratorGetNextAsOptional + */ + public IteratorGetNextAsOptional iteratorGetNextAsOptional(Operand iterator, + List> outputTypes, List outputShapes) { + return IteratorGetNextAsOptional.create(scope, iterator, outputTypes, outputShapes); + } + + /** + * Builds an {@link IteratorToStringHandle} operation + * + * @param resourceHandle A handle to an iterator resource. + * @return a new instance of IteratorToStringHandle + * @see org.tensorflow.op.data.IteratorToStringHandle + */ + public IteratorToStringHandle iteratorToStringHandle(Operand resourceHandle) { + return IteratorToStringHandle.create(scope, resourceHandle); + } + + /** + * Builds an {@link IteratorGetNextSync} operation + * + * @param iterator + * @param outputTypes + * @param outputShapes + * @return a new instance of IteratorGetNextSync + * @see org.tensorflow.op.data.IteratorGetNextSync + */ + public IteratorGetNextSync iteratorGetNextSync(Operand iterator, List> outputTypes, + List outputShapes) { + return IteratorGetNextSync.create(scope, iterator, outputTypes, outputShapes); + } + + /** + * Builds an {@link OptionalHasValue} operation + * + * @param optional + * @return a new instance of OptionalHasValue + * @see org.tensorflow.op.data.OptionalHasValue + */ + public OptionalHasValue optionalHasValue(Operand optional) { + return OptionalHasValue.create(scope, optional); + } + + /** + * Builds an {@link MakeIterator} operation + * + * @param dataset + * @param iterator + * @return a new instance of MakeIterator + * @see org.tensorflow.op.data.MakeIterator + */ + public MakeIterator makeIterator(Operand dataset, Operand iterator) { + return MakeIterator.create(scope, dataset, iterator); + } + + /** + * Builds an {@link DeserializeIterator} operation + * + * @param resourceHandle A handle to an iterator resource. + * @param serialized A variant tensor storing the state of the iterator contained in the + * @return a new instance of DeserializeIterator + * @see org.tensorflow.op.data.DeserializeIterator + */ + public DeserializeIterator deserializeIterator(Operand resourceHandle, Operand serialized) { + return DeserializeIterator.create(scope, resourceHandle, serialized); + } + + /** + * Builds an {@link SerializeIterator} operation + * + * @param resourceHandle A handle to an iterator resource. + * @return a new instance of SerializeIterator + * @see org.tensorflow.op.data.SerializeIterator + */ + public SerializeIterator serializeIterator(Operand resourceHandle) { + return SerializeIterator.create(scope, resourceHandle); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DtypesOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DtypesOps.java new file mode 100644 index 00000000000..7766fefed69 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DtypesOps.java @@ -0,0 +1,57 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.dtypes.AsString; +import org.tensorflow.op.dtypes.Cast; +import org.tensorflow.op.dtypes.Complex; + +/** + * An API for building {@code dtypes} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class DtypesOps { + private final Scope scope; + + DtypesOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link Cast} operation + * + * @param x + * @param DstT + * @param options carries optional attributes values + * @return a new instance of Cast + * @see org.tensorflow.op.dtypes.Cast + */ + public Cast cast(Operand x, Class DstT, Cast.Options... options) { + return Cast.create(scope, x, DstT, options); + } + + /** + * Builds an {@link AsString} operation + * + * @param input + * @param options carries optional attributes values + * @return a new instance of AsString + * @see org.tensorflow.op.dtypes.AsString + */ + public AsString asString(Operand input, AsString.Options... options) { + return AsString.create(scope, input, options); + } + + /** + * Builds an {@link Complex} operation + * + * @param real + * @param imag + * @param Tout + * @return a new instance of Complex + * @see org.tensorflow.op.dtypes.Complex + */ + public Complex complex(Operand real, Operand imag, Class Tout) { + return Complex.create(scope, real, imag, Tout); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/ImageOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/ImageOps.java new file mode 100644 index 00000000000..98e4a46455c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/ImageOps.java @@ -0,0 +1,476 @@ +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.op.image.AdjustContrast; +import org.tensorflow.op.image.AdjustHue; +import org.tensorflow.op.image.AdjustSaturation; +import org.tensorflow.op.image.CropAndResize; +import org.tensorflow.op.image.CropAndResizeGradBoxes; +import org.tensorflow.op.image.CropAndResizeGradImage; +import org.tensorflow.op.image.DecodeAndCropJpeg; +import org.tensorflow.op.image.DecodeBmp; +import org.tensorflow.op.image.DecodeGif; +import org.tensorflow.op.image.DecodeJpeg; +import org.tensorflow.op.image.DecodePng; +import org.tensorflow.op.image.DrawBoundingBoxes; +import org.tensorflow.op.image.EncodeJpeg; +import org.tensorflow.op.image.EncodeJpegVariableQuality; +import org.tensorflow.op.image.EncodePng; +import org.tensorflow.op.image.ExtractGlimpse; +import org.tensorflow.op.image.ExtractImagePatches; +import org.tensorflow.op.image.ExtractJpegShape; +import org.tensorflow.op.image.HsvToRgb; +import org.tensorflow.op.image.NonMaxSuppression; +import org.tensorflow.op.image.NonMaxSuppressionWithOverlaps; +import org.tensorflow.op.image.QuantizedResizeBilinear; +import org.tensorflow.op.image.RandomCrop; +import org.tensorflow.op.image.ResizeArea; +import org.tensorflow.op.image.ResizeBicubic; +import org.tensorflow.op.image.ResizeBilinear; +import org.tensorflow.op.image.ResizeNearestNeighbor; +import org.tensorflow.op.image.RgbToHsv; +import org.tensorflow.op.image.SampleDistortedBoundingBox; +import org.tensorflow.types.UInt8; + +/** + * An API for building {@code image} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class ImageOps { + private final Scope scope; + + ImageOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link AdjustHue} operation + * + * @param images Images to adjust. At least 3-D. + * @param delta A float delta to add to the hue. + * @return a new instance of AdjustHue + * @see org.tensorflow.op.image.AdjustHue + */ + public AdjustHue adjustHue(Operand images, Operand delta) { + return AdjustHue.create(scope, images, delta); + } + + /** + * Builds an {@link EncodePng} operation + * + * @param image 3-D with shape `[height, width, channels]`. + * @param options carries optional attributes values + * @return a new instance of EncodePng + * @see org.tensorflow.op.image.EncodePng + */ + public EncodePng encodePng(Operand image, EncodePng.Options... options) { + return EncodePng.create(scope, image, options); + } + + /** + * Builds an {@link SampleDistortedBoundingBox} operation + * + * @param imageSize 1-D, containing `[height, width, channels]`. + * @param boundingBoxes 3-D with shape `[batch, N, 4]` describing the N bounding boxes + * @param minObjectCovered The cropped area of the image must contain at least this + * @param options carries optional attributes values + * @return a new instance of SampleDistortedBoundingBox + * @see org.tensorflow.op.image.SampleDistortedBoundingBox + */ + public SampleDistortedBoundingBox sampleDistortedBoundingBox( + Operand imageSize, Operand boundingBoxes, Operand minObjectCovered, + SampleDistortedBoundingBox.Options... options) { + return SampleDistortedBoundingBox.create(scope, imageSize, boundingBoxes, minObjectCovered, options); + } + + /** + * Builds an {@link DecodeGif} operation + * + * @param contents 0-D. The GIF-encoded image. + * @return a new instance of DecodeGif + * @see org.tensorflow.op.image.DecodeGif + */ + public DecodeGif decodeGif(Operand contents) { + return DecodeGif.create(scope, contents); + } + + /** + * Builds an {@link RandomCrop} operation + * + * @param image 3-D of shape `[height, width, channels]`. + * @param size 1-D of length 2 containing: `crop_height`, `crop_width`.. + * @param options carries optional attributes values + * @return a new instance of RandomCrop + * @see org.tensorflow.op.image.RandomCrop + */ + public RandomCrop randomCrop(Operand image, Operand size, + RandomCrop.Options... options) { + return RandomCrop.create(scope, image, size, options); + } + + /** + * Builds an {@link DecodePng} operation + * + * @param contents 0-D. The PNG-encoded image. + * @param dtype + * @param options carries optional attributes values + * @return a new instance of DecodePng + * @see org.tensorflow.op.image.DecodePng + */ + public DecodePng decodePng(Operand contents, Class dtype, + DecodePng.Options... options) { + return DecodePng.create(scope, contents, dtype, options); + } + + /** + * Builds an {@link NonMaxSuppression} operation + * + * @param boxes A 2-D float tensor of shape `[num_boxes, 4]`. + * @param scores A 1-D float tensor of shape `[num_boxes]` representing a single + * @param maxOutputSize A scalar integer tensor representing the maximum number of + * @param iouThreshold A 0-D float tensor representing the threshold for deciding whether + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * @param options carries optional attributes values + * @return a new instance of NonMaxSuppression + * @see org.tensorflow.op.image.NonMaxSuppression + */ + public NonMaxSuppression nonMaxSuppression(Operand boxes, + Operand scores, Operand maxOutputSize, Operand iouThreshold, + Operand scoreThreshold, NonMaxSuppression.Options... options) { + return NonMaxSuppression.create(scope, boxes, scores, maxOutputSize, iouThreshold, scoreThreshold, options); + } + + /** + * Builds an {@link ResizeBilinear} operation + * + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * @param options carries optional attributes values + * @return a new instance of ResizeBilinear + * @see org.tensorflow.op.image.ResizeBilinear + */ + public ResizeBilinear resizeBilinear(Operand images, Operand size, + ResizeBilinear.Options... options) { + return ResizeBilinear.create(scope, images, size, options); + } + + /** + * Builds an {@link DecodePng} operation + * + * @param contents 0-D. The PNG-encoded image. + * @param options carries optional attributes values + * @return a new instance of DecodePng + * @see org.tensorflow.op.image.DecodePng + */ + public DecodePng decodePng(Operand contents, DecodePng.Options... options) { + return DecodePng.create(scope, contents, options); + } + + /** + * Builds an {@link ExtractJpegShape} operation + * + * @param contents 0-D. The JPEG-encoded image. + * @return a new instance of ExtractJpegShape + * @see org.tensorflow.op.image.ExtractJpegShape + */ + public ExtractJpegShape extractJpegShape(Operand contents) { + return ExtractJpegShape.create(scope, contents); + } + + /** + * Builds an {@link AdjustContrast} operation + * + * @param images Images to adjust. At least 3-D. + * @param contrastFactor A float multiplier for adjusting contrast. + * @return a new instance of AdjustContrast + * @see org.tensorflow.op.image.AdjustContrast + */ + public AdjustContrast adjustContrast(Operand images, + Operand contrastFactor) { + return AdjustContrast.create(scope, images, contrastFactor); + } + + /** + * Builds an {@link CropAndResizeGradImage} operation + * + * @param grads A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. + * @param boxes A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor + * @param boxInd A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. + * @param imageSize A 1-D tensor with value `[batch, image_height, image_width, depth]` + * @param T + * @param options carries optional attributes values + * @return a new instance of CropAndResizeGradImage + * @see org.tensorflow.op.image.CropAndResizeGradImage + */ + public CropAndResizeGradImage cropAndResizeGradImage(Operand grads, + Operand boxes, Operand boxInd, Operand imageSize, Class T, + CropAndResizeGradImage.Options... options) { + return CropAndResizeGradImage.create(scope, grads, boxes, boxInd, imageSize, T, options); + } + + /** + * Builds an {@link CropAndResize} operation + * + * @param image A 4-D tensor of shape `[batch, image_height, image_width, depth]`. + * @param boxes A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor + * @param boxInd A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. + * @param cropSize A 1-D tensor of 2 elements, `size = [crop_height, crop_width]`. All + * @param options carries optional attributes values + * @return a new instance of CropAndResize + * @see org.tensorflow.op.image.CropAndResize + */ + public CropAndResize cropAndResize(Operand image, Operand boxes, + Operand boxInd, Operand cropSize, CropAndResize.Options... options) { + return CropAndResize.create(scope, image, boxes, boxInd, cropSize, options); + } + + /** + * Builds an {@link AdjustSaturation} operation + * + * @param images Images to adjust. At least 3-D. + * @param scale A float scale to add to the saturation. + * @return a new instance of AdjustSaturation + * @see org.tensorflow.op.image.AdjustSaturation + */ + public AdjustSaturation adjustSaturation(Operand images, + Operand scale) { + return AdjustSaturation.create(scope, images, scale); + } + + /** + * Builds an {@link DecodeAndCropJpeg} operation + * + * @param contents 0-D. The JPEG-encoded image. + * @param cropWindow 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width]. + * @param options carries optional attributes values + * @return a new instance of DecodeAndCropJpeg + * @see org.tensorflow.op.image.DecodeAndCropJpeg + */ + public DecodeAndCropJpeg decodeAndCropJpeg(Operand contents, Operand cropWindow, + DecodeAndCropJpeg.Options... options) { + return DecodeAndCropJpeg.create(scope, contents, cropWindow, options); + } + + /** + * Builds an {@link DecodeJpeg} operation + * + * @param contents 0-D. The JPEG-encoded image. + * @param options carries optional attributes values + * @return a new instance of DecodeJpeg + * @see org.tensorflow.op.image.DecodeJpeg + */ + public DecodeJpeg decodeJpeg(Operand contents, DecodeJpeg.Options... options) { + return DecodeJpeg.create(scope, contents, options); + } + + /** + * Builds an {@link ExtractGlimpse} operation + * + * @param input A 4-D float tensor of shape `[batch_size, height, width, channels]`. + * @param size A 1-D tensor of 2 elements containing the size of the glimpses + * @param offsets A 2-D integer tensor of shape `[batch_size, 2]` containing + * @param options carries optional attributes values + * @return a new instance of ExtractGlimpse + * @see org.tensorflow.op.image.ExtractGlimpse + */ + public ExtractGlimpse extractGlimpse(Operand input, Operand size, + Operand offsets, ExtractGlimpse.Options... options) { + return ExtractGlimpse.create(scope, input, size, offsets, options); + } + + /** + * Builds an {@link DecodeBmp} operation + * + * @param contents 0-D. The BMP-encoded image. + * @param options carries optional attributes values + * @return a new instance of DecodeBmp + * @see org.tensorflow.op.image.DecodeBmp + */ + public DecodeBmp decodeBmp(Operand contents, DecodeBmp.Options... options) { + return DecodeBmp.create(scope, contents, options); + } + + /** + * Builds an {@link ExtractJpegShape} operation + * + * @param contents 0-D. The JPEG-encoded image. + * @param outputType (Optional) The output type of the operation (int32 or int64). + * @return a new instance of ExtractJpegShape + * @see org.tensorflow.op.image.ExtractJpegShape + */ + public ExtractJpegShape extractJpegShape(Operand contents, + Class outputType) { + return ExtractJpegShape.create(scope, contents, outputType); + } + + /** + * Builds an {@link ResizeArea} operation + * + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * @param options carries optional attributes values + * @return a new instance of ResizeArea + * @see org.tensorflow.op.image.ResizeArea + */ + public ResizeArea resizeArea(Operand images, Operand size, + ResizeArea.Options... options) { + return ResizeArea.create(scope, images, size, options); + } + + /** + * Builds an {@link RgbToHsv} operation + * + * @param images 1-D or higher rank. RGB data to convert. Last dimension must be size 3. + * @return a new instance of RgbToHsv + * @see org.tensorflow.op.image.RgbToHsv + */ + public RgbToHsv rgbToHsv(Operand images) { + return RgbToHsv.create(scope, images); + } + + /** + * Builds an {@link EncodeJpegVariableQuality} operation + * + * @param images Images to adjust. At least 3-D. + * @param quality An int quality to encode to. + * @return a new instance of EncodeJpegVariableQuality + * @see org.tensorflow.op.image.EncodeJpegVariableQuality + */ + public EncodeJpegVariableQuality encodeJpegVariableQuality(Operand images, + Operand quality) { + return EncodeJpegVariableQuality.create(scope, images, quality); + } + + /** + * Builds an {@link CropAndResizeGradBoxes} operation + * + * @param grads A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. + * @param image A 4-D tensor of shape `[batch, image_height, image_width, depth]`. + * @param boxes A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor + * @param boxInd A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. + * @param options carries optional attributes values + * @return a new instance of CropAndResizeGradBoxes + * @see org.tensorflow.op.image.CropAndResizeGradBoxes + */ + public CropAndResizeGradBoxes cropAndResizeGradBoxes(Operand grads, + Operand image, Operand boxes, Operand boxInd, + CropAndResizeGradBoxes.Options... options) { + return CropAndResizeGradBoxes.create(scope, grads, image, boxes, boxInd, options); + } + + /** + * Builds an {@link ExtractImagePatches} operation + * + * @param images 4-D Tensor with shape `[batch, in_rows, in_cols, depth]`. + * @param ksizes The size of the sliding window for each dimension of `images`. + * @param strides How far the centers of two consecutive patches are in + * @param rates Must be: `[1, rate_rows, rate_cols, 1]`. This is the + * @param padding The type of padding algorithm to use. + * @return a new instance of ExtractImagePatches + * @see org.tensorflow.op.image.ExtractImagePatches + */ + public ExtractImagePatches extractImagePatches(Operand images, + List ksizes, List strides, List rates, String padding) { + return ExtractImagePatches.create(scope, images, ksizes, strides, rates, padding); + } + + /** + * Builds an {@link DrawBoundingBoxes} operation + * + * @param images 4-D with shape `[batch, height, width, depth]`. A batch of images. + * @param boxes 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding + * @return a new instance of DrawBoundingBoxes + * @see org.tensorflow.op.image.DrawBoundingBoxes + */ + public DrawBoundingBoxes drawBoundingBoxes(Operand images, + Operand boxes) { + return DrawBoundingBoxes.create(scope, images, boxes); + } + + /** + * Builds an {@link NonMaxSuppressionWithOverlaps} operation + * + * @param overlaps A 2-D float tensor of shape `[num_boxes, num_boxes]` representing + * @param scores A 1-D float tensor of shape `[num_boxes]` representing a single + * @param maxOutputSize A scalar integer tensor representing the maximum number of + * @param overlapThreshold A 0-D float tensor representing the threshold for deciding whether + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * @return a new instance of NonMaxSuppressionWithOverlaps + * @see org.tensorflow.op.image.NonMaxSuppressionWithOverlaps + */ + public NonMaxSuppressionWithOverlaps nonMaxSuppressionWithOverlaps(Operand overlaps, + Operand scores, Operand maxOutputSize, Operand overlapThreshold, + Operand scoreThreshold) { + return NonMaxSuppressionWithOverlaps.create(scope, overlaps, scores, maxOutputSize, overlapThreshold, scoreThreshold); + } + + /** + * Builds an {@link ResizeBicubic} operation + * + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * @param options carries optional attributes values + * @return a new instance of ResizeBicubic + * @see org.tensorflow.op.image.ResizeBicubic + */ + public ResizeBicubic resizeBicubic(Operand images, Operand size, + ResizeBicubic.Options... options) { + return ResizeBicubic.create(scope, images, size, options); + } + + /** + * Builds an {@link QuantizedResizeBilinear} operation + * + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of QuantizedResizeBilinear + * @see org.tensorflow.op.image.QuantizedResizeBilinear + */ + public QuantizedResizeBilinear quantizedResizeBilinear(Operand images, + Operand size, Operand min, Operand max, + QuantizedResizeBilinear.Options... options) { + return QuantizedResizeBilinear.create(scope, images, size, min, max, options); + } + + /** + * Builds an {@link ResizeNearestNeighbor} operation + * + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * @param options carries optional attributes values + * @return a new instance of ResizeNearestNeighbor + * @see org.tensorflow.op.image.ResizeNearestNeighbor + */ + public ResizeNearestNeighbor resizeNearestNeighbor(Operand images, + Operand size, ResizeNearestNeighbor.Options... options) { + return ResizeNearestNeighbor.create(scope, images, size, options); + } + + /** + * Builds an {@link HsvToRgb} operation + * + * @param images 1-D or higher rank. HSV data to convert. Last dimension must be size 3. + * @return a new instance of HsvToRgb + * @see org.tensorflow.op.image.HsvToRgb + */ + public HsvToRgb hsvToRgb(Operand images) { + return HsvToRgb.create(scope, images); + } + + /** + * Builds an {@link EncodeJpeg} operation + * + * @param image 3-D with shape `[height, width, channels]`. + * @param options carries optional attributes values + * @return a new instance of EncodeJpeg + * @see org.tensorflow.op.image.EncodeJpeg + */ + public EncodeJpeg encodeJpeg(Operand image, EncodeJpeg.Options... options) { + return EncodeJpeg.create(scope, image, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java new file mode 100644 index 00000000000..04978cbdab3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java @@ -0,0 +1,695 @@ +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Shape; +import org.tensorflow.op.io.DecodeBase64; +import org.tensorflow.op.io.DecodeCompressed; +import org.tensorflow.op.io.DecodeCsv; +import org.tensorflow.op.io.DecodeJsonExample; +import org.tensorflow.op.io.DecodeRaw; +import org.tensorflow.op.io.DeserializeManySparse; +import org.tensorflow.op.io.EncodeBase64; +import org.tensorflow.op.io.FifoQueue; +import org.tensorflow.op.io.FixedLengthRecordReader; +import org.tensorflow.op.io.IdentityReader; +import org.tensorflow.op.io.LmdbReader; +import org.tensorflow.op.io.MatchingFiles; +import org.tensorflow.op.io.PaddingFifoQueue; +import org.tensorflow.op.io.ParseExample; +import org.tensorflow.op.io.ParseSequenceExample; +import org.tensorflow.op.io.ParseSingleExample; +import org.tensorflow.op.io.ParseSingleSequenceExample; +import org.tensorflow.op.io.ParseTensor; +import org.tensorflow.op.io.PriorityQueue; +import org.tensorflow.op.io.QueueClose; +import org.tensorflow.op.io.QueueDequeue; +import org.tensorflow.op.io.QueueDequeueMany; +import org.tensorflow.op.io.QueueDequeueUpTo; +import org.tensorflow.op.io.QueueEnqueue; +import org.tensorflow.op.io.QueueEnqueueMany; +import org.tensorflow.op.io.QueueIsClosed; +import org.tensorflow.op.io.QueueSize; +import org.tensorflow.op.io.RandomShuffleQueue; +import org.tensorflow.op.io.ReadFile; +import org.tensorflow.op.io.ReaderNumRecordsProduced; +import org.tensorflow.op.io.ReaderNumWorkUnitsCompleted; +import org.tensorflow.op.io.ReaderRead; +import org.tensorflow.op.io.ReaderReadUpTo; +import org.tensorflow.op.io.ReaderReset; +import org.tensorflow.op.io.ReaderRestoreState; +import org.tensorflow.op.io.ReaderSerializeState; +import org.tensorflow.op.io.SerializeManySparse; +import org.tensorflow.op.io.SerializeSparse; +import org.tensorflow.op.io.SerializeTensor; +import org.tensorflow.op.io.ShardedFilename; +import org.tensorflow.op.io.ShardedFilespec; +import org.tensorflow.op.io.TextLineReader; +import org.tensorflow.op.io.TfRecordReader; +import org.tensorflow.op.io.WholeFileReader; +import org.tensorflow.op.io.WriteFile; + +/** + * An API for building {@code io} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class IoOps { + private final Scope scope; + + IoOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link QueueEnqueueMany} operation + * + * @param handle The handle to a queue. + * @param components One or more tensors from which the enqueued tensors should + * @param options carries optional attributes values + * @return a new instance of QueueEnqueueMany + * @see org.tensorflow.op.io.QueueEnqueueMany + */ + public QueueEnqueueMany queueEnqueueMany(Operand handle, Iterable> components, + QueueEnqueueMany.Options... options) { + return QueueEnqueueMany.create(scope, handle, components, options); + } + + /** + * Builds an {@link ReaderReset} operation + * + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderReset + * @see org.tensorflow.op.io.ReaderReset + */ + public ReaderReset readerReset(Operand readerHandle) { + return ReaderReset.create(scope, readerHandle); + } + + /** + * Builds an {@link QueueDequeue} operation + * + * @param handle The handle to a queue. + * @param componentTypes The type of each component in a tuple. + * @param options carries optional attributes values + * @return a new instance of QueueDequeue + * @see org.tensorflow.op.io.QueueDequeue + */ + public QueueDequeue queueDequeue(Operand handle, List> componentTypes, + QueueDequeue.Options... options) { + return QueueDequeue.create(scope, handle, componentTypes, options); + } + + /** + * Builds an {@link ReaderRestoreState} operation + * + * @param readerHandle Handle to a Reader. + * @param state Result of a ReaderSerializeState of a Reader with type + * @return a new instance of ReaderRestoreState + * @see org.tensorflow.op.io.ReaderRestoreState + */ + public ReaderRestoreState readerRestoreState(Operand readerHandle, Operand state) { + return ReaderRestoreState.create(scope, readerHandle, state); + } + + /** + * Builds an {@link ParseSingleExample} operation + * + * @param serialized A vector containing a batch of binary serialized Example protos. + * @param denseDefaults A list of Tensors (some may be empty), whose length matches + * @param numSparse The number of sparse features to be parsed from the example. This + * @param sparseKeys A list of `num_sparse` strings. + * @param denseKeys The keys expected in the Examples' features associated with dense + * @param sparseTypes A list of `num_sparse` types; the data types of data in each + * @param denseShapes The shapes of data in each Feature given in dense_keys. + * @return a new instance of ParseSingleExample + * @see org.tensorflow.op.io.ParseSingleExample + */ + public ParseSingleExample parseSingleExample(Operand serialized, + Iterable> denseDefaults, Long numSparse, List sparseKeys, + List denseKeys, List> sparseTypes, List denseShapes) { + return ParseSingleExample.create(scope, serialized, denseDefaults, numSparse, sparseKeys, denseKeys, sparseTypes, denseShapes); + } + + /** + * Builds an {@link DecodeJsonExample} operation + * + * @param jsonExamples Each string is a JSON object serialized according to the JSON + * @return a new instance of DecodeJsonExample + * @see org.tensorflow.op.io.DecodeJsonExample + */ + public DecodeJsonExample decodeJsonExample(Operand jsonExamples) { + return DecodeJsonExample.create(scope, jsonExamples); + } + + /** + * Builds an {@link ParseSequenceExample} operation + * + * @param serialized A vector containing binary serialized SequenceExample protos. + * @param debugName A vector containing the names of the serialized protos. + * @param contextDenseDefaults A list of Ncontext_dense Tensors (some may be empty). + * @param featureListDenseMissingAssumedEmpty A vector listing the + * @param contextSparseKeys A list of Ncontext_sparse string Tensors (scalars). + * @param contextDenseKeys A list of Ncontext_dense string Tensors (scalars). + * @param featureListSparseKeys A list of Nfeature_list_sparse string Tensors + * @param featureListDenseKeys A list of Nfeature_list_dense string Tensors (scalars). + * @param contextSparseTypes A list of Ncontext_sparse types; the data types of data in + * @param featureListDenseTypes + * @param featureListSparseTypes A list of Nfeature_list_sparse types; the data types + * @param options carries optional attributes values + * @return a new instance of ParseSequenceExample + * @see org.tensorflow.op.io.ParseSequenceExample + */ + public ParseSequenceExample parseSequenceExample(Operand serialized, + Operand debugName, Iterable> contextDenseDefaults, + List featureListDenseMissingAssumedEmpty, List contextSparseKeys, + List contextDenseKeys, List featureListSparseKeys, + List featureListDenseKeys, List> contextSparseTypes, + List> featureListDenseTypes, List> featureListSparseTypes, + ParseSequenceExample.Options... options) { + return ParseSequenceExample.create(scope, serialized, debugName, contextDenseDefaults, featureListDenseMissingAssumedEmpty, contextSparseKeys, contextDenseKeys, featureListSparseKeys, featureListDenseKeys, contextSparseTypes, featureListDenseTypes, featureListSparseTypes, options); + } + + /** + * Builds an {@link IdentityReader} operation + * + * @param options carries optional attributes values + * @return a new instance of IdentityReader + * @see org.tensorflow.op.io.IdentityReader + */ + public IdentityReader identityReader(IdentityReader.Options... options) { + return IdentityReader.create(scope, options); + } + + /** + * Builds an {@link SerializeManySparse} operation + * + * @param sparseIndices 2-D. The `indices` of the minibatch `SparseTensor`. + * @param sparseValues 1-D. The `values` of the minibatch `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the minibatch `SparseTensor`. + * @return a new instance of SerializeManySparse + * @see org.tensorflow.op.io.SerializeManySparse + */ + public SerializeManySparse serializeManySparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape) { + return SerializeManySparse.create(scope, sparseIndices, sparseValues, sparseShape); + } + + /** + * Builds an {@link ShardedFilename} operation + * + * @param basename + * @param shard + * @param numShards + * @return a new instance of ShardedFilename + * @see org.tensorflow.op.io.ShardedFilename + */ + public ShardedFilename shardedFilename(Operand basename, Operand shard, + Operand numShards) { + return ShardedFilename.create(scope, basename, shard, numShards); + } + + /** + * Builds an {@link WholeFileReader} operation + * + * @param options carries optional attributes values + * @return a new instance of WholeFileReader + * @see org.tensorflow.op.io.WholeFileReader + */ + public WholeFileReader wholeFileReader(WholeFileReader.Options... options) { + return WholeFileReader.create(scope, options); + } + + /** + * Builds an {@link SerializeSparse} operation + * + * @param sparseIndices 2-D. The `indices` of the `SparseTensor`. + * @param sparseValues 1-D. The `values` of the `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the `SparseTensor`. + * @param outType The `dtype` to use for serialization; the supported types are `string` + * @return a new instance of SerializeSparse + * @see org.tensorflow.op.io.SerializeSparse + */ + public SerializeSparse serializeSparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, Class outType) { + return SerializeSparse.create(scope, sparseIndices, sparseValues, sparseShape, outType); + } + + /** + * Builds an {@link PriorityQueue} operation + * + * @param componentTypes The type of each component in a value. + * @param shapes The shape of each component in a value. The length of this attr must + * @param options carries optional attributes values + * @return a new instance of PriorityQueue + * @see org.tensorflow.op.io.PriorityQueue + */ + public PriorityQueue priorityQueue(List> componentTypes, List shapes, + PriorityQueue.Options... options) { + return PriorityQueue.create(scope, componentTypes, shapes, options); + } + + /** + * Builds an {@link ReaderReadUpTo} operation + * + * @param readerHandle Handle to a `Reader`. + * @param queueHandle Handle to a `Queue`, with string work items. + * @param numRecords number of records to read from `Reader`. + * @return a new instance of ReaderReadUpTo + * @see org.tensorflow.op.io.ReaderReadUpTo + */ + public ReaderReadUpTo readerReadUpTo(Operand readerHandle, Operand queueHandle, + Operand numRecords) { + return ReaderReadUpTo.create(scope, readerHandle, queueHandle, numRecords); + } + + /** + * Builds an {@link ReaderNumRecordsProduced} operation + * + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderNumRecordsProduced + * @see org.tensorflow.op.io.ReaderNumRecordsProduced + */ + public ReaderNumRecordsProduced readerNumRecordsProduced(Operand readerHandle) { + return ReaderNumRecordsProduced.create(scope, readerHandle); + } + + /** + * Builds an {@link QueueEnqueue} operation + * + * @param handle The handle to a queue. + * @param components One or more tensors from which the enqueued tensors should be taken. + * @param options carries optional attributes values + * @return a new instance of QueueEnqueue + * @see org.tensorflow.op.io.QueueEnqueue + */ + public QueueEnqueue queueEnqueue(Operand handle, Iterable> components, + QueueEnqueue.Options... options) { + return QueueEnqueue.create(scope, handle, components, options); + } + + /** + * Builds an {@link QueueDequeueUpTo} operation + * + * @param handle The handle to a queue. + * @param n The number of tuples to dequeue. + * @param componentTypes The type of each component in a tuple. + * @param options carries optional attributes values + * @return a new instance of QueueDequeueUpTo + * @see org.tensorflow.op.io.QueueDequeueUpTo + */ + public QueueDequeueUpTo queueDequeueUpTo(Operand handle, Operand n, + List> componentTypes, QueueDequeueUpTo.Options... options) { + return QueueDequeueUpTo.create(scope, handle, n, componentTypes, options); + } + + /** + * Builds an {@link DecodeCompressed} operation + * + * @param bytes A Tensor of string which is compressed. + * @param options carries optional attributes values + * @return a new instance of DecodeCompressed + * @see org.tensorflow.op.io.DecodeCompressed + */ + public DecodeCompressed decodeCompressed(Operand bytes, + DecodeCompressed.Options... options) { + return DecodeCompressed.create(scope, bytes, options); + } + + /** + * Builds an {@link ReaderSerializeState} operation + * + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderSerializeState + * @see org.tensorflow.op.io.ReaderSerializeState + */ + public ReaderSerializeState readerSerializeState(Operand readerHandle) { + return ReaderSerializeState.create(scope, readerHandle); + } + + /** + * Builds an {@link QueueClose} operation + * + * @param handle The handle to a queue. + * @param options carries optional attributes values + * @return a new instance of QueueClose + * @see org.tensorflow.op.io.QueueClose + */ + public QueueClose queueClose(Operand handle, QueueClose.Options... options) { + return QueueClose.create(scope, handle, options); + } + + /** + * Builds an {@link ParseExample} operation + * + * @param serialized A vector containing a batch of binary serialized Example protos. + * @param names A vector containing the names of the serialized protos. + * @param sparseKeys A list of Nsparse string Tensors (scalars). + * @param denseKeys A list of Ndense string Tensors (scalars). + * @param denseDefaults A list of Ndense Tensors (some may be empty). + * @param sparseTypes A list of Nsparse types; the data types of data in each Feature + * @param denseShapes A list of Ndense shapes; the shapes of data in each Feature + * @return a new instance of ParseExample + * @see org.tensorflow.op.io.ParseExample + */ + public ParseExample parseExample(Operand serialized, Operand names, + Iterable> sparseKeys, Iterable> denseKeys, + Iterable> denseDefaults, List> sparseTypes, List denseShapes) { + return ParseExample.create(scope, serialized, names, sparseKeys, denseKeys, denseDefaults, sparseTypes, denseShapes); + } + + /** + * Builds an {@link WriteFile} operation + * + * @param filename scalar. The name of the file to which we write the contents. + * @param contents scalar. The content to be written to the output file. + * @return a new instance of WriteFile + * @see org.tensorflow.op.io.WriteFile + */ + public WriteFile writeFile(Operand filename, Operand contents) { + return WriteFile.create(scope, filename, contents); + } + + /** + * Builds an {@link RandomShuffleQueue} operation + * + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of RandomShuffleQueue + * @see org.tensorflow.op.io.RandomShuffleQueue + */ + public RandomShuffleQueue randomShuffleQueue(List> componentTypes, + RandomShuffleQueue.Options... options) { + return RandomShuffleQueue.create(scope, componentTypes, options); + } + + /** + * Builds an {@link ReadFile} operation + * + * @param filename + * @return a new instance of ReadFile + * @see org.tensorflow.op.io.ReadFile + */ + public ReadFile readFile(Operand filename) { + return ReadFile.create(scope, filename); + } + + /** + * Builds an {@link FifoQueue} operation + * + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of FifoQueue + * @see org.tensorflow.op.io.FifoQueue + */ + public FifoQueue fifoQueue(List> componentTypes, FifoQueue.Options... options) { + return FifoQueue.create(scope, componentTypes, options); + } + + /** + * Builds an {@link DeserializeManySparse} operation + * + * @param serializedSparse 2-D, The `N` serialized `SparseTensor` objects. + * @param dtype The `dtype` of the serialized `SparseTensor` objects. + * @return a new instance of DeserializeManySparse + * @see org.tensorflow.op.io.DeserializeManySparse + */ + public DeserializeManySparse deserializeManySparse(Operand serializedSparse, + Class dtype) { + return DeserializeManySparse.create(scope, serializedSparse, dtype); + } + + /** + * Builds an {@link TfRecordReader} operation + * + * @param options carries optional attributes values + * @return a new instance of TfRecordReader + * @see org.tensorflow.op.io.TfRecordReader + */ + public TfRecordReader tfRecordReader(TfRecordReader.Options... options) { + return TfRecordReader.create(scope, options); + } + + /** + * Builds an {@link EncodeBase64} operation + * + * @param input Strings to be encoded. + * @param options carries optional attributes values + * @return a new instance of EncodeBase64 + * @see org.tensorflow.op.io.EncodeBase64 + */ + public EncodeBase64 encodeBase64(Operand input, EncodeBase64.Options... options) { + return EncodeBase64.create(scope, input, options); + } + + /** + * Builds an {@link QueueDequeueMany} operation + * + * @param handle The handle to a queue. + * @param n The number of tuples to dequeue. + * @param componentTypes The type of each component in a tuple. + * @param options carries optional attributes values + * @return a new instance of QueueDequeueMany + * @see org.tensorflow.op.io.QueueDequeueMany + */ + public QueueDequeueMany queueDequeueMany(Operand handle, Operand n, + List> componentTypes, QueueDequeueMany.Options... options) { + return QueueDequeueMany.create(scope, handle, n, componentTypes, options); + } + + /** + * Builds an {@link LmdbReader} operation + * + * @param options carries optional attributes values + * @return a new instance of LmdbReader + * @see org.tensorflow.op.io.LmdbReader + */ + public LmdbReader lmdbReader(LmdbReader.Options... options) { + return LmdbReader.create(scope, options); + } + + /** + * Builds an {@link ReaderNumWorkUnitsCompleted} operation + * + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderNumWorkUnitsCompleted + * @see org.tensorflow.op.io.ReaderNumWorkUnitsCompleted + */ + public ReaderNumWorkUnitsCompleted readerNumWorkUnitsCompleted(Operand readerHandle) { + return ReaderNumWorkUnitsCompleted.create(scope, readerHandle); + } + + /** + * Builds an {@link ParseTensor} operation + * + * @param serialized A scalar string containing a serialized TensorProto proto. + * @param outType The type of the serialized tensor. The provided type must match the + * @return a new instance of ParseTensor + * @see org.tensorflow.op.io.ParseTensor + */ + public ParseTensor parseTensor(Operand serialized, Class outType) { + return ParseTensor.create(scope, serialized, outType); + } + + /** + * Builds an {@link ReaderRead} operation + * + * @param readerHandle Handle to a Reader. + * @param queueHandle Handle to a Queue, with string work items. + * @return a new instance of ReaderRead + * @see org.tensorflow.op.io.ReaderRead + */ + public ReaderRead readerRead(Operand readerHandle, Operand queueHandle) { + return ReaderRead.create(scope, readerHandle, queueHandle); + } + + /** + * Builds an {@link DecodeBase64} operation + * + * @param input Base64 strings to decode. + * @return a new instance of DecodeBase64 + * @see org.tensorflow.op.io.DecodeBase64 + */ + public DecodeBase64 decodeBase64(Operand input) { + return DecodeBase64.create(scope, input); + } + + /** + * Builds an {@link PaddingFifoQueue} operation + * + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of PaddingFifoQueue + * @see org.tensorflow.op.io.PaddingFifoQueue + */ + public PaddingFifoQueue paddingFifoQueue(List> componentTypes, + PaddingFifoQueue.Options... options) { + return PaddingFifoQueue.create(scope, componentTypes, options); + } + + /** + * Builds an {@link ParseSingleSequenceExample} operation + * + * @param serialized A scalar containing a binary serialized SequenceExample proto. + * @param featureListDenseMissingAssumedEmpty A vector listing the + * @param contextSparseKeys A list of Ncontext_sparse string Tensors (scalars). + * @param contextDenseKeys A list of Ncontext_dense string Tensors (scalars). + * @param featureListSparseKeys A list of Nfeature_list_sparse string Tensors + * @param featureListDenseKeys A list of Nfeature_list_dense string Tensors (scalars). + * @param contextDenseDefaults A list of Ncontext_dense Tensors (some may be empty). + * @param debugName A scalar containing the name of the serialized proto. + * @param contextSparseTypes A list of Ncontext_sparse types; the data types of data in + * @param featureListDenseTypes + * @param featureListSparseTypes A list of Nfeature_list_sparse types; the data types + * @param options carries optional attributes values + * @return a new instance of ParseSingleSequenceExample + * @see org.tensorflow.op.io.ParseSingleSequenceExample + */ + public ParseSingleSequenceExample parseSingleSequenceExample(Operand serialized, + Operand featureListDenseMissingAssumedEmpty, + Iterable> contextSparseKeys, Iterable> contextDenseKeys, + Iterable> featureListSparseKeys, + Iterable> featureListDenseKeys, Iterable> contextDenseDefaults, + Operand debugName, List> contextSparseTypes, + List> featureListDenseTypes, List> featureListSparseTypes, + ParseSingleSequenceExample.Options... options) { + return ParseSingleSequenceExample.create(scope, serialized, featureListDenseMissingAssumedEmpty, contextSparseKeys, contextDenseKeys, featureListSparseKeys, featureListDenseKeys, contextDenseDefaults, debugName, contextSparseTypes, featureListDenseTypes, featureListSparseTypes, options); + } + + /** + * Builds an {@link SerializeTensor} operation + * + * @param tensor A Tensor of type `T`. + * @return a new instance of SerializeTensor + * @see org.tensorflow.op.io.SerializeTensor + */ + public SerializeTensor serializeTensor(Operand tensor) { + return SerializeTensor.create(scope, tensor); + } + + /** + * Builds an {@link ShardedFilespec} operation + * + * @param basename + * @param numShards + * @return a new instance of ShardedFilespec + * @see org.tensorflow.op.io.ShardedFilespec + */ + public ShardedFilespec shardedFilespec(Operand basename, Operand numShards) { + return ShardedFilespec.create(scope, basename, numShards); + } + + /** + * Builds an {@link SerializeSparse} operation + * + * @param sparseIndices 2-D. The `indices` of the `SparseTensor`. + * @param sparseValues 1-D. The `values` of the `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the `SparseTensor`. + * @return a new instance of SerializeSparse + * @see org.tensorflow.op.io.SerializeSparse + */ + public SerializeSparse serializeSparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape) { + return SerializeSparse.create(scope, sparseIndices, sparseValues, sparseShape); + } + + /** + * Builds an {@link QueueIsClosed} operation + * + * @param handle The handle to a queue. + * @return a new instance of QueueIsClosed + * @see org.tensorflow.op.io.QueueIsClosed + */ + public QueueIsClosed queueIsClosed(Operand handle) { + return QueueIsClosed.create(scope, handle); + } + + /** + * Builds an {@link MatchingFiles} operation + * + * @param pattern Shell wildcard pattern(s). Scalar or vector of type string. + * @return a new instance of MatchingFiles + * @see org.tensorflow.op.io.MatchingFiles + */ + public MatchingFiles matchingFiles(Operand pattern) { + return MatchingFiles.create(scope, pattern); + } + + /** + * Builds an {@link SerializeManySparse} operation + * + * @param sparseIndices 2-D. The `indices` of the minibatch `SparseTensor`. + * @param sparseValues 1-D. The `values` of the minibatch `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the minibatch `SparseTensor`. + * @param outType The `dtype` to use for serialization; the supported types are `string` + * @return a new instance of SerializeManySparse + * @see org.tensorflow.op.io.SerializeManySparse + */ + public SerializeManySparse serializeManySparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, Class outType) { + return SerializeManySparse.create(scope, sparseIndices, sparseValues, sparseShape, outType); + } + + /** + * Builds an {@link DecodeRaw} operation + * + * @param bytes All the elements must have the same length. + * @param outType + * @param options carries optional attributes values + * @return a new instance of DecodeRaw + * @see org.tensorflow.op.io.DecodeRaw + */ + public DecodeRaw decodeRaw(Operand bytes, Class outType, + DecodeRaw.Options... options) { + return DecodeRaw.create(scope, bytes, outType, options); + } + + /** + * Builds an {@link QueueSize} operation + * + * @param handle The handle to a queue. + * @return a new instance of QueueSize + * @see org.tensorflow.op.io.QueueSize + */ + public QueueSize queueSize(Operand handle) { + return QueueSize.create(scope, handle); + } + + /** + * Builds an {@link TextLineReader} operation + * + * @param options carries optional attributes values + * @return a new instance of TextLineReader + * @see org.tensorflow.op.io.TextLineReader + */ + public TextLineReader textLineReader(TextLineReader.Options... options) { + return TextLineReader.create(scope, options); + } + + /** + * Builds an {@link FixedLengthRecordReader} operation + * + * @param recordBytes Number of bytes in the record. + * @param options carries optional attributes values + * @return a new instance of FixedLengthRecordReader + * @see org.tensorflow.op.io.FixedLengthRecordReader + */ + public FixedLengthRecordReader fixedLengthRecordReader(Long recordBytes, + FixedLengthRecordReader.Options... options) { + return FixedLengthRecordReader.create(scope, recordBytes, options); + } + + /** + * Builds an {@link DecodeCsv} operation + * + * @param records Each string is a record/row in the csv and all records should have + * @param recordDefaults One tensor per column of the input record, with either a + * @param options carries optional attributes values + * @return a new instance of DecodeCsv + * @see org.tensorflow.op.io.DecodeCsv + */ + public DecodeCsv decodeCsv(Operand records, Iterable> recordDefaults, + DecodeCsv.Options... options) { + return DecodeCsv.create(scope, records, recordDefaults, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/LinalgOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/LinalgOps.java new file mode 100644 index 00000000000..f6b4876cf12 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/LinalgOps.java @@ -0,0 +1,539 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.linalg.BandPart; +import org.tensorflow.op.linalg.BatchCholesky; +import org.tensorflow.op.linalg.BatchCholeskyGrad; +import org.tensorflow.op.linalg.BatchMatMul; +import org.tensorflow.op.linalg.BatchMatrixBandPart; +import org.tensorflow.op.linalg.BatchMatrixDeterminant; +import org.tensorflow.op.linalg.BatchMatrixDiag; +import org.tensorflow.op.linalg.BatchMatrixDiagPart; +import org.tensorflow.op.linalg.BatchMatrixInverse; +import org.tensorflow.op.linalg.BatchMatrixSetDiag; +import org.tensorflow.op.linalg.BatchMatrixSolve; +import org.tensorflow.op.linalg.BatchMatrixSolveLs; +import org.tensorflow.op.linalg.BatchMatrixTriangularSolve; +import org.tensorflow.op.linalg.BatchSelfAdjointEig; +import org.tensorflow.op.linalg.BatchSvd; +import org.tensorflow.op.linalg.Cholesky; +import org.tensorflow.op.linalg.CholeskyGrad; +import org.tensorflow.op.linalg.ConjugateTranspose; +import org.tensorflow.op.linalg.Cross; +import org.tensorflow.op.linalg.Det; +import org.tensorflow.op.linalg.Diag; +import org.tensorflow.op.linalg.DiagPart; +import org.tensorflow.op.linalg.Inv; +import org.tensorflow.op.linalg.LoadAndRemapMatrix; +import org.tensorflow.op.linalg.LogMatrixDeterminant; +import org.tensorflow.op.linalg.MatMul; +import org.tensorflow.op.linalg.MatrixSolveLs; +import org.tensorflow.op.linalg.Qr; +import org.tensorflow.op.linalg.QuantizedMatMul; +import org.tensorflow.op.linalg.SelfAdjointEig; +import org.tensorflow.op.linalg.SetDiag; +import org.tensorflow.op.linalg.Solve; +import org.tensorflow.op.linalg.Sqrtm; +import org.tensorflow.op.linalg.Svd; +import org.tensorflow.op.linalg.TensorDiag; +import org.tensorflow.op.linalg.TensorDiagPart; +import org.tensorflow.op.linalg.Transpose; +import org.tensorflow.op.linalg.TriangularSolve; + +/** + * An API for building {@code linalg} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class LinalgOps { + private final Scope scope; + + LinalgOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link BatchMatrixSolve} operation + * + * @param matrix + * @param rhs + * @param options carries optional attributes values + * @return a new instance of BatchMatrixSolve + * @see org.tensorflow.op.linalg.BatchMatrixSolve + */ + public BatchMatrixSolve batchMatrixSolve(Operand matrix, Operand rhs, + BatchMatrixSolve.Options... options) { + return BatchMatrixSolve.create(scope, matrix, rhs, options); + } + + /** + * Builds an {@link Qr} operation + * + * @param input A tensor of shape `[..., M, N]` whose inner-most 2 dimensions + * @param options carries optional attributes values + * @return a new instance of Qr + * @see org.tensorflow.op.linalg.Qr + */ + public Qr qr(Operand input, Qr.Options... options) { + return Qr.create(scope, input, options); + } + + /** + * Builds an {@link ConjugateTranspose} operation + * + * @param x + * @param perm + * @return a new instance of ConjugateTranspose + * @see org.tensorflow.op.linalg.ConjugateTranspose + */ + public ConjugateTranspose conjugateTranspose(Operand x, + Operand perm) { + return ConjugateTranspose.create(scope, x, perm); + } + + /** + * Builds an {@link BatchMatrixDiagPart} operation + * + * @param input + * @return a new instance of BatchMatrixDiagPart + * @see org.tensorflow.op.linalg.BatchMatrixDiagPart + */ + public BatchMatrixDiagPart batchMatrixDiagPart(Operand input) { + return BatchMatrixDiagPart.create(scope, input); + } + + /** + * Builds an {@link BatchMatrixBandPart} operation + * + * @param input + * @param numLower + * @param numUpper + * @return a new instance of BatchMatrixBandPart + * @see org.tensorflow.op.linalg.BatchMatrixBandPart + */ + public BatchMatrixBandPart batchMatrixBandPart(Operand input, Operand numLower, + Operand numUpper) { + return BatchMatrixBandPart.create(scope, input, numLower, numUpper); + } + + /** + * Builds an {@link BatchMatrixDeterminant} operation + * + * @param input + * @return a new instance of BatchMatrixDeterminant + * @see org.tensorflow.op.linalg.BatchMatrixDeterminant + */ + public BatchMatrixDeterminant batchMatrixDeterminant(Operand input) { + return BatchMatrixDeterminant.create(scope, input); + } + + /** + * Builds an {@link LoadAndRemapMatrix} operation + * + * @param ckptPath Path to the TensorFlow checkpoint (version 2, `TensorBundle`) from + * @param oldTensorName Name of the 2-D `Tensor` to load from checkpoint. + * @param rowRemapping An int `Tensor` of row remappings (generally created by + * @param colRemapping An int `Tensor` of column remappings (generally created by + * @param initializingValues A float `Tensor` containing values to fill in for cells + * @param numRows Number of rows (length of the 1st dimension) in the output matrix. + * @param numCols Number of columns (length of the 2nd dimension) in the output matrix. + * @param options carries optional attributes values + * @return a new instance of LoadAndRemapMatrix + * @see org.tensorflow.op.linalg.LoadAndRemapMatrix + */ + public LoadAndRemapMatrix loadAndRemapMatrix(Operand ckptPath, + Operand oldTensorName, Operand rowRemapping, Operand colRemapping, + Operand initializingValues, Long numRows, Long numCols, + LoadAndRemapMatrix.Options... options) { + return LoadAndRemapMatrix.create(scope, ckptPath, oldTensorName, rowRemapping, colRemapping, initializingValues, numRows, numCols, options); + } + + /** + * Builds an {@link TensorDiag} operation + * + * @param diagonal Rank k tensor where k is at most 1. + * @return a new instance of TensorDiag + * @see org.tensorflow.op.linalg.TensorDiag + */ + public TensorDiag tensorDiag(Operand diagonal) { + return TensorDiag.create(scope, diagonal); + } + + /** + * Builds an {@link TriangularSolve} operation + * + * @param matrix Shape is `[..., M, M]`. + * @param rhs Shape is `[..., M, K]`. + * @param options carries optional attributes values + * @return a new instance of TriangularSolve + * @see org.tensorflow.op.linalg.TriangularSolve + */ + public TriangularSolve triangularSolve(Operand matrix, Operand rhs, + TriangularSolve.Options... options) { + return TriangularSolve.create(scope, matrix, rhs, options); + } + + /** + * Builds an {@link SelfAdjointEig} operation + * + * @param input `Tensor` input of shape `[N, N]`. + * @param options carries optional attributes values + * @return a new instance of SelfAdjointEig + * @see org.tensorflow.op.linalg.SelfAdjointEig + */ + public SelfAdjointEig selfAdjointEig(Operand input, SelfAdjointEig.Options... options) { + return SelfAdjointEig.create(scope, input, options); + } + + /** + * Builds an {@link Sqrtm} operation + * + * @param input Shape is `[..., M, M]`. + * @return a new instance of Sqrtm + * @see org.tensorflow.op.linalg.Sqrtm + */ + public Sqrtm sqrtm(Operand input) { + return Sqrtm.create(scope, input); + } + + /** + * Builds an {@link BatchCholeskyGrad} operation + * + * @param l + * @param grad + * @return a new instance of BatchCholeskyGrad + * @see org.tensorflow.op.linalg.BatchCholeskyGrad + */ + public BatchCholeskyGrad batchCholeskyGrad(Operand l, Operand grad) { + return BatchCholeskyGrad.create(scope, l, grad); + } + + /** + * Builds an {@link Cholesky} operation + * + * @param input Shape is `[..., M, M]`. + * @return a new instance of Cholesky + * @see org.tensorflow.op.linalg.Cholesky + */ + public Cholesky cholesky(Operand input) { + return Cholesky.create(scope, input); + } + + /** + * Builds an {@link BatchCholesky} operation + * + * @param input + * @return a new instance of BatchCholesky + * @see org.tensorflow.op.linalg.BatchCholesky + */ + public BatchCholesky batchCholesky(Operand input) { + return BatchCholesky.create(scope, input); + } + + /** + * Builds an {@link Svd} operation + * + * @param input A tensor of shape `[..., M, N]` whose inner-most 2 dimensions + * @param options carries optional attributes values + * @return a new instance of Svd + * @see org.tensorflow.op.linalg.Svd + */ + public Svd svd(Operand input, Svd.Options... options) { + return Svd.create(scope, input, options); + } + + /** + * Builds an {@link Det} operation + * + * @param input Shape is `[..., M, M]`. + * @return a new instance of Det + * @see org.tensorflow.op.linalg.Det + */ + public Det det(Operand input) { + return Det.create(scope, input); + } + + /** + * Builds an {@link DiagPart} operation + * + * @param input Rank `k` tensor where `k >= 2`. + * @return a new instance of DiagPart + * @see org.tensorflow.op.linalg.DiagPart + */ + public DiagPart diagPart(Operand input) { + return DiagPart.create(scope, input); + } + + /** + * Builds an {@link SetDiag} operation + * + * @param input Rank `k+1`, where `k >= 1`. + * @param diagonal Rank `k`, where `k >= 1`. + * @return a new instance of SetDiag + * @see org.tensorflow.op.linalg.SetDiag + */ + public SetDiag setDiag(Operand input, Operand diagonal) { + return SetDiag.create(scope, input, diagonal); + } + + /** + * Builds an {@link Solve} operation + * + * @param matrix Shape is `[..., M, M]`. + * @param rhs Shape is `[..., M, K]`. + * @param options carries optional attributes values + * @return a new instance of Solve + * @see org.tensorflow.op.linalg.Solve + */ + public Solve solve(Operand matrix, Operand rhs, Solve.Options... options) { + return Solve.create(scope, matrix, rhs, options); + } + + /** + * Builds an {@link MatrixSolveLs} operation + * + * @param matrix Shape is `[..., M, N]`. + * @param rhs Shape is `[..., M, K]`. + * @param l2Regularizer Scalar tensor. + * @param options carries optional attributes values + * @return a new instance of MatrixSolveLs + * @see org.tensorflow.op.linalg.MatrixSolveLs + */ + public MatrixSolveLs matrixSolveLs(Operand matrix, Operand rhs, + Operand l2Regularizer, MatrixSolveLs.Options... options) { + return MatrixSolveLs.create(scope, matrix, rhs, l2Regularizer, options); + } + + /** + * Builds an {@link BatchSvd} operation + * + * @param input + * @param options carries optional attributes values + * @return a new instance of BatchSvd + * @see org.tensorflow.op.linalg.BatchSvd + */ + public BatchSvd batchSvd(Operand input, BatchSvd.Options... options) { + return BatchSvd.create(scope, input, options); + } + + /** + * Builds an {@link BatchMatrixInverse} operation + * + * @param input + * @param options carries optional attributes values + * @return a new instance of BatchMatrixInverse + * @see org.tensorflow.op.linalg.BatchMatrixInverse + */ + public BatchMatrixInverse batchMatrixInverse(Operand input, + BatchMatrixInverse.Options... options) { + return BatchMatrixInverse.create(scope, input, options); + } + + /** + * Builds an {@link CholeskyGrad} operation + * + * @param l Output of batch Cholesky algorithm l = cholesky(A). Shape is `[..., M, M]`. + * @param grad df/dl where f is some scalar function. Shape is `[..., M, M]`. + * @return a new instance of CholeskyGrad + * @see org.tensorflow.op.linalg.CholeskyGrad + */ + public CholeskyGrad choleskyGrad(Operand l, Operand grad) { + return CholeskyGrad.create(scope, l, grad); + } + + /** + * Builds an {@link Inv} operation + * + * @param input Shape is `[..., M, M]`. + * @param options carries optional attributes values + * @return a new instance of Inv + * @see org.tensorflow.op.linalg.Inv + */ + public Inv inv(Operand input, Inv.Options... options) { + return Inv.create(scope, input, options); + } + + /** + * Builds an {@link BatchMatrixTriangularSolve} operation + * + * @param matrix + * @param rhs + * @param options carries optional attributes values + * @return a new instance of BatchMatrixTriangularSolve + * @see org.tensorflow.op.linalg.BatchMatrixTriangularSolve + */ + public BatchMatrixTriangularSolve batchMatrixTriangularSolve( + Operand matrix, Operand rhs, BatchMatrixTriangularSolve.Options... options) { + return BatchMatrixTriangularSolve.create(scope, matrix, rhs, options); + } + + /** + * Builds an {@link MatMul} operation + * + * @param a + * @param b + * @param options carries optional attributes values + * @return a new instance of MatMul + * @see org.tensorflow.op.linalg.MatMul + */ + public MatMul matMul(Operand a, Operand b, MatMul.Options... options) { + return MatMul.create(scope, a, b, options); + } + + /** + * Builds an {@link QuantizedMatMul} operation + * + * @param a Must be a two-dimensional tensor. + * @param b Must be a two-dimensional tensor. + * @param minA The float value that the lowest quantized `a` value represents. + * @param maxA The float value that the highest quantized `a` value represents. + * @param minB The float value that the lowest quantized `b` value represents. + * @param maxB The float value that the highest quantized `b` value represents. + * @param Toutput + * @param Tactivation The type of output produced by activation function + * @param options carries optional attributes values + * @return a new instance of QuantizedMatMul + * @see org.tensorflow.op.linalg.QuantizedMatMul + */ + public QuantizedMatMul quantizedMatMul(Operand a, Operand b, + Operand minA, Operand maxA, Operand minB, Operand maxB, + Class Toutput, Class Tactivation, QuantizedMatMul.Options... options) { + return QuantizedMatMul.create(scope, a, b, minA, maxA, minB, maxB, Toutput, Tactivation, options); + } + + /** + * Builds an {@link Cross} operation + * + * @param a A tensor containing 3-element vectors. + * @param b Another tensor, of same type and shape as `a`. + * @return a new instance of Cross + * @see org.tensorflow.op.linalg.Cross + */ + public Cross cross(Operand a, Operand b) { + return Cross.create(scope, a, b); + } + + /** + * Builds an {@link BatchMatrixDiag} operation + * + * @param diagonal + * @return a new instance of BatchMatrixDiag + * @see org.tensorflow.op.linalg.BatchMatrixDiag + */ + public BatchMatrixDiag batchMatrixDiag(Operand diagonal) { + return BatchMatrixDiag.create(scope, diagonal); + } + + /** + * Builds an {@link Transpose} operation + * + * @param x + * @param perm + * @return a new instance of Transpose + * @see org.tensorflow.op.linalg.Transpose + */ + public Transpose transpose(Operand x, Operand perm) { + return Transpose.create(scope, x, perm); + } + + /** + * Builds an {@link LogMatrixDeterminant} operation + * + * @param input Shape is `[N, M, M]`. + * @return a new instance of LogMatrixDeterminant + * @see org.tensorflow.op.linalg.LogMatrixDeterminant + */ + public LogMatrixDeterminant logMatrixDeterminant(Operand input) { + return LogMatrixDeterminant.create(scope, input); + } + + /** + * Builds an {@link BatchMatrixSolveLs} operation + * + * @param matrix + * @param rhs + * @param l2Regularizer + * @param options carries optional attributes values + * @return a new instance of BatchMatrixSolveLs + * @see org.tensorflow.op.linalg.BatchMatrixSolveLs + */ + public BatchMatrixSolveLs batchMatrixSolveLs(Operand matrix, + Operand rhs, Operand l2Regularizer, BatchMatrixSolveLs.Options... options) { + return BatchMatrixSolveLs.create(scope, matrix, rhs, l2Regularizer, options); + } + + /** + * Builds an {@link Diag} operation + * + * @param diagonal Rank `k`, where `k >= 1`. + * @return a new instance of Diag + * @see org.tensorflow.op.linalg.Diag + */ + public Diag diag(Operand diagonal) { + return Diag.create(scope, diagonal); + } + + /** + * Builds an {@link BatchMatrixSetDiag} operation + * + * @param input + * @param diagonal + * @return a new instance of BatchMatrixSetDiag + * @see org.tensorflow.op.linalg.BatchMatrixSetDiag + */ + public BatchMatrixSetDiag batchMatrixSetDiag(Operand input, Operand diagonal) { + return BatchMatrixSetDiag.create(scope, input, diagonal); + } + + /** + * Builds an {@link TensorDiagPart} operation + * + * @param input Rank k tensor where k is even and not zero. + * @return a new instance of TensorDiagPart + * @see org.tensorflow.op.linalg.TensorDiagPart + */ + public TensorDiagPart tensorDiagPart(Operand input) { + return TensorDiagPart.create(scope, input); + } + + /** + * Builds an {@link BandPart} operation + * + * @param input Rank `k` tensor. + * @param numLower 0-D tensor. Number of subdiagonals to keep. If negative, keep entire + * @param numUpper 0-D tensor. Number of superdiagonals to keep. If negative, keep + * @return a new instance of BandPart + * @see org.tensorflow.op.linalg.BandPart + */ + public BandPart bandPart(Operand input, Operand numLower, + Operand numUpper) { + return BandPart.create(scope, input, numLower, numUpper); + } + + /** + * Builds an {@link BatchSelfAdjointEig} operation + * + * @param input + * @param options carries optional attributes values + * @return a new instance of BatchSelfAdjointEig + * @see org.tensorflow.op.linalg.BatchSelfAdjointEig + */ + public BatchSelfAdjointEig batchSelfAdjointEig(Operand input, + BatchSelfAdjointEig.Options... options) { + return BatchSelfAdjointEig.create(scope, input, options); + } + + /** + * Builds an {@link BatchMatMul} operation + * + * @param x 2-D or higher with shape `[..., r_x, c_x]`. + * @param y 2-D or higher with shape `[..., r_y, c_y]`. + * @param options carries optional attributes values + * @return a new instance of BatchMatMul + * @see org.tensorflow.op.linalg.BatchMatMul + */ + public BatchMatMul batchMatMul(Operand x, Operand y, + BatchMatMul.Options... options) { + return BatchMatMul.create(scope, x, y, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java new file mode 100644 index 00000000000..7f14ae6abe5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java @@ -0,0 +1,1379 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.Shape; +import org.tensorflow.op.math.Abs; +import org.tensorflow.op.math.AccumulateN; +import org.tensorflow.op.math.Acos; +import org.tensorflow.op.math.Acosh; +import org.tensorflow.op.math.Add; +import org.tensorflow.op.math.AddN; +import org.tensorflow.op.math.Angle; +import org.tensorflow.op.math.ApproximateEqual; +import org.tensorflow.op.math.ArgMax; +import org.tensorflow.op.math.ArgMin; +import org.tensorflow.op.math.Asin; +import org.tensorflow.op.math.Asinh; +import org.tensorflow.op.math.Atan; +import org.tensorflow.op.math.Atan2; +import org.tensorflow.op.math.Atanh; +import org.tensorflow.op.math.BesselI0e; +import org.tensorflow.op.math.BesselI1e; +import org.tensorflow.op.math.Betainc; +import org.tensorflow.op.math.Bincount; +import org.tensorflow.op.math.Ceil; +import org.tensorflow.op.math.CheckNumerics; +import org.tensorflow.op.math.CompareAndBitpack; +import org.tensorflow.op.math.ComplexAbs; +import org.tensorflow.op.math.Conj; +import org.tensorflow.op.math.Cos; +import org.tensorflow.op.math.Cosh; +import org.tensorflow.op.math.Cumprod; +import org.tensorflow.op.math.Cumsum; +import org.tensorflow.op.math.Digamma; +import org.tensorflow.op.math.Div; +import org.tensorflow.op.math.DivNoNan; +import org.tensorflow.op.math.Equal; +import org.tensorflow.op.math.Erf; +import org.tensorflow.op.math.Erfc; +import org.tensorflow.op.math.Exp; +import org.tensorflow.op.math.Expm1; +import org.tensorflow.op.math.Fact; +import org.tensorflow.op.math.Floor; +import org.tensorflow.op.math.FloorDiv; +import org.tensorflow.op.math.FloorMod; +import org.tensorflow.op.math.Greater; +import org.tensorflow.op.math.GreaterEqual; +import org.tensorflow.op.math.Igamma; +import org.tensorflow.op.math.Igammac; +import org.tensorflow.op.math.Imag; +import org.tensorflow.op.math.InvertPermutation; +import org.tensorflow.op.math.IsFinite; +import org.tensorflow.op.math.IsInf; +import org.tensorflow.op.math.IsNan; +import org.tensorflow.op.math.Less; +import org.tensorflow.op.math.LessEqual; +import org.tensorflow.op.math.Lgamma; +import org.tensorflow.op.math.Log; +import org.tensorflow.op.math.Log1p; +import org.tensorflow.op.math.LogicalAnd; +import org.tensorflow.op.math.LogicalNot; +import org.tensorflow.op.math.LogicalOr; +import org.tensorflow.op.math.Maximum; +import org.tensorflow.op.math.Mean; +import org.tensorflow.op.math.Minimum; +import org.tensorflow.op.math.Mod; +import org.tensorflow.op.math.Mul; +import org.tensorflow.op.math.Neg; +import org.tensorflow.op.math.NotEqual; +import org.tensorflow.op.math.Polygamma; +import org.tensorflow.op.math.PopulationCount; +import org.tensorflow.op.math.Pow; +import org.tensorflow.op.math.QuantizedAdd; +import org.tensorflow.op.math.QuantizedMul; +import org.tensorflow.op.math.Real; +import org.tensorflow.op.math.RealDiv; +import org.tensorflow.op.math.Reciprocal; +import org.tensorflow.op.math.Rint; +import org.tensorflow.op.math.Round; +import org.tensorflow.op.math.Rsqrt; +import org.tensorflow.op.math.SegmentMax; +import org.tensorflow.op.math.SegmentMean; +import org.tensorflow.op.math.SegmentMin; +import org.tensorflow.op.math.SegmentProd; +import org.tensorflow.op.math.SegmentSum; +import org.tensorflow.op.math.Sigmoid; +import org.tensorflow.op.math.Sign; +import org.tensorflow.op.math.Sin; +import org.tensorflow.op.math.Sinh; +import org.tensorflow.op.math.Softplus; +import org.tensorflow.op.math.Sqrt; +import org.tensorflow.op.math.Square; +import org.tensorflow.op.math.SquaredDifference; +import org.tensorflow.op.math.Sub; +import org.tensorflow.op.math.Tan; +import org.tensorflow.op.math.Tanh; +import org.tensorflow.op.math.TruncateDiv; +import org.tensorflow.op.math.TruncateMod; +import org.tensorflow.op.math.UnsortedSegmentMax; +import org.tensorflow.op.math.UnsortedSegmentMin; +import org.tensorflow.op.math.UnsortedSegmentProd; +import org.tensorflow.op.math.UnsortedSegmentSum; +import org.tensorflow.op.math.Xdivy; +import org.tensorflow.op.math.Xlogy; +import org.tensorflow.op.math.Zeta; + +/** + * An API for building {@code math} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class MathOps { + private final Scope scope; + + MathOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link LogicalOr} operation + * + * @param x + * @param y + * @return a new instance of LogicalOr + * @see org.tensorflow.op.math.LogicalOr + */ + public LogicalOr logicalOr(Operand x, Operand y) { + return LogicalOr.create(scope, x, y); + } + + /** + * Builds an {@link Digamma} operation + * + * @param x + * @return a new instance of Digamma + * @see org.tensorflow.op.math.Digamma + */ + public Digamma digamma(Operand x) { + return Digamma.create(scope, x); + } + + /** + * Builds an {@link TruncateDiv} operation + * + * @param x + * @param y + * @return a new instance of TruncateDiv + * @see org.tensorflow.op.math.TruncateDiv + */ + public TruncateDiv truncateDiv(Operand x, Operand y) { + return TruncateDiv.create(scope, x, y); + } + + /** + * Builds an {@link Square} operation + * + * @param x + * @return a new instance of Square + * @see org.tensorflow.op.math.Square + */ + public Square square(Operand x) { + return Square.create(scope, x); + } + + /** + * Builds an {@link LogicalNot} operation + * + * @param x + * @return a new instance of LogicalNot + * @see org.tensorflow.op.math.LogicalNot + */ + public LogicalNot logicalNot(Operand x) { + return LogicalNot.create(scope, x); + } + + /** + * Builds an {@link CheckNumerics} operation + * + * @param tensor + * @param message Prefix of the error message. + * @return a new instance of CheckNumerics + * @see org.tensorflow.op.math.CheckNumerics + */ + public CheckNumerics checkNumerics(Operand tensor, String message) { + return CheckNumerics.create(scope, tensor, message); + } + + /** + * Builds an {@link Equal} operation + * + * @param x + * @param y + * @param options carries optional attributes values + * @return a new instance of Equal + * @see org.tensorflow.op.math.Equal + */ + public Equal equal(Operand x, Operand y, Equal.Options... options) { + return Equal.create(scope, x, y, options); + } + + /** + * Builds an {@link Bincount} operation + * + * @param arr int32 `Tensor`. + * @param size non-negative int32 scalar `Tensor`. + * @param weights is an int32, int64, float32, or float64 `Tensor` with the same + * @return a new instance of Bincount + * @see org.tensorflow.op.math.Bincount + */ + public Bincount bincount(Operand arr, Operand size, + Operand weights) { + return Bincount.create(scope, arr, size, weights); + } + + /** + * Builds an {@link Mul} operation + * + * @param x + * @param y + * @return a new instance of Mul + * @see org.tensorflow.op.math.Mul + */ + public Mul mul(Operand x, Operand y) { + return Mul.create(scope, x, y); + } + + /** + * Builds an {@link Neg} operation + * + * @param x + * @return a new instance of Neg + * @see org.tensorflow.op.math.Neg + */ + public Neg neg(Operand x) { + return Neg.create(scope, x); + } + + /** + * Builds an {@link Asinh} operation + * + * @param x + * @return a new instance of Asinh + * @see org.tensorflow.op.math.Asinh + */ + public Asinh asinh(Operand x) { + return Asinh.create(scope, x); + } + + /** + * Builds an {@link SegmentMean} operation + * + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * @return a new instance of SegmentMean + * @see org.tensorflow.op.math.SegmentMean + */ + public SegmentMean segmentMean(Operand data, Operand segmentIds) { + return SegmentMean.create(scope, data, segmentIds); + } + + /** + * Builds an {@link Atan} operation + * + * @param x + * @return a new instance of Atan + * @see org.tensorflow.op.math.Atan + */ + public Atan atan(Operand x) { + return Atan.create(scope, x); + } + + /** + * Builds an {@link TruncateMod} operation + * + * @param x + * @param y + * @return a new instance of TruncateMod + * @see org.tensorflow.op.math.TruncateMod + */ + public TruncateMod truncateMod(Operand x, Operand y) { + return TruncateMod.create(scope, x, y); + } + + /** + * Builds an {@link Acos} operation + * + * @param x + * @return a new instance of Acos + * @see org.tensorflow.op.math.Acos + */ + public Acos acos(Operand x) { + return Acos.create(scope, x); + } + + /** + * Builds an {@link Xlogy} operation + * + * @param x + * @param y + * @return a new instance of Xlogy + * @see org.tensorflow.op.math.Xlogy + */ + public Xlogy xlogy(Operand x, Operand y) { + return Xlogy.create(scope, x, y); + } + + /** + * Builds an {@link UnsortedSegmentSum} operation + * + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentSum + * @see org.tensorflow.op.math.UnsortedSegmentSum + */ + public UnsortedSegmentSum unsortedSegmentSum( + Operand data, Operand segmentIds, Operand numSegments) { + return UnsortedSegmentSum.create(scope, data, segmentIds, numSegments); + } + + /** + * Builds an {@link Tan} operation + * + * @param x + * @return a new instance of Tan + * @see org.tensorflow.op.math.Tan + */ + public Tan tan(Operand x) { + return Tan.create(scope, x); + } + + /** + * Builds an {@link Betainc} operation + * + * @param a + * @param b + * @param x + * @return a new instance of Betainc + * @see org.tensorflow.op.math.Betainc + */ + public Betainc betainc(Operand a, Operand b, Operand x) { + return Betainc.create(scope, a, b, x); + } + + /** + * Builds an {@link UnsortedSegmentProd} operation + * + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentProd + * @see org.tensorflow.op.math.UnsortedSegmentProd + */ + public UnsortedSegmentProd unsortedSegmentProd( + Operand data, Operand segmentIds, Operand numSegments) { + return UnsortedSegmentProd.create(scope, data, segmentIds, numSegments); + } + + /** + * Builds an {@link Igamma} operation + * + * @param a + * @param x + * @return a new instance of Igamma + * @see org.tensorflow.op.math.Igamma + */ + public Igamma igamma(Operand a, Operand x) { + return Igamma.create(scope, a, x); + } + + /** + * Builds an {@link Xdivy} operation + * + * @param x + * @param y + * @return a new instance of Xdivy + * @see org.tensorflow.op.math.Xdivy + */ + public Xdivy xdivy(Operand x, Operand y) { + return Xdivy.create(scope, x, y); + } + + /** + * Builds an {@link Ceil} operation + * + * @param x + * @return a new instance of Ceil + * @see org.tensorflow.op.math.Ceil + */ + public Ceil ceil(Operand x) { + return Ceil.create(scope, x); + } + + /** + * Builds an {@link ComplexAbs} operation + * + * @param x + * @param Tout + * @return a new instance of ComplexAbs + * @see org.tensorflow.op.math.ComplexAbs + */ + public ComplexAbs complexAbs(Operand x, Class Tout) { + return ComplexAbs.create(scope, x, Tout); + } + + /** + * Builds an {@link BesselI0e} operation + * + * @param x + * @return a new instance of BesselI0e + * @see org.tensorflow.op.math.BesselI0e + */ + public BesselI0e besselI0e(Operand x) { + return BesselI0e.create(scope, x); + } + + /** + * Builds an {@link Log} operation + * + * @param x + * @return a new instance of Log + * @see org.tensorflow.op.math.Log + */ + public Log log(Operand x) { + return Log.create(scope, x); + } + + /** + * Builds an {@link Sqrt} operation + * + * @param x + * @return a new instance of Sqrt + * @see org.tensorflow.op.math.Sqrt + */ + public Sqrt sqrt(Operand x) { + return Sqrt.create(scope, x); + } + + /** + * Builds an {@link InvertPermutation} operation + * + * @param x 1-D. + * @return a new instance of InvertPermutation + * @see org.tensorflow.op.math.InvertPermutation + */ + public InvertPermutation invertPermutation(Operand x) { + return InvertPermutation.create(scope, x); + } + + /** + * Builds an {@link GreaterEqual} operation + * + * @param x + * @param y + * @return a new instance of GreaterEqual + * @see org.tensorflow.op.math.GreaterEqual + */ + public GreaterEqual greaterEqual(Operand x, Operand y) { + return GreaterEqual.create(scope, x, y); + } + + /** + * Builds an {@link BesselI1e} operation + * + * @param x + * @return a new instance of BesselI1e + * @see org.tensorflow.op.math.BesselI1e + */ + public BesselI1e besselI1e(Operand x) { + return BesselI1e.create(scope, x); + } + + /** + * Builds an {@link FloorDiv} operation + * + * @param x + * @param y + * @return a new instance of FloorDiv + * @see org.tensorflow.op.math.FloorDiv + */ + public FloorDiv floorDiv(Operand x, Operand y) { + return FloorDiv.create(scope, x, y); + } + + /** + * Builds an {@link Angle} operation + * + * @param input + * @return a new instance of Angle + * @see org.tensorflow.op.math.Angle + */ + public Angle angle(Operand input) { + return Angle.create(scope, input); + } + + /** + * Builds an {@link RealDiv} operation + * + * @param x + * @param y + * @return a new instance of RealDiv + * @see org.tensorflow.op.math.RealDiv + */ + public RealDiv realDiv(Operand x, Operand y) { + return RealDiv.create(scope, x, y); + } + + /** + * Builds an {@link QuantizedMul} operation + * + * @param x + * @param y + * @param minX The float value that the lowest quantized `x` value represents. + * @param maxX The float value that the highest quantized `x` value represents. + * @param minY The float value that the lowest quantized `y` value represents. + * @param maxY The float value that the highest quantized `y` value represents. + * @param Toutput + * @return a new instance of QuantizedMul + * @see org.tensorflow.op.math.QuantizedMul + */ + public QuantizedMul quantizedMul(Operand x, Operand y, Operand minX, + Operand maxX, Operand minY, Operand maxY, Class Toutput) { + return QuantizedMul.create(scope, x, y, minX, maxX, minY, maxY, Toutput); + } + + /** + * Builds an {@link IsInf} operation + * + * @param x + * @return a new instance of IsInf + * @see org.tensorflow.op.math.IsInf + */ + public IsInf isInf(Operand x) { + return IsInf.create(scope, x); + } + + /** + * Builds an {@link Angle} operation + * + * @param input + * @param Tout + * @return a new instance of Angle + * @see org.tensorflow.op.math.Angle + */ + public Angle angle(Operand input, Class Tout) { + return Angle.create(scope, input, Tout); + } + + /** + * Builds an {@link Real} operation + * + * @param input + * @param Tout + * @return a new instance of Real + * @see org.tensorflow.op.math.Real + */ + public Real real(Operand input, Class Tout) { + return Real.create(scope, input, Tout); + } + + /** + * Builds an {@link Acosh} operation + * + * @param x + * @return a new instance of Acosh + * @see org.tensorflow.op.math.Acosh + */ + public Acosh acosh(Operand x) { + return Acosh.create(scope, x); + } + + /** + * Builds an {@link Mod} operation + * + * @param x + * @param y + * @return a new instance of Mod + * @see org.tensorflow.op.math.Mod + */ + public Mod mod(Operand x, Operand y) { + return Mod.create(scope, x, y); + } + + /** + * Builds an {@link LessEqual} operation + * + * @param x + * @param y + * @return a new instance of LessEqual + * @see org.tensorflow.op.math.LessEqual + */ + public LessEqual lessEqual(Operand x, Operand y) { + return LessEqual.create(scope, x, y); + } + + /** + * Builds an {@link Sigmoid} operation + * + * @param x + * @return a new instance of Sigmoid + * @see org.tensorflow.op.math.Sigmoid + */ + public Sigmoid sigmoid(Operand x) { + return Sigmoid.create(scope, x); + } + + /** + * Builds an {@link ArgMax} operation + * + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * @param outputType + * @return a new instance of ArgMax + * @see org.tensorflow.op.math.ArgMax + */ + public ArgMax argMax(Operand input, + Operand dimension, Class outputType) { + return ArgMax.create(scope, input, dimension, outputType); + } + + /** + * Builds an {@link Rint} operation + * + * @param x + * @return a new instance of Rint + * @see org.tensorflow.op.math.Rint + */ + public Rint rint(Operand x) { + return Rint.create(scope, x); + } + + /** + * Builds an {@link Cumprod} operation + * + * @param x A `Tensor`. Must be one of the following types: `float32`, `float64`, + * @param axis A `Tensor` of type `int32` (default: 0). Must be in the range + * @param options carries optional attributes values + * @return a new instance of Cumprod + * @see org.tensorflow.op.math.Cumprod + */ + public Cumprod cumprod(Operand x, Operand axis, + Cumprod.Options... options) { + return Cumprod.create(scope, x, axis, options); + } + + /** + * Builds an {@link LogicalAnd} operation + * + * @param x + * @param y + * @return a new instance of LogicalAnd + * @see org.tensorflow.op.math.LogicalAnd + */ + public LogicalAnd logicalAnd(Operand x, Operand y) { + return LogicalAnd.create(scope, x, y); + } + + /** + * Builds an {@link Sin} operation + * + * @param x + * @return a new instance of Sin + * @see org.tensorflow.op.math.Sin + */ + public Sin sin(Operand x) { + return Sin.create(scope, x); + } + + /** + * Builds an {@link Erf} operation + * + * @param x + * @return a new instance of Erf + * @see org.tensorflow.op.math.Erf + */ + public Erf erf(Operand x) { + return Erf.create(scope, x); + } + + /** + * Builds an {@link Igammac} operation + * + * @param a + * @param x + * @return a new instance of Igammac + * @see org.tensorflow.op.math.Igammac + */ + public Igammac igammac(Operand a, Operand x) { + return Igammac.create(scope, a, x); + } + + /** + * Builds an {@link ApproximateEqual} operation + * + * @param x + * @param y + * @param options carries optional attributes values + * @return a new instance of ApproximateEqual + * @see org.tensorflow.op.math.ApproximateEqual + */ + public ApproximateEqual approximateEqual(Operand x, Operand y, + ApproximateEqual.Options... options) { + return ApproximateEqual.create(scope, x, y, options); + } + + /** + * Builds an {@link Imag} operation + * + * @param input + * @return a new instance of Imag + * @see org.tensorflow.op.math.Imag + */ + public Imag imag(Operand input) { + return Imag.create(scope, input); + } + + /** + * Builds an {@link FloorMod} operation + * + * @param x + * @param y + * @return a new instance of FloorMod + * @see org.tensorflow.op.math.FloorMod + */ + public FloorMod floorMod(Operand x, Operand y) { + return FloorMod.create(scope, x, y); + } + + /** + * Builds an {@link Maximum} operation + * + * @param x + * @param y + * @return a new instance of Maximum + * @see org.tensorflow.op.math.Maximum + */ + public Maximum maximum(Operand x, Operand y) { + return Maximum.create(scope, x, y); + } + + /** + * Builds an {@link NotEqual} operation + * + * @param x + * @param y + * @param options carries optional attributes values + * @return a new instance of NotEqual + * @see org.tensorflow.op.math.NotEqual + */ + public NotEqual notEqual(Operand x, Operand y, NotEqual.Options... options) { + return NotEqual.create(scope, x, y, options); + } + + /** + * Builds an {@link Expm1} operation + * + * @param x + * @return a new instance of Expm1 + * @see org.tensorflow.op.math.Expm1 + */ + public Expm1 expm1(Operand x) { + return Expm1.create(scope, x); + } + + /** + * Builds an {@link IsFinite} operation + * + * @param x + * @return a new instance of IsFinite + * @see org.tensorflow.op.math.IsFinite + */ + public IsFinite isFinite(Operand x) { + return IsFinite.create(scope, x); + } + + /** + * Builds an {@link QuantizedAdd} operation + * + * @param x + * @param y + * @param minX The float value that the lowest quantized `x` value represents. + * @param maxX The float value that the highest quantized `x` value represents. + * @param minY The float value that the lowest quantized `y` value represents. + * @param maxY The float value that the highest quantized `y` value represents. + * @param Toutput + * @return a new instance of QuantizedAdd + * @see org.tensorflow.op.math.QuantizedAdd + */ + public QuantizedAdd quantizedAdd(Operand x, Operand y, Operand minX, + Operand maxX, Operand minY, Operand maxY, Class Toutput) { + return QuantizedAdd.create(scope, x, y, minX, maxX, minY, maxY, Toutput); + } + + /** + * Builds an {@link Log1p} operation + * + * @param x + * @return a new instance of Log1p + * @see org.tensorflow.op.math.Log1p + */ + public Log1p log1p(Operand x) { + return Log1p.create(scope, x); + } + + /** + * Builds an {@link Exp} operation + * + * @param x + * @return a new instance of Exp + * @see org.tensorflow.op.math.Exp + */ + public Exp exp(Operand x) { + return Exp.create(scope, x); + } + + /** + * Builds an {@link Erfc} operation + * + * @param x + * @return a new instance of Erfc + * @see org.tensorflow.op.math.Erfc + */ + public Erfc erfc(Operand x) { + return Erfc.create(scope, x); + } + + /** + * Builds an {@link SquaredDifference} operation + * + * @param x + * @param y + * @return a new instance of SquaredDifference + * @see org.tensorflow.op.math.SquaredDifference + */ + public SquaredDifference squaredDifference(Operand x, Operand y) { + return SquaredDifference.create(scope, x, y); + } + + /** + * Builds an {@link Softplus} operation + * + * @param features + * @return a new instance of Softplus + * @see org.tensorflow.op.math.Softplus + */ + public Softplus softplus(Operand features) { + return Softplus.create(scope, features); + } + + /** + * Builds an {@link CompareAndBitpack} operation + * + * @param input Values to compare against `threshold` and bitpack. + * @param threshold Threshold to compare against. + * @return a new instance of CompareAndBitpack + * @see org.tensorflow.op.math.CompareAndBitpack + */ + public CompareAndBitpack compareAndBitpack(Operand input, Operand threshold) { + return CompareAndBitpack.create(scope, input, threshold); + } + + /** + * Builds an {@link IsNan} operation + * + * @param x + * @return a new instance of IsNan + * @see org.tensorflow.op.math.IsNan + */ + public IsNan isNan(Operand x) { + return IsNan.create(scope, x); + } + + /** + * Builds an {@link Floor} operation + * + * @param x + * @return a new instance of Floor + * @see org.tensorflow.op.math.Floor + */ + public Floor floor(Operand x) { + return Floor.create(scope, x); + } + + /** + * Builds an {@link Sub} operation + * + * @param x + * @param y + * @return a new instance of Sub + * @see org.tensorflow.op.math.Sub + */ + public Sub sub(Operand x, Operand y) { + return Sub.create(scope, x, y); + } + + /** + * Builds an {@link Asin} operation + * + * @param x + * @return a new instance of Asin + * @see org.tensorflow.op.math.Asin + */ + public Asin asin(Operand x) { + return Asin.create(scope, x); + } + + /** + * Builds an {@link Round} operation + * + * @param x + * @return a new instance of Round + * @see org.tensorflow.op.math.Round + */ + public Round round(Operand x) { + return Round.create(scope, x); + } + + /** + * Builds an {@link SegmentMin} operation + * + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * @return a new instance of SegmentMin + * @see org.tensorflow.op.math.SegmentMin + */ + public SegmentMin segmentMin(Operand data, + Operand segmentIds) { + return SegmentMin.create(scope, data, segmentIds); + } + + /** + * Builds an {@link Atan2} operation + * + * @param y + * @param x + * @return a new instance of Atan2 + * @see org.tensorflow.op.math.Atan2 + */ + public Atan2 atan2(Operand y, Operand x) { + return Atan2.create(scope, y, x); + } + + /** + * Builds an {@link SegmentProd} operation + * + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * @return a new instance of SegmentProd + * @see org.tensorflow.op.math.SegmentProd + */ + public SegmentProd segmentProd(Operand data, Operand segmentIds) { + return SegmentProd.create(scope, data, segmentIds); + } + + /** + * Builds an {@link Sign} operation + * + * @param x + * @return a new instance of Sign + * @see org.tensorflow.op.math.Sign + */ + public Sign sign(Operand x) { + return Sign.create(scope, x); + } + + /** + * Builds an {@link ComplexAbs} operation + * + * @param x + * @return a new instance of ComplexAbs + * @see org.tensorflow.op.math.ComplexAbs + */ + public ComplexAbs complexAbs(Operand x) { + return ComplexAbs.create(scope, x); + } + + /** + * Builds an {@link SegmentSum} operation + * + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * @return a new instance of SegmentSum + * @see org.tensorflow.op.math.SegmentSum + */ + public SegmentSum segmentSum(Operand data, Operand segmentIds) { + return SegmentSum.create(scope, data, segmentIds); + } + + /** + * Builds an {@link Div} operation + * + * @param x + * @param y + * @return a new instance of Div + * @see org.tensorflow.op.math.Div + */ + public Div div(Operand x, Operand y) { + return Div.create(scope, x, y); + } + + /** + * Builds an {@link Pow} operation + * + * @param x + * @param y + * @return a new instance of Pow + * @see org.tensorflow.op.math.Pow + */ + public Pow pow(Operand x, Operand y) { + return Pow.create(scope, x, y); + } + + /** + * Builds an {@link Less} operation + * + * @param x + * @param y + * @return a new instance of Less + * @see org.tensorflow.op.math.Less + */ + public Less less(Operand x, Operand y) { + return Less.create(scope, x, y); + } + + /** + * Builds an {@link AccumulateN} operation + * + * @param inputs A list of `Tensor` objects, each with same shape and type. + * @param shape Shape of elements of `inputs`. + * @return a new instance of AccumulateN + * @see org.tensorflow.op.math.AccumulateN + */ + public AccumulateN accumulateN(Iterable> inputs, Shape shape) { + return AccumulateN.create(scope, inputs, shape); + } + + /** + * Builds an {@link Zeta} operation + * + * @param x + * @param q + * @return a new instance of Zeta + * @see org.tensorflow.op.math.Zeta + */ + public Zeta zeta(Operand x, Operand q) { + return Zeta.create(scope, x, q); + } + + /** + * Builds an {@link ArgMin} operation + * + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * @return a new instance of ArgMin + * @see org.tensorflow.op.math.ArgMin + */ + public ArgMin argMin(Operand input, Operand dimension) { + return ArgMin.create(scope, input, dimension); + } + + /** + * Builds an {@link Abs} operation + * + * @param x + * @return a new instance of Abs + * @see org.tensorflow.op.math.Abs + */ + public Abs abs(Operand x) { + return Abs.create(scope, x); + } + + /** + * Builds an {@link Polygamma} operation + * + * @param a + * @param x + * @return a new instance of Polygamma + * @see org.tensorflow.op.math.Polygamma + */ + public Polygamma polygamma(Operand a, Operand x) { + return Polygamma.create(scope, a, x); + } + + /** + * Builds an {@link DivNoNan} operation + * + * @param x + * @param y + * @return a new instance of DivNoNan + * @see org.tensorflow.op.math.DivNoNan + */ + public DivNoNan divNoNan(Operand x, Operand y) { + return DivNoNan.create(scope, x, y); + } + + /** + * Builds an {@link Sinh} operation + * + * @param x + * @return a new instance of Sinh + * @see org.tensorflow.op.math.Sinh + */ + public Sinh sinh(Operand x) { + return Sinh.create(scope, x); + } + + /** + * Builds an {@link Rsqrt} operation + * + * @param x + * @return a new instance of Rsqrt + * @see org.tensorflow.op.math.Rsqrt + */ + public Rsqrt rsqrt(Operand x) { + return Rsqrt.create(scope, x); + } + + /** + * Builds an {@link Minimum} operation + * + * @param x + * @param y + * @return a new instance of Minimum + * @see org.tensorflow.op.math.Minimum + */ + public Minimum minimum(Operand x, Operand y) { + return Minimum.create(scope, x, y); + } + + /** + * Builds an {@link Lgamma} operation + * + * @param x + * @return a new instance of Lgamma + * @see org.tensorflow.op.math.Lgamma + */ + public Lgamma lgamma(Operand x) { + return Lgamma.create(scope, x); + } + + /** + * Builds an {@link ArgMin} operation + * + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * @param outputType + * @return a new instance of ArgMin + * @see org.tensorflow.op.math.ArgMin + */ + public ArgMin argMin(Operand input, + Operand dimension, Class outputType) { + return ArgMin.create(scope, input, dimension, outputType); + } + + /** + * Builds an {@link UnsortedSegmentMax} operation + * + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentMax + * @see org.tensorflow.op.math.UnsortedSegmentMax + */ + public UnsortedSegmentMax unsortedSegmentMax( + Operand data, Operand segmentIds, Operand numSegments) { + return UnsortedSegmentMax.create(scope, data, segmentIds, numSegments); + } + + /** + * Builds an {@link UnsortedSegmentMin} operation + * + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentMin + * @see org.tensorflow.op.math.UnsortedSegmentMin + */ + public UnsortedSegmentMin unsortedSegmentMin( + Operand data, Operand segmentIds, Operand numSegments) { + return UnsortedSegmentMin.create(scope, data, segmentIds, numSegments); + } + + /** + * Builds an {@link PopulationCount} operation + * + * @param x + * @return a new instance of PopulationCount + * @see org.tensorflow.op.math.PopulationCount + */ + public PopulationCount populationCount(Operand x) { + return PopulationCount.create(scope, x); + } + + /** + * Builds an {@link Cumsum} operation + * + * @param x A `Tensor`. Must be one of the following types: `float32`, `float64`, + * @param axis A `Tensor` of type `int32` (default: 0). Must be in the range + * @param options carries optional attributes values + * @return a new instance of Cumsum + * @see org.tensorflow.op.math.Cumsum + */ + public Cumsum cumsum(Operand x, Operand axis, + Cumsum.Options... options) { + return Cumsum.create(scope, x, axis, options); + } + + /** + * Builds an {@link Imag} operation + * + * @param input + * @param Tout + * @return a new instance of Imag + * @see org.tensorflow.op.math.Imag + */ + public Imag imag(Operand input, Class Tout) { + return Imag.create(scope, input, Tout); + } + + /** + * Builds an {@link Tanh} operation + * + * @param x + * @return a new instance of Tanh + * @see org.tensorflow.op.math.Tanh + */ + public Tanh tanh(Operand x) { + return Tanh.create(scope, x); + } + + /** + * Builds an {@link AddN} operation + * + * @param inputs + * @return a new instance of AddN + * @see org.tensorflow.op.math.AddN + */ + public AddN addN(Iterable> inputs) { + return AddN.create(scope, inputs); + } + + /** + * Builds an {@link SegmentMax} operation + * + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * @return a new instance of SegmentMax + * @see org.tensorflow.op.math.SegmentMax + */ + public SegmentMax segmentMax(Operand data, + Operand segmentIds) { + return SegmentMax.create(scope, data, segmentIds); + } + + /** + * Builds an {@link Cosh} operation + * + * @param x + * @return a new instance of Cosh + * @see org.tensorflow.op.math.Cosh + */ + public Cosh cosh(Operand x) { + return Cosh.create(scope, x); + } + + /** + * Builds an {@link Conj} operation + * + * @param input + * @return a new instance of Conj + * @see org.tensorflow.op.math.Conj + */ + public Conj conj(Operand input) { + return Conj.create(scope, input); + } + + /** + * Builds an {@link Add} operation + * + * @param x + * @param y + * @return a new instance of Add + * @see org.tensorflow.op.math.Add + */ + public Add add(Operand x, Operand y) { + return Add.create(scope, x, y); + } + + /** + * Builds an {@link Fact} operation + * + * @return a new instance of Fact + * @see org.tensorflow.op.math.Fact + */ + public Fact fact() { + return Fact.create(scope); + } + + /** + * Builds an {@link Cos} operation + * + * @param x + * @return a new instance of Cos + * @see org.tensorflow.op.math.Cos + */ + public Cos cos(Operand x) { + return Cos.create(scope, x); + } + + /** + * Builds an {@link Mean} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of Mean + * @see org.tensorflow.op.math.Mean + */ + public Mean mean(Operand input, Operand axis, + Mean.Options... options) { + return Mean.create(scope, input, axis, options); + } + + /** + * Builds an {@link ArgMax} operation + * + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * @return a new instance of ArgMax + * @see org.tensorflow.op.math.ArgMax + */ + public ArgMax argMax(Operand input, Operand dimension) { + return ArgMax.create(scope, input, dimension); + } + + /** + * Builds an {@link Real} operation + * + * @param input + * @return a new instance of Real + * @see org.tensorflow.op.math.Real + */ + public Real real(Operand input) { + return Real.create(scope, input); + } + + /** + * Builds an {@link Greater} operation + * + * @param x + * @param y + * @return a new instance of Greater + * @see org.tensorflow.op.math.Greater + */ + public Greater greater(Operand x, Operand y) { + return Greater.create(scope, x, y); + } + + /** + * Builds an {@link Atanh} operation + * + * @param x + * @return a new instance of Atanh + * @see org.tensorflow.op.math.Atanh + */ + public Atanh atanh(Operand x) { + return Atanh.create(scope, x); + } + + /** + * Builds an {@link Reciprocal} operation + * + * @param x + * @return a new instance of Reciprocal + * @see org.tensorflow.op.math.Reciprocal + */ + public Reciprocal reciprocal(Operand x) { + return Reciprocal.create(scope, x); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java new file mode 100644 index 00000000000..da716e4639e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java @@ -0,0 +1,1232 @@ +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.op.nn.AvgPool; +import org.tensorflow.op.nn.AvgPool3d; +import org.tensorflow.op.nn.AvgPool3dGrad; +import org.tensorflow.op.nn.BatchNormWithGlobalNormalization; +import org.tensorflow.op.nn.BatchNormWithGlobalNormalizationGrad; +import org.tensorflow.op.nn.BiasAdd; +import org.tensorflow.op.nn.BiasAddGrad; +import org.tensorflow.op.nn.ComputeAccidentalHits; +import org.tensorflow.op.nn.Conv2d; +import org.tensorflow.op.nn.Conv2dBackpropFilter; +import org.tensorflow.op.nn.Conv2dBackpropInput; +import org.tensorflow.op.nn.Conv3d; +import org.tensorflow.op.nn.Conv3dBackpropFilter; +import org.tensorflow.op.nn.Conv3dBackpropInput; +import org.tensorflow.op.nn.CtcBeamSearchDecoder; +import org.tensorflow.op.nn.CtcGreedyDecoder; +import org.tensorflow.op.nn.CtcLoss; +import org.tensorflow.op.nn.CudnnRnnCanonicalToParams; +import org.tensorflow.op.nn.CudnnRnnParamsSize; +import org.tensorflow.op.nn.CudnnRnnParamsToCanonical; +import org.tensorflow.op.nn.DataFormatDimMap; +import org.tensorflow.op.nn.DataFormatVecPermute; +import org.tensorflow.op.nn.DepthToSpace; +import org.tensorflow.op.nn.DepthwiseConv2dNative; +import org.tensorflow.op.nn.DepthwiseConv2dNativeBackpropFilter; +import org.tensorflow.op.nn.DepthwiseConv2dNativeBackpropInput; +import org.tensorflow.op.nn.Dilation2d; +import org.tensorflow.op.nn.Dilation2dBackpropFilter; +import org.tensorflow.op.nn.Dilation2dBackpropInput; +import org.tensorflow.op.nn.Elu; +import org.tensorflow.op.nn.FixedUnigramCandidateSampler; +import org.tensorflow.op.nn.FractionalAvgPool; +import org.tensorflow.op.nn.FractionalMaxPool; +import org.tensorflow.op.nn.FusedBatchNorm; +import org.tensorflow.op.nn.FusedBatchNormGrad; +import org.tensorflow.op.nn.FusedPadConv2d; +import org.tensorflow.op.nn.FusedResizeAndPadConv2d; +import org.tensorflow.op.nn.InTopK; +import org.tensorflow.op.nn.L2Loss; +import org.tensorflow.op.nn.LearnedUnigramCandidateSampler; +import org.tensorflow.op.nn.LocalResponseNormalization; +import org.tensorflow.op.nn.LogSoftmax; +import org.tensorflow.op.nn.MaxPool; +import org.tensorflow.op.nn.MaxPool3d; +import org.tensorflow.op.nn.MaxPool3dGrad; +import org.tensorflow.op.nn.MaxPool3dGradGrad; +import org.tensorflow.op.nn.MaxPoolGrad; +import org.tensorflow.op.nn.MaxPoolGradGrad; +import org.tensorflow.op.nn.MaxPoolGradGradWithArgmax; +import org.tensorflow.op.nn.MaxPoolWithArgmax; +import org.tensorflow.op.nn.NthElement; +import org.tensorflow.op.nn.QuantizedAvgPool; +import org.tensorflow.op.nn.QuantizedBatchNormWithGlobalNormalization; +import org.tensorflow.op.nn.QuantizedBiasAdd; +import org.tensorflow.op.nn.QuantizedConv2d; +import org.tensorflow.op.nn.QuantizedInstanceNorm; +import org.tensorflow.op.nn.QuantizedMaxPool; +import org.tensorflow.op.nn.QuantizedRelu; +import org.tensorflow.op.nn.QuantizedRelu6; +import org.tensorflow.op.nn.QuantizedReluX; +import org.tensorflow.op.nn.Relu; +import org.tensorflow.op.nn.Relu6; +import org.tensorflow.op.nn.Selu; +import org.tensorflow.op.nn.Softmax; +import org.tensorflow.op.nn.SoftmaxCrossEntropyWithLogits; +import org.tensorflow.op.nn.Softsign; +import org.tensorflow.op.nn.SpaceToBatch; +import org.tensorflow.op.nn.SpaceToDepth; +import org.tensorflow.op.nn.SparseSoftmaxCrossEntropyWithLogits; +import org.tensorflow.op.nn.TopK; + +/** + * An API for building {@code nn} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class NnOps { + private final Scope scope; + + NnOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link QuantizedReluX} operation + * + * @param features + * @param maxValue + * @param minFeatures The float value that the lowest quantized value represents. + * @param maxFeatures The float value that the highest quantized value represents. + * @param outType + * @return a new instance of QuantizedReluX + * @see org.tensorflow.op.nn.QuantizedReluX + */ + public QuantizedReluX quantizedReluX(Operand features, Operand maxValue, + Operand minFeatures, Operand maxFeatures, Class outType) { + return QuantizedReluX.create(scope, features, maxValue, minFeatures, maxFeatures, outType); + } + + /** + * Builds an {@link Conv2d} operation + * + * @param input A 4-D tensor. The dimension order is interpreted according to the value + * @param filter A 4-D tensor of shape + * @param strides 1-D tensor of length 4. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv2d + * @see org.tensorflow.op.nn.Conv2d + */ + public Conv2d conv2d(Operand input, Operand filter, + List strides, String padding, Conv2d.Options... options) { + return Conv2d.create(scope, input, filter, strides, padding, options); + } + + /** + * Builds an {@link QuantizedAvgPool} operation + * + * @param input 4-D with shape `[batch, height, width, channels]`. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the input + * @param padding The type of padding algorithm to use. + * @return a new instance of QuantizedAvgPool + * @see org.tensorflow.op.nn.QuantizedAvgPool + */ + public QuantizedAvgPool quantizedAvgPool(Operand input, Operand minInput, + Operand maxInput, List ksize, List strides, String padding) { + return QuantizedAvgPool.create(scope, input, minInput, maxInput, ksize, strides, padding); + } + + /** + * Builds an {@link AvgPool3d} operation + * + * @param input Shape `[batch, depth, rows, cols, channels]` tensor to pool over. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of AvgPool3d + * @see org.tensorflow.op.nn.AvgPool3d + */ + public AvgPool3d avgPool3d(Operand input, List ksize, + List strides, String padding, AvgPool3d.Options... options) { + return AvgPool3d.create(scope, input, ksize, strides, padding, options); + } + + /** + * Builds an {@link LearnedUnigramCandidateSampler} operation + * + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of LearnedUnigramCandidateSampler + * @see org.tensorflow.op.nn.LearnedUnigramCandidateSampler + */ + public LearnedUnigramCandidateSampler learnedUnigramCandidateSampler(Operand trueClasses, + Long numTrue, Long numSampled, Boolean unique, Long rangeMax, + LearnedUnigramCandidateSampler.Options... options) { + return LearnedUnigramCandidateSampler.create(scope, trueClasses, numTrue, numSampled, unique, rangeMax, options); + } + + /** + * Builds an {@link DepthToSpace} operation + * + * @param input + * @param blockSize The size of the spatial block, same as in Space2Depth. + * @param options carries optional attributes values + * @return a new instance of DepthToSpace + * @see org.tensorflow.op.nn.DepthToSpace + */ + public DepthToSpace depthToSpace(Operand input, Long blockSize, + DepthToSpace.Options... options) { + return DepthToSpace.create(scope, input, blockSize, options); + } + + /** + * Builds an {@link CudnnRnnParamsSize} operation + * + * @param numLayers + * @param numUnits + * @param inputSize + * @param T + * @param S + * @param options carries optional attributes values + * @return a new instance of CudnnRnnParamsSize + * @see org.tensorflow.op.nn.CudnnRnnParamsSize + */ + public CudnnRnnParamsSize cudnnRnnParamsSize( + Operand numLayers, Operand numUnits, Operand inputSize, Class T, + Class S, CudnnRnnParamsSize.Options... options) { + return CudnnRnnParamsSize.create(scope, numLayers, numUnits, inputSize, T, S, options); + } + + /** + * Builds an {@link Dilation2d} operation + * + * @param input 4-D with shape `[batch, in_height, in_width, depth]`. + * @param filter 3-D with shape `[filter_height, filter_width, depth]`. + * @param strides The stride of the sliding window for each dimension of the input + * @param rates The input stride for atrous morphological dilation. Must be: + * @param padding The type of padding algorithm to use. + * @return a new instance of Dilation2d + * @see org.tensorflow.op.nn.Dilation2d + */ + public Dilation2d dilation2d(Operand input, Operand filter, + List strides, List rates, String padding) { + return Dilation2d.create(scope, input, filter, strides, rates, padding); + } + + /** + * Builds an {@link Conv3dBackpropFilter} operation + * + * @param input Shape `[batch, depth, rows, cols, in_channels]`. + * @param filterSizes An integer vector representing the tensor shape of `filter`, + * @param outBackprop Backprop signal of shape `[batch, out_depth, out_rows, out_cols, + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv3dBackpropFilter + * @see org.tensorflow.op.nn.Conv3dBackpropFilter + */ + public Conv3dBackpropFilter conv3dBackpropFilter(Operand input, + Operand filterSizes, Operand outBackprop, List strides, String padding, + Conv3dBackpropFilter.Options... options) { + return Conv3dBackpropFilter.create(scope, input, filterSizes, outBackprop, strides, padding, options); + } + + /** + * Builds an {@link MaxPool3dGradGrad} operation + * + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad Output backprop of shape `[batch, depth, rows, cols, channels]`. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool3dGradGrad + * @see org.tensorflow.op.nn.MaxPool3dGradGrad + */ + public MaxPool3dGradGrad maxPool3dGradGrad(Operand origInput, + Operand origOutput, Operand grad, List ksize, List strides, String padding, + MaxPool3dGradGrad.Options... options) { + return MaxPool3dGradGrad.create(scope, origInput, origOutput, grad, ksize, strides, padding, options); + } + + /** + * Builds an {@link CtcLoss} operation + * + * @param inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. + * @param labelsIndices The indices of a `SparseTensor`. + * @param labelsValues The values (labels) associated with the given batch and time. + * @param sequenceLength A vector containing sequence lengths (batch). + * @param options carries optional attributes values + * @return a new instance of CtcLoss + * @see org.tensorflow.op.nn.CtcLoss + */ + public CtcLoss ctcLoss(Operand inputs, Operand labelsIndices, + Operand labelsValues, Operand sequenceLength, CtcLoss.Options... options) { + return CtcLoss.create(scope, inputs, labelsIndices, labelsValues, sequenceLength, options); + } + + /** + * Builds an {@link SoftmaxCrossEntropyWithLogits} operation + * + * @param features batch_size x num_classes matrix + * @param labels batch_size x num_classes matrix + * @return a new instance of SoftmaxCrossEntropyWithLogits + * @see org.tensorflow.op.nn.SoftmaxCrossEntropyWithLogits + */ + public SoftmaxCrossEntropyWithLogits softmaxCrossEntropyWithLogits( + Operand features, Operand labels) { + return SoftmaxCrossEntropyWithLogits.create(scope, features, labels); + } + + /** + * Builds an {@link QuantizedMaxPool} operation + * + * @param input The 4D (batch x rows x cols x depth) Tensor to MaxReduce over. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the input + * @param padding The type of padding algorithm to use. + * @return a new instance of QuantizedMaxPool + * @see org.tensorflow.op.nn.QuantizedMaxPool + */ + public QuantizedMaxPool quantizedMaxPool(Operand input, Operand minInput, + Operand maxInput, List ksize, List strides, String padding) { + return QuantizedMaxPool.create(scope, input, minInput, maxInput, ksize, strides, padding); + } + + /** + * Builds an {@link Softmax} operation + * + * @param logits 2-D with shape `[batch_size, num_classes]`. + * @return a new instance of Softmax + * @see org.tensorflow.op.nn.Softmax + */ + public Softmax softmax(Operand logits) { + return Softmax.create(scope, logits); + } + + /** + * Builds an {@link Conv2dBackpropFilter} operation + * + * @param input 4-D with shape `[batch, in_height, in_width, in_channels]`. + * @param filterSizes An integer vector representing the tensor shape of `filter`, + * @param outBackprop 4-D with shape `[batch, out_height, out_width, out_channels]`. + * @param strides The stride of the sliding window for each dimension of the input + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv2dBackpropFilter + * @see org.tensorflow.op.nn.Conv2dBackpropFilter + */ + public Conv2dBackpropFilter conv2dBackpropFilter(Operand input, + Operand filterSizes, Operand outBackprop, List strides, String padding, + Conv2dBackpropFilter.Options... options) { + return Conv2dBackpropFilter.create(scope, input, filterSizes, outBackprop, strides, padding, options); + } + + /** + * Builds an {@link L2Loss} operation + * + * @param t Typically 2-D, but may have any dimensions. + * @return a new instance of L2Loss + * @see org.tensorflow.op.nn.L2Loss + */ + public L2Loss l2Loss(Operand t) { + return L2Loss.create(scope, t); + } + + /** + * Builds an {@link MaxPool3dGrad} operation + * + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad Output backprop of shape `[batch, depth, rows, cols, channels]`. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool3dGrad + * @see org.tensorflow.op.nn.MaxPool3dGrad + */ + public MaxPool3dGrad maxPool3dGrad(Operand origInput, + Operand origOutput, Operand grad, List ksize, List strides, String padding, + MaxPool3dGrad.Options... options) { + return MaxPool3dGrad.create(scope, origInput, origOutput, grad, ksize, strides, padding, options); + } + + /** + * Builds an {@link SparseSoftmaxCrossEntropyWithLogits} operation + * + * @param features batch_size x num_classes matrix + * @param labels batch_size vector with values in [0, num_classes). + * @return a new instance of SparseSoftmaxCrossEntropyWithLogits + * @see org.tensorflow.op.nn.SparseSoftmaxCrossEntropyWithLogits + */ + public SparseSoftmaxCrossEntropyWithLogits sparseSoftmaxCrossEntropyWithLogits( + Operand features, Operand labels) { + return SparseSoftmaxCrossEntropyWithLogits.create(scope, features, labels); + } + + /** + * Builds an {@link QuantizedConv2d} operation + * + * @param input + * @param filter filter's input_depth dimension must match input's depth dimensions. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param minFilter The float value that the lowest quantized filter value represents. + * @param maxFilter The float value that the highest quantized filter value represents. + * @param outType + * @param strides The stride of the sliding window for each dimension of the input + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2d + * @see org.tensorflow.op.nn.QuantizedConv2d + */ + public QuantizedConv2d quantizedConv2d(Operand input, Operand filter, + Operand minInput, Operand maxInput, Operand minFilter, + Operand maxFilter, Class outType, List strides, String padding, + QuantizedConv2d.Options... options) { + return QuantizedConv2d.create(scope, input, filter, minInput, maxInput, minFilter, maxFilter, outType, strides, padding, options); + } + + /** + * Builds an {@link AvgPool} operation + * + * @param value 4-D with shape `[batch, height, width, channels]`. + * @param ksize The size of the sliding window for each dimension of `value`. + * @param strides The stride of the sliding window for each dimension of `value`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of AvgPool + * @see org.tensorflow.op.nn.AvgPool + */ + public AvgPool avgPool(Operand value, List ksize, + List strides, String padding, AvgPool.Options... options) { + return AvgPool.create(scope, value, ksize, strides, padding, options); + } + + /** + * Builds an {@link QuantizedRelu} operation + * + * @param features + * @param minFeatures The float value that the lowest quantized value represents. + * @param maxFeatures The float value that the highest quantized value represents. + * @param outType + * @return a new instance of QuantizedRelu + * @see org.tensorflow.op.nn.QuantizedRelu + */ + public QuantizedRelu quantizedRelu(Operand features, Operand minFeatures, + Operand maxFeatures, Class outType) { + return QuantizedRelu.create(scope, features, minFeatures, maxFeatures, outType); + } + + /** + * Builds an {@link Conv3d} operation + * + * @param input Shape `[batch, in_depth, in_height, in_width, in_channels]`. + * @param filter Shape `[filter_depth, filter_height, filter_width, in_channels, + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv3d + * @see org.tensorflow.op.nn.Conv3d + */ + public Conv3d conv3d(Operand input, Operand filter, + List strides, String padding, Conv3d.Options... options) { + return Conv3d.create(scope, input, filter, strides, padding, options); + } + + /** + * Builds an {@link FractionalMaxPool} operation + * + * @param value 4-D with shape `[batch, height, width, channels]`. + * @param poolingRatio Pooling ratio for each dimension of `value`, currently only + * @param options carries optional attributes values + * @return a new instance of FractionalMaxPool + * @see org.tensorflow.op.nn.FractionalMaxPool + */ + public FractionalMaxPool fractionalMaxPool(Operand value, + List poolingRatio, FractionalMaxPool.Options... options) { + return FractionalMaxPool.create(scope, value, poolingRatio, options); + } + + /** + * Builds an {@link QuantizedInstanceNorm} operation + * + * @param x A 4D input Tensor. + * @param xMin The value represented by the lowest quantized input. + * @param xMax The value represented by the highest quantized input. + * @param options carries optional attributes values + * @return a new instance of QuantizedInstanceNorm + * @see org.tensorflow.op.nn.QuantizedInstanceNorm + */ + public QuantizedInstanceNorm quantizedInstanceNorm(Operand x, Operand xMin, + Operand xMax, QuantizedInstanceNorm.Options... options) { + return QuantizedInstanceNorm.create(scope, x, xMin, xMax, options); + } + + /** + * Builds an {@link AvgPool3dGrad} operation + * + * @param origInputShape The original input dimensions. + * @param grad Output backprop of shape `[batch, depth, rows, cols, channels]`. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of AvgPool3dGrad + * @see org.tensorflow.op.nn.AvgPool3dGrad + */ + public AvgPool3dGrad avgPool3dGrad(Operand origInputShape, + Operand grad, List ksize, List strides, String padding, + AvgPool3dGrad.Options... options) { + return AvgPool3dGrad.create(scope, origInputShape, grad, ksize, strides, padding, options); + } + + /** + * Builds an {@link DepthwiseConv2dNativeBackpropInput} operation + * + * @param inputSizes An integer vector representing the shape of `input`, based + * @param filter 4-D with shape + * @param outBackprop 4-D with shape based on `data_format`. + * @param strides The stride of the sliding window for each dimension of the input + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of DepthwiseConv2dNativeBackpropInput + * @see org.tensorflow.op.nn.DepthwiseConv2dNativeBackpropInput + */ + public DepthwiseConv2dNativeBackpropInput depthwiseConv2dNativeBackpropInput( + Operand inputSizes, Operand filter, Operand outBackprop, List strides, + String padding, DepthwiseConv2dNativeBackpropInput.Options... options) { + return DepthwiseConv2dNativeBackpropInput.create(scope, inputSizes, filter, outBackprop, strides, padding, options); + } + + /** + * Builds an {@link Relu6} operation + * + * @param features + * @return a new instance of Relu6 + * @see org.tensorflow.op.nn.Relu6 + */ + public Relu6 relu6(Operand features) { + return Relu6.create(scope, features); + } + + /** + * Builds an {@link DataFormatDimMap} operation + * + * @param x A Tensor with each element as a dimension index in source data format. + * @param options carries optional attributes values + * @return a new instance of DataFormatDimMap + * @see org.tensorflow.op.nn.DataFormatDimMap + */ + public DataFormatDimMap dataFormatDimMap(Operand x, + DataFormatDimMap.Options... options) { + return DataFormatDimMap.create(scope, x, options); + } + + /** + * Builds an {@link Relu} operation + * + * @param features + * @return a new instance of Relu + * @see org.tensorflow.op.nn.Relu + */ + public Relu relu(Operand features) { + return Relu.create(scope, features); + } + + /** + * Builds an {@link FusedBatchNormGrad} operation + * + * @param yBackprop A 4D Tensor for the gradient with respect to y. + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param reserveSpace1 When is_training is True, a 1D Tensor for the computed batch + * @param reserveSpace2 When is_training is True, a 1D Tensor for the computed batch + * @param options carries optional attributes values + * @return a new instance of FusedBatchNormGrad + * @see org.tensorflow.op.nn.FusedBatchNormGrad + */ + public FusedBatchNormGrad fusedBatchNormGrad( + Operand yBackprop, Operand x, Operand scale, Operand reserveSpace1, + Operand reserveSpace2, FusedBatchNormGrad.Options... options) { + return FusedBatchNormGrad.create(scope, yBackprop, x, scale, reserveSpace1, reserveSpace2, options); + } + + /** + * Builds an {@link SpaceToDepth} operation + * + * @param input + * @param blockSize The size of the spatial block. + * @param options carries optional attributes values + * @return a new instance of SpaceToDepth + * @see org.tensorflow.op.nn.SpaceToDepth + */ + public SpaceToDepth spaceToDepth(Operand input, Long blockSize, + SpaceToDepth.Options... options) { + return SpaceToDepth.create(scope, input, blockSize, options); + } + + /** + * Builds an {@link MaxPool} operation + * + * @param input 4-D input to pool over. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool + * @see org.tensorflow.op.nn.MaxPool + */ + public MaxPool maxPool(Operand input, Operand ksize, Operand strides, + String padding, MaxPool.Options... options) { + return MaxPool.create(scope, input, ksize, strides, padding, options); + } + + /** + * Builds an {@link BatchNormWithGlobalNormalizationGrad} operation + * + * @param t A 4D input Tensor. + * @param m A 1D mean Tensor with size matching the last dimension of t. + * @param v A 1D variance Tensor with size matching the last dimension of t. + * @param gamma A 1D gamma Tensor with size matching the last dimension of t. + * @param backprop 4D backprop Tensor. + * @param varianceEpsilon A small float number to avoid dividing by 0. + * @param scaleAfterNormalization A bool indicating whether the resulted tensor + * @return a new instance of BatchNormWithGlobalNormalizationGrad + * @see org.tensorflow.op.nn.BatchNormWithGlobalNormalizationGrad + */ + public BatchNormWithGlobalNormalizationGrad batchNormWithGlobalNormalizationGrad( + Operand t, Operand m, Operand v, Operand gamma, Operand backprop, + Float varianceEpsilon, Boolean scaleAfterNormalization) { + return BatchNormWithGlobalNormalizationGrad.create(scope, t, m, v, gamma, backprop, varianceEpsilon, scaleAfterNormalization); + } + + /** + * Builds an {@link BatchNormWithGlobalNormalization} operation + * + * @param t A 4D input Tensor. + * @param m A 1D mean Tensor with size matching the last dimension of t. + * @param v A 1D variance Tensor with size matching the last dimension of t. + * @param beta A 1D beta Tensor with size matching the last dimension of t. + * @param gamma A 1D gamma Tensor with size matching the last dimension of t. + * @param varianceEpsilon A small float number to avoid dividing by 0. + * @param scaleAfterNormalization A bool indicating whether the resulted tensor + * @return a new instance of BatchNormWithGlobalNormalization + * @see org.tensorflow.op.nn.BatchNormWithGlobalNormalization + */ + public BatchNormWithGlobalNormalization batchNormWithGlobalNormalization(Operand t, + Operand m, Operand v, Operand beta, Operand gamma, Float varianceEpsilon, + Boolean scaleAfterNormalization) { + return BatchNormWithGlobalNormalization.create(scope, t, m, v, beta, gamma, varianceEpsilon, scaleAfterNormalization); + } + + /** + * Builds an {@link CudnnRnnCanonicalToParams} operation + * + * @param numLayers + * @param numUnits + * @param inputSize + * @param weights + * @param biases + * @param options carries optional attributes values + * @return a new instance of CudnnRnnCanonicalToParams + * @see org.tensorflow.op.nn.CudnnRnnCanonicalToParams + */ + public CudnnRnnCanonicalToParams cudnnRnnCanonicalToParams( + Operand numLayers, Operand numUnits, Operand inputSize, + Iterable> weights, Iterable> biases, + CudnnRnnCanonicalToParams.Options... options) { + return CudnnRnnCanonicalToParams.create(scope, numLayers, numUnits, inputSize, weights, biases, options); + } + + /** + * Builds an {@link InTopK} operation + * + * @param predictions A `batch_size` x `classes` tensor. + * @param targets A `batch_size` vector of class ids. + * @param k Number of top elements to look at for computing precision. + * @return a new instance of InTopK + * @see org.tensorflow.op.nn.InTopK + */ + public InTopK inTopK(Operand predictions, Operand targets, + Operand k) { + return InTopK.create(scope, predictions, targets, k); + } + + /** + * Builds an {@link MaxPoolWithArgmax} operation + * + * @param input 4-D with shape `[batch, height, width, channels]`. Input to pool over. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * @param Targmax + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolWithArgmax + * @see org.tensorflow.op.nn.MaxPoolWithArgmax + */ + public MaxPoolWithArgmax maxPoolWithArgmax( + Operand input, List ksize, List strides, Class Targmax, String padding, + MaxPoolWithArgmax.Options... options) { + return MaxPoolWithArgmax.create(scope, input, ksize, strides, Targmax, padding, options); + } + + /** + * Builds an {@link MaxPoolGradGrad} operation + * + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad 4-D. Gradients of gradients w.r.t. the input of `max_pool`. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolGradGrad + * @see org.tensorflow.op.nn.MaxPoolGradGrad + */ + public MaxPoolGradGrad maxPoolGradGrad(Operand origInput, + Operand origOutput, Operand grad, Operand ksize, Operand strides, + String padding, MaxPoolGradGrad.Options... options) { + return MaxPoolGradGrad.create(scope, origInput, origOutput, grad, ksize, strides, padding, options); + } + + /** + * Builds an {@link Dilation2dBackpropFilter} operation + * + * @param input 4-D with shape `[batch, in_height, in_width, depth]`. + * @param filter 3-D with shape `[filter_height, filter_width, depth]`. + * @param outBackprop 4-D with shape `[batch, out_height, out_width, depth]`. + * @param strides 1-D of length 4. The stride of the sliding window for each dimension of + * @param rates 1-D of length 4. The input stride for atrous morphological dilation. + * @param padding The type of padding algorithm to use. + * @return a new instance of Dilation2dBackpropFilter + * @see org.tensorflow.op.nn.Dilation2dBackpropFilter + */ + public Dilation2dBackpropFilter dilation2dBackpropFilter(Operand input, + Operand filter, Operand outBackprop, List strides, List rates, + String padding) { + return Dilation2dBackpropFilter.create(scope, input, filter, outBackprop, strides, rates, padding); + } + + /** + * Builds an {@link FusedBatchNorm} operation + * + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param offset A 1D Tensor for offset, to shift to the normalized x. + * @param mean A 1D Tensor for population mean. Used for inference only; + * @param variance A 1D Tensor for population variance. Used for inference only; + * @param options carries optional attributes values + * @return a new instance of FusedBatchNorm + * @see org.tensorflow.op.nn.FusedBatchNorm + */ + public FusedBatchNorm fusedBatchNorm(Operand x, + Operand scale, Operand offset, Operand mean, Operand variance, + FusedBatchNorm.Options... options) { + return FusedBatchNorm.create(scope, x, scale, offset, mean, variance, options); + } + + /** + * Builds an {@link FractionalAvgPool} operation + * + * @param value 4-D with shape `[batch, height, width, channels]`. + * @param poolingRatio Pooling ratio for each dimension of `value`, currently only + * @param options carries optional attributes values + * @return a new instance of FractionalAvgPool + * @see org.tensorflow.op.nn.FractionalAvgPool + */ + public FractionalAvgPool fractionalAvgPool(Operand value, + List poolingRatio, FractionalAvgPool.Options... options) { + return FractionalAvgPool.create(scope, value, poolingRatio, options); + } + + /** + * Builds an {@link BiasAddGrad} operation + * + * @param outBackprop Any number of dimensions. + * @param options carries optional attributes values + * @return a new instance of BiasAddGrad + * @see org.tensorflow.op.nn.BiasAddGrad + */ + public BiasAddGrad biasAddGrad(Operand outBackprop, BiasAddGrad.Options... options) { + return BiasAddGrad.create(scope, outBackprop, options); + } + + /** + * Builds an {@link LogSoftmax} operation + * + * @param logits 2-D with shape `[batch_size, num_classes]`. + * @return a new instance of LogSoftmax + * @see org.tensorflow.op.nn.LogSoftmax + */ + public LogSoftmax logSoftmax(Operand logits) { + return LogSoftmax.create(scope, logits); + } + + /** + * Builds an {@link TopK} operation + * + * @param input 1-D or higher with last dimension at least `k`. + * @param k 0-D. Number of top elements to look for along the last dimension (along each + * @param options carries optional attributes values + * @return a new instance of TopK + * @see org.tensorflow.op.nn.TopK + */ + public TopK topK(Operand input, Operand k, + TopK.Options... options) { + return TopK.create(scope, input, k, options); + } + + /** + * Builds an {@link CudnnRnnParamsToCanonical} operation + * + * @param numLayers + * @param numUnits + * @param inputSize + * @param params + * @param numParams + * @param options carries optional attributes values + * @return a new instance of CudnnRnnParamsToCanonical + * @see org.tensorflow.op.nn.CudnnRnnParamsToCanonical + */ + public CudnnRnnParamsToCanonical cudnnRnnParamsToCanonical( + Operand numLayers, Operand numUnits, Operand inputSize, + Operand params, Long numParams, CudnnRnnParamsToCanonical.Options... options) { + return CudnnRnnParamsToCanonical.create(scope, numLayers, numUnits, inputSize, params, numParams, options); + } + + /** + * Builds an {@link FixedUnigramCandidateSampler} operation + * + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of FixedUnigramCandidateSampler + * @see org.tensorflow.op.nn.FixedUnigramCandidateSampler + */ + public FixedUnigramCandidateSampler fixedUnigramCandidateSampler(Operand trueClasses, + Long numTrue, Long numSampled, Boolean unique, Long rangeMax, + FixedUnigramCandidateSampler.Options... options) { + return FixedUnigramCandidateSampler.create(scope, trueClasses, numTrue, numSampled, unique, rangeMax, options); + } + + /** + * Builds an {@link MaxPoolGradGradWithArgmax} operation + * + * @param input The original input. + * @param grad 4-D with shape `[batch, height, width, channels]`. Gradients w.r.t. the + * @param argmax The indices of the maximum values chosen for each output of `max_pool`. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolGradGradWithArgmax + * @see org.tensorflow.op.nn.MaxPoolGradGradWithArgmax + */ + public MaxPoolGradGradWithArgmax maxPoolGradGradWithArgmax( + Operand input, Operand grad, Operand argmax, List ksize, List strides, + String padding, MaxPoolGradGradWithArgmax.Options... options) { + return MaxPoolGradGradWithArgmax.create(scope, input, grad, argmax, ksize, strides, padding, options); + } + + /** + * Builds an {@link Conv3dBackpropInput} operation + * + * @param inputSizes An integer vector representing the tensor shape of `input`, + * @param filter Shape `[depth, rows, cols, in_channels, out_channels]`. + * @param outBackprop Backprop signal of shape `[batch, out_depth, out_rows, out_cols, + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv3dBackpropInput + * @see org.tensorflow.op.nn.Conv3dBackpropInput + */ + public Conv3dBackpropInput conv3dBackpropInput( + Operand inputSizes, Operand filter, Operand outBackprop, List strides, + String padding, Conv3dBackpropInput.Options... options) { + return Conv3dBackpropInput.create(scope, inputSizes, filter, outBackprop, strides, padding, options); + } + + /** + * Builds an {@link Softsign} operation + * + * @param features + * @return a new instance of Softsign + * @see org.tensorflow.op.nn.Softsign + */ + public Softsign softsign(Operand features) { + return Softsign.create(scope, features); + } + + /** + * Builds an {@link ComputeAccidentalHits} operation + * + * @param trueClasses The true_classes output of UnpackSparseLabels. + * @param sampledCandidates The sampled_candidates output of CandidateSampler. + * @param numTrue Number of true labels per context. + * @param options carries optional attributes values + * @return a new instance of ComputeAccidentalHits + * @see org.tensorflow.op.nn.ComputeAccidentalHits + */ + public ComputeAccidentalHits computeAccidentalHits(Operand trueClasses, + Operand sampledCandidates, Long numTrue, ComputeAccidentalHits.Options... options) { + return ComputeAccidentalHits.create(scope, trueClasses, sampledCandidates, numTrue, options); + } + + /** + * Builds an {@link DataFormatVecPermute} operation + * + * @param x Vector of size 4 or Tensor of shape (4, 2) in source data format. + * @param options carries optional attributes values + * @return a new instance of DataFormatVecPermute + * @see org.tensorflow.op.nn.DataFormatVecPermute + */ + public DataFormatVecPermute dataFormatVecPermute(Operand x, + DataFormatVecPermute.Options... options) { + return DataFormatVecPermute.create(scope, x, options); + } + + /** + * Builds an {@link CtcBeamSearchDecoder} operation + * + * @param inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. + * @param sequenceLength A vector containing sequence lengths, size `(batch)`. + * @param beamWidth A scalar >= 0 (beam search beam width). + * @param topPaths A scalar >= 0, <= beam_width (controls output size). + * @param options carries optional attributes values + * @return a new instance of CtcBeamSearchDecoder + * @see org.tensorflow.op.nn.CtcBeamSearchDecoder + */ + public CtcBeamSearchDecoder ctcBeamSearchDecoder(Operand inputs, + Operand sequenceLength, Long beamWidth, Long topPaths, + CtcBeamSearchDecoder.Options... options) { + return CtcBeamSearchDecoder.create(scope, inputs, sequenceLength, beamWidth, topPaths, options); + } + + /** + * Builds an {@link MaxPoolWithArgmax} operation + * + * @param input 4-D with shape `[batch, height, width, channels]`. Input to pool over. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolWithArgmax + * @see org.tensorflow.op.nn.MaxPoolWithArgmax + */ + public MaxPoolWithArgmax maxPoolWithArgmax(Operand input, + List ksize, List strides, String padding, MaxPoolWithArgmax.Options... options) { + return MaxPoolWithArgmax.create(scope, input, ksize, strides, padding, options); + } + + /** + * Builds an {@link DepthwiseConv2dNative} operation + * + * @param input + * @param filter + * @param strides 1-D of length 4. The stride of the sliding window for each dimension + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of DepthwiseConv2dNative + * @see org.tensorflow.op.nn.DepthwiseConv2dNative + */ + public DepthwiseConv2dNative depthwiseConv2dNative(Operand input, + Operand filter, List strides, String padding, + DepthwiseConv2dNative.Options... options) { + return DepthwiseConv2dNative.create(scope, input, filter, strides, padding, options); + } + + /** + * Builds an {@link QuantizedBiasAdd} operation + * + * @param input + * @param bias A 1D bias Tensor with size matching the last dimension of 'input'. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param minBias The float value that the lowest quantized bias value represents. + * @param maxBias The float value that the highest quantized bias value represents. + * @param outType + * @return a new instance of QuantizedBiasAdd + * @see org.tensorflow.op.nn.QuantizedBiasAdd + */ + public QuantizedBiasAdd quantizedBiasAdd(Operand input, Operand bias, + Operand minInput, Operand maxInput, Operand minBias, + Operand maxBias, Class outType) { + return QuantizedBiasAdd.create(scope, input, bias, minInput, maxInput, minBias, maxBias, outType); + } + + /** + * Builds an {@link Dilation2dBackpropInput} operation + * + * @param input 4-D with shape `[batch, in_height, in_width, depth]`. + * @param filter 3-D with shape `[filter_height, filter_width, depth]`. + * @param outBackprop 4-D with shape `[batch, out_height, out_width, depth]`. + * @param strides 1-D of length 4. The stride of the sliding window for each dimension of + * @param rates 1-D of length 4. The input stride for atrous morphological dilation. + * @param padding The type of padding algorithm to use. + * @return a new instance of Dilation2dBackpropInput + * @see org.tensorflow.op.nn.Dilation2dBackpropInput + */ + public Dilation2dBackpropInput dilation2dBackpropInput(Operand input, + Operand filter, Operand outBackprop, List strides, List rates, + String padding) { + return Dilation2dBackpropInput.create(scope, input, filter, outBackprop, strides, rates, padding); + } + + /** + * Builds an {@link NthElement} operation + * + * @param input 1-D or higher with last dimension at least `n+1`. + * @param n 0-D. Position of sorted vector to select along the last dimension (along + * @param options carries optional attributes values + * @return a new instance of NthElement + * @see org.tensorflow.op.nn.NthElement + */ + public NthElement nthElement(Operand input, Operand n, + NthElement.Options... options) { + return NthElement.create(scope, input, n, options); + } + + /** + * Builds an {@link Conv2dBackpropInput} operation + * + * @param inputSizes An integer vector representing the shape of `input`, + * @param filter 4-D with shape + * @param outBackprop 4-D with shape `[batch, out_height, out_width, out_channels]`. + * @param strides The stride of the sliding window for each dimension of the input + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv2dBackpropInput + * @see org.tensorflow.op.nn.Conv2dBackpropInput + */ + public Conv2dBackpropInput conv2dBackpropInput(Operand inputSizes, + Operand filter, Operand outBackprop, List strides, String padding, + Conv2dBackpropInput.Options... options) { + return Conv2dBackpropInput.create(scope, inputSizes, filter, outBackprop, strides, padding, options); + } + + /** + * Builds an {@link Elu} operation + * + * @param features + * @return a new instance of Elu + * @see org.tensorflow.op.nn.Elu + */ + public Elu elu(Operand features) { + return Elu.create(scope, features); + } + + /** + * Builds an {@link LocalResponseNormalization} operation + * + * @param input 4-D. + * @param options carries optional attributes values + * @return a new instance of LocalResponseNormalization + * @see org.tensorflow.op.nn.LocalResponseNormalization + */ + public LocalResponseNormalization localResponseNormalization( + Operand input, LocalResponseNormalization.Options... options) { + return LocalResponseNormalization.create(scope, input, options); + } + + /** + * Builds an {@link DepthwiseConv2dNativeBackpropFilter} operation + * + * @param input 4-D with shape based on `data_format`. For example, if + * @param filterSizes An integer vector representing the tensor shape of `filter`, + * @param outBackprop 4-D with shape based on `data_format`. + * @param strides The stride of the sliding window for each dimension of the input + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of DepthwiseConv2dNativeBackpropFilter + * @see org.tensorflow.op.nn.DepthwiseConv2dNativeBackpropFilter + */ + public DepthwiseConv2dNativeBackpropFilter depthwiseConv2dNativeBackpropFilter( + Operand input, Operand filterSizes, Operand outBackprop, List strides, + String padding, DepthwiseConv2dNativeBackpropFilter.Options... options) { + return DepthwiseConv2dNativeBackpropFilter.create(scope, input, filterSizes, outBackprop, strides, padding, options); + } + + /** + * Builds an {@link SpaceToBatch} operation + * + * @param input 4-D with shape `[batch, height, width, depth]`. + * @param paddings 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies + * @param blockSize + * @return a new instance of SpaceToBatch + * @see org.tensorflow.op.nn.SpaceToBatch + */ + public SpaceToBatch spaceToBatch(Operand input, Operand paddings, + Long blockSize) { + return SpaceToBatch.create(scope, input, paddings, blockSize); + } + + /** + * Builds an {@link FusedPadConv2d} operation + * + * @param input 4-D with shape `[batch, in_height, in_width, in_channels]`. + * @param paddings A two-column matrix specifying the padding sizes. The number of + * @param filter 4-D with shape + * @param mode + * @param strides 1-D of length 4. The stride of the sliding window for each dimension + * @param padding The type of padding algorithm to use. + * @return a new instance of FusedPadConv2d + * @see org.tensorflow.op.nn.FusedPadConv2d + */ + public FusedPadConv2d fusedPadConv2d(Operand input, + Operand paddings, Operand filter, String mode, List strides, + String padding) { + return FusedPadConv2d.create(scope, input, paddings, filter, mode, strides, padding); + } + + /** + * Builds an {@link MaxPoolGrad} operation + * + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad 4-D. Gradients w.r.t. the output of `max_pool`. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolGrad + * @see org.tensorflow.op.nn.MaxPoolGrad + */ + public MaxPoolGrad maxPoolGrad(Operand origInput, Operand origOutput, + Operand grad, Operand ksize, Operand strides, String padding, + MaxPoolGrad.Options... options) { + return MaxPoolGrad.create(scope, origInput, origOutput, grad, ksize, strides, padding, options); + } + + /** + * Builds an {@link QuantizedBatchNormWithGlobalNormalization} operation + * + * @param t A 4D input Tensor. + * @param tMin The value represented by the lowest quantized input. + * @param tMax The value represented by the highest quantized input. + * @param m A 1D mean Tensor with size matching the last dimension of t. + * @param mMin The value represented by the lowest quantized mean. + * @param mMax The value represented by the highest quantized mean. + * @param v A 1D variance Tensor with size matching the last dimension of t. + * @param vMin The value represented by the lowest quantized variance. + * @param vMax The value represented by the highest quantized variance. + * @param beta A 1D beta Tensor with size matching the last dimension of t. + * @param betaMin The value represented by the lowest quantized offset. + * @param betaMax The value represented by the highest quantized offset. + * @param gamma A 1D gamma Tensor with size matching the last dimension of t. + * @param gammaMin The value represented by the lowest quantized gamma. + * @param gammaMax The value represented by the highest quantized gamma. + * @param outType + * @param varianceEpsilon A small float number to avoid dividing by 0. + * @param scaleAfterNormalization A bool indicating whether the resulted tensor + * @return a new instance of QuantizedBatchNormWithGlobalNormalization + * @see org.tensorflow.op.nn.QuantizedBatchNormWithGlobalNormalization + */ + public QuantizedBatchNormWithGlobalNormalization quantizedBatchNormWithGlobalNormalization( + Operand t, Operand tMin, Operand tMax, Operand m, Operand mMin, + Operand mMax, Operand v, Operand vMin, Operand vMax, Operand beta, + Operand betaMin, Operand betaMax, Operand gamma, Operand gammaMin, + Operand gammaMax, Class outType, Float varianceEpsilon, + Boolean scaleAfterNormalization) { + return QuantizedBatchNormWithGlobalNormalization.create(scope, t, tMin, tMax, m, mMin, mMax, v, vMin, vMax, beta, betaMin, betaMax, gamma, gammaMin, gammaMax, outType, varianceEpsilon, scaleAfterNormalization); + } + + /** + * Builds an {@link Selu} operation + * + * @param features + * @return a new instance of Selu + * @see org.tensorflow.op.nn.Selu + */ + public Selu selu(Operand features) { + return Selu.create(scope, features); + } + + /** + * Builds an {@link FusedResizeAndPadConv2d} operation + * + * @param input 4-D with shape `[batch, in_height, in_width, in_channels]`. + * @param size A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * @param paddings A two-column matrix specifying the padding sizes. The number of + * @param filter 4-D with shape + * @param mode + * @param strides 1-D of length 4. The stride of the sliding window for each dimension + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of FusedResizeAndPadConv2d + * @see org.tensorflow.op.nn.FusedResizeAndPadConv2d + */ + public FusedResizeAndPadConv2d fusedResizeAndPadConv2d(Operand input, + Operand size, Operand paddings, Operand filter, String mode, + List strides, String padding, FusedResizeAndPadConv2d.Options... options) { + return FusedResizeAndPadConv2d.create(scope, input, size, paddings, filter, mode, strides, padding, options); + } + + /** + * Builds an {@link MaxPool3d} operation + * + * @param input Shape `[batch, depth, rows, cols, channels]` tensor to pool over. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool3d + * @see org.tensorflow.op.nn.MaxPool3d + */ + public MaxPool3d maxPool3d(Operand input, List ksize, + List strides, String padding, MaxPool3d.Options... options) { + return MaxPool3d.create(scope, input, ksize, strides, padding, options); + } + + /** + * Builds an {@link CtcGreedyDecoder} operation + * + * @param inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. + * @param sequenceLength A vector containing sequence lengths, size `(batch_size)`. + * @param options carries optional attributes values + * @return a new instance of CtcGreedyDecoder + * @see org.tensorflow.op.nn.CtcGreedyDecoder + */ + public CtcGreedyDecoder ctcGreedyDecoder(Operand inputs, Operand sequenceLength, + CtcGreedyDecoder.Options... options) { + return CtcGreedyDecoder.create(scope, inputs, sequenceLength, options); + } + + /** + * Builds an {@link QuantizedRelu6} operation + * + * @param features + * @param minFeatures The float value that the lowest quantized value represents. + * @param maxFeatures The float value that the highest quantized value represents. + * @param outType + * @return a new instance of QuantizedRelu6 + * @see org.tensorflow.op.nn.QuantizedRelu6 + */ + public QuantizedRelu6 quantizedRelu6(Operand features, Operand minFeatures, + Operand maxFeatures, Class outType) { + return QuantizedRelu6.create(scope, features, minFeatures, maxFeatures, outType); + } + + /** + * Builds an {@link BiasAdd} operation + * + * @param value Any number of dimensions. + * @param bias 1-D with size the last dimension of `value`. + * @param options carries optional attributes values + * @return a new instance of BiasAdd + * @see org.tensorflow.op.nn.BiasAdd + */ + public BiasAdd biasAdd(Operand value, Operand bias, BiasAdd.Options... options) { + return BiasAdd.create(scope, value, bias, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java new file mode 100644 index 00000000000..49afedf3717 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java @@ -0,0 +1,4681 @@ +package org.tensorflow.op; + +import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; +import java.nio.charset.Charset; +import java.util.List; +import org.tensorflow.ExecutionEnvironment; +import org.tensorflow.Operand; +import org.tensorflow.Shape; +import org.tensorflow.op.core.Abort; +import org.tensorflow.op.core.All; +import org.tensorflow.op.core.Any; +import org.tensorflow.op.core.AssertThat; +import org.tensorflow.op.core.Assign; +import org.tensorflow.op.core.AssignAdd; +import org.tensorflow.op.core.AssignAddVariableOp; +import org.tensorflow.op.core.AssignSub; +import org.tensorflow.op.core.AssignSubVariableOp; +import org.tensorflow.op.core.AssignVariableOp; +import org.tensorflow.op.core.Barrier; +import org.tensorflow.op.core.BarrierClose; +import org.tensorflow.op.core.BarrierIncompleteSize; +import org.tensorflow.op.core.BarrierInsertMany; +import org.tensorflow.op.core.BarrierReadySize; +import org.tensorflow.op.core.BarrierTakeMany; +import org.tensorflow.op.core.Batch; +import org.tensorflow.op.core.BatchMatMulV2; +import org.tensorflow.op.core.BatchToSpace; +import org.tensorflow.op.core.BatchToSpaceNd; +import org.tensorflow.op.core.Bitcast; +import org.tensorflow.op.core.BroadcastDynamicShape; +import org.tensorflow.op.core.BroadcastTo; +import org.tensorflow.op.core.Bucketize; +import org.tensorflow.op.core.ClipByValue; +import org.tensorflow.op.core.CombinedNonMaxSuppression; +import org.tensorflow.op.core.Concat; +import org.tensorflow.op.core.Constant; +import org.tensorflow.op.core.ConsumeMutexLock; +import org.tensorflow.op.core.ControlTrigger; +import org.tensorflow.op.core.CountUpTo; +import org.tensorflow.op.core.CudnnRNNCanonicalToParamsV2; +import org.tensorflow.op.core.CudnnRNNParamsToCanonicalV2; +import org.tensorflow.op.core.DecodePaddedRaw; +import org.tensorflow.op.core.DeepCopy; +import org.tensorflow.op.core.DeleteSessionTensor; +import org.tensorflow.op.core.DestroyResourceOp; +import org.tensorflow.op.core.DestroyTemporaryVariable; +import org.tensorflow.op.core.DrawBoundingBoxesV2; +import org.tensorflow.op.core.DynamicPartition; +import org.tensorflow.op.core.DynamicStitch; +import org.tensorflow.op.core.EditDistance; +import org.tensorflow.op.core.Einsum; +import org.tensorflow.op.core.Empty; +import org.tensorflow.op.core.EmptyTensorList; +import org.tensorflow.op.core.EnsureShape; +import org.tensorflow.op.core.EuclideanNorm; +import org.tensorflow.op.core.ExpandDims; +import org.tensorflow.op.core.ExtractVolumePatches; +import org.tensorflow.op.core.Fill; +import org.tensorflow.op.core.Fingerprint; +import org.tensorflow.op.core.FusedBatchNormGradV3; +import org.tensorflow.op.core.FusedBatchNormV3; +import org.tensorflow.op.core.Gather; +import org.tensorflow.op.core.GatherNd; +import org.tensorflow.op.core.GetSessionHandle; +import org.tensorflow.op.core.GetSessionTensor; +import org.tensorflow.op.core.Gradients; +import org.tensorflow.op.core.GuaranteeConst; +import org.tensorflow.op.core.HashTable; +import org.tensorflow.op.core.HistogramFixedWidth; +import org.tensorflow.op.core.Identity; +import org.tensorflow.op.core.IdentityN; +import org.tensorflow.op.core.ImmutableConst; +import org.tensorflow.op.core.InitializeTable; +import org.tensorflow.op.core.InitializeTableFromTextFile; +import org.tensorflow.op.core.InplaceAdd; +import org.tensorflow.op.core.InplaceSub; +import org.tensorflow.op.core.InplaceUpdate; +import org.tensorflow.op.core.IsVariableInitialized; +import org.tensorflow.op.core.LinSpace; +import org.tensorflow.op.core.LookupTableExport; +import org.tensorflow.op.core.LookupTableFind; +import org.tensorflow.op.core.LookupTableImport; +import org.tensorflow.op.core.LookupTableInsert; +import org.tensorflow.op.core.LookupTableSize; +import org.tensorflow.op.core.LoopCond; +import org.tensorflow.op.core.Lu; +import org.tensorflow.op.core.MapClear; +import org.tensorflow.op.core.MapIncompleteSize; +import org.tensorflow.op.core.MapPeek; +import org.tensorflow.op.core.MapSize; +import org.tensorflow.op.core.MapStage; +import org.tensorflow.op.core.MapUnstage; +import org.tensorflow.op.core.MapUnstageNoKey; +import org.tensorflow.op.core.MatrixDiagPartV2; +import org.tensorflow.op.core.MatrixDiagV2; +import org.tensorflow.op.core.MatrixSetDiagV2; +import org.tensorflow.op.core.Max; +import org.tensorflow.op.core.Merge; +import org.tensorflow.op.core.Min; +import org.tensorflow.op.core.MirrorPad; +import org.tensorflow.op.core.MulNoNan; +import org.tensorflow.op.core.MutableDenseHashTable; +import org.tensorflow.op.core.MutableHashTable; +import org.tensorflow.op.core.MutableHashTableOfTensors; +import org.tensorflow.op.core.Mutex; +import org.tensorflow.op.core.MutexLock; +import org.tensorflow.op.core.NextAfter; +import org.tensorflow.op.core.NextIteration; +import org.tensorflow.op.core.NoOp; +import org.tensorflow.op.core.NonMaxSuppressionV5; +import org.tensorflow.op.core.OneHot; +import org.tensorflow.op.core.OnesLike; +import org.tensorflow.op.core.OrderedMapClear; +import org.tensorflow.op.core.OrderedMapIncompleteSize; +import org.tensorflow.op.core.OrderedMapPeek; +import org.tensorflow.op.core.OrderedMapSize; +import org.tensorflow.op.core.OrderedMapStage; +import org.tensorflow.op.core.OrderedMapUnstage; +import org.tensorflow.op.core.OrderedMapUnstageNoKey; +import org.tensorflow.op.core.Pad; +import org.tensorflow.op.core.ParallelConcat; +import org.tensorflow.op.core.ParallelDynamicStitch; +import org.tensorflow.op.core.Placeholder; +import org.tensorflow.op.core.PlaceholderWithDefault; +import org.tensorflow.op.core.Print; +import org.tensorflow.op.core.Prod; +import org.tensorflow.op.core.QuantizedConcat; +import org.tensorflow.op.core.QuantizedConcatV2; +import org.tensorflow.op.core.QuantizedReshape; +import org.tensorflow.op.core.Range; +import org.tensorflow.op.core.Rank; +import org.tensorflow.op.core.ReadVariableOp; +import org.tensorflow.op.core.ReduceAll; +import org.tensorflow.op.core.ReduceAny; +import org.tensorflow.op.core.ReduceMax; +import org.tensorflow.op.core.ReduceMin; +import org.tensorflow.op.core.ReduceProd; +import org.tensorflow.op.core.ReduceSum; +import org.tensorflow.op.core.RefNextIteration; +import org.tensorflow.op.core.RefSelect; +import org.tensorflow.op.core.RefSwitch; +import org.tensorflow.op.core.RemoteFusedGraphExecute; +import org.tensorflow.op.core.Reshape; +import org.tensorflow.op.core.ResourceApplyAdamWithAmsgrad; +import org.tensorflow.op.core.ResourceApplyKerasMomentum; +import org.tensorflow.op.core.ResourceCountUpTo; +import org.tensorflow.op.core.ResourceGather; +import org.tensorflow.op.core.ResourceGatherNd; +import org.tensorflow.op.core.ResourceScatterAdd; +import org.tensorflow.op.core.ResourceScatterDiv; +import org.tensorflow.op.core.ResourceScatterMax; +import org.tensorflow.op.core.ResourceScatterMin; +import org.tensorflow.op.core.ResourceScatterMul; +import org.tensorflow.op.core.ResourceScatterNdAdd; +import org.tensorflow.op.core.ResourceScatterNdSub; +import org.tensorflow.op.core.ResourceScatterNdUpdate; +import org.tensorflow.op.core.ResourceScatterSub; +import org.tensorflow.op.core.ResourceScatterUpdate; +import org.tensorflow.op.core.ResourceSparseApplyKerasMomentum; +import org.tensorflow.op.core.ResourceStridedSliceAssign; +import org.tensorflow.op.core.Reverse; +import org.tensorflow.op.core.ReverseSequence; +import org.tensorflow.op.core.Roll; +import org.tensorflow.op.core.Rpc; +import org.tensorflow.op.core.ScaleAndTranslate; +import org.tensorflow.op.core.ScatterAdd; +import org.tensorflow.op.core.ScatterDiv; +import org.tensorflow.op.core.ScatterMax; +import org.tensorflow.op.core.ScatterMin; +import org.tensorflow.op.core.ScatterMul; +import org.tensorflow.op.core.ScatterNd; +import org.tensorflow.op.core.ScatterNdAdd; +import org.tensorflow.op.core.ScatterNdNonAliasingAdd; +import org.tensorflow.op.core.ScatterNdSub; +import org.tensorflow.op.core.ScatterNdUpdate; +import org.tensorflow.op.core.ScatterSub; +import org.tensorflow.op.core.ScatterUpdate; +import org.tensorflow.op.core.SelectV2; +import org.tensorflow.op.core.SetDiff1d; +import org.tensorflow.op.core.SetSize; +import org.tensorflow.op.core.ShapeN; +import org.tensorflow.op.core.Size; +import org.tensorflow.op.core.Skipgram; +import org.tensorflow.op.core.Slice; +import org.tensorflow.op.core.Snapshot; +import org.tensorflow.op.core.SpaceToBatchNd; +import org.tensorflow.op.core.Split; +import org.tensorflow.op.core.SplitV; +import org.tensorflow.op.core.Squeeze; +import org.tensorflow.op.core.Stack; +import org.tensorflow.op.core.Stage; +import org.tensorflow.op.core.StageClear; +import org.tensorflow.op.core.StagePeek; +import org.tensorflow.op.core.StageSize; +import org.tensorflow.op.core.StatefulRandomBinomial; +import org.tensorflow.op.core.StatefulStandardNormal; +import org.tensorflow.op.core.StatefulStandardNormalV2; +import org.tensorflow.op.core.StopGradient; +import org.tensorflow.op.core.StridedSlice; +import org.tensorflow.op.core.StridedSliceAssign; +import org.tensorflow.op.core.StridedSliceGrad; +import org.tensorflow.op.core.StringLower; +import org.tensorflow.op.core.StringNGrams; +import org.tensorflow.op.core.StringUpper; +import org.tensorflow.op.core.Sum; +import org.tensorflow.op.core.SwitchCond; +import org.tensorflow.op.core.TemporaryVariable; +import org.tensorflow.op.core.TensorArray; +import org.tensorflow.op.core.TensorArrayClose; +import org.tensorflow.op.core.TensorArrayConcat; +import org.tensorflow.op.core.TensorArrayGather; +import org.tensorflow.op.core.TensorArrayGrad; +import org.tensorflow.op.core.TensorArrayGradWithShape; +import org.tensorflow.op.core.TensorArrayPack; +import org.tensorflow.op.core.TensorArrayRead; +import org.tensorflow.op.core.TensorArrayScatter; +import org.tensorflow.op.core.TensorArraySize; +import org.tensorflow.op.core.TensorArraySplit; +import org.tensorflow.op.core.TensorArrayUnpack; +import org.tensorflow.op.core.TensorArrayWrite; +import org.tensorflow.op.core.TensorListConcat; +import org.tensorflow.op.core.TensorListConcatLists; +import org.tensorflow.op.core.TensorListConcatV2; +import org.tensorflow.op.core.TensorListElementShape; +import org.tensorflow.op.core.TensorListFromTensor; +import org.tensorflow.op.core.TensorListGather; +import org.tensorflow.op.core.TensorListGetItem; +import org.tensorflow.op.core.TensorListLength; +import org.tensorflow.op.core.TensorListPopBack; +import org.tensorflow.op.core.TensorListPushBack; +import org.tensorflow.op.core.TensorListPushBackBatch; +import org.tensorflow.op.core.TensorListReserve; +import org.tensorflow.op.core.TensorListResize; +import org.tensorflow.op.core.TensorListScatter; +import org.tensorflow.op.core.TensorListScatterIntoExistingList; +import org.tensorflow.op.core.TensorListScatterV2; +import org.tensorflow.op.core.TensorListSetItem; +import org.tensorflow.op.core.TensorListSplit; +import org.tensorflow.op.core.TensorListStack; +import org.tensorflow.op.core.TensorScatterAdd; +import org.tensorflow.op.core.TensorScatterSub; +import org.tensorflow.op.core.TensorScatterUpdate; +import org.tensorflow.op.core.TensorStridedSliceUpdate; +import org.tensorflow.op.core.Tile; +import org.tensorflow.op.core.Timestamp; +import org.tensorflow.op.core.TryRpc; +import org.tensorflow.op.core.Unbatch; +import org.tensorflow.op.core.UnbatchGrad; +import org.tensorflow.op.core.Unique; +import org.tensorflow.op.core.UniqueWithCounts; +import org.tensorflow.op.core.UnravelIndex; +import org.tensorflow.op.core.UnsortedSegmentJoin; +import org.tensorflow.op.core.Unstack; +import org.tensorflow.op.core.Unstage; +import org.tensorflow.op.core.VarHandleOp; +import org.tensorflow.op.core.VarIsInitializedOp; +import org.tensorflow.op.core.Variable; +import org.tensorflow.op.core.VariableShape; +import org.tensorflow.op.core.Where; +import org.tensorflow.op.core.Where3; +import org.tensorflow.op.core.Zeros; +import org.tensorflow.op.core.ZerosLike; + +/** + * An API for building operations as {@link Op Op}s + *

+ * Any operation wrapper found in the classpath properly annotated as an{@link org.tensorflow.op.annotation.Operator @Operator} is exposed + * by this API or one of its subgroup. + *

Example usage: + *

{@code
+ * try (Graph g = new Graph()) {
+ *   Ops ops = Ops.create(g);
+ *   // Operations are typed classes with convenience
+ *   // builders in Ops.
+ *   Constant three = ops.constant(3);
+ *   // Single-result operations implement the Operand
+ *   // interface, so this works too.
+ *   Operand four = ops.constant(4);
+ *   // Most builders are found within a group, and accept
+ *   // Operand types as operands
+ *   Operand nine = ops.math().add(four, ops.constant(5));
+ *   // Multi-result operations however offer methods to
+ *   // select a particular result for use.
+ *   Operand result = 
+ *       ops.math().add(ops.array().unique(s, a).y(), b);
+ *   // Optional attributes
+ *   ops.math().matMul(a, b, MatMul.transposeA(true));
+ *   // Naming operators
+ *   ops.withName("foo").constant(5); // name "foo"
+ *   // Names can exist in a hierarchy
+ *   Ops sub = ops.withSubScope("sub");
+ *   sub.withName("bar").constant(4); // "sub/bar"
+ * }
+ * }
+ */ +public final class Ops { + private final Scope scope; + + public final NnOps nn; + + public final SummaryOps summary; + + public final ImageOps image; + + public final DataOps data; + + public final IoOps io; + + public final DtypesOps dtypes; + + public final LinalgOps linalg; + + public final RandomOps random; + + public final StringsOps strings; + + public final SparseOps sparse; + + public final BitwiseOps bitwise; + + public final MathOps math; + + public final AudioOps audio; + + public final SignalOps signal; + + public final QuantizationOps quantization; + + public final TrainOps train; + + private Ops(Scope scope) { + this.scope = scope; + nn = new NnOps(scope); + summary = new SummaryOps(scope); + image = new ImageOps(scope); + data = new DataOps(scope); + io = new IoOps(scope); + dtypes = new DtypesOps(scope); + linalg = new LinalgOps(scope); + random = new RandomOps(scope); + strings = new StringsOps(scope); + sparse = new SparseOps(scope); + bitwise = new BitwiseOps(scope); + math = new MathOps(scope); + audio = new AudioOps(scope); + signal = new SignalOps(scope); + quantization = new QuantizationOps(scope); + train = new TrainOps(scope); + } + + /** + * Builds an {@link RemoteFusedGraphExecute} operation + * + * @param inputs Arbitrary number of tensors with arbitrary data types + * @param Toutputs + * @param serializedRemoteFusedGraphExecuteInfo Serialized protocol buffer + * @return a new instance of RemoteFusedGraphExecute + * @see org.tensorflow.op.core.RemoteFusedGraphExecute + */ + public RemoteFusedGraphExecute remoteFusedGraphExecute(Iterable> inputs, + List> Toutputs, String serializedRemoteFusedGraphExecuteInfo) { + return RemoteFusedGraphExecute.create(scope, inputs, Toutputs, serializedRemoteFusedGraphExecuteInfo); + } + + /** + * Builds an {@link ReadVariableOp} operation + * + * @param resource handle to the resource in which to store the variable. + * @param dtype the dtype of the value. + * @return a new instance of ReadVariableOp + * @see org.tensorflow.op.core.ReadVariableOp + */ + public ReadVariableOp readVariableOp(Operand resource, Class dtype) { + return ReadVariableOp.create(scope, resource, dtype); + } + + /** + * Builds an {@link MutexLock} operation + * + * @param mutex The mutex resource to lock. + * @return a new instance of MutexLock + * @see org.tensorflow.op.core.MutexLock + */ + public MutexLock mutexLock(Operand mutex) { + return MutexLock.create(scope, mutex); + } + + /** + * Builds an {@link OrderedMapUnstageNoKey} operation + * + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapUnstageNoKey + * @see org.tensorflow.op.core.OrderedMapUnstageNoKey + */ + public OrderedMapUnstageNoKey orderedMapUnstageNoKey(Operand indices, + List> dtypes, OrderedMapUnstageNoKey.Options... options) { + return OrderedMapUnstageNoKey.create(scope, indices, dtypes, options); + } + + /** + * Builds an {@link ResourceScatterAdd} operation + * + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterAdd + * @see org.tensorflow.op.core.ResourceScatterAdd + */ + public ResourceScatterAdd resourceScatterAdd(Operand resource, + Operand indices, Operand updates) { + return ResourceScatterAdd.create(scope, resource, indices, updates); + } + + /** + * Builds an {@link TensorListFromTensor} operation + * + * @param tensor + * @param elementShape + * @return a new instance of TensorListFromTensor + * @see org.tensorflow.op.core.TensorListFromTensor + */ + public TensorListFromTensor tensorListFromTensor(Operand tensor, + Operand elementShape) { + return TensorListFromTensor.create(scope, tensor, elementShape); + } + + /** + * Builds an {@link Constant} operation + * + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a float constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[] shape, FloatBuffer data) { + return Constant.create(scope, shape, data); + } + + /** + * Builds an {@link MutableDenseHashTable} operation + * + * @param emptyKey The key used to represent empty key buckets internally. Must not + * @param deletedKey + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of MutableDenseHashTable + * @see org.tensorflow.op.core.MutableDenseHashTable + */ + public MutableDenseHashTable mutableDenseHashTable(Operand emptyKey, + Operand deletedKey, Class valueDtype, MutableDenseHashTable.Options... options) { + return MutableDenseHashTable.create(scope, emptyKey, deletedKey, valueDtype, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data The value to put into the new constant. + * @return a float constant + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(float data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link TensorListConcatV2} operation + * + * @param inputHandle + * @param elementShape + * @param leadingDims + * @param elementDtype + * @return a new instance of TensorListConcatV2 + * @see org.tensorflow.op.core.TensorListConcatV2 + */ + public TensorListConcatV2 tensorListConcatV2(Operand inputHandle, + Operand elementShape, Operand leadingDims, Class elementDtype) { + return TensorListConcatV2.create(scope, inputHandle, elementShape, leadingDims, elementDtype); + } + + /** + * Builds an {@link ReduceAny} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of ReduceAny + * @see org.tensorflow.op.core.ReduceAny + */ + public ReduceAny reduceAny(Operand input, Operand axis, + ReduceAny.Options... options) { + return ReduceAny.create(scope, input, axis, options); + } + + /** + * Builds an {@link CudnnRNNCanonicalToParamsV2} operation + * + * @param numLayers + * @param numUnits + * @param inputSize + * @param weights + * @param biases + * @param options carries optional attributes values + * @return a new instance of CudnnRNNCanonicalToParamsV2 + * @see org.tensorflow.op.core.CudnnRNNCanonicalToParamsV2 + */ + public CudnnRNNCanonicalToParamsV2 cudnnRNNCanonicalToParamsV2( + Operand numLayers, Operand numUnits, Operand inputSize, + Iterable> weights, Iterable> biases, + CudnnRNNCanonicalToParamsV2.Options... options) { + return CudnnRNNCanonicalToParamsV2.create(scope, numLayers, numUnits, inputSize, weights, biases, options); + } + + /** + * Builds an {@link StatefulStandardNormalV2} operation + * + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @return a new instance of StatefulStandardNormalV2 + * @see org.tensorflow.op.core.StatefulStandardNormalV2 + */ + public StatefulStandardNormalV2 statefulStandardNormalV2(Operand resource, + Operand algorithm, Operand shape) { + return StatefulStandardNormalV2.create(scope, resource, algorithm, shape); + } + + /** + * Builds an {@link OrderedMapIncompleteSize} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapIncompleteSize + * @see org.tensorflow.op.core.OrderedMapIncompleteSize + */ + public OrderedMapIncompleteSize orderedMapIncompleteSize(List> dtypes, + OrderedMapIncompleteSize.Options... options) { + return OrderedMapIncompleteSize.create(scope, dtypes, options); + } + + /** + * Builds an {@link TensorListResize} operation + * + * @param inputHandle + * @param size + * @return a new instance of TensorListResize + * @see org.tensorflow.op.core.TensorListResize + */ + public TensorListResize tensorListResize(Operand inputHandle, Operand size) { + return TensorListResize.create(scope, inputHandle, size); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. String elements are + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(byte[] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link InplaceAdd} operation + * + * @param x A `Tensor` of type T. + * @param i A vector. Indices into the left-most dimension of `x`. + * @param v A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @return a new instance of InplaceAdd + * @see org.tensorflow.op.core.InplaceAdd + */ + public InplaceAdd inplaceAdd(Operand x, Operand i, Operand v) { + return InplaceAdd.create(scope, x, i, v); + } + + /** + * Builds an {@link All} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of All + * @see org.tensorflow.op.core.All + */ + public All all(Operand input, Operand axis, + All.Options... options) { + return All.create(scope, input, axis, options); + } + + /** + * Builds an {@link QuantizedReshape} operation + * + * @param tensor + * @param shape Defines the shape of the output tensor. + * @param inputMin The minimum value of the input. + * @param inputMax The maximum value of the input. + * @return a new instance of QuantizedReshape + * @see org.tensorflow.op.core.QuantizedReshape + */ + public QuantizedReshape quantizedReshape(Operand tensor, + Operand shape, Operand inputMin, Operand inputMax) { + return QuantizedReshape.create(scope, tensor, shape, inputMin, inputMax); + } + + /** + * Builds an {@link Bucketize} operation + * + * @param input Any shape of Tensor contains with int or float type. + * @param boundaries A sorted list of floats gives the boundary of the buckets. + * @return a new instance of Bucketize + * @see org.tensorflow.op.core.Bucketize + */ + public Bucketize bucketize(Operand input, List boundaries) { + return Bucketize.create(scope, input, boundaries); + } + + /** + * Builds an {@link BatchToSpaceNd} operation + * + * @param input N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, + * @param blockShape 1-D with shape `[M]`, all values must be >= 1. + * @param crops 2-D with shape `[M, 2]`, all values must be >= 0. + * @return a new instance of BatchToSpaceNd + * @see org.tensorflow.op.core.BatchToSpaceNd + */ + public BatchToSpaceNd batchToSpaceNd(Operand input, + Operand blockShape, Operand crops) { + return BatchToSpaceNd.create(scope, input, blockShape, crops); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(int[][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Slice} operation + * + * @param input + * @param begin begin[i] specifies the offset into the 'i'th dimension of + * @param size size[i] specifies the number of elements of the 'i'th dimension + * @return a new instance of Slice + * @see org.tensorflow.op.core.Slice + */ + public Slice slice(Operand input, Operand begin, Operand size) { + return Slice.create(scope, input, begin, size); + } + + /** + * Builds an {@link DynamicStitch} operation + * + * @param indices + * @param data + * @return a new instance of DynamicStitch + * @see org.tensorflow.op.core.DynamicStitch + */ + public DynamicStitch dynamicStitch(Iterable> indices, + Iterable> data) { + return DynamicStitch.create(scope, indices, data); + } + + /** + * Builds an {@link VarHandleOp} operation + * + * @param dtype the type of this variable. Must agree with the dtypes + * @param shape The (possibly partially specified) shape of this variable. + * @param options carries optional attributes values + * @return a new instance of VarHandleOp + * @see org.tensorflow.op.core.VarHandleOp + */ + public VarHandleOp varHandleOp(Class dtype, Shape shape, VarHandleOp.Options... options) { + return VarHandleOp.create(scope, dtype, shape, options); + } + + /** + * Builds an {@link ResourceScatterMin} operation + * + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterMin + * @see org.tensorflow.op.core.ResourceScatterMin + */ + public ResourceScatterMin resourceScatterMin(Operand resource, + Operand indices, Operand updates) { + return ResourceScatterMin.create(scope, resource, indices, updates); + } + + /** + * Builds an {@link MapIncompleteSize} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapIncompleteSize + * @see org.tensorflow.op.core.MapIncompleteSize + */ + public MapIncompleteSize mapIncompleteSize(List> dtypes, + MapIncompleteSize.Options... options) { + return MapIncompleteSize.create(scope, dtypes, options); + } + + /** + * Builds an {@link TensorArrayRead} operation + * + * @param handle The handle to a TensorArray. + * @param index + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param dtype The type of the elem that is returned. + * @return a new instance of TensorArrayRead + * @see org.tensorflow.op.core.TensorArrayRead + */ + public TensorArrayRead tensorArrayRead(Operand handle, Operand index, + Operand flowIn, Class dtype) { + return TensorArrayRead.create(scope, handle, index, flowIn, dtype); + } + + /** + * Builds an {@link Unique} operation + * + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * @param outIdx + * @return a new instance of Unique + * @see org.tensorflow.op.core.Unique + */ + public Unique unique(Operand x, Operand axis, + Class outIdx) { + return Unique.create(scope, x, axis, outIdx); + } + + /** + * Builds an {@link OneHot} operation + * + * @param indices A tensor of indices. + * @param depth A scalar defining the depth of the one hot dimension. + * @param onValue A scalar defining the value to fill in output when `indices[j] = i`. + * @param offValue A scalar defining the value to fill in output when `indices[j] != i`. + * @param options carries optional attributes values + * @return a new instance of OneHot + * @see org.tensorflow.op.core.OneHot + */ + public OneHot oneHot(Operand indices, Operand depth, + Operand onValue, Operand offValue, OneHot.Options... options) { + return OneHot.create(scope, indices, depth, onValue, offValue, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(boolean[][][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link TensorListPushBackBatch} operation + * + * @param inputHandles + * @param tensor + * @return a new instance of TensorListPushBackBatch + * @see org.tensorflow.op.core.TensorListPushBackBatch + */ + public TensorListPushBackBatch tensorListPushBackBatch(Operand inputHandles, + Operand tensor) { + return TensorListPushBackBatch.create(scope, inputHandles, tensor); + } + + /** + * Builds an {@link ResourceScatterNdUpdate} operation + * + * @param ref A resource handle. Must be from a VarHandleOp. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated + * @param options carries optional attributes values + * @return a new instance of ResourceScatterNdUpdate + * @see org.tensorflow.op.core.ResourceScatterNdUpdate + */ + public ResourceScatterNdUpdate resourceScatterNdUpdate(Operand ref, + Operand indices, Operand updates, ResourceScatterNdUpdate.Options... options) { + return ResourceScatterNdUpdate.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link DeleteSessionTensor} operation + * + * @param handle The handle for a tensor stored in the session state. + * @return a new instance of DeleteSessionTensor + * @see org.tensorflow.op.core.DeleteSessionTensor + */ + public DeleteSessionTensor deleteSessionTensor(Operand handle) { + return DeleteSessionTensor.create(scope, handle); + } + + /** + * Builds an {@link MatrixDiagPartV2} operation + * + * @param input Rank `r` tensor where `r >= 2`. + * @param k Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + * @param paddingValue The value to fill the area outside the specified diagonal band with. + * @return a new instance of MatrixDiagPartV2 + * @see org.tensorflow.op.core.MatrixDiagPartV2 + */ + public MatrixDiagPartV2 matrixDiagPartV2(Operand input, Operand k, + Operand paddingValue) { + return MatrixDiagPartV2.create(scope, input, k, paddingValue); + } + + /** + * Builds an {@link AssignSubVariableOp} operation + * + * @param resource handle to the resource in which to store the variable. + * @param value the value by which the variable will be incremented. + * @return a new instance of AssignSubVariableOp + * @see org.tensorflow.op.core.AssignSubVariableOp + */ + public AssignSubVariableOp assignSubVariableOp(Operand resource, Operand value) { + return AssignSubVariableOp.create(scope, resource, value); + } + + /** + * Builds an {@link ReduceProd} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of ReduceProd + * @see org.tensorflow.op.core.ReduceProd + */ + public ReduceProd reduceProd(Operand input, Operand axis, + ReduceProd.Options... options) { + return ReduceProd.create(scope, input, axis, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(int[] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Unstage} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of Unstage + * @see org.tensorflow.op.core.Unstage + */ + public Unstage unstage(List> dtypes, Unstage.Options... options) { + return Unstage.create(scope, dtypes, options); + } + + /** + * Builds an {@link Tile} operation + * + * @param input 1-D or higher. + * @param multiples 1-D. Length must be the same as the number of dimensions in `input` + * @return a new instance of Tile + * @see org.tensorflow.op.core.Tile + */ + public Tile tile(Operand input, Operand multiples) { + return Tile.create(scope, input, multiples); + } + + /** + * Builds an {@link TensorListSetItem} operation + * + * @param inputHandle + * @param index + * @param item + * @return a new instance of TensorListSetItem + * @see org.tensorflow.op.core.TensorListSetItem + */ + public TensorListSetItem tensorListSetItem(Operand inputHandle, Operand index, + Operand item) { + return TensorListSetItem.create(scope, inputHandle, index, item); + } + + /** + * Builds an {@link EditDistance} operation + * + * @param hypothesisIndices The indices of the hypothesis list SparseTensor. + * @param hypothesisValues The values of the hypothesis list SparseTensor. + * @param hypothesisShape The shape of the hypothesis list SparseTensor. + * @param truthIndices The indices of the truth list SparseTensor. + * @param truthValues The values of the truth list SparseTensor. + * @param truthShape truth indices, vector. + * @param options carries optional attributes values + * @return a new instance of EditDistance + * @see org.tensorflow.op.core.EditDistance + */ + public EditDistance editDistance(Operand hypothesisIndices, Operand hypothesisValues, + Operand hypothesisShape, Operand truthIndices, Operand truthValues, + Operand truthShape, EditDistance.Options... options) { + return EditDistance.create(scope, hypothesisIndices, hypothesisValues, hypothesisShape, truthIndices, truthValues, truthShape, options); + } + + /** + * Builds an {@link TensorListPopBack} operation + * + * @param inputHandle + * @param elementShape + * @param elementDtype + * @return a new instance of TensorListPopBack + * @see org.tensorflow.op.core.TensorListPopBack + */ + public TensorListPopBack tensorListPopBack(Operand inputHandle, + Operand elementShape, Class elementDtype) { + return TensorListPopBack.create(scope, inputHandle, elementShape, elementDtype); + } + + /** + * Builds an {@link Concat} operation + * + * @param values List of `N` Tensors to concatenate. Their ranks and types must match, + * @param axis 0-D. The dimension along which to concatenate. Must be in the + * @return a new instance of Concat + * @see org.tensorflow.op.core.Concat + */ + public Concat concat(Iterable> values, Operand axis) { + return Concat.create(scope, values, axis); + } + + /** + * Builds an {@link PlaceholderWithDefault} operation + * + * @param input The default value to produce when `output` is not fed. + * @param shape The (possibly partial) shape of the tensor. + * @return a new instance of PlaceholderWithDefault + * @see org.tensorflow.op.core.PlaceholderWithDefault + */ + public PlaceholderWithDefault placeholderWithDefault(Operand input, Shape shape) { + return PlaceholderWithDefault.create(scope, input, shape); + } + + /** + * Builds an {@link ResourceScatterDiv} operation + * + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterDiv + * @see org.tensorflow.op.core.ResourceScatterDiv + */ + public ResourceScatterDiv resourceScatterDiv(Operand resource, + Operand indices, Operand updates) { + return ResourceScatterDiv.create(scope, resource, indices, updates); + } + + /** + * Builds an {@link Fingerprint} operation + * + * @param data Must have rank 1 or higher. + * @param method Fingerprint method used by this op. Currently available method is + * @return a new instance of Fingerprint + * @see org.tensorflow.op.core.Fingerprint + */ + public Fingerprint fingerprint(Operand data, Operand method) { + return Fingerprint.create(scope, data, method); + } + + /** + * Builds an {@link ReverseSequence} operation + * + * @param input The input to reverse. + * @param seqLengths 1-D with length `input.dims(batch_dim)` and + * @param seqDim The dimension which is partially reversed. + * @param options carries optional attributes values + * @return a new instance of ReverseSequence + * @see org.tensorflow.op.core.ReverseSequence + */ + public ReverseSequence reverseSequence(Operand input, + Operand seqLengths, Long seqDim, ReverseSequence.Options... options) { + return ReverseSequence.create(scope, input, seqLengths, seqDim, options); + } + + /** + * Builds an {@link MutableHashTableOfTensors} operation + * + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of MutableHashTableOfTensors + * @see org.tensorflow.op.core.MutableHashTableOfTensors + */ + public MutableHashTableOfTensors mutableHashTableOfTensors(Class keyDtype, + Class valueDtype, MutableHashTableOfTensors.Options... options) { + return MutableHashTableOfTensors.create(scope, keyDtype, valueDtype, options); + } + + /** + * Builds an {@link ResourceScatterSub} operation + * + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterSub + * @see org.tensorflow.op.core.ResourceScatterSub + */ + public ResourceScatterSub resourceScatterSub(Operand resource, + Operand indices, Operand updates) { + return ResourceScatterSub.create(scope, resource, indices, updates); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(float[][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Constant} operation + * + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a double constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[] shape, DoubleBuffer data) { + return Constant.create(scope, shape, data); + } + + /** + * Builds an {@link Assign} operation + * + * @param ref Should be from a `Variable` node. May be uninitialized. + * @param value The value to be assigned to the variable. + * @param options carries optional attributes values + * @return a new instance of Assign + * @see org.tensorflow.op.core.Assign + */ + public Assign assign(Operand ref, Operand value, Assign.Options... options) { + return Assign.create(scope, ref, value, options); + } + + /** + * Builds an {@link StatefulRandomBinomial} operation + * + * @param resource + * @param algorithm + * @param shape + * @param counts + * @param probs + * @return a new instance of StatefulRandomBinomial + * @see org.tensorflow.op.core.StatefulRandomBinomial + */ + public StatefulRandomBinomial statefulRandomBinomial( + Operand resource, Operand algorithm, Operand shape, Operand counts, + Operand probs) { + return StatefulRandomBinomial.create(scope, resource, algorithm, shape, counts, probs); + } + + /** + * Builds an {@link ExpandDims} operation + * + * @param input + * @param axis 0-D (scalar). Specifies the dimension index at which to + * @return a new instance of ExpandDims + * @see org.tensorflow.op.core.ExpandDims + */ + public ExpandDims expandDims(Operand input, Operand axis) { + return ExpandDims.create(scope, input, axis); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(float[] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link FusedBatchNormGradV3} operation + * + * @param yBackprop A 4D Tensor for the gradient with respect to y. + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param reserveSpace1 When is_training is True, a 1D Tensor for the computed batch + * @param reserveSpace2 When is_training is True, a 1D Tensor for the computed batch + * @param reserveSpace3 When is_training is True, a 1D Tensor for some intermediate results to be reused + * @param options carries optional attributes values + * @return a new instance of FusedBatchNormGradV3 + * @see org.tensorflow.op.core.FusedBatchNormGradV3 + */ + public FusedBatchNormGradV3 fusedBatchNormGradV3( + Operand yBackprop, Operand x, Operand scale, Operand reserveSpace1, + Operand reserveSpace2, Operand reserveSpace3, FusedBatchNormGradV3.Options... options) { + return FusedBatchNormGradV3.create(scope, yBackprop, x, scale, reserveSpace1, reserveSpace2, reserveSpace3, options); + } + + /** + * Builds an {@link ScatterNdAdd} operation + * + * @param ref A mutable Tensor. Should be from a Variable node. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated values + * @param options carries optional attributes values + * @return a new instance of ScatterNdAdd + * @see org.tensorflow.op.core.ScatterNdAdd + */ + public ScatterNdAdd scatterNdAdd(Operand ref, Operand indices, + Operand updates, ScatterNdAdd.Options... options) { + return ScatterNdAdd.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(boolean[][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link AssignAdd} operation + * + * @param ref Should be from a `Variable` node. + * @param value The value to be added to the variable. + * @param options carries optional attributes values + * @return a new instance of AssignAdd + * @see org.tensorflow.op.core.AssignAdd + */ + public AssignAdd assignAdd(Operand ref, Operand value, + AssignAdd.Options... options) { + return AssignAdd.create(scope, ref, value, options); + } + + /** + * Builds an {@link MutableHashTable} operation + * + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of MutableHashTable + * @see org.tensorflow.op.core.MutableHashTable + */ + public MutableHashTable mutableHashTable(Class keyDtype, Class valueDtype, + MutableHashTable.Options... options) { + return MutableHashTable.create(scope, keyDtype, valueDtype, options); + } + + /** + * Builds an {@link ExtractVolumePatches} operation + * + * @param input 5-D Tensor with shape `[batch, in_planes, in_rows, in_cols, depth]`. + * @param ksizes The size of the sliding window for each dimension of `input`. + * @param strides 1-D of length 5. How far the centers of two consecutive patches are in + * @param padding The type of padding algorithm to use. + * @return a new instance of ExtractVolumePatches + * @see org.tensorflow.op.core.ExtractVolumePatches + */ + public ExtractVolumePatches extractVolumePatches(Operand input, + List ksizes, List strides, String padding) { + return ExtractVolumePatches.create(scope, input, ksizes, strides, padding); + } + + /** + * Builds an {@link Size} operation + * + * @param input + * @return a new instance of Size + * @see org.tensorflow.op.core.Size + */ + public Size size(Operand input) { + return Size.create(scope, input); + } + + /** + * Builds an {@link ScatterAdd} operation + * + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterAdd + * @see org.tensorflow.op.core.ScatterAdd + */ + public ScatterAdd scatterAdd(Operand ref, Operand indices, + Operand updates, ScatterAdd.Options... options) { + return ScatterAdd.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param object a Java object representing the constant. + * @return a constant of type `type` + * @see org.tensorflow.Tensor#create(Object) Tensor.create + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(Object object, Class type) { + return Constant.create(scope, object, type); + } + + /** + * Builds an {@link ResourceScatterMax} operation + * + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterMax + * @see org.tensorflow.op.core.ResourceScatterMax + */ + public ResourceScatterMax resourceScatterMax(Operand resource, + Operand indices, Operand updates) { + return ResourceScatterMax.create(scope, resource, indices, updates); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. String elements are + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(byte[][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link UnsortedSegmentJoin} operation + * + * @param inputs The input to be joined. + * @param segmentIds A tensor whose shape is a prefix of data.shape. Negative segment ids are not + * @param numSegments A scalar. + * @param options carries optional attributes values + * @return a new instance of UnsortedSegmentJoin + * @see org.tensorflow.op.core.UnsortedSegmentJoin + */ + public UnsortedSegmentJoin unsortedSegmentJoin( + Operand inputs, Operand segmentIds, Operand numSegments, + UnsortedSegmentJoin.Options... options) { + return UnsortedSegmentJoin.create(scope, inputs, segmentIds, numSegments, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(int[][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link BroadcastTo} operation + * + * @param input A Tensor to broadcast. + * @param shape An 1-D `int` Tensor. The shape of the desired output. + * @return a new instance of BroadcastTo + * @see org.tensorflow.op.core.BroadcastTo + */ + public BroadcastTo broadcastTo(Operand input, Operand shape) { + return BroadcastTo.create(scope, input, shape); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(double[] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link StridedSliceGrad} operation + * + * @param shape + * @param begin + * @param end + * @param strides + * @param dy + * @param options carries optional attributes values + * @return a new instance of StridedSliceGrad + * @see org.tensorflow.op.core.StridedSliceGrad + */ + public StridedSliceGrad stridedSliceGrad(Operand shape, + Operand begin, Operand end, Operand strides, Operand dy, + StridedSliceGrad.Options... options) { + return StridedSliceGrad.create(scope, shape, begin, end, strides, dy, options); + } + + /** + * Builds an {@link Lu} operation + * + * @param input A tensor of shape `[..., M, M]` whose inner-most 2 dimensions form matrices of + * @return a new instance of Lu + * @see org.tensorflow.op.core.Lu + */ + public Lu lu(Operand input) { + return Lu.create(scope, input); + } + + /** + * Builds an {@link Gradients} operation + * + * @param y output of the function to derive + * @param x inputs of the function for which partial derivatives are computed + * @param options carries optional attributes values + * @return a new instance of {@code Gradients} + * @throws IllegalArgumentException if execution environment is not a graph + * @see org.tensorflow.op.core.Gradients + */ + public Gradients gradients(Operand y, Iterable> x, + Gradients.Options... options) { + return Gradients.create(scope, y, x, options); + } + + /** + * Builds an {@link Unique} operation + * + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * @return a new instance of Unique + * @see org.tensorflow.op.core.Unique + */ + public Unique unique(Operand x, Operand axis) { + return Unique.create(scope, x, axis); + } + + /** + * Builds an {@link DecodePaddedRaw} operation + * + * @param inputBytes Tensor of string to be decoded. + * @param fixedLength Length in bytes for each element of the decoded output. Must be a multiple + * @param outType + * @param options carries optional attributes values + * @return a new instance of DecodePaddedRaw + * @see org.tensorflow.op.core.DecodePaddedRaw + */ + public DecodePaddedRaw decodePaddedRaw(Operand inputBytes, + Operand fixedLength, Class outType, DecodePaddedRaw.Options... options) { + return DecodePaddedRaw.create(scope, inputBytes, fixedLength, outType, options); + } + + /** + * Builds an {@link SelectV2} operation + * + * @param condition + * @param t + * @param e + * @return a new instance of SelectV2 + * @see org.tensorflow.op.core.SelectV2 + */ + public SelectV2 selectV2(Operand condition, Operand t, Operand e) { + return SelectV2.create(scope, condition, t, e); + } + + /** + * Builds an {@link ShapeN} operation + * + * @param input + * @param outType + * @return a new instance of ShapeN + * @see org.tensorflow.op.core.ShapeN + */ + public ShapeN shapeN(Iterable> input, Class outType) { + return ShapeN.create(scope, input, outType); + } + + /** + * Builds an {@link Max} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of Max + * @see org.tensorflow.op.core.Max + */ + public Max max(Operand input, Operand axis, + Max.Options... options) { + return Max.create(scope, input, axis, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(float[][][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link ResourceGatherNd} operation + * + * @param resource + * @param indices + * @param dtype + * @return a new instance of ResourceGatherNd + * @see org.tensorflow.op.core.ResourceGatherNd + */ + public ResourceGatherNd resourceGatherNd(Operand resource, + Operand indices, Class dtype) { + return ResourceGatherNd.create(scope, resource, indices, dtype); + } + + /** + * Builds an {@link ZerosLike} operation + * + * @param x a tensor of type T. + * @return a new instance of ZerosLike + * @see org.tensorflow.op.core.ZerosLike + */ + public ZerosLike zerosLike(Operand x) { + return ZerosLike.create(scope, x); + } + + /** + * Builds an {@link IsVariableInitialized} operation + * + * @param ref Should be from a `Variable` node. May be uninitialized. + * @return a new instance of IsVariableInitialized + * @see org.tensorflow.op.core.IsVariableInitialized + */ + public IsVariableInitialized isVariableInitialized(Operand ref) { + return IsVariableInitialized.create(scope, ref); + } + + /** + * Builds an {@link TensorListStack} operation + * + * @param inputHandle + * @param elementShape + * @param elementDtype + * @param options carries optional attributes values + * @return a new instance of TensorListStack + * @see org.tensorflow.op.core.TensorListStack + */ + public TensorListStack tensorListStack(Operand inputHandle, + Operand elementShape, Class elementDtype, TensorListStack.Options... options) { + return TensorListStack.create(scope, inputHandle, elementShape, elementDtype, options); + } + + /** + * Builds an {@link InplaceSub} operation + * + * @param x A `Tensor` of type T. + * @param i A vector. Indices into the left-most dimension of `x`. + * @param v A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @return a new instance of InplaceSub + * @see org.tensorflow.op.core.InplaceSub + */ + public InplaceSub inplaceSub(Operand x, Operand i, Operand v) { + return InplaceSub.create(scope, x, i, v); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(double[][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link OnesLike} operation + * + * @param x a tensor of type T. + * @return a new instance of OnesLike + * @see org.tensorflow.op.core.OnesLike + */ + public OnesLike onesLike(Operand x) { + return OnesLike.create(scope, x); + } + + /** + * Builds an {@link OrderedMapSize} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapSize + * @see org.tensorflow.op.core.OrderedMapSize + */ + public OrderedMapSize orderedMapSize(List> dtypes, OrderedMapSize.Options... options) { + return OrderedMapSize.create(scope, dtypes, options); + } + + /** + * Builds an {@link QuantizedConcat} operation + * + * @param concatDim 0-D. The dimension along which to concatenate. Must be in the + * @param values The `N` Tensors to concatenate. Their ranks and types must match, + * @param inputMins The minimum scalar values for each of the input tensors. + * @param inputMaxes The maximum scalar values for each of the input tensors. + * @return a new instance of QuantizedConcat + * @see org.tensorflow.op.core.QuantizedConcat + */ + public QuantizedConcat quantizedConcat(Operand concatDim, + Iterable> values, Iterable> inputMins, + Iterable> inputMaxes) { + return QuantizedConcat.create(scope, concatDim, values, inputMins, inputMaxes); + } + + /** + * Builds an {@link LookupTableInsert} operation + * + * @param tableHandle Handle to the table. + * @param keys Any shape. Keys to look up. + * @param values Values to associate with keys. + * @return a new instance of LookupTableInsert + * @see org.tensorflow.op.core.LookupTableInsert + */ + public LookupTableInsert lookupTableInsert(Operand tableHandle, Operand keys, + Operand values) { + return LookupTableInsert.create(scope, tableHandle, keys, values); + } + + /** + * Builds an {@link Roll} operation + * + * @param input + * @param shift Dimension must be 0-D or 1-D. `shift[i]` specifies the number of places by which + * @param axis Dimension must be 0-D or 1-D. `axis[i]` specifies the dimension that the shift + * @return a new instance of Roll + * @see org.tensorflow.op.core.Roll + */ + public Roll roll(Operand input, Operand shift, + Operand axis) { + return Roll.create(scope, input, shift, axis); + } + + /** + * Builds an {@link HashTable} operation + * + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of HashTable + * @see org.tensorflow.op.core.HashTable + */ + public HashTable hashTable(Class keyDtype, Class valueDtype, + HashTable.Options... options) { + return HashTable.create(scope, keyDtype, valueDtype, options); + } + + /** + * Builds an {@link ResourceGather} operation + * + * @param resource + * @param indices + * @param dtype + * @param options carries optional attributes values + * @return a new instance of ResourceGather + * @see org.tensorflow.op.core.ResourceGather + */ + public ResourceGather resourceGather(Operand resource, + Operand indices, Class dtype, ResourceGather.Options... options) { + return ResourceGather.create(scope, resource, indices, dtype, options); + } + + /** + * Builds an {@link ClipByValue} operation + * + * @param t A `Tensor`. + * @param clipValueMin A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape + * @param clipValueMax A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape + * @return a new instance of ClipByValue + * @see org.tensorflow.op.core.ClipByValue + */ + public ClipByValue clipByValue(Operand t, Operand clipValueMin, + Operand clipValueMax) { + return ClipByValue.create(scope, t, clipValueMin, clipValueMax); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Sum} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of Sum + * @see org.tensorflow.op.core.Sum + */ + public Sum sum(Operand input, Operand axis, + Sum.Options... options) { + return Sum.create(scope, input, axis, options); + } + + /** + * Builds an {@link Shape} operation + * + * @param input + * @param outType + * @return a new instance of Shape + * @see org.tensorflow.op.core.Shape + */ + public org.tensorflow.op.core.Shape shape(Operand input, + Class outType) { + return org.tensorflow.op.core.Shape.create(scope, input, outType); + } + + /** + * Builds an {@link MapSize} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapSize + * @see org.tensorflow.op.core.MapSize + */ + public MapSize mapSize(List> dtypes, MapSize.Options... options) { + return MapSize.create(scope, dtypes, options); + } + + /** + * Builds an {@link Timestamp} operation + * + * @return a new instance of Timestamp + * @see org.tensorflow.op.core.Timestamp + */ + public Timestamp timestamp() { + return Timestamp.create(scope); + } + + /** + * Builds an {@link GetSessionHandle} operation + * + * @param value The tensor to be stored. + * @return a new instance of GetSessionHandle + * @see org.tensorflow.op.core.GetSessionHandle + */ + public GetSessionHandle getSessionHandle(Operand value) { + return GetSessionHandle.create(scope, value); + } + + /** + * Builds an {@link BarrierReadySize} operation + * + * @param handle The handle to a barrier. + * @return a new instance of BarrierReadySize + * @see org.tensorflow.op.core.BarrierReadySize + */ + public BarrierReadySize barrierReadySize(Operand handle) { + return BarrierReadySize.create(scope, handle); + } + + /** + * Builds an {@link CountUpTo} operation + * + * @param ref Should be from a scalar `Variable` node. + * @param limit If incrementing ref would bring it above limit, instead generates an + * @return a new instance of CountUpTo + * @see org.tensorflow.op.core.CountUpTo + */ + public CountUpTo countUpTo(Operand ref, Long limit) { + return CountUpTo.create(scope, ref, limit); + } + + /** + * Builds an {@link DrawBoundingBoxesV2} operation + * + * @param images 4-D with shape `[batch, height, width, depth]`. A batch of images. + * @param boxes 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding + * @param colors 2-D. A list of RGBA colors to cycle through for the boxes. + * @return a new instance of DrawBoundingBoxesV2 + * @see org.tensorflow.op.core.DrawBoundingBoxesV2 + */ + public DrawBoundingBoxesV2 drawBoundingBoxesV2(Operand images, + Operand boxes, Operand colors) { + return DrawBoundingBoxesV2.create(scope, images, boxes, colors); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(boolean[][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link BarrierClose} operation + * + * @param handle The handle to a barrier. + * @param options carries optional attributes values + * @return a new instance of BarrierClose + * @see org.tensorflow.op.core.BarrierClose + */ + public BarrierClose barrierClose(Operand handle, BarrierClose.Options... options) { + return BarrierClose.create(scope, handle, options); + } + + /** + * Builds an {@link Lu} operation + * + * @param input A tensor of shape `[..., M, M]` whose inner-most 2 dimensions form matrices of + * @param outputIdxType + * @return a new instance of Lu + * @see org.tensorflow.op.core.Lu + */ + public Lu lu(Operand input, Class outputIdxType) { + return Lu.create(scope, input, outputIdxType); + } + + /** + * Builds an {@link TensorListScatterV2} operation + * + * @param tensor + * @param indices + * @param elementShape + * @param numElements + * @return a new instance of TensorListScatterV2 + * @see org.tensorflow.op.core.TensorListScatterV2 + */ + public TensorListScatterV2 tensorListScatterV2(Operand tensor, + Operand indices, Operand elementShape, Operand numElements) { + return TensorListScatterV2.create(scope, tensor, indices, elementShape, numElements); + } + + /** + * Builds an {@link Rpc} operation + * + * @param address `0-D` or `1-D`. The address (i.e. host_name:port) of the RPC server. + * @param method `0-D` or `1-D`. The method address on the RPC server. + * @param request `0-D` or `1-D`. Serialized proto strings: the rpc request argument. + * @param options carries optional attributes values + * @return a new instance of Rpc + * @see org.tensorflow.op.core.Rpc + */ + public Rpc rpc(Operand address, Operand method, Operand request, + Rpc.Options... options) { + return Rpc.create(scope, address, method, request, options); + } + + /** + * Builds an {@link TensorListConcatLists} operation + * + * @param inputA + * @param inputB + * @param elementDtype + * @return a new instance of TensorListConcatLists + * @see org.tensorflow.op.core.TensorListConcatLists + */ + public TensorListConcatLists tensorListConcatLists(Operand inputA, Operand inputB, + Class elementDtype) { + return TensorListConcatLists.create(scope, inputA, inputB, elementDtype); + } + + /** + * Builds an {@link Batch} operation + * + * @param inTensors + * @param numBatchThreads + * @param maxBatchSize + * @param batchTimeoutMicros + * @param gradTimeoutMicros + * @param options carries optional attributes values + * @return a new instance of Batch + * @see org.tensorflow.op.core.Batch + */ + public Batch batch(Iterable> inTensors, Long numBatchThreads, Long maxBatchSize, + Long batchTimeoutMicros, Long gradTimeoutMicros, Batch.Options... options) { + return Batch.create(scope, inTensors, numBatchThreads, maxBatchSize, batchTimeoutMicros, gradTimeoutMicros, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(int[][][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link SetDiff1d} operation + * + * @param x 1-D. Values to keep. + * @param y 1-D. Values to remove. + * @param outIdx + * @return a new instance of SetDiff1d + * @see org.tensorflow.op.core.SetDiff1d + */ + public SetDiff1d setDiff1d(Operand x, Operand y, + Class outIdx) { + return SetDiff1d.create(scope, x, y, outIdx); + } + + /** + * Builds an {@link Einsum} operation + * + * @param inputs List of 1 or 2 Tensors. + * @param equation String describing the Einstein Summation operation; in the format of np.einsum. + * @return a new instance of Einsum + * @see org.tensorflow.op.core.Einsum + */ + public Einsum einsum(Iterable> inputs, String equation) { + return Einsum.create(scope, inputs, equation); + } + + /** + * Builds an {@link LinSpace} operation + * + * @param start 0-D tensor. First entry in the range. + * @param stop 0-D tensor. Last entry in the range. + * @param num 0-D tensor. Number of values to generate. + * @return a new instance of LinSpace + * @see org.tensorflow.op.core.LinSpace + */ + public LinSpace linSpace(Operand start, + Operand stop, Operand num) { + return LinSpace.create(scope, start, stop, num); + } + + /** + * Builds an {@link StatefulStandardNormal} operation + * + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param shape The shape of the output tensor. + * @return a new instance of StatefulStandardNormal + * @see org.tensorflow.op.core.StatefulStandardNormal + */ + public StatefulStandardNormal statefulStandardNormal(Operand resource, + Operand shape) { + return StatefulStandardNormal.create(scope, resource, shape); + } + + /** + * Builds an {@link Empty} operation + * + * @param shape 1-D. Represents the shape of the output tensor. + * @param dtype + * @param options carries optional attributes values + * @return a new instance of Empty + * @see org.tensorflow.op.core.Empty + */ + public Empty empty(Operand shape, Class dtype, Empty.Options... options) { + return Empty.create(scope, shape, dtype, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Stack} operation + * + * @param values Must be of same shape and type. + * @param options carries optional attributes values + * @return a new instance of Stack + * @see org.tensorflow.op.core.Stack + */ + public Stack stack(Iterable> values, Stack.Options... options) { + return Stack.create(scope, values, options); + } + + /** + * Builds an {@link BarrierInsertMany} operation + * + * @param handle The handle to a barrier. + * @param keys A one-dimensional tensor of keys, with length n. + * @param values An any-dimensional tensor of values, which are associated with the + * @param componentIndex The component of the barrier elements that is being assigned. + * @return a new instance of BarrierInsertMany + * @see org.tensorflow.op.core.BarrierInsertMany + */ + public BarrierInsertMany barrierInsertMany(Operand handle, Operand keys, + Operand values, Long componentIndex) { + return BarrierInsertMany.create(scope, handle, keys, values, componentIndex); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Stage} operation + * + * @param values a list of tensors + * @param options carries optional attributes values + * @return a new instance of Stage + * @see org.tensorflow.op.core.Stage + */ + public Stage stage(Iterable> values, Stage.Options... options) { + return Stage.create(scope, values, options); + } + + /** + * Builds an {@link TensorArraySplit} operation + * + * @param handle The handle to a TensorArray. + * @param value The concatenated tensor to write to the TensorArray. + * @param lengths The vector of lengths, how to split the rows of value into the + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArraySplit + * @see org.tensorflow.op.core.TensorArraySplit + */ + public TensorArraySplit tensorArraySplit(Operand handle, Operand value, + Operand lengths, Operand flowIn) { + return TensorArraySplit.create(scope, handle, value, lengths, flowIn); + } + + /** + * Builds an {@link TensorArrayGather} operation + * + * @param handle The handle to a TensorArray. + * @param indices The locations in the TensorArray from which to read tensor elements. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param dtype The type of the elem that is returned. + * @param options carries optional attributes values + * @return a new instance of TensorArrayGather + * @see org.tensorflow.op.core.TensorArrayGather + */ + public TensorArrayGather tensorArrayGather(Operand handle, Operand indices, + Operand flowIn, Class dtype, TensorArrayGather.Options... options) { + return TensorArrayGather.create(scope, handle, indices, flowIn, dtype, options); + } + + /** + * Builds an {@link ParallelDynamicStitch} operation + * + * @param indices + * @param data + * @return a new instance of ParallelDynamicStitch + * @see org.tensorflow.op.core.ParallelDynamicStitch + */ + public ParallelDynamicStitch parallelDynamicStitch(Iterable> indices, + Iterable> data) { + return ParallelDynamicStitch.create(scope, indices, data); + } + + /** + * Builds an {@link Any} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of Any + * @see org.tensorflow.op.core.Any + */ + public Any any(Operand input, Operand axis, + Any.Options... options) { + return Any.create(scope, input, axis, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(double[][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Constant} operation + * + * @param type the tensor datatype. + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a constant of type `type` + * @throws IllegalArgumentException If the tensor datatype or shape is not compatible with the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(Class type, long[] shape, ByteBuffer data) { + return Constant.create(scope, type, shape, data); + } + + /** + * Builds an {@link GuaranteeConst} operation + * + * @param input + * @return a new instance of GuaranteeConst + * @see org.tensorflow.op.core.GuaranteeConst + */ + public GuaranteeConst guaranteeConst(Operand input) { + return GuaranteeConst.create(scope, input); + } + + /** + * Builds an {@link TensorListConcat} operation + * + * @param inputHandle + * @param elementDtype + * @param options carries optional attributes values + * @return a new instance of TensorListConcat + * @see org.tensorflow.op.core.TensorListConcat + */ + public TensorListConcat tensorListConcat(Operand inputHandle, Class elementDtype, + TensorListConcat.Options... options) { + return TensorListConcat.create(scope, inputHandle, elementDtype, options); + } + + /** + * Builds an {@link QuantizedConcatV2} operation + * + * @param values + * @param axis + * @param inputMins + * @param inputMaxes + * @return a new instance of QuantizedConcatV2 + * @see org.tensorflow.op.core.QuantizedConcatV2 + */ + public QuantizedConcatV2 quantizedConcatV2(Iterable> values, + Operand axis, Iterable> inputMins, Iterable> inputMaxes) { + return QuantizedConcatV2.create(scope, values, axis, inputMins, inputMaxes); + } + + /** + * Builds an {@link TensorScatterAdd} operation + * + * @param tensor Tensor to copy/update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @return a new instance of TensorScatterAdd + * @see org.tensorflow.op.core.TensorScatterAdd + */ + public TensorScatterAdd tensorScatterAdd(Operand tensor, + Operand indices, Operand updates) { + return TensorScatterAdd.create(scope, tensor, indices, updates); + } + + /** + * Builds an {@link RefNextIteration} operation + * + * @param data The tensor to be made available to the next iteration. + * @return a new instance of RefNextIteration + * @see org.tensorflow.op.core.RefNextIteration + */ + public RefNextIteration refNextIteration(Operand data) { + return RefNextIteration.create(scope, data); + } + + /** + * Builds an {@link Unstack} operation + * + * @param value 1-D or higher, with `axis` dimension size equal to `num`. + * @param num + * @param options carries optional attributes values + * @return a new instance of Unstack + * @see org.tensorflow.op.core.Unstack + */ + public Unstack unstack(Operand value, Long num, Unstack.Options... options) { + return Unstack.create(scope, value, num, options); + } + + /** + * Builds an {@link Unbatch} operation + * + * @param batchedTensor + * @param batchIndex + * @param id + * @param timeoutMicros + * @param options carries optional attributes values + * @return a new instance of Unbatch + * @see org.tensorflow.op.core.Unbatch + */ + public Unbatch unbatch(Operand batchedTensor, Operand batchIndex, + Operand id, Long timeoutMicros, Unbatch.Options... options) { + return Unbatch.create(scope, batchedTensor, batchIndex, id, timeoutMicros, options); + } + + /** + * Builds an {@link ParallelConcat} operation + * + * @param values Tensors to be concatenated. All must have size 1 in the first dimension + * @param shape the final shape of the result; should be equal to the shapes of any input + * @return a new instance of ParallelConcat + * @see org.tensorflow.op.core.ParallelConcat + */ + public ParallelConcat parallelConcat(Iterable> values, Shape shape) { + return ParallelConcat.create(scope, values, shape); + } + + /** + * Builds an {@link ScatterDiv} operation + * + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of values that `ref` is divided by. + * @param options carries optional attributes values + * @return a new instance of ScatterDiv + * @see org.tensorflow.op.core.ScatterDiv + */ + public ScatterDiv scatterDiv(Operand ref, Operand indices, + Operand updates, ScatterDiv.Options... options) { + return ScatterDiv.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link Gradients} operation + * + * @param y outputs of the function to derive + * @param x inputs of the function for which partial derivatives are computed + * @param options carries optional attributes values + * @return a new instance of {@code Gradients} + * @throws IllegalArgumentException if execution environment is not a graph + * @see org.tensorflow.op.core.Gradients + */ + public Gradients gradients(Iterable> y, Iterable> x, + Gradients.Options... options) { + return Gradients.create(scope, y, x, options); + } + + /** + * Builds an {@link NoOp} operation + * + * @return a new instance of NoOp + * @see org.tensorflow.op.core.NoOp + */ + public NoOp noOp() { + return NoOp.create(scope); + } + + /** + * Builds an {@link ResourceApplyKerasMomentum} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyKerasMomentum + * @see org.tensorflow.op.core.ResourceApplyKerasMomentum + */ + public ResourceApplyKerasMomentum resourceApplyKerasMomentum(Operand var, Operand accum, + Operand lr, Operand grad, Operand momentum, + ResourceApplyKerasMomentum.Options... options) { + return ResourceApplyKerasMomentum.create(scope, var, accum, lr, grad, momentum, options); + } + + /** + * Builds an {@link TemporaryVariable} operation + * + * @param shape The shape of the variable tensor. + * @param dtype The type of elements in the variable tensor. + * @param options carries optional attributes values + * @return a new instance of TemporaryVariable + * @see org.tensorflow.op.core.TemporaryVariable + */ + public TemporaryVariable temporaryVariable(Shape shape, Class dtype, + TemporaryVariable.Options... options) { + return TemporaryVariable.create(scope, shape, dtype, options); + } + + /** + * Builds an {@link TensorListLength} operation + * + * @param inputHandle + * @return a new instance of TensorListLength + * @see org.tensorflow.op.core.TensorListLength + */ + public TensorListLength tensorListLength(Operand inputHandle) { + return TensorListLength.create(scope, inputHandle); + } + + /** + * Builds an {@link Min} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of Min + * @see org.tensorflow.op.core.Min + */ + public Min min(Operand input, Operand axis, + Min.Options... options) { + return Min.create(scope, input, axis, options); + } + + /** + * Builds an {@link StopGradient} operation + * + * @param input + * @return a new instance of StopGradient + * @see org.tensorflow.op.core.StopGradient + */ + public StopGradient stopGradient(Operand input) { + return StopGradient.create(scope, input); + } + + /** + * Builds an {@link CudnnRNNParamsToCanonicalV2} operation + * + * @param numLayers + * @param numUnits + * @param inputSize + * @param params + * @param numParamsWeights + * @param numParamsBiases + * @param options carries optional attributes values + * @return a new instance of CudnnRNNParamsToCanonicalV2 + * @see org.tensorflow.op.core.CudnnRNNParamsToCanonicalV2 + */ + public CudnnRNNParamsToCanonicalV2 cudnnRNNParamsToCanonicalV2( + Operand numLayers, Operand numUnits, Operand inputSize, + Operand params, Long numParamsWeights, Long numParamsBiases, + CudnnRNNParamsToCanonicalV2.Options... options) { + return CudnnRNNParamsToCanonicalV2.create(scope, numLayers, numUnits, inputSize, params, numParamsWeights, numParamsBiases, options); + } + + /** + * Builds an {@link Identity} operation + * + * @param input + * @return a new instance of Identity + * @see org.tensorflow.op.core.Identity + */ + public Identity identity(Operand input) { + return Identity.create(scope, input); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Skipgram} operation + * + * @param filename The corpus's text file name. + * @param batchSize The size of produced batch. + * @param options carries optional attributes values + * @return a new instance of Skipgram + * @see org.tensorflow.op.core.Skipgram + */ + public Skipgram skipgram(String filename, Long batchSize, Skipgram.Options... options) { + return Skipgram.create(scope, filename, batchSize, options); + } + + /** + * Builds an {@link TensorArrayClose} operation + * + * @param handle The handle to a TensorArray (output of TensorArray or TensorArrayGrad). + * @return a new instance of TensorArrayClose + * @see org.tensorflow.op.core.TensorArrayClose + */ + public TensorArrayClose tensorArrayClose(Operand handle) { + return TensorArrayClose.create(scope, handle); + } + + /** + * Builds an {@link StatefulStandardNormalV2} operation + * + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of StatefulStandardNormalV2 + * @see org.tensorflow.op.core.StatefulStandardNormalV2 + */ + public StatefulStandardNormalV2 statefulStandardNormalV2(Operand resource, + Operand algorithm, Operand shape, Class dtype) { + return StatefulStandardNormalV2.create(scope, resource, algorithm, shape, dtype); + } + + /** + * Builds an {@link Constant} operation + * + * @param data The string to put into the new constant. + * @return a string constant + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(String data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Prod} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of Prod + * @see org.tensorflow.op.core.Prod + */ + public Prod prod(Operand input, Operand axis, + Prod.Options... options) { + return Prod.create(scope, input, axis, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. String elements are + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(byte[][][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link SetSize} operation + * + * @param setIndices 2D `Tensor`, indices of a `SparseTensor`. + * @param setValues 1D `Tensor`, values of a `SparseTensor`. + * @param setShape 1D `Tensor`, shape of a `SparseTensor`. + * @param options carries optional attributes values + * @return a new instance of SetSize + * @see org.tensorflow.op.core.SetSize + */ + public SetSize setSize(Operand setIndices, Operand setValues, Operand setShape, + SetSize.Options... options) { + return SetSize.create(scope, setIndices, setValues, setShape, options); + } + + /** + * Builds an {@link LookupTableExport} operation + * + * @param tableHandle Handle to the table. + * @param Tkeys + * @param Tvalues + * @return a new instance of LookupTableExport + * @see org.tensorflow.op.core.LookupTableExport + */ + public LookupTableExport lookupTableExport(Operand tableHandle, Class Tkeys, + Class Tvalues) { + return LookupTableExport.create(scope, tableHandle, Tkeys, Tvalues); + } + + /** + * Builds an {@link Fill} operation + * + * @param dims 1-D. Represents the shape of the output tensor. + * @param value 0-D (scalar). Value to fill the returned tensor. + * @return a new instance of Fill + * @see org.tensorflow.op.core.Fill + */ + public Fill fill(Operand dims, Operand value) { + return Fill.create(scope, dims, value); + } + + /** + * Builds an {@link AssignAddVariableOp} operation + * + * @param resource handle to the resource in which to store the variable. + * @param value the value by which the variable will be incremented. + * @return a new instance of AssignAddVariableOp + * @see org.tensorflow.op.core.AssignAddVariableOp + */ + public AssignAddVariableOp assignAddVariableOp(Operand resource, Operand value) { + return AssignAddVariableOp.create(scope, resource, value); + } + + /** + * Builds an {@link AssignSub} operation + * + * @param ref Should be from a `Variable` node. + * @param value The value to be subtracted to the variable. + * @param options carries optional attributes values + * @return a new instance of AssignSub + * @see org.tensorflow.op.core.AssignSub + */ + public AssignSub assignSub(Operand ref, Operand value, + AssignSub.Options... options) { + return AssignSub.create(scope, ref, value, options); + } + + /** + * Builds an {@link LoopCond} operation + * + * @param input A boolean scalar, representing the branch predicate of the Switch op. + * @return a new instance of LoopCond + * @see org.tensorflow.op.core.LoopCond + */ + public LoopCond loopCond(Operand input) { + return LoopCond.create(scope, input); + } + + /** + * Builds an {@link BarrierTakeMany} operation + * + * @param handle The handle to a barrier. + * @param numElements A single-element tensor containing the number of elements to + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of BarrierTakeMany + * @see org.tensorflow.op.core.BarrierTakeMany + */ + public BarrierTakeMany barrierTakeMany(Operand handle, Operand numElements, + List> componentTypes, BarrierTakeMany.Options... options) { + return BarrierTakeMany.create(scope, handle, numElements, componentTypes, options); + } + + /** + * Builds an {@link MapUnstage} operation + * + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapUnstage + * @see org.tensorflow.op.core.MapUnstage + */ + public MapUnstage mapUnstage(Operand key, Operand indices, List> dtypes, + MapUnstage.Options... options) { + return MapUnstage.create(scope, key, indices, dtypes, options); + } + + /** + * Builds an {@link TensorArrayGradWithShape} operation + * + * @param handle The handle to the forward TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param shapeToPrepend An int32 vector representing a shape. Elements in the gradient accumulator will + * @param source The gradient source string, used to decide which gradient TensorArray + * @return a new instance of TensorArrayGradWithShape + * @see org.tensorflow.op.core.TensorArrayGradWithShape + */ + public TensorArrayGradWithShape tensorArrayGradWithShape(Operand handle, Operand flowIn, + Operand shapeToPrepend, String source) { + return TensorArrayGradWithShape.create(scope, handle, flowIn, shapeToPrepend, source); + } + + /** + * Builds an {@link Mutex} operation + * + * @param options carries optional attributes values + * @return a new instance of Mutex + * @see org.tensorflow.op.core.Mutex + */ + public Mutex mutex(Mutex.Options... options) { + return Mutex.create(scope, options); + } + + /** + * Builds an {@link UniqueWithCounts} operation + * + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * @return a new instance of UniqueWithCounts + * @see org.tensorflow.op.core.UniqueWithCounts + */ + public UniqueWithCounts uniqueWithCounts(Operand x, + Operand axis) { + return UniqueWithCounts.create(scope, x, axis); + } + + /** + * Builds an {@link HistogramFixedWidth} operation + * + * @param values Numeric `Tensor`. + * @param valueRange Shape [2] `Tensor` of same `dtype` as `values`. + * @param nbins Scalar `int32 Tensor`. Number of histogram bins. + * @param dtype + * @return a new instance of HistogramFixedWidth + * @see org.tensorflow.op.core.HistogramFixedWidth + */ + public HistogramFixedWidth histogramFixedWidth( + Operand values, Operand valueRange, Operand nbins, Class dtype) { + return HistogramFixedWidth.create(scope, values, valueRange, nbins, dtype); + } + + /** + * Builds an {@link MatrixDiagV2} operation + * + * @param diagonal Rank `r`, where `r >= 1` + * @param k Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + * @param numRows The number of rows of the output matrix. If it is not provided, the op assumes + * @param numCols The number of columns of the output matrix. If it is not provided, the op + * @param paddingValue The number to fill the area outside the specified diagonal band with. + * @return a new instance of MatrixDiagV2 + * @see org.tensorflow.op.core.MatrixDiagV2 + */ + public MatrixDiagV2 matrixDiagV2(Operand diagonal, Operand k, + Operand numRows, Operand numCols, Operand paddingValue) { + return MatrixDiagV2.create(scope, diagonal, k, numRows, numCols, paddingValue); + } + + /** + * Builds an {@link TensorScatterSub} operation + * + * @param tensor Tensor to copy/update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @return a new instance of TensorScatterSub + * @see org.tensorflow.op.core.TensorScatterSub + */ + public TensorScatterSub tensorScatterSub(Operand tensor, + Operand indices, Operand updates) { + return TensorScatterSub.create(scope, tensor, indices, updates); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(boolean[] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(double[][][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. String elements are + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(byte[][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Constant} operation + * + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return an integer constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[] shape, IntBuffer data) { + return Constant.create(scope, shape, data); + } + + /** + * Builds an {@link LookupTableFind} operation + * + * @param tableHandle Handle to the table. + * @param keys Any shape. Keys to look up. + * @param defaultValue + * @return a new instance of LookupTableFind + * @see org.tensorflow.op.core.LookupTableFind + */ + public LookupTableFind lookupTableFind(Operand tableHandle, Operand keys, + Operand defaultValue) { + return LookupTableFind.create(scope, tableHandle, keys, defaultValue); + } + + /** + * Builds an {@link TensorArrayUnpack} operation + * + * @param handle + * @param value + * @param flowIn + * @return a new instance of TensorArrayUnpack + * @see org.tensorflow.op.core.TensorArrayUnpack + */ + public TensorArrayUnpack tensorArrayUnpack(Operand handle, Operand value, + Operand flowIn) { + return TensorArrayUnpack.create(scope, handle, value, flowIn); + } + + /** + * Builds an {@link DynamicPartition} operation + * + * @param data + * @param partitions Any shape. Indices in the range `[0, num_partitions)`. + * @param numPartitions The number of partitions to output. + * @return a new instance of DynamicPartition + * @see org.tensorflow.op.core.DynamicPartition + */ + public DynamicPartition dynamicPartition(Operand data, Operand partitions, + Long numPartitions) { + return DynamicPartition.create(scope, data, partitions, numPartitions); + } + + /** + * Builds an {@link SpaceToBatchNd} operation + * + * @param input N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, + * @param blockShape 1-D with shape `[M]`, all values must be >= 1. + * @param paddings 2-D with shape `[M, 2]`, all values must be >= 0. + * @return a new instance of SpaceToBatchNd + * @see org.tensorflow.op.core.SpaceToBatchNd + */ + public SpaceToBatchNd spaceToBatchNd(Operand input, + Operand blockShape, Operand paddings) { + return SpaceToBatchNd.create(scope, input, blockShape, paddings); + } + + /** + * Builds an {@link TensorListScatterIntoExistingList} operation + * + * @param inputHandle + * @param tensor + * @param indices + * @return a new instance of TensorListScatterIntoExistingList + * @see org.tensorflow.op.core.TensorListScatterIntoExistingList + */ + public TensorListScatterIntoExistingList tensorListScatterIntoExistingList( + Operand inputHandle, Operand tensor, Operand indices) { + return TensorListScatterIntoExistingList.create(scope, inputHandle, tensor, indices); + } + + /** + * Builds an {@link NonMaxSuppressionV5} operation + * + * @param boxes A 2-D float tensor of shape `[num_boxes, 4]`. + * @param scores A 1-D float tensor of shape `[num_boxes]` representing a single + * @param maxOutputSize A scalar integer tensor representing the maximum number of + * @param iouThreshold A 0-D float tensor representing the threshold for deciding whether + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * @param softNmsSigma A 0-D float tensor representing the sigma parameter for Soft NMS; see Bodla et + * @param options carries optional attributes values + * @return a new instance of NonMaxSuppressionV5 + * @see org.tensorflow.op.core.NonMaxSuppressionV5 + */ + public NonMaxSuppressionV5 nonMaxSuppressionV5(Operand boxes, + Operand scores, Operand maxOutputSize, Operand iouThreshold, + Operand scoreThreshold, Operand softNmsSigma, NonMaxSuppressionV5.Options... options) { + return NonMaxSuppressionV5.create(scope, boxes, scores, maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma, options); + } + + /** + * Builds an {@link Pad} operation + * + * @param input + * @param paddings + * @param constantValues + * @return a new instance of Pad + * @see org.tensorflow.op.core.Pad + */ + public Pad pad(Operand input, Operand paddings, + Operand constantValues) { + return Pad.create(scope, input, paddings, constantValues); + } + + /** + * Builds an {@link RefSelect} operation + * + * @param index A scalar that determines the input that gets selected. + * @param inputs A list of ref tensors, one of which will be forwarded to `output`. + * @return a new instance of RefSelect + * @see org.tensorflow.op.core.RefSelect + */ + public RefSelect refSelect(Operand index, Iterable> inputs) { + return RefSelect.create(scope, index, inputs); + } + + /** + * Builds an {@link ScatterNdUpdate} operation + * + * @param ref A mutable Tensor. Should be from a Variable node. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated + * @param options carries optional attributes values + * @return a new instance of ScatterNdUpdate + * @see org.tensorflow.op.core.ScatterNdUpdate + */ + public ScatterNdUpdate scatterNdUpdate(Operand ref, + Operand indices, Operand updates, ScatterNdUpdate.Options... options) { + return ScatterNdUpdate.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link ReduceMax} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of ReduceMax + * @see org.tensorflow.op.core.ReduceMax + */ + public ReduceMax reduceMax(Operand input, Operand axis, + ReduceMax.Options... options) { + return ReduceMax.create(scope, input, axis, options); + } + + /** + * Builds an {@link ScatterNd} operation + * + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @param shape 1-D. The shape of the resulting tensor. + * @return a new instance of ScatterNd + * @see org.tensorflow.op.core.ScatterNd + */ + public ScatterNd scatterNd(Operand indices, Operand updates, + Operand shape) { + return ScatterNd.create(scope, indices, updates, shape); + } + + /** + * Builds an {@link Size} operation + * + * @param input + * @param outType + * @return a new instance of Size + * @see org.tensorflow.op.core.Size + */ + public Size size(Operand input, Class outType) { + return Size.create(scope, input, outType); + } + + /** + * Builds an {@link LookupTableImport} operation + * + * @param tableHandle Handle to the table. + * @param keys Any shape. Keys to look up. + * @param values Values to associate with keys. + * @return a new instance of LookupTableImport + * @see org.tensorflow.op.core.LookupTableImport + */ + public LookupTableImport lookupTableImport(Operand tableHandle, Operand keys, + Operand values) { + return LookupTableImport.create(scope, tableHandle, keys, values); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(boolean[][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link BroadcastDynamicShape} operation + * + * @param s0 + * @param s1 + * @return a new instance of BroadcastDynamicShape + * @see org.tensorflow.op.core.BroadcastDynamicShape + */ + public BroadcastDynamicShape broadcastDynamicShape(Operand s0, + Operand s1) { + return BroadcastDynamicShape.create(scope, s0, s1); + } + + /** + * Builds an {@link TensorArrayPack} operation + * + * @param handle + * @param flowIn + * @param dtype + * @param options carries optional attributes values + * @return a new instance of TensorArrayPack + * @see org.tensorflow.op.core.TensorArrayPack + */ + public TensorArrayPack tensorArrayPack(Operand handle, Operand flowIn, + Class dtype, TensorArrayPack.Options... options) { + return TensorArrayPack.create(scope, handle, flowIn, dtype, options); + } + + /** + * Builds an {@link ScatterNdSub} operation + * + * @param ref A mutable Tensor. Should be from a Variable node. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated values + * @param options carries optional attributes values + * @return a new instance of ScatterNdSub + * @see org.tensorflow.op.core.ScatterNdSub + */ + public ScatterNdSub scatterNdSub(Operand ref, Operand indices, + Operand updates, ScatterNdSub.Options... options) { + return ScatterNdSub.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link DestroyResourceOp} operation + * + * @param resource handle to the resource to delete. + * @param options carries optional attributes values + * @return a new instance of DestroyResourceOp + * @see org.tensorflow.op.core.DestroyResourceOp + */ + public DestroyResourceOp destroyResourceOp(Operand resource, + DestroyResourceOp.Options... options) { + return DestroyResourceOp.create(scope, resource, options); + } + + /** + * Builds an {@link ResourceSparseApplyKerasMomentum} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyKerasMomentum + * @see org.tensorflow.op.core.ResourceSparseApplyKerasMomentum + */ + public ResourceSparseApplyKerasMomentum resourceSparseApplyKerasMomentum( + Operand var, Operand accum, Operand lr, Operand grad, Operand indices, + Operand momentum, ResourceSparseApplyKerasMomentum.Options... options) { + return ResourceSparseApplyKerasMomentum.create(scope, var, accum, lr, grad, indices, momentum, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(float[][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link StringNGrams} operation + * + * @param data The values tensor of the ragged string tensor to make ngrams out of. Must be a + * @param dataSplits The splits tensor of the ragged string tensor to make ngrams out of. + * @param separator The string to append between elements of the token. Use "" for no separator. + * @param ngramWidths The sizes of the ngrams to create. + * @param leftPad The string to use to pad the left side of the ngram sequence. Only used if + * @param rightPad The string to use to pad the right side of the ngram sequence. Only used if + * @param padWidth The number of padding elements to add to each side of each + * @param preserveShortSequences + * @return a new instance of StringNGrams + * @see org.tensorflow.op.core.StringNGrams + */ + public StringNGrams stringNGrams(Operand data, + Operand dataSplits, String separator, List ngramWidths, String leftPad, + String rightPad, Long padWidth, Boolean preserveShortSequences) { + return StringNGrams.create(scope, data, dataSplits, separator, ngramWidths, leftPad, rightPad, padWidth, preserveShortSequences); + } + + /** + * Builds an {@link BarrierIncompleteSize} operation + * + * @param handle The handle to a barrier. + * @return a new instance of BarrierIncompleteSize + * @see org.tensorflow.op.core.BarrierIncompleteSize + */ + public BarrierIncompleteSize barrierIncompleteSize(Operand handle) { + return BarrierIncompleteSize.create(scope, handle); + } + + /** + * Builds an {@link MapClear} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapClear + * @see org.tensorflow.op.core.MapClear + */ + public MapClear mapClear(List> dtypes, MapClear.Options... options) { + return MapClear.create(scope, dtypes, options); + } + + /** + * Builds an {@link ConsumeMutexLock} operation + * + * @param mutexLock A tensor returned by `MutexLock`. + * @return a new instance of ConsumeMutexLock + * @see org.tensorflow.op.core.ConsumeMutexLock + */ + public ConsumeMutexLock consumeMutexLock(Operand mutexLock) { + return ConsumeMutexLock.create(scope, mutexLock); + } + + /** + * Builds an {@link UnravelIndex} operation + * + * @param indices An 0-D or 1-D `int` Tensor whose elements are indices into the + * @param dims An 1-D `int` Tensor. The shape of the array to use for unraveling + * @return a new instance of UnravelIndex + * @see org.tensorflow.op.core.UnravelIndex + */ + public UnravelIndex unravelIndex(Operand indices, Operand dims) { + return UnravelIndex.create(scope, indices, dims); + } + + /** + * Builds an {@link DestroyTemporaryVariable} operation + * + * @param ref A reference to the temporary variable tensor. + * @param varName Name of the temporary variable, usually the name of the matching + * @return a new instance of DestroyTemporaryVariable + * @see org.tensorflow.op.core.DestroyTemporaryVariable + */ + public DestroyTemporaryVariable destroyTemporaryVariable(Operand ref, String varName) { + return DestroyTemporaryVariable.create(scope, ref, varName); + } + + /** + * Builds an {@link StatefulStandardNormal} operation + * + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of StatefulStandardNormal + * @see org.tensorflow.op.core.StatefulStandardNormal + */ + public StatefulStandardNormal statefulStandardNormal(Operand resource, + Operand shape, Class dtype) { + return StatefulStandardNormal.create(scope, resource, shape, dtype); + } + + /** + * Builds an {@link ResourceScatterNdSub} operation + * + * @param ref A resource handle. Must be from a VarHandleOp. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * @param updates A Tensor. Must have the same type as ref. A tensor of + * @param options carries optional attributes values + * @return a new instance of ResourceScatterNdSub + * @see org.tensorflow.op.core.ResourceScatterNdSub + */ + public ResourceScatterNdSub resourceScatterNdSub(Operand ref, + Operand indices, Operand updates, ResourceScatterNdSub.Options... options) { + return ResourceScatterNdSub.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link Bitcast} operation + * + * @param input + * @param type + * @return a new instance of Bitcast + * @see org.tensorflow.op.core.Bitcast + */ + public Bitcast bitcast(Operand input, Class type) { + return Bitcast.create(scope, input, type); + } + + /** + * Builds an {@link Constant} operation + * + * @param data The value to put into the new constant. + * @return an integer constant + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(int data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. String elements are + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(byte[][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link ScatterUpdate} operation + * + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to store in `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterUpdate + * @see org.tensorflow.op.core.ScatterUpdate + */ + public ScatterUpdate scatterUpdate(Operand ref, Operand indices, + Operand updates, ScatterUpdate.Options... options) { + return ScatterUpdate.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link ScatterMul} operation + * + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to multiply to `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterMul + * @see org.tensorflow.op.core.ScatterMul + */ + public ScatterMul scatterMul(Operand ref, Operand indices, + Operand updates, ScatterMul.Options... options) { + return ScatterMul.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link AssertThat} operation + * + * @param condition The condition to evaluate. + * @param data The tensors to print out when condition is false. + * @param options carries optional attributes values + * @return a new instance of AssertThat + * @see org.tensorflow.op.core.AssertThat + */ + public AssertThat assertThat(Operand condition, Iterable> data, + AssertThat.Options... options) { + return AssertThat.create(scope, condition, data, options); + } + + /** + * Builds an {@link BatchMatMulV2} operation + * + * @param x 2-D or higher with shape `[..., r_x, c_x]`. + * @param y 2-D or higher with shape `[..., r_y, c_y]`. + * @param options carries optional attributes values + * @return a new instance of BatchMatMulV2 + * @see org.tensorflow.op.core.BatchMatMulV2 + */ + public BatchMatMulV2 batchMatMulV2(Operand x, Operand y, + BatchMatMulV2.Options... options) { + return BatchMatMulV2.create(scope, x, y, options); + } + + /** + * Builds an {@link ImmutableConst} operation + * + * @param dtype Type of the returned tensor. + * @param shape Shape of the returned tensor. + * @param memoryRegionName Name of readonly memory region used by the tensor, see + * @return a new instance of ImmutableConst + * @see org.tensorflow.op.core.ImmutableConst + */ + public ImmutableConst immutableConst(Class dtype, Shape shape, + String memoryRegionName) { + return ImmutableConst.create(scope, dtype, shape, memoryRegionName); + } + + /** + * Builds an {@link OrderedMapStage} operation + * + * @param key int64 + * @param indices + * @param values a list of tensors + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapStage + * @see org.tensorflow.op.core.OrderedMapStage + */ + public OrderedMapStage orderedMapStage(Operand key, Operand indices, + Iterable> values, List> dtypes, OrderedMapStage.Options... options) { + return OrderedMapStage.create(scope, key, indices, values, dtypes, options); + } + + /** + * Builds an {@link TensorArrayConcat} operation + * + * @param handle The handle to a TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param dtype The type of the elem that is returned. + * @param options carries optional attributes values + * @return a new instance of TensorArrayConcat + * @see org.tensorflow.op.core.TensorArrayConcat + */ + public TensorArrayConcat tensorArrayConcat(Operand handle, Operand flowIn, + Class dtype, TensorArrayConcat.Options... options) { + return TensorArrayConcat.create(scope, handle, flowIn, dtype, options); + } + + /** + * Builds an {@link VariableShape} operation + * + * @param input + * @return a new instance of VariableShape + * @see org.tensorflow.op.core.VariableShape + */ + public VariableShape variableShape(Operand input) { + return VariableShape.create(scope, input); + } + + /** + * Builds an {@link RefSwitch} operation + * + * @param data The ref tensor to be forwarded to the appropriate output. + * @param pred A scalar that specifies which output port will receive data. + * @return a new instance of RefSwitch + * @see org.tensorflow.op.core.RefSwitch + */ + public RefSwitch refSwitch(Operand data, Operand pred) { + return RefSwitch.create(scope, data, pred); + } + + /** + * Builds an {@link Abort} operation + * + * @param options carries optional attributes values + * @return a new instance of Abort + * @see org.tensorflow.op.core.Abort + */ + public Abort abort(Abort.Options... options) { + return Abort.create(scope, options); + } + + /** + * Builds an {@link ScatterNdNonAliasingAdd} operation + * + * @param input A Tensor. + * @param indices A Tensor. Must be one of the following types: `int32`, `int64`. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated values + * @return a new instance of ScatterNdNonAliasingAdd + * @see org.tensorflow.op.core.ScatterNdNonAliasingAdd + */ + public ScatterNdNonAliasingAdd scatterNdNonAliasingAdd(Operand input, + Operand indices, Operand updates) { + return ScatterNdNonAliasingAdd.create(scope, input, indices, updates); + } + + /** + * Builds an {@link VarIsInitializedOp} operation + * + * @param resource the input resource handle. + * @return a new instance of VarIsInitializedOp + * @see org.tensorflow.op.core.VarIsInitializedOp + */ + public VarIsInitializedOp varIsInitializedOp(Operand resource) { + return VarIsInitializedOp.create(scope, resource); + } + + /** + * Builds an {@link ScatterSub} operation + * + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to subtract from `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterSub + * @see org.tensorflow.op.core.ScatterSub + */ + public ScatterSub scatterSub(Operand ref, Operand indices, + Operand updates, ScatterSub.Options... options) { + return ScatterSub.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link ScatterMin} operation + * + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to reduce into `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterMin + * @see org.tensorflow.op.core.ScatterMin + */ + public ScatterMin scatterMin(Operand ref, + Operand indices, Operand updates, ScatterMin.Options... options) { + return ScatterMin.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link EmptyTensorList} operation + * + * @param elementShape + * @param maxNumElements + * @param elementDtype + * @return a new instance of EmptyTensorList + * @see org.tensorflow.op.core.EmptyTensorList + */ + public EmptyTensorList emptyTensorList(Operand elementShape, + Operand maxNumElements, Class elementDtype) { + return EmptyTensorList.create(scope, elementShape, maxNumElements, elementDtype); + } + + /** + * Builds an {@link TensorArrayWrite} operation + * + * @param handle The handle to a TensorArray. + * @param index The position to write to inside the TensorArray. + * @param value The tensor to write to the TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArrayWrite + * @see org.tensorflow.op.core.TensorArrayWrite + */ + public TensorArrayWrite tensorArrayWrite(Operand handle, Operand index, + Operand value, Operand flowIn) { + return TensorArrayWrite.create(scope, handle, index, value, flowIn); + } + + /** + * Builds an {@link TensorListGetItem} operation + * + * @param inputHandle + * @param index + * @param elementShape + * @param elementDtype + * @return a new instance of TensorListGetItem + * @see org.tensorflow.op.core.TensorListGetItem + */ + public TensorListGetItem tensorListGetItem(Operand inputHandle, Operand index, + Operand elementShape, Class elementDtype) { + return TensorListGetItem.create(scope, inputHandle, index, elementShape, elementDtype); + } + + /** + * Builds an {@link ReduceMin} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of ReduceMin + * @see org.tensorflow.op.core.ReduceMin + */ + public ReduceMin reduceMin(Operand input, Operand axis, + ReduceMin.Options... options) { + return ReduceMin.create(scope, input, axis, options); + } + + /** + * Builds an {@link Print} operation + * + * @param input The string scalar to print. + * @param options carries optional attributes values + * @return a new instance of Print + * @see org.tensorflow.op.core.Print + */ + public Print print(Operand input, Print.Options... options) { + return Print.create(scope, input, options); + } + + /** + * Builds an {@link UniqueWithCounts} operation + * + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * @param outIdx + * @return a new instance of UniqueWithCounts + * @see org.tensorflow.op.core.UniqueWithCounts + */ + public UniqueWithCounts uniqueWithCounts( + Operand x, Operand axis, Class outIdx) { + return UniqueWithCounts.create(scope, x, axis, outIdx); + } + + /** + * Builds an {@link TensorArrayScatter} operation + * + * @param handle The handle to a TensorArray. + * @param indices The locations at which to write the tensor elements. + * @param value The concatenated tensor to write to the TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArrayScatter + * @see org.tensorflow.op.core.TensorArrayScatter + */ + public TensorArrayScatter tensorArrayScatter(Operand handle, Operand indices, + Operand value, Operand flowIn) { + return TensorArrayScatter.create(scope, handle, indices, value, flowIn); + } + + /** + * Builds an {@link Constant} operation + * + * @param charset The encoding from String to bytes. + * @param data The string to put into the new constant. + * @return a string constant + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(String data, Charset charset) { + return Constant.create(scope, data, charset); + } + + /** + * Builds an {@link ResourceScatterNdAdd} operation + * + * @param ref A resource handle. Must be from a VarHandleOp. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * @param updates A Tensor. Must have the same type as ref. A tensor of + * @param options carries optional attributes values + * @return a new instance of ResourceScatterNdAdd + * @see org.tensorflow.op.core.ResourceScatterNdAdd + */ + public ResourceScatterNdAdd resourceScatterNdAdd(Operand ref, + Operand indices, Operand updates, ResourceScatterNdAdd.Options... options) { + return ResourceScatterNdAdd.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link FusedBatchNormV3} operation + * + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param offset A 1D Tensor for offset, to shift to the normalized x. + * @param mean A 1D Tensor for population mean. Used for inference only; + * @param variance A 1D Tensor for population variance. Used for inference only; + * @param options carries optional attributes values + * @return a new instance of FusedBatchNormV3 + * @see org.tensorflow.op.core.FusedBatchNormV3 + */ + public FusedBatchNormV3 fusedBatchNormV3(Operand x, + Operand scale, Operand offset, Operand mean, Operand variance, + FusedBatchNormV3.Options... options) { + return FusedBatchNormV3.create(scope, x, scale, offset, mean, variance, options); + } + + /** + * Builds an {@link ShapeN} operation + * + * @param input + * @return a new instance of ShapeN + * @see org.tensorflow.op.core.ShapeN + */ + public ShapeN shapeN(Iterable> input) { + return ShapeN.create(scope, input); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(int[][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(double[][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link StageSize} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of StageSize + * @see org.tensorflow.op.core.StageSize + */ + public StageSize stageSize(List> dtypes, StageSize.Options... options) { + return StageSize.create(scope, dtypes, options); + } + + /** + * Builds an {@link InitializeTable} operation + * + * @param tableHandle Handle to a table which will be initialized. + * @param keys Keys of type Tkey. + * @param values Values of type Tval. + * @return a new instance of InitializeTable + * @see org.tensorflow.op.core.InitializeTable + */ + public InitializeTable initializeTable(Operand tableHandle, Operand keys, + Operand values) { + return InitializeTable.create(scope, tableHandle, keys, values); + } + + /** + * Builds an {@link MulNoNan} operation + * + * @param x + * @param y + * @return a new instance of MulNoNan + * @see org.tensorflow.op.core.MulNoNan + */ + public MulNoNan mulNoNan(Operand x, Operand y) { + return MulNoNan.create(scope, x, y); + } + + /** + * Builds an {@link Constant} operation + * + * @param data The value to put into the new constant. + * @return a double constant + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(double data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link NextAfter} operation + * + * @param x1 + * @param x2 + * @return a new instance of NextAfter + * @see org.tensorflow.op.core.NextAfter + */ + public NextAfter nextAfter(Operand x1, Operand x2) { + return NextAfter.create(scope, x1, x2); + } + + /** + * Builds an {@link StringLower} operation + * + * @param input + * @param options carries optional attributes values + * @return a new instance of StringLower + * @see org.tensorflow.op.core.StringLower + */ + public StringLower stringLower(Operand input, StringLower.Options... options) { + return StringLower.create(scope, input, options); + } + + /** + * Builds an {@link TensorListGather} operation + * + * @param inputHandle + * @param indices + * @param elementShape + * @param elementDtype + * @return a new instance of TensorListGather + * @see org.tensorflow.op.core.TensorListGather + */ + public TensorListGather tensorListGather(Operand inputHandle, Operand indices, + Operand elementShape, Class elementDtype) { + return TensorListGather.create(scope, inputHandle, indices, elementShape, elementDtype); + } + + /** + * Builds an {@link Reverse} operation + * + * @param tensor Up to 8-D. + * @param axis 1-D. The indices of the dimensions to reverse. Must be in the range + * @return a new instance of Reverse + * @see org.tensorflow.op.core.Reverse + */ + public Reverse reverse(Operand tensor, Operand axis) { + return Reverse.create(scope, tensor, axis); + } + + /** + * Builds an {@link SplitV} operation + * + * @param value The tensor to split. + * @param sizeSplits list containing the sizes of each output tensor along the split + * @param axis 0-D. The dimension along which to split. Must be in the range + * @param numSplit + * @return a new instance of SplitV + * @see org.tensorflow.op.core.SplitV + */ + public SplitV splitV(Operand value, Operand sizeSplits, + Operand axis, Long numSplit) { + return SplitV.create(scope, value, sizeSplits, axis, numSplit); + } + + /** + * Builds an {@link ScaleAndTranslate} operation + * + * @param images + * @param size + * @param scale + * @param translation + * @param options carries optional attributes values + * @return a new instance of ScaleAndTranslate + * @see org.tensorflow.op.core.ScaleAndTranslate + */ + public ScaleAndTranslate scaleAndTranslate(Operand images, + Operand size, Operand scale, Operand translation, + ScaleAndTranslate.Options... options) { + return ScaleAndTranslate.create(scope, images, size, scale, translation, options); + } + + /** + * Builds an {@link Barrier} operation + * + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of Barrier + * @see org.tensorflow.op.core.Barrier + */ + public Barrier barrier(List> componentTypes, Barrier.Options... options) { + return Barrier.create(scope, componentTypes, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param shape the tensor shape. + * @param data a buffer containing the tensor data. + * @return a long constant + * @throws IllegalArgumentException If the tensor shape is not compatible with the buffer + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[] shape, LongBuffer data) { + return Constant.create(scope, shape, data); + } + + /** + * Builds an {@link ReduceSum} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of ReduceSum + * @see org.tensorflow.op.core.ReduceSum + */ + public ReduceSum reduceSum(Operand input, Operand axis, + ReduceSum.Options... options) { + return ReduceSum.create(scope, input, axis, options); + } + + /** + * Builds an {@link EnsureShape} operation + * + * @param input A tensor, whose shape is to be validated. + * @param shape The expected (possibly partially specified) shape of the input tensor. + * @return a new instance of EnsureShape + * @see org.tensorflow.op.core.EnsureShape + */ + public EnsureShape ensureShape(Operand input, Shape shape) { + return EnsureShape.create(scope, input, shape); + } + + /** + * Builds an {@link UnbatchGrad} operation + * + * @param originalInput + * @param batchIndex + * @param grad + * @param id + * @param options carries optional attributes values + * @return a new instance of UnbatchGrad + * @see org.tensorflow.op.core.UnbatchGrad + */ + public UnbatchGrad unbatchGrad(Operand originalInput, Operand batchIndex, + Operand grad, Operand id, UnbatchGrad.Options... options) { + return UnbatchGrad.create(scope, originalInput, batchIndex, grad, id, options); + } + + /** + * Builds an {@link StringUpper} operation + * + * @param input + * @param options carries optional attributes values + * @return a new instance of StringUpper + * @see org.tensorflow.op.core.StringUpper + */ + public StringUpper stringUpper(Operand input, StringUpper.Options... options) { + return StringUpper.create(scope, input, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data The value to put into the new constant. + * @return a long constant + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Where} operation + * + * @param condition + * @return a new instance of Where + * @see org.tensorflow.op.core.Where + */ + public Where where(Operand condition) { + return Where.create(scope, condition); + } + + /** + * Builds an {@link VariableShape} operation + * + * @param input + * @param outType + * @return a new instance of VariableShape + * @see org.tensorflow.op.core.VariableShape + */ + public VariableShape variableShape(Operand input, Class outType) { + return VariableShape.create(scope, input, outType); + } + + /** + * Builds an {@link MapPeek} operation + * + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapPeek + * @see org.tensorflow.op.core.MapPeek + */ + public MapPeek mapPeek(Operand key, Operand indices, List> dtypes, + MapPeek.Options... options) { + return MapPeek.create(scope, key, indices, dtypes, options); + } + + /** + * Builds an {@link ScatterMax} operation + * + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to reduce into `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterMax + * @see org.tensorflow.op.core.ScatterMax + */ + public ScatterMax scatterMax(Operand ref, + Operand indices, Operand updates, ScatterMax.Options... options) { + return ScatterMax.create(scope, ref, indices, updates, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(float[][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link TensorListScatter} operation + * + * @param tensor + * @param indices + * @param elementShape + * @return a new instance of TensorListScatter + * @see org.tensorflow.op.core.TensorListScatter + */ + public TensorListScatter tensorListScatter(Operand tensor, + Operand indices, Operand elementShape) { + return TensorListScatter.create(scope, tensor, indices, elementShape); + } + + /** + * Builds an {@link CombinedNonMaxSuppression} operation + * + * @param boxes A 4-D float tensor of shape `[batch_size, num_boxes, q, 4]`. If `q` is 1 then + * @param scores A 3-D float tensor of shape `[batch_size, num_boxes, num_classes]` + * @param maxOutputSizePerClass A scalar integer tensor representing the maximum number of + * @param maxTotalSize A scalar representing maximum number of boxes retained over all classes. + * @param iouThreshold A 0-D float tensor representing the threshold for deciding whether + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * @param options carries optional attributes values + * @return a new instance of CombinedNonMaxSuppression + * @see org.tensorflow.op.core.CombinedNonMaxSuppression + */ + public CombinedNonMaxSuppression combinedNonMaxSuppression(Operand boxes, + Operand scores, Operand maxOutputSizePerClass, Operand maxTotalSize, + Operand iouThreshold, Operand scoreThreshold, + CombinedNonMaxSuppression.Options... options) { + return CombinedNonMaxSuppression.create(scope, boxes, scores, maxOutputSizePerClass, maxTotalSize, iouThreshold, scoreThreshold, options); + } + + /** + * Builds an {@link StridedSlice} operation + * + * @param input + * @param begin `begin[k]` specifies the offset into the `k`th range specification. + * @param end `end[i]` is like `begin` with the exception that `end_mask` is + * @param strides `strides[i]` specifies the increment in the `i`th specification + * @param options carries optional attributes values + * @return a new instance of StridedSlice + * @see org.tensorflow.op.core.StridedSlice + */ + public StridedSlice stridedSlice(Operand input, Operand begin, + Operand end, Operand strides, StridedSlice.Options... options) { + return StridedSlice.create(scope, input, begin, end, strides, options); + } + + /** + * Builds an {@link Shape} operation + * + * @param input + * @return a new instance of Shape + * @see org.tensorflow.op.core.Shape + */ + public org.tensorflow.op.core.Shape shape(Operand input) { + return org.tensorflow.op.core.Shape.create(scope, input); + } + + /** + * Builds an {@link GatherNd} operation + * + * @param params The tensor from which to gather values. + * @param indices Index tensor. + * @return a new instance of GatherNd + * @see org.tensorflow.op.core.GatherNd + */ + public GatherNd gatherNd(Operand params, Operand indices) { + return GatherNd.create(scope, params, indices); + } + + /** + * Builds an {@link SwitchCond} operation + * + * @param data The tensor to be forwarded to the appropriate output. + * @param pred A scalar that specifies which output port will receive data. + * @return a new instance of SwitchCond + * @see org.tensorflow.op.core.SwitchCond + */ + public SwitchCond switchCond(Operand data, Operand pred) { + return SwitchCond.create(scope, data, pred); + } + + /** + * Builds an {@link ResourceCountUpTo} operation + * + * @param resource Should be from a scalar `Variable` node. + * @param limit If incrementing ref would bring it above limit, instead generates an + * @param T + * @return a new instance of ResourceCountUpTo + * @see org.tensorflow.op.core.ResourceCountUpTo + */ + public ResourceCountUpTo resourceCountUpTo(Operand resource, Long limit, + Class T) { + return ResourceCountUpTo.create(scope, resource, limit, T); + } + + /** + * Builds an {@link Where3} operation + * + * @param condition + * @param x = A `Tensor` which may have the same shape as `condition`. + * @param y = A `Tensor` with the same type and shape as `x`. + * @return a new instance of Where3 + * @see org.tensorflow.op.core.Where3 + */ + public Where3 where3(Operand condition, Operand x, Operand y) { + return Where3.create(scope, condition, x, y); + } + + /** + * Builds an {@link InitializeTableFromTextFile} operation + * + * @param tableHandle Handle to a table which will be initialized. + * @param filename Filename of a vocabulary text file. + * @param keyIndex Column index in a line to get the table `key` values from. + * @param valueIndex Column index that represents information of a line to get the table + * @param options carries optional attributes values + * @return a new instance of InitializeTableFromTextFile + * @see org.tensorflow.op.core.InitializeTableFromTextFile + */ + public InitializeTableFromTextFile initializeTableFromTextFile(Operand tableHandle, + Operand filename, Long keyIndex, Long valueIndex, + InitializeTableFromTextFile.Options... options) { + return InitializeTableFromTextFile.create(scope, tableHandle, filename, keyIndex, valueIndex, options); + } + + /** + * Builds an {@link ResourceScatterUpdate} operation + * + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterUpdate + * @see org.tensorflow.op.core.ResourceScatterUpdate + */ + public ResourceScatterUpdate resourceScatterUpdate(Operand resource, + Operand indices, Operand updates) { + return ResourceScatterUpdate.create(scope, resource, indices, updates); + } + + /** + * Builds an {@link IdentityN} operation + * + * @param input + * @return a new instance of IdentityN + * @see org.tensorflow.op.core.IdentityN + */ + public IdentityN identityN(Iterable> input) { + return IdentityN.create(scope, input); + } + + /** + * Builds an {@link BatchToSpace} operation + * + * @param input 4-D tensor with shape + * @param crops 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies + * @param blockSize + * @return a new instance of BatchToSpace + * @see org.tensorflow.op.core.BatchToSpace + */ + public BatchToSpace batchToSpace(Operand input, Operand crops, + Long blockSize) { + return BatchToSpace.create(scope, input, crops, blockSize); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(boolean[][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link StageClear} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of StageClear + * @see org.tensorflow.op.core.StageClear + */ + public StageClear stageClear(List> dtypes, StageClear.Options... options) { + return StageClear.create(scope, dtypes, options); + } + + /** + * Builds an {@link TryRpc} operation + * + * @param address `0-D` or `1-D`. The address (i.e. host_name:port) of the RPC server. + * @param method `0-D` or `1-D`. The method address on the RPC server. + * @param request `0-D` or `1-D`. Serialized proto strings: the rpc request argument. + * @param options carries optional attributes values + * @return a new instance of TryRpc + * @see org.tensorflow.op.core.TryRpc + */ + public TryRpc tryRpc(Operand address, Operand method, Operand request, + TryRpc.Options... options) { + return TryRpc.create(scope, address, method, request, options); + } + + /** + * Builds an {@link InplaceUpdate} operation + * + * @param x A tensor of type `T`. + * @param i A vector. Indices into the left-most dimension of `x`. + * @param v A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @return a new instance of InplaceUpdate + * @see org.tensorflow.op.core.InplaceUpdate + */ + public InplaceUpdate inplaceUpdate(Operand x, Operand i, Operand v) { + return InplaceUpdate.create(scope, x, i, v); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(double[][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link DeepCopy} operation + * + * @param x The source tensor of type `T`. + * @return a new instance of DeepCopy + * @see org.tensorflow.op.core.DeepCopy + */ + public DeepCopy deepCopy(Operand x) { + return DeepCopy.create(scope, x); + } + + /** + * Builds an {@link TensorArrayGrad} operation + * + * @param handle The handle to the forward TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param source The gradient source string, used to decide which gradient TensorArray + * @return a new instance of TensorArrayGrad + * @see org.tensorflow.op.core.TensorArrayGrad + */ + public TensorArrayGrad tensorArrayGrad(Operand handle, Operand flowIn, String source) { + return TensorArrayGrad.create(scope, handle, flowIn, source); + } + + /** + * Builds an {@link ResourceApplyAdamWithAmsgrad} operation + * + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param vhat Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param beta2Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdamWithAmsgrad + * @see org.tensorflow.op.core.ResourceApplyAdamWithAmsgrad + */ + public ResourceApplyAdamWithAmsgrad resourceApplyAdamWithAmsgrad(Operand var, Operand m, + Operand v, Operand vhat, Operand beta1Power, Operand beta2Power, Operand lr, + Operand beta1, Operand beta2, Operand epsilon, Operand grad, + ResourceApplyAdamWithAmsgrad.Options... options) { + return ResourceApplyAdamWithAmsgrad.create(scope, var, m, v, vhat, beta1Power, beta2Power, lr, beta1, beta2, epsilon, grad, options); + } + + /** + * Builds an {@link TensorArray} operation + * + * @param size The size of the array. + * @param dtype The type of the elements on the tensor_array. + * @param options carries optional attributes values + * @return a new instance of TensorArray + * @see org.tensorflow.op.core.TensorArray + */ + public TensorArray tensorArray(Operand size, Class dtype, + TensorArray.Options... options) { + return TensorArray.create(scope, size, dtype, options); + } + + /** + * Builds an {@link StagePeek} operation + * + * @param index + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of StagePeek + * @see org.tensorflow.op.core.StagePeek + */ + public StagePeek stagePeek(Operand index, List> dtypes, + StagePeek.Options... options) { + return StagePeek.create(scope, index, dtypes, options); + } + + /** + * Builds an {@link OrderedMapUnstage} operation + * + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapUnstage + * @see org.tensorflow.op.core.OrderedMapUnstage + */ + public OrderedMapUnstage orderedMapUnstage(Operand key, Operand indices, + List> dtypes, OrderedMapUnstage.Options... options) { + return OrderedMapUnstage.create(scope, key, indices, dtypes, options); + } + + /** + * Builds an {@link EuclideanNorm} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of EuclideanNorm + * @see org.tensorflow.op.core.EuclideanNorm + */ + public EuclideanNorm euclideanNorm(Operand input, Operand axis, + EuclideanNorm.Options... options) { + return EuclideanNorm.create(scope, input, axis, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. String elements are + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(byte[][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link OrderedMapPeek} operation + * + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapPeek + * @see org.tensorflow.op.core.OrderedMapPeek + */ + public OrderedMapPeek orderedMapPeek(Operand key, Operand indices, + List> dtypes, OrderedMapPeek.Options... options) { + return OrderedMapPeek.create(scope, key, indices, dtypes, options); + } + + /** + * Builds an {@link AssignVariableOp} operation + * + * @param resource handle to the resource in which to store the variable. + * @param value the value to set the new tensor to use. + * @return a new instance of AssignVariableOp + * @see org.tensorflow.op.core.AssignVariableOp + */ + public AssignVariableOp assignVariableOp(Operand resource, Operand value) { + return AssignVariableOp.create(scope, resource, value); + } + + /** + * Builds an {@link GetSessionTensor} operation + * + * @param handle The handle for a tensor stored in the session state. + * @param dtype The type of the output value. + * @return a new instance of GetSessionTensor + * @see org.tensorflow.op.core.GetSessionTensor + */ + public GetSessionTensor getSessionTensor(Operand handle, Class dtype) { + return GetSessionTensor.create(scope, handle, dtype); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(float[][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link MapUnstageNoKey} operation + * + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapUnstageNoKey + * @see org.tensorflow.op.core.MapUnstageNoKey + */ + public MapUnstageNoKey mapUnstageNoKey(Operand indices, List> dtypes, + MapUnstageNoKey.Options... options) { + return MapUnstageNoKey.create(scope, indices, dtypes, options); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link MirrorPad} operation + * + * @param input The input tensor to be padded. + * @param paddings A two-column matrix specifying the padding sizes. The number of + * @param mode Either `REFLECT` or `SYMMETRIC`. In reflect mode the padded regions + * @return a new instance of MirrorPad + * @see org.tensorflow.op.core.MirrorPad + */ + public MirrorPad mirrorPad(Operand input, Operand paddings, + String mode) { + return MirrorPad.create(scope, input, paddings, mode); + } + + /** + * Builds an {@link TensorListSplit} operation + * + * @param tensor + * @param elementShape + * @param lengths + * @return a new instance of TensorListSplit + * @see org.tensorflow.op.core.TensorListSplit + */ + public TensorListSplit tensorListSplit(Operand tensor, + Operand elementShape, Operand lengths) { + return TensorListSplit.create(scope, tensor, elementShape, lengths); + } + + /** + * Builds an {@link StridedSliceAssign} operation + * + * @param ref + * @param begin + * @param end + * @param strides + * @param value + * @param options carries optional attributes values + * @return a new instance of StridedSliceAssign + * @see org.tensorflow.op.core.StridedSliceAssign + */ + public StridedSliceAssign stridedSliceAssign(Operand ref, + Operand begin, Operand end, Operand strides, Operand value, + StridedSliceAssign.Options... options) { + return StridedSliceAssign.create(scope, ref, begin, end, strides, value, options); + } + + /** + * Builds an {@link MapStage} operation + * + * @param key int64 + * @param indices + * @param values a list of tensors + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapStage + * @see org.tensorflow.op.core.MapStage + */ + public MapStage mapStage(Operand key, Operand indices, Iterable> values, + List> dtypes, MapStage.Options... options) { + return MapStage.create(scope, key, indices, values, dtypes, options); + } + + /** + * Builds an {@link ReduceAll} operation + * + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * @param options carries optional attributes values + * @return a new instance of ReduceAll + * @see org.tensorflow.op.core.ReduceAll + */ + public ReduceAll reduceAll(Operand input, Operand axis, + ReduceAll.Options... options) { + return ReduceAll.create(scope, input, axis, options); + } + + /** + * Builds an {@link TensorListPushBack} operation + * + * @param inputHandle + * @param tensor + * @return a new instance of TensorListPushBack + * @see org.tensorflow.op.core.TensorListPushBack + */ + public TensorListPushBack tensorListPushBack(Operand inputHandle, Operand tensor) { + return TensorListPushBack.create(scope, inputHandle, tensor); + } + + /** + * Builds an {@link TensorScatterUpdate} operation + * + * @param tensor Tensor to copy/update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @return a new instance of TensorScatterUpdate + * @see org.tensorflow.op.core.TensorScatterUpdate + */ + public TensorScatterUpdate tensorScatterUpdate(Operand tensor, + Operand indices, Operand updates) { + return TensorScatterUpdate.create(scope, tensor, indices, updates); + } + + /** + * Builds an {@link ResourceStridedSliceAssign} operation + * + * @param ref + * @param begin + * @param end + * @param strides + * @param value + * @param options carries optional attributes values + * @return a new instance of ResourceStridedSliceAssign + * @see org.tensorflow.op.core.ResourceStridedSliceAssign + */ + public ResourceStridedSliceAssign resourceStridedSliceAssign(Operand ref, + Operand begin, Operand end, Operand strides, Operand value, + ResourceStridedSliceAssign.Options... options) { + return ResourceStridedSliceAssign.create(scope, ref, begin, end, strides, value, options); + } + + /** + * Builds an {@link Rank} operation + * + * @param input + * @return a new instance of Rank + * @see org.tensorflow.op.core.Rank + */ + public Rank rank(Operand input) { + return Rank.create(scope, input); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(int[][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Gather} operation + * + * @param params The tensor from which to gather values. Must be at least rank + * @param indices Index tensor. Must be in range `[0, params.shape[axis])`. + * @param axis The axis in `params` to gather `indices` from. Defaults to the first + * @param options carries optional attributes values + * @return a new instance of Gather + * @see org.tensorflow.op.core.Gather + */ + public Gather gather(Operand params, + Operand indices, Operand axis, Gather.Options... options) { + return Gather.create(scope, params, indices, axis, options); + } + + /** + * Builds an {@link TensorListReserve} operation + * + * @param elementShape + * @param numElements + * @param elementDtype + * @return a new instance of TensorListReserve + * @see org.tensorflow.op.core.TensorListReserve + */ + public TensorListReserve tensorListReserve(Operand elementShape, + Operand numElements, Class elementDtype) { + return TensorListReserve.create(scope, elementShape, numElements, elementDtype); + } + + /** + * Builds an {@link Constant} operation + * + * @param data The value to put into the new constant. + * @return a boolean constant + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(boolean data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link Zeros} operation + * + * @param dims a 1-D operand that represents the shape of the output tensor + * @param type the output tensor datatype + * @return a constant tensor initialized with zeros + * @throws IllegalArgumentException if the tensor type or shape cannot be initialized with zeros. + * @see org.tensorflow.op.core.Zeros + */ + public Zeros zeros(Operand dims, Class type) { + return Zeros.create(scope, dims, type); + } + + /** + * Builds an {@link Snapshot} operation + * + * @param input + * @return a new instance of Snapshot + * @see org.tensorflow.op.core.Snapshot + */ + public Snapshot snapshot(Operand input) { + return Snapshot.create(scope, input); + } + + /** + * Builds an {@link LookupTableSize} operation + * + * @param tableHandle Handle to the table. + * @return a new instance of LookupTableSize + * @see org.tensorflow.op.core.LookupTableSize + */ + public LookupTableSize lookupTableSize(Operand tableHandle) { + return LookupTableSize.create(scope, tableHandle); + } + + /** + * Builds an {@link SetDiff1d} operation + * + * @param x 1-D. Values to keep. + * @param y 1-D. Values to remove. + * @return a new instance of SetDiff1d + * @see org.tensorflow.op.core.SetDiff1d + */ + public SetDiff1d setDiff1d(Operand x, Operand y) { + return SetDiff1d.create(scope, x, y); + } + + /** + * Builds an {@link Reshape} operation + * + * @param tensor + * @param shape Defines the shape of the output tensor. + * @return a new instance of Reshape + * @see org.tensorflow.op.core.Reshape + */ + public Reshape reshape(Operand tensor, Operand shape) { + return Reshape.create(scope, tensor, shape); + } + + /** + * Builds an {@link MatrixSetDiagV2} operation + * + * @param input Rank `r+1`, where `r >= 1`. + * @param diagonal Rank `r` when `k` is an integer or `k[0] == k[1]`. Otherwise, it has rank `r+1`. + * @param k Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + * @return a new instance of MatrixSetDiagV2 + * @see org.tensorflow.op.core.MatrixSetDiagV2 + */ + public MatrixSetDiagV2 matrixSetDiagV2(Operand input, Operand diagonal, + Operand k) { + return MatrixSetDiagV2.create(scope, input, diagonal, k); + } + + /** + * Builds an {@link ResourceScatterMul} operation + * + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterMul + * @see org.tensorflow.op.core.ResourceScatterMul + */ + public ResourceScatterMul resourceScatterMul(Operand resource, + Operand indices, Operand updates) { + return ResourceScatterMul.create(scope, resource, indices, updates); + } + + /** + * Builds an {@link Squeeze} operation + * + * @param input The `input` to squeeze. + * @param options carries optional attributes values + * @return a new instance of Squeeze + * @see org.tensorflow.op.core.Squeeze + */ + public Squeeze squeeze(Operand input, Squeeze.Options... options) { + return Squeeze.create(scope, input, options); + } + + /** + * Builds an {@link NextIteration} operation + * + * @param data The tensor to be made available to the next iteration. + * @return a new instance of NextIteration + * @see org.tensorflow.op.core.NextIteration + */ + public NextIteration nextIteration(Operand data) { + return NextIteration.create(scope, data); + } + + /** + * Builds an {@link TensorStridedSliceUpdate} operation + * + * @param input + * @param begin + * @param end + * @param strides + * @param value + * @param options carries optional attributes values + * @return a new instance of TensorStridedSliceUpdate + * @see org.tensorflow.op.core.TensorStridedSliceUpdate + */ + public TensorStridedSliceUpdate tensorStridedSliceUpdate( + Operand input, Operand begin, Operand end, Operand strides, Operand value, + TensorStridedSliceUpdate.Options... options) { + return TensorStridedSliceUpdate.create(scope, input, begin, end, strides, value, options); + } + + /** + * Builds an {@link TensorArraySize} operation + * + * @param handle The handle to a TensorArray (output of TensorArray or TensorArrayGrad). + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArraySize + * @see org.tensorflow.op.core.TensorArraySize + */ + public TensorArraySize tensorArraySize(Operand handle, Operand flowIn) { + return TensorArraySize.create(scope, handle, flowIn); + } + + /** + * Builds an {@link StatefulRandomBinomial} operation + * + * @param resource + * @param algorithm + * @param shape + * @param counts + * @param probs + * @param dtype + * @return a new instance of StatefulRandomBinomial + * @see org.tensorflow.op.core.StatefulRandomBinomial + */ + public StatefulRandomBinomial statefulRandomBinomial( + Operand resource, Operand algorithm, Operand shape, Operand counts, + Operand probs, Class dtype) { + return StatefulRandomBinomial.create(scope, resource, algorithm, shape, counts, probs, dtype); + } + + /** + * Builds an {@link Merge} operation + * + * @param inputs The input tensors, exactly one of which will become available. + * @return a new instance of Merge + * @see org.tensorflow.op.core.Merge + */ + public Merge merge(Iterable> inputs) { + return Merge.create(scope, inputs); + } + + /** + * Builds an {@link TensorListElementShape} operation + * + * @param inputHandle + * @param shapeType + * @return a new instance of TensorListElementShape + * @see org.tensorflow.op.core.TensorListElementShape + */ + public TensorListElementShape tensorListElementShape(Operand inputHandle, + Class shapeType) { + return TensorListElementShape.create(scope, inputHandle, shapeType); + } + + /** + * Builds an {@link Variable} operation + * + * @param shape The shape of the variable tensor. + * @param dtype The type of elements in the variable tensor. + * @param options carries optional attributes values + * @return a new instance of Variable + * @see org.tensorflow.op.core.Variable + */ + public Variable variable(Shape shape, Class dtype, Variable.Options... options) { + return Variable.create(scope, shape, dtype, options); + } + + /** + * Builds an {@link HistogramFixedWidth} operation + * + * @param values Numeric `Tensor`. + * @param valueRange Shape [2] `Tensor` of same `dtype` as `values`. + * @param nbins Scalar `int32 Tensor`. Number of histogram bins. + * @return a new instance of HistogramFixedWidth + * @see org.tensorflow.op.core.HistogramFixedWidth + */ + public HistogramFixedWidth histogramFixedWidth(Operand values, + Operand valueRange, Operand nbins) { + return HistogramFixedWidth.create(scope, values, valueRange, nbins); + } + + /** + * Builds an {@link Constant} operation + * + * @param data An array containing the values to put into the new constant. The dimensions of the + * @see org.tensorflow.op.core.Constant + */ + public Constant constant(long[][][][][][] data) { + return Constant.create(scope, data); + } + + /** + * Builds an {@link OrderedMapClear} operation + * + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapClear + * @see org.tensorflow.op.core.OrderedMapClear + */ + public OrderedMapClear orderedMapClear(List> dtypes, + OrderedMapClear.Options... options) { + return OrderedMapClear.create(scope, dtypes, options); + } + + /** + * Builds an {@link Split} operation + * + * @param axis 0-D. The dimension along which to split. Must be in the range + * @param value The tensor to split. + * @param numSplit The number of ways to split. Must evenly divide + * @return a new instance of Split + * @see org.tensorflow.op.core.Split + */ + public Split split(Operand axis, Operand value, Long numSplit) { + return Split.create(scope, axis, value, numSplit); + } + + /** + * Builds an {@link Range} operation + * + * @param start 0-D (scalar). First entry in the sequence. + * @param limit 0-D (scalar). Upper limit of sequence, exclusive. + * @param delta 0-D (scalar). Optional. Default is 1. Number that increments `start`. + * @return a new instance of Range + * @see org.tensorflow.op.core.Range + */ + public Range range(Operand start, Operand limit, Operand delta) { + return Range.create(scope, start, limit, delta); + } + + /** + * Builds an {@link Placeholder} operation + * + * @param dtype The type of elements in the tensor. + * @param options carries optional attributes values + * @return a new instance of Placeholder + * @see org.tensorflow.op.core.Placeholder + */ + public Placeholder placeholder(Class dtype, Placeholder.Options... options) { + return Placeholder.create(scope, dtype, options); + } + + /** + * Builds an {@link ControlTrigger} operation + * + * @return a new instance of ControlTrigger + * @see org.tensorflow.op.core.ControlTrigger + */ + public ControlTrigger controlTrigger() { + return ControlTrigger.create(scope); + } + + /** + * Returns an API that builds operations with the provided name prefix. + * + * @see {@link Scope#withSubScope(String)} + */ + public Ops withSubScope(String childScopeName) { + return new Ops(scope.withSubScope(childScopeName)); + } + + /** + * Returns an API that uses the provided name for an op. + * + * @see {@link Scope#withName(String)} + */ + public Ops withName(String opName) { + return new Ops(scope.withName(opName)); + } + + /** + * Returns an API that adds operations to the graph with the provided control dependencies. + * + * @see {@link Scope#withControlDependencies(Iterable>)} + */ + public Ops withControlDependencies(Iterable> controls) { + return new Ops(scope.withControlDependencies(controls)); + } + + /** + * Returns the current {@link Scope scope} of this API + */ + public final Scope scope() { + return scope; + } + + /** + * Returns an API for building {@code nn} operations + */ + public final NnOps nn() { + return nn; + } + + /** + * Returns an API for building {@code summary} operations + */ + public final SummaryOps summary() { + return summary; + } + + /** + * Returns an API for building {@code image} operations + */ + public final ImageOps image() { + return image; + } + + /** + * Returns an API for building {@code data} operations + */ + public final DataOps data() { + return data; + } + + /** + * Returns an API for building {@code io} operations + */ + public final IoOps io() { + return io; + } + + /** + * Returns an API for building {@code dtypes} operations + */ + public final DtypesOps dtypes() { + return dtypes; + } + + /** + * Returns an API for building {@code linalg} operations + */ + public final LinalgOps linalg() { + return linalg; + } + + /** + * Returns an API for building {@code random} operations + */ + public final RandomOps random() { + return random; + } + + /** + * Returns an API for building {@code strings} operations + */ + public final StringsOps strings() { + return strings; + } + + /** + * Returns an API for building {@code sparse} operations + */ + public final SparseOps sparse() { + return sparse; + } + + /** + * Returns an API for building {@code bitwise} operations + */ + public final BitwiseOps bitwise() { + return bitwise; + } + + /** + * Returns an API for building {@code math} operations + */ + public final MathOps math() { + return math; + } + + /** + * Returns an API for building {@code audio} operations + */ + public final AudioOps audio() { + return audio; + } + + /** + * Returns an API for building {@code signal} operations + */ + public final SignalOps signal() { + return signal; + } + + /** + * Returns an API for building {@code quantization} operations + */ + public final QuantizationOps quantization() { + return quantization; + } + + /** + * Returns an API for building {@code train} operations + */ + public final TrainOps train() { + return train; + } + + /** + * Creates an API for building operations in the provided environment + */ + public static Ops create(ExecutionEnvironment env) { + return new Ops(new Scope(env)); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/QuantizationOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/QuantizationOps.java new file mode 100644 index 00000000000..2a868f4a96a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/QuantizationOps.java @@ -0,0 +1,215 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.quantization.Dequantize; +import org.tensorflow.op.quantization.FakeQuantWithMinMaxArgs; +import org.tensorflow.op.quantization.FakeQuantWithMinMaxArgsGradient; +import org.tensorflow.op.quantization.FakeQuantWithMinMaxVars; +import org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsGradient; +import org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsPerChannel; +import org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsPerChannelGradient; +import org.tensorflow.op.quantization.Quantize; +import org.tensorflow.op.quantization.QuantizeAndDequantize; +import org.tensorflow.op.quantization.QuantizeDownAndShrinkRange; +import org.tensorflow.op.quantization.RequantizationRange; +import org.tensorflow.op.quantization.Requantize; + +/** + * An API for building {@code quantization} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class QuantizationOps { + private final Scope scope; + + QuantizationOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link Dequantize} operation + * + * @param input + * @param minRange The minimum scalar value possibly produced for the input. + * @param maxRange The maximum scalar value possibly produced for the input. + * @param options carries optional attributes values + * @return a new instance of Dequantize + * @see org.tensorflow.op.quantization.Dequantize + */ + public Dequantize dequantize(Operand input, Operand minRange, + Operand maxRange, Dequantize.Options... options) { + return Dequantize.create(scope, input, minRange, maxRange, options); + } + + /** + * Builds an {@link Quantize} operation + * + * @param input + * @param minRange The minimum scalar value possibly produced for the input. + * @param maxRange The maximum scalar value possibly produced for the input. + * @param T + * @param options carries optional attributes values + * @return a new instance of Quantize + * @see org.tensorflow.op.quantization.Quantize + */ + public Quantize quantize(Operand input, Operand minRange, + Operand maxRange, Class T, Quantize.Options... options) { + return Quantize.create(scope, input, minRange, maxRange, T, options); + } + + /** + * Builds an {@link FakeQuantWithMinMaxVars} operation + * + * @param inputs + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVars + * @see org.tensorflow.op.quantization.FakeQuantWithMinMaxVars + */ + public FakeQuantWithMinMaxVars fakeQuantWithMinMaxVars(Operand inputs, Operand min, + Operand max, FakeQuantWithMinMaxVars.Options... options) { + return FakeQuantWithMinMaxVars.create(scope, inputs, min, max, options); + } + + /** + * Builds an {@link FakeQuantWithMinMaxVarsPerChannel} operation + * + * @param inputs + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVarsPerChannel + * @see org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsPerChannel + */ + public FakeQuantWithMinMaxVarsPerChannel fakeQuantWithMinMaxVarsPerChannel(Operand inputs, + Operand min, Operand max, + FakeQuantWithMinMaxVarsPerChannel.Options... options) { + return FakeQuantWithMinMaxVarsPerChannel.create(scope, inputs, min, max, options); + } + + /** + * Builds an {@link QuantizeAndDequantize} operation + * + * @param input + * @param inputMin + * @param inputMax + * @param numBits + * @param options carries optional attributes values + * @return a new instance of QuantizeAndDequantize + * @see org.tensorflow.op.quantization.QuantizeAndDequantize + */ + public QuantizeAndDequantize quantizeAndDequantize(Operand input, + Operand inputMin, Operand inputMax, Operand numBits, + QuantizeAndDequantize.Options... options) { + return QuantizeAndDequantize.create(scope, input, inputMin, inputMax, numBits, options); + } + + /** + * Builds an {@link FakeQuantWithMinMaxVarsPerChannelGradient} operation + * + * @param gradients Backpropagated gradients above the FakeQuantWithMinMaxVars operation, + * @param inputs Values passed as inputs to the FakeQuantWithMinMaxVars operation, shape + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVarsPerChannelGradient + * @see org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsPerChannelGradient + */ + public FakeQuantWithMinMaxVarsPerChannelGradient fakeQuantWithMinMaxVarsPerChannelGradient( + Operand gradients, Operand inputs, Operand min, Operand max, + FakeQuantWithMinMaxVarsPerChannelGradient.Options... options) { + return FakeQuantWithMinMaxVarsPerChannelGradient.create(scope, gradients, inputs, min, max, options); + } + + /** + * Builds an {@link FakeQuantWithMinMaxArgs} operation + * + * @param inputs + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxArgs + * @see org.tensorflow.op.quantization.FakeQuantWithMinMaxArgs + */ + public FakeQuantWithMinMaxArgs fakeQuantWithMinMaxArgs(Operand inputs, + FakeQuantWithMinMaxArgs.Options... options) { + return FakeQuantWithMinMaxArgs.create(scope, inputs, options); + } + + /** + * Builds an {@link Requantize} operation + * + * @param input + * @param inputMin The float value that the minimum quantized input value represents. + * @param inputMax The float value that the maximum quantized input value represents. + * @param requestedOutputMin The float value that the minimum quantized output value represents. + * @param requestedOutputMax The float value that the maximum quantized output value represents. + * @param outType The type of the output. Should be a lower bit depth than Tinput. + * @return a new instance of Requantize + * @see org.tensorflow.op.quantization.Requantize + */ + public Requantize requantize(Operand input, Operand inputMin, + Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, + Class outType) { + return Requantize.create(scope, input, inputMin, inputMax, requestedOutputMin, requestedOutputMax, outType); + } + + /** + * Builds an {@link FakeQuantWithMinMaxArgsGradient} operation + * + * @param gradients Backpropagated gradients above the FakeQuantWithMinMaxArgs operation. + * @param inputs Values passed as inputs to the FakeQuantWithMinMaxArgs operation. + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxArgsGradient + * @see org.tensorflow.op.quantization.FakeQuantWithMinMaxArgsGradient + */ + public FakeQuantWithMinMaxArgsGradient fakeQuantWithMinMaxArgsGradient(Operand gradients, + Operand inputs, FakeQuantWithMinMaxArgsGradient.Options... options) { + return FakeQuantWithMinMaxArgsGradient.create(scope, gradients, inputs, options); + } + + /** + * Builds an {@link FakeQuantWithMinMaxVarsGradient} operation + * + * @param gradients Backpropagated gradients above the FakeQuantWithMinMaxVars operation. + * @param inputs Values passed as inputs to the FakeQuantWithMinMaxVars operation. + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVarsGradient + * @see org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsGradient + */ + public FakeQuantWithMinMaxVarsGradient fakeQuantWithMinMaxVarsGradient(Operand gradients, + Operand inputs, Operand min, Operand max, + FakeQuantWithMinMaxVarsGradient.Options... options) { + return FakeQuantWithMinMaxVarsGradient.create(scope, gradients, inputs, min, max, options); + } + + /** + * Builds an {@link QuantizeDownAndShrinkRange} operation + * + * @param input + * @param inputMin The float value that the minimum quantized input value represents. + * @param inputMax The float value that the maximum quantized input value represents. + * @param outType The type of the output. Should be a lower bit depth than Tinput. + * @return a new instance of QuantizeDownAndShrinkRange + * @see org.tensorflow.op.quantization.QuantizeDownAndShrinkRange + */ + public QuantizeDownAndShrinkRange quantizeDownAndShrinkRange(Operand input, + Operand inputMin, Operand inputMax, Class outType) { + return QuantizeDownAndShrinkRange.create(scope, input, inputMin, inputMax, outType); + } + + /** + * Builds an {@link RequantizationRange} operation + * + * @param input + * @param inputMin The float value that the minimum quantized input value represents. + * @param inputMax The float value that the maximum quantized input value represents. + * @return a new instance of RequantizationRange + * @see org.tensorflow.op.quantization.RequantizationRange + */ + public RequantizationRange requantizationRange(Operand input, Operand inputMin, + Operand inputMax) { + return RequantizationRange.create(scope, input, inputMin, inputMax); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/RandomOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/RandomOps.java new file mode 100644 index 00000000000..558531f55a6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/RandomOps.java @@ -0,0 +1,365 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.random.AllCandidateSampler; +import org.tensorflow.op.random.LogUniformCandidateSampler; +import org.tensorflow.op.random.Multinomial; +import org.tensorflow.op.random.ParameterizedTruncatedNormal; +import org.tensorflow.op.random.RandomGamma; +import org.tensorflow.op.random.RandomPoisson; +import org.tensorflow.op.random.RandomShuffle; +import org.tensorflow.op.random.RandomStandardNormal; +import org.tensorflow.op.random.RandomUniform; +import org.tensorflow.op.random.RandomUniformInt; +import org.tensorflow.op.random.RecordInput; +import org.tensorflow.op.random.StatelessMultinomial; +import org.tensorflow.op.random.StatelessRandomNormal; +import org.tensorflow.op.random.StatelessRandomUniform; +import org.tensorflow.op.random.StatelessTruncatedNormal; +import org.tensorflow.op.random.TruncatedNormal; +import org.tensorflow.op.random.UniformCandidateSampler; + +/** + * An API for building {@code random} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class RandomOps { + private final Scope scope; + + RandomOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link RandomShuffle} operation + * + * @param value The tensor to be shuffled. + * @param options carries optional attributes values + * @return a new instance of RandomShuffle + * @see org.tensorflow.op.random.RandomShuffle + */ + public RandomShuffle randomShuffle(Operand value, RandomShuffle.Options... options) { + return RandomShuffle.create(scope, value, options); + } + + /** + * Builds an {@link RandomUniform} operation + * + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @param options carries optional attributes values + * @return a new instance of RandomUniform + * @see org.tensorflow.op.random.RandomUniform + */ + public RandomUniform randomUniform(Operand shape, + Class dtype, RandomUniform.Options... options) { + return RandomUniform.create(scope, shape, dtype, options); + } + + /** + * Builds an {@link StatelessRandomNormal} operation + * + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessRandomNormal + * @see org.tensorflow.op.random.StatelessRandomNormal + */ + public StatelessRandomNormal statelessRandomNormal( + Operand shape, Operand seed) { + return StatelessRandomNormal.create(scope, shape, seed); + } + + /** + * Builds an {@link StatelessTruncatedNormal} operation + * + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @param dtype The type of the output. + * @return a new instance of StatelessTruncatedNormal + * @see org.tensorflow.op.random.StatelessTruncatedNormal + */ + public StatelessTruncatedNormal statelessTruncatedNormal( + Operand shape, Operand seed, Class dtype) { + return StatelessTruncatedNormal.create(scope, shape, seed, dtype); + } + + /** + * Builds an {@link RandomPoisson} operation + * + * @param shape 1-D integer tensor. Shape of independent samples to draw from each + * @param rate A tensor in which each scalar is a "rate" parameter describing the + * @param options carries optional attributes values + * @return a new instance of RandomPoisson + * @see org.tensorflow.op.random.RandomPoisson + */ + public RandomPoisson randomPoisson(Operand shape, + Operand rate, RandomPoisson.Options... options) { + return RandomPoisson.create(scope, shape, rate, options); + } + + /** + * Builds an {@link RandomUniformInt} operation + * + * @param shape The shape of the output tensor. + * @param minval 0-D. Inclusive lower bound on the generated integers. + * @param maxval 0-D. Exclusive upper bound on the generated integers. + * @param options carries optional attributes values + * @return a new instance of RandomUniformInt + * @see org.tensorflow.op.random.RandomUniformInt + */ + public RandomUniformInt randomUniformInt(Operand shape, + Operand minval, Operand maxval, RandomUniformInt.Options... options) { + return RandomUniformInt.create(scope, shape, minval, maxval, options); + } + + /** + * Builds an {@link StatelessMultinomial} operation + * + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param seed 2 seeds (shape [2]). + * @param outputDtype + * @return a new instance of StatelessMultinomial + * @see org.tensorflow.op.random.StatelessMultinomial + */ + public StatelessMultinomial statelessMultinomial( + Operand logits, Operand numSamples, Operand seed, Class outputDtype) { + return StatelessMultinomial.create(scope, logits, numSamples, seed, outputDtype); + } + + /** + * Builds an {@link RandomStandardNormal} operation + * + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @param options carries optional attributes values + * @return a new instance of RandomStandardNormal + * @see org.tensorflow.op.random.RandomStandardNormal + */ + public RandomStandardNormal randomStandardNormal( + Operand shape, Class dtype, RandomStandardNormal.Options... options) { + return RandomStandardNormal.create(scope, shape, dtype, options); + } + + /** + * Builds an {@link LogUniformCandidateSampler} operation + * + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of LogUniformCandidateSampler + * @see org.tensorflow.op.random.LogUniformCandidateSampler + */ + public LogUniformCandidateSampler logUniformCandidateSampler(Operand trueClasses, + Long numTrue, Long numSampled, Boolean unique, Long rangeMax, + LogUniformCandidateSampler.Options... options) { + return LogUniformCandidateSampler.create(scope, trueClasses, numTrue, numSampled, unique, rangeMax, options); + } + + /** + * Builds an {@link RandomGamma} operation + * + * @param shape 1-D integer tensor. Shape of independent samples to draw from each + * @param alpha A tensor in which each scalar is a "shape" parameter describing the + * @param options carries optional attributes values + * @return a new instance of RandomGamma + * @see org.tensorflow.op.random.RandomGamma + */ + public RandomGamma randomGamma(Operand shape, + Operand alpha, RandomGamma.Options... options) { + return RandomGamma.create(scope, shape, alpha, options); + } + + /** + * Builds an {@link Multinomial} operation + * + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param options carries optional attributes values + * @return a new instance of Multinomial + * @see org.tensorflow.op.random.Multinomial + */ + public Multinomial multinomial(Operand logits, + Operand numSamples, Multinomial.Options... options) { + return Multinomial.create(scope, logits, numSamples, options); + } + + /** + * Builds an {@link TruncatedNormal} operation + * + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @param options carries optional attributes values + * @return a new instance of TruncatedNormal + * @see org.tensorflow.op.random.TruncatedNormal + */ + public TruncatedNormal truncatedNormal(Operand shape, + Class dtype, TruncatedNormal.Options... options) { + return TruncatedNormal.create(scope, shape, dtype, options); + } + + /** + * Builds an {@link StatelessTruncatedNormal} operation + * + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessTruncatedNormal + * @see org.tensorflow.op.random.StatelessTruncatedNormal + */ + public StatelessTruncatedNormal statelessTruncatedNormal( + Operand shape, Operand seed) { + return StatelessTruncatedNormal.create(scope, shape, seed); + } + + /** + * Builds an {@link StatelessRandomNormal} operation + * + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @param dtype The type of the output. + * @return a new instance of StatelessRandomNormal + * @see org.tensorflow.op.random.StatelessRandomNormal + */ + public StatelessRandomNormal statelessRandomNormal( + Operand shape, Operand seed, Class dtype) { + return StatelessRandomNormal.create(scope, shape, seed, dtype); + } + + /** + * Builds an {@link AllCandidateSampler} operation + * + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to produce. + * @param unique If unique is true, we sample with rejection, so that all sampled + * @param options carries optional attributes values + * @return a new instance of AllCandidateSampler + * @see org.tensorflow.op.random.AllCandidateSampler + */ + public AllCandidateSampler allCandidateSampler(Operand trueClasses, Long numTrue, + Long numSampled, Boolean unique, AllCandidateSampler.Options... options) { + return AllCandidateSampler.create(scope, trueClasses, numTrue, numSampled, unique, options); + } + + /** + * Builds an {@link StatelessMultinomial} operation + * + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessMultinomial + * @see org.tensorflow.op.random.StatelessMultinomial + */ + public StatelessMultinomial statelessMultinomial( + Operand logits, Operand numSamples, Operand seed) { + return StatelessMultinomial.create(scope, logits, numSamples, seed); + } + + /** + * Builds an {@link Multinomial} operation + * + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param outputDtype + * @param options carries optional attributes values + * @return a new instance of Multinomial + * @see org.tensorflow.op.random.Multinomial + */ + public Multinomial multinomial(Operand logits, + Operand numSamples, Class outputDtype, Multinomial.Options... options) { + return Multinomial.create(scope, logits, numSamples, outputDtype, options); + } + + /** + * Builds an {@link RandomPoisson} operation + * + * @param shape 1-D integer tensor. Shape of independent samples to draw from each + * @param rate A tensor in which each scalar is a "rate" parameter describing the + * @param dtype + * @param options carries optional attributes values + * @return a new instance of RandomPoisson + * @see org.tensorflow.op.random.RandomPoisson + */ + public RandomPoisson randomPoisson( + Operand shape, Operand rate, Class dtype, RandomPoisson.Options... options) { + return RandomPoisson.create(scope, shape, rate, dtype, options); + } + + /** + * Builds an {@link ParameterizedTruncatedNormal} operation + * + * @param shape The shape of the output tensor. Batches are indexed by the 0th dimension. + * @param means The mean parameter of each batch. + * @param stdevs The standard deviation parameter of each batch. Must be greater than 0. + * @param minvals The minimum cutoff. May be -infinity. + * @param maxvals The maximum cutoff. May be +infinity, and must be more than the minval + * @param options carries optional attributes values + * @return a new instance of ParameterizedTruncatedNormal + * @see org.tensorflow.op.random.ParameterizedTruncatedNormal + */ + public ParameterizedTruncatedNormal parameterizedTruncatedNormal( + Operand shape, Operand means, Operand stdevs, Operand minvals, Operand maxvals, + ParameterizedTruncatedNormal.Options... options) { + return ParameterizedTruncatedNormal.create(scope, shape, means, stdevs, minvals, maxvals, options); + } + + /** + * Builds an {@link StatelessRandomUniform} operation + * + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @param dtype The type of the output. + * @return a new instance of StatelessRandomUniform + * @see org.tensorflow.op.random.StatelessRandomUniform + */ + public StatelessRandomUniform statelessRandomUniform( + Operand shape, Operand seed, Class dtype) { + return StatelessRandomUniform.create(scope, shape, seed, dtype); + } + + /** + * Builds an {@link StatelessRandomUniform} operation + * + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessRandomUniform + * @see org.tensorflow.op.random.StatelessRandomUniform + */ + public StatelessRandomUniform statelessRandomUniform( + Operand shape, Operand seed) { + return StatelessRandomUniform.create(scope, shape, seed); + } + + /** + * Builds an {@link UniformCandidateSampler} operation + * + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of UniformCandidateSampler + * @see org.tensorflow.op.random.UniformCandidateSampler + */ + public UniformCandidateSampler uniformCandidateSampler(Operand trueClasses, Long numTrue, + Long numSampled, Boolean unique, Long rangeMax, UniformCandidateSampler.Options... options) { + return UniformCandidateSampler.create(scope, trueClasses, numTrue, numSampled, unique, rangeMax, options); + } + + /** + * Builds an {@link RecordInput} operation + * + * @param filePattern Glob pattern for the data files. + * @param options carries optional attributes values + * @return a new instance of RecordInput + * @see org.tensorflow.op.random.RecordInput + */ + public RecordInput recordInput(String filePattern, RecordInput.Options... options) { + return RecordInput.create(scope, filePattern, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SignalOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SignalOps.java new file mode 100644 index 00000000000..aae6e7e6755 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SignalOps.java @@ -0,0 +1,238 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.signal.BatchFft; +import org.tensorflow.op.signal.BatchFft2d; +import org.tensorflow.op.signal.BatchFft3d; +import org.tensorflow.op.signal.BatchIfft; +import org.tensorflow.op.signal.BatchIfft2d; +import org.tensorflow.op.signal.BatchIfft3d; +import org.tensorflow.op.signal.Fft; +import org.tensorflow.op.signal.Fft2d; +import org.tensorflow.op.signal.Fft3d; +import org.tensorflow.op.signal.Ifft; +import org.tensorflow.op.signal.Ifft2d; +import org.tensorflow.op.signal.Ifft3d; +import org.tensorflow.op.signal.Irfft; +import org.tensorflow.op.signal.Irfft2d; +import org.tensorflow.op.signal.Irfft3d; +import org.tensorflow.op.signal.Rfft; +import org.tensorflow.op.signal.Rfft2d; +import org.tensorflow.op.signal.Rfft3d; + +/** + * An API for building {@code signal} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class SignalOps { + private final Scope scope; + + SignalOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link BatchIfft} operation + * + * @param input + * @return a new instance of BatchIfft + * @see org.tensorflow.op.signal.BatchIfft + */ + public BatchIfft batchIfft(Operand input) { + return BatchIfft.create(scope, input); + } + + /** + * Builds an {@link Ifft2d} operation + * + * @param input A complex tensor. + * @return a new instance of Ifft2d + * @see org.tensorflow.op.signal.Ifft2d + */ + public Ifft2d ifft2d(Operand input) { + return Ifft2d.create(scope, input); + } + + /** + * Builds an {@link Ifft3d} operation + * + * @param input A complex64 tensor. + * @return a new instance of Ifft3d + * @see org.tensorflow.op.signal.Ifft3d + */ + public Ifft3d ifft3d(Operand input) { + return Ifft3d.create(scope, input); + } + + /** + * Builds an {@link Fft2d} operation + * + * @param input A complex tensor. + * @return a new instance of Fft2d + * @see org.tensorflow.op.signal.Fft2d + */ + public Fft2d fft2d(Operand input) { + return Fft2d.create(scope, input); + } + + /** + * Builds an {@link Ifft} operation + * + * @param input A complex tensor. + * @return a new instance of Ifft + * @see org.tensorflow.op.signal.Ifft + */ + public Ifft ifft(Operand input) { + return Ifft.create(scope, input); + } + + /** + * Builds an {@link Irfft2d} operation + * + * @param input A complex64 tensor. + * @param fftLength An int32 tensor of shape [2]. The FFT length for each dimension. + * @return a new instance of Irfft2d + * @see org.tensorflow.op.signal.Irfft2d + */ + public Irfft2d irfft2d(Operand input, Operand fftLength) { + return Irfft2d.create(scope, input, fftLength); + } + + /** + * Builds an {@link Rfft2d} operation + * + * @param input A float32 tensor. + * @param fftLength An int32 tensor of shape [2]. The FFT length for each dimension. + * @return a new instance of Rfft2d + * @see org.tensorflow.op.signal.Rfft2d + */ + public Rfft2d rfft2d(Operand input, Operand fftLength) { + return Rfft2d.create(scope, input, fftLength); + } + + /** + * Builds an {@link Rfft} operation + * + * @param input A float32 tensor. + * @param fftLength An int32 tensor of shape [1]. The FFT length. + * @return a new instance of Rfft + * @see org.tensorflow.op.signal.Rfft + */ + public Rfft rfft(Operand input, Operand fftLength) { + return Rfft.create(scope, input, fftLength); + } + + /** + * Builds an {@link Irfft3d} operation + * + * @param input A complex64 tensor. + * @param fftLength An int32 tensor of shape [3]. The FFT length for each dimension. + * @return a new instance of Irfft3d + * @see org.tensorflow.op.signal.Irfft3d + */ + public Irfft3d irfft3d(Operand input, Operand fftLength) { + return Irfft3d.create(scope, input, fftLength); + } + + /** + * Builds an {@link BatchIfft3d} operation + * + * @param input + * @return a new instance of BatchIfft3d + * @see org.tensorflow.op.signal.BatchIfft3d + */ + public BatchIfft3d batchIfft3d(Operand input) { + return BatchIfft3d.create(scope, input); + } + + /** + * Builds an {@link Rfft3d} operation + * + * @param input A float32 tensor. + * @param fftLength An int32 tensor of shape [3]. The FFT length for each dimension. + * @return a new instance of Rfft3d + * @see org.tensorflow.op.signal.Rfft3d + */ + public Rfft3d rfft3d(Operand input, Operand fftLength) { + return Rfft3d.create(scope, input, fftLength); + } + + /** + * Builds an {@link BatchFft3d} operation + * + * @param input + * @return a new instance of BatchFft3d + * @see org.tensorflow.op.signal.BatchFft3d + */ + public BatchFft3d batchFft3d(Operand input) { + return BatchFft3d.create(scope, input); + } + + /** + * Builds an {@link Fft} operation + * + * @param input A complex tensor. + * @return a new instance of Fft + * @see org.tensorflow.op.signal.Fft + */ + public Fft fft(Operand input) { + return Fft.create(scope, input); + } + + /** + * Builds an {@link BatchFft2d} operation + * + * @param input + * @return a new instance of BatchFft2d + * @see org.tensorflow.op.signal.BatchFft2d + */ + public BatchFft2d batchFft2d(Operand input) { + return BatchFft2d.create(scope, input); + } + + /** + * Builds an {@link Fft3d} operation + * + * @param input A complex64 tensor. + * @return a new instance of Fft3d + * @see org.tensorflow.op.signal.Fft3d + */ + public Fft3d fft3d(Operand input) { + return Fft3d.create(scope, input); + } + + /** + * Builds an {@link BatchFft} operation + * + * @param input + * @return a new instance of BatchFft + * @see org.tensorflow.op.signal.BatchFft + */ + public BatchFft batchFft(Operand input) { + return BatchFft.create(scope, input); + } + + /** + * Builds an {@link Irfft} operation + * + * @param input A complex64 tensor. + * @param fftLength An int32 tensor of shape [1]. The FFT length. + * @return a new instance of Irfft + * @see org.tensorflow.op.signal.Irfft + */ + public Irfft irfft(Operand input, Operand fftLength) { + return Irfft.create(scope, input, fftLength); + } + + /** + * Builds an {@link BatchIfft2d} operation + * + * @param input + * @return a new instance of BatchIfft2d + * @see org.tensorflow.op.signal.BatchIfft2d + */ + public BatchIfft2d batchIfft2d(Operand input) { + return BatchIfft2d.create(scope, input); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SparseOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SparseOps.java new file mode 100644 index 00000000000..837dd7f328d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SparseOps.java @@ -0,0 +1,738 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.Shape; +import org.tensorflow.op.sparse.AddManySparseToTensorsMap; +import org.tensorflow.op.sparse.AddSparseToTensorsMap; +import org.tensorflow.op.sparse.DenseToDenseSetOperation; +import org.tensorflow.op.sparse.DenseToSparseSetOperation; +import org.tensorflow.op.sparse.DeserializeSparse; +import org.tensorflow.op.sparse.SparseAccumulatorApplyGradient; +import org.tensorflow.op.sparse.SparseAccumulatorTakeGradient; +import org.tensorflow.op.sparse.SparseAdd; +import org.tensorflow.op.sparse.SparseAddGrad; +import org.tensorflow.op.sparse.SparseConcat; +import org.tensorflow.op.sparse.SparseConditionalAccumulator; +import org.tensorflow.op.sparse.SparseCross; +import org.tensorflow.op.sparse.SparseDenseCwiseAdd; +import org.tensorflow.op.sparse.SparseDenseCwiseDiv; +import org.tensorflow.op.sparse.SparseDenseCwiseMul; +import org.tensorflow.op.sparse.SparseFillEmptyRows; +import org.tensorflow.op.sparse.SparseFillEmptyRowsGrad; +import org.tensorflow.op.sparse.SparseMatMul; +import org.tensorflow.op.sparse.SparseReduceMax; +import org.tensorflow.op.sparse.SparseReduceMaxSparse; +import org.tensorflow.op.sparse.SparseReduceSum; +import org.tensorflow.op.sparse.SparseReduceSumSparse; +import org.tensorflow.op.sparse.SparseReorder; +import org.tensorflow.op.sparse.SparseReshape; +import org.tensorflow.op.sparse.SparseSegmentMean; +import org.tensorflow.op.sparse.SparseSegmentMeanGrad; +import org.tensorflow.op.sparse.SparseSegmentMeanWithNumSegments; +import org.tensorflow.op.sparse.SparseSegmentSqrtN; +import org.tensorflow.op.sparse.SparseSegmentSqrtNGrad; +import org.tensorflow.op.sparse.SparseSegmentSqrtNWithNumSegments; +import org.tensorflow.op.sparse.SparseSegmentSum; +import org.tensorflow.op.sparse.SparseSegmentSumWithNumSegments; +import org.tensorflow.op.sparse.SparseSlice; +import org.tensorflow.op.sparse.SparseSliceGrad; +import org.tensorflow.op.sparse.SparseSoftmax; +import org.tensorflow.op.sparse.SparseSparseMaximum; +import org.tensorflow.op.sparse.SparseSparseMinimum; +import org.tensorflow.op.sparse.SparseSplit; +import org.tensorflow.op.sparse.SparseTensorDenseAdd; +import org.tensorflow.op.sparse.SparseTensorDenseMatMul; +import org.tensorflow.op.sparse.SparseToDense; +import org.tensorflow.op.sparse.SparseToSparseSetOperation; +import org.tensorflow.op.sparse.TakeManySparseFromTensorsMap; + +/** + * An API for building {@code sparse} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class SparseOps { + private final Scope scope; + + SparseOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link SparseReduceSum} operation + * + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceSum + * @see org.tensorflow.op.sparse.SparseReduceSum + */ + public SparseReduceSum sparseReduceSum(Operand inputIndices, Operand inputValues, + Operand inputShape, Operand reductionAxes, + SparseReduceSum.Options... options) { + return SparseReduceSum.create(scope, inputIndices, inputValues, inputShape, reductionAxes, options); + } + + /** + * Builds an {@link SparseSegmentMeanGrad} operation + * + * @param grad gradient propagated to the SparseSegmentMean op. + * @param indices indices passed to the corresponding SparseSegmentMean op. + * @param segmentIds segment_ids passed to the corresponding SparseSegmentMean op. + * @param outputDim0 dimension 0 of "data" passed to SparseSegmentMean op. + * @return a new instance of SparseSegmentMeanGrad + * @see org.tensorflow.op.sparse.SparseSegmentMeanGrad + */ + public SparseSegmentMeanGrad sparseSegmentMeanGrad( + Operand grad, Operand indices, Operand segmentIds, + Operand outputDim0) { + return SparseSegmentMeanGrad.create(scope, grad, indices, segmentIds, outputDim0); + } + + /** + * Builds an {@link SparseReshape} operation + * + * @param inputIndices 2-D. `N x R_in` matrix with the indices of non-empty values in a + * @param inputShape 1-D. `R_in` vector with the input SparseTensor's dense shape. + * @param newShape 1-D. `R_out` vector with the requested new dense shape. + * @return a new instance of SparseReshape + * @see org.tensorflow.op.sparse.SparseReshape + */ + public SparseReshape sparseReshape(Operand inputIndices, Operand inputShape, + Operand newShape) { + return SparseReshape.create(scope, inputIndices, inputShape, newShape); + } + + /** + * Builds an {@link SparseDenseCwiseAdd} operation + * + * @param spIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param spValues 1-D. `N` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @param dense `R`-D. The dense Tensor operand. + * @return a new instance of SparseDenseCwiseAdd + * @see org.tensorflow.op.sparse.SparseDenseCwiseAdd + */ + public SparseDenseCwiseAdd sparseDenseCwiseAdd(Operand spIndices, + Operand spValues, Operand spShape, Operand dense) { + return SparseDenseCwiseAdd.create(scope, spIndices, spValues, spShape, dense); + } + + /** + * Builds an {@link AddSparseToTensorsMap} operation + * + * @param sparseIndices 2-D. The `indices` of the `SparseTensor`. + * @param sparseValues 1-D. The `values` of the `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the `SparseTensor`. + * @param options carries optional attributes values + * @return a new instance of AddSparseToTensorsMap + * @see org.tensorflow.op.sparse.AddSparseToTensorsMap + */ + public AddSparseToTensorsMap addSparseToTensorsMap(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, + AddSparseToTensorsMap.Options... options) { + return AddSparseToTensorsMap.create(scope, sparseIndices, sparseValues, sparseShape, options); + } + + /** + * Builds an {@link SparseFillEmptyRows} operation + * + * @param indices 2-D. the indices of the sparse tensor. + * @param values 1-D. the values of the sparse tensor. + * @param denseShape 1-D. the shape of the sparse tensor. + * @param defaultValue 0-D. default value to insert into location `[row, 0, ..., 0]` + * @return a new instance of SparseFillEmptyRows + * @see org.tensorflow.op.sparse.SparseFillEmptyRows + */ + public SparseFillEmptyRows sparseFillEmptyRows(Operand indices, Operand values, + Operand denseShape, Operand defaultValue) { + return SparseFillEmptyRows.create(scope, indices, values, denseShape, defaultValue); + } + + /** + * Builds an {@link SparseTensorDenseAdd} operation + * + * @param aIndices 2-D. The `indices` of the `SparseTensor`, with shape `[nnz, ndims]`. + * @param aValues 1-D. The `values` of the `SparseTensor`, with shape `[nnz]`. + * @param aShape 1-D. The `shape` of the `SparseTensor`, with shape `[ndims]`. + * @param b `ndims`-D Tensor. With shape `a_shape`. + * @return a new instance of SparseTensorDenseAdd + * @see org.tensorflow.op.sparse.SparseTensorDenseAdd + */ + public SparseTensorDenseAdd sparseTensorDenseAdd(Operand aIndices, + Operand aValues, Operand aShape, Operand b) { + return SparseTensorDenseAdd.create(scope, aIndices, aValues, aShape, b); + } + + /** + * Builds an {@link SparseFillEmptyRowsGrad} operation + * + * @param reverseIndexMap 1-D. The reverse index map from SparseFillEmptyRows. + * @param gradValues 1-D. The gradients from backprop. + * @return a new instance of SparseFillEmptyRowsGrad + * @see org.tensorflow.op.sparse.SparseFillEmptyRowsGrad + */ + public SparseFillEmptyRowsGrad sparseFillEmptyRowsGrad(Operand reverseIndexMap, + Operand gradValues) { + return SparseFillEmptyRowsGrad.create(scope, reverseIndexMap, gradValues); + } + + /** + * Builds an {@link SparseAddGrad} operation + * + * @param backpropValGrad 1-D with shape `[nnz(sum)]`. The gradient with respect to + * @param aIndices 2-D. The `indices` of the `SparseTensor` A, size `[nnz(A), ndims]`. + * @param bIndices 2-D. The `indices` of the `SparseTensor` B, size `[nnz(B), ndims]`. + * @param sumIndices 2-D. The `indices` of the sum `SparseTensor`, size + * @return a new instance of SparseAddGrad + * @see org.tensorflow.op.sparse.SparseAddGrad + */ + public SparseAddGrad sparseAddGrad(Operand backpropValGrad, Operand aIndices, + Operand bIndices, Operand sumIndices) { + return SparseAddGrad.create(scope, backpropValGrad, aIndices, bIndices, sumIndices); + } + + /** + * Builds an {@link SparseSparseMinimum} operation + * + * @param aIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param aValues 1-D. `N` non-empty values corresponding to `a_indices`. + * @param aShape 1-D. Shape of the input SparseTensor. + * @param bIndices counterpart to `a_indices` for the other operand. + * @param bValues counterpart to `a_values` for the other operand; must be of the same dtype. + * @param bShape counterpart to `a_shape` for the other operand; the two shapes must be equal. + * @return a new instance of SparseSparseMinimum + * @see org.tensorflow.op.sparse.SparseSparseMinimum + */ + public SparseSparseMinimum sparseSparseMinimum(Operand aIndices, Operand aValues, + Operand aShape, Operand bIndices, Operand bValues, Operand bShape) { + return SparseSparseMinimum.create(scope, aIndices, aValues, aShape, bIndices, bValues, bShape); + } + + /** + * Builds an {@link SparseReduceMaxSparse} operation + * + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceMaxSparse + * @see org.tensorflow.op.sparse.SparseReduceMaxSparse + */ + public SparseReduceMaxSparse sparseReduceMaxSparse( + Operand inputIndices, Operand inputValues, Operand inputShape, + Operand reductionAxes, SparseReduceMaxSparse.Options... options) { + return SparseReduceMaxSparse.create(scope, inputIndices, inputValues, inputShape, reductionAxes, options); + } + + /** + * Builds an {@link SparseSegmentSumWithNumSegments} operation + * + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @param numSegments Should equal the number of distinct segment IDs. + * @return a new instance of SparseSegmentSumWithNumSegments + * @see org.tensorflow.op.sparse.SparseSegmentSumWithNumSegments + */ + public SparseSegmentSumWithNumSegments sparseSegmentSumWithNumSegments( + Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + return SparseSegmentSumWithNumSegments.create(scope, data, indices, segmentIds, numSegments); + } + + /** + * Builds an {@link SparseReduceSumSparse} operation + * + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceSumSparse + * @see org.tensorflow.op.sparse.SparseReduceSumSparse + */ + public SparseReduceSumSparse sparseReduceSumSparse(Operand inputIndices, + Operand inputValues, Operand inputShape, Operand reductionAxes, + SparseReduceSumSparse.Options... options) { + return SparseReduceSumSparse.create(scope, inputIndices, inputValues, inputShape, reductionAxes, options); + } + + /** + * Builds an {@link SparseSliceGrad} operation + * + * @param backpropValGrad 1-D. The gradient with respect to + * @param inputIndices 2-D. The `indices` of the input `SparseTensor`. + * @param inputStart 1-D. tensor represents the start of the slice. + * @param outputIndices 2-D. The `indices` of the sliced `SparseTensor`. + * @return a new instance of SparseSliceGrad + * @see org.tensorflow.op.sparse.SparseSliceGrad + */ + public SparseSliceGrad sparseSliceGrad(Operand backpropValGrad, + Operand inputIndices, Operand inputStart, Operand outputIndices) { + return SparseSliceGrad.create(scope, backpropValGrad, inputIndices, inputStart, outputIndices); + } + + /** + * Builds an {@link SparseSegmentSqrtNGrad} operation + * + * @param grad gradient propagated to the SparseSegmentSqrtN op. + * @param indices indices passed to the corresponding SparseSegmentSqrtN op. + * @param segmentIds segment_ids passed to the corresponding SparseSegmentSqrtN op. + * @param outputDim0 dimension 0 of "data" passed to SparseSegmentSqrtN op. + * @return a new instance of SparseSegmentSqrtNGrad + * @see org.tensorflow.op.sparse.SparseSegmentSqrtNGrad + */ + public SparseSegmentSqrtNGrad sparseSegmentSqrtNGrad( + Operand grad, Operand indices, Operand segmentIds, + Operand outputDim0) { + return SparseSegmentSqrtNGrad.create(scope, grad, indices, segmentIds, outputDim0); + } + + /** + * Builds an {@link SparseDenseCwiseDiv} operation + * + * @param spIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param spValues 1-D. `N` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @param dense `R`-D. The dense Tensor operand. + * @return a new instance of SparseDenseCwiseDiv + * @see org.tensorflow.op.sparse.SparseDenseCwiseDiv + */ + public SparseDenseCwiseDiv sparseDenseCwiseDiv(Operand spIndices, + Operand spValues, Operand spShape, Operand dense) { + return SparseDenseCwiseDiv.create(scope, spIndices, spValues, spShape, dense); + } + + /** + * Builds an {@link SparseSegmentSum} operation + * + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @return a new instance of SparseSegmentSum + * @see org.tensorflow.op.sparse.SparseSegmentSum + */ + public SparseSegmentSum sparseSegmentSum(Operand data, + Operand indices, Operand segmentIds) { + return SparseSegmentSum.create(scope, data, indices, segmentIds); + } + + /** + * Builds an {@link SparseMatMul} operation + * + * @param a + * @param b + * @param options carries optional attributes values + * @return a new instance of SparseMatMul + * @see org.tensorflow.op.sparse.SparseMatMul + */ + public SparseMatMul sparseMatMul(Operand a, Operand b, + SparseMatMul.Options... options) { + return SparseMatMul.create(scope, a, b, options); + } + + /** + * Builds an {@link SparseAccumulatorTakeGradient} operation + * + * @param handle The handle to a SparseConditionalAccumulator. + * @param numRequired Number of gradients required before we return an aggregate. + * @param dtype The data type of accumulated gradients. Needs to correspond to the type + * @return a new instance of SparseAccumulatorTakeGradient + * @see org.tensorflow.op.sparse.SparseAccumulatorTakeGradient + */ + public SparseAccumulatorTakeGradient sparseAccumulatorTakeGradient(Operand handle, + Operand numRequired, Class dtype) { + return SparseAccumulatorTakeGradient.create(scope, handle, numRequired, dtype); + } + + /** + * Builds an {@link AddManySparseToTensorsMap} operation + * + * @param sparseIndices 2-D. The `indices` of the minibatch `SparseTensor`. + * @param sparseValues 1-D. The `values` of the minibatch `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the minibatch `SparseTensor`. + * @param options carries optional attributes values + * @return a new instance of AddManySparseToTensorsMap + * @see org.tensorflow.op.sparse.AddManySparseToTensorsMap + */ + public AddManySparseToTensorsMap addManySparseToTensorsMap(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, + AddManySparseToTensorsMap.Options... options) { + return AddManySparseToTensorsMap.create(scope, sparseIndices, sparseValues, sparseShape, options); + } + + /** + * Builds an {@link SparseConditionalAccumulator} operation + * + * @param dtype The type of the value being accumulated. + * @param shape The shape of the values. + * @param options carries optional attributes values + * @return a new instance of SparseConditionalAccumulator + * @see org.tensorflow.op.sparse.SparseConditionalAccumulator + */ + public SparseConditionalAccumulator sparseConditionalAccumulator(Class dtype, Shape shape, + SparseConditionalAccumulator.Options... options) { + return SparseConditionalAccumulator.create(scope, dtype, shape, options); + } + + /** + * Builds an {@link DenseToSparseSetOperation} operation + * + * @param set1 `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set2`. + * @param set2Indices 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major + * @param set2Values 1D `Tensor`, values of a `SparseTensor`. Must be in row-major + * @param set2Shape 1D `Tensor`, shape of a `SparseTensor`. `set2_shape[0...n-1]` must + * @param setOperation + * @param options carries optional attributes values + * @return a new instance of DenseToSparseSetOperation + * @see org.tensorflow.op.sparse.DenseToSparseSetOperation + */ + public DenseToSparseSetOperation denseToSparseSetOperation(Operand set1, + Operand set2Indices, Operand set2Values, Operand set2Shape, + String setOperation, DenseToSparseSetOperation.Options... options) { + return DenseToSparseSetOperation.create(scope, set1, set2Indices, set2Values, set2Shape, setOperation, options); + } + + /** + * Builds an {@link SparseReduceMax} operation + * + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceMax + * @see org.tensorflow.op.sparse.SparseReduceMax + */ + public SparseReduceMax sparseReduceMax(Operand inputIndices, + Operand inputValues, Operand inputShape, Operand reductionAxes, + SparseReduceMax.Options... options) { + return SparseReduceMax.create(scope, inputIndices, inputValues, inputShape, reductionAxes, options); + } + + /** + * Builds an {@link SparseToSparseSetOperation} operation + * + * @param set1Indices 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major + * @param set1Values 1D `Tensor`, values of a `SparseTensor`. Must be in row-major + * @param set1Shape 1D `Tensor`, shape of a `SparseTensor`. `set1_shape[0...n-1]` must + * @param set2Indices 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major + * @param set2Values 1D `Tensor`, values of a `SparseTensor`. Must be in row-major + * @param set2Shape 1D `Tensor`, shape of a `SparseTensor`. `set2_shape[0...n-1]` must + * @param setOperation + * @param options carries optional attributes values + * @return a new instance of SparseToSparseSetOperation + * @see org.tensorflow.op.sparse.SparseToSparseSetOperation + */ + public SparseToSparseSetOperation sparseToSparseSetOperation(Operand set1Indices, + Operand set1Values, Operand set1Shape, Operand set2Indices, + Operand set2Values, Operand set2Shape, String setOperation, + SparseToSparseSetOperation.Options... options) { + return SparseToSparseSetOperation.create(scope, set1Indices, set1Values, set1Shape, set2Indices, set2Values, set2Shape, setOperation, options); + } + + /** + * Builds an {@link SparseSplit} operation + * + * @param splitDim 0-D. The dimension along which to split. Must be in the range + * @param indices 2-D tensor represents the indices of the sparse tensor. + * @param values 1-D tensor represents the values of the sparse tensor. + * @param shape 1-D. tensor represents the shape of the sparse tensor. + * @param numSplit The number of ways to split. + * @return a new instance of SparseSplit + * @see org.tensorflow.op.sparse.SparseSplit + */ + public SparseSplit sparseSplit(Operand splitDim, Operand indices, + Operand values, Operand shape, Long numSplit) { + return SparseSplit.create(scope, splitDim, indices, values, shape, numSplit); + } + + /** + * Builds an {@link DeserializeSparse} operation + * + * @param serializedSparse The serialized `SparseTensor` objects. The last dimension + * @param dtype The `dtype` of the serialized `SparseTensor` objects. + * @return a new instance of DeserializeSparse + * @see org.tensorflow.op.sparse.DeserializeSparse + */ + public DeserializeSparse deserializeSparse(Operand serializedSparse, + Class dtype) { + return DeserializeSparse.create(scope, serializedSparse, dtype); + } + + /** + * Builds an {@link SparseToDense} operation + * + * @param sparseIndices 0-D, 1-D, or 2-D. `sparse_indices[i]` contains the complete + * @param outputShape 1-D. Shape of the dense output tensor. + * @param sparseValues 1-D. Values corresponding to each row of `sparse_indices`, + * @param defaultValue Scalar value to set for indices not specified in + * @param options carries optional attributes values + * @return a new instance of SparseToDense + * @see org.tensorflow.op.sparse.SparseToDense + */ + public SparseToDense sparseToDense(Operand sparseIndices, + Operand outputShape, Operand sparseValues, Operand defaultValue, + SparseToDense.Options... options) { + return SparseToDense.create(scope, sparseIndices, outputShape, sparseValues, defaultValue, options); + } + + /** + * Builds an {@link SparseSegmentMeanWithNumSegments} operation + * + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @param numSegments Should equal the number of distinct segment IDs. + * @return a new instance of SparseSegmentMeanWithNumSegments + * @see org.tensorflow.op.sparse.SparseSegmentMeanWithNumSegments + */ + public SparseSegmentMeanWithNumSegments sparseSegmentMeanWithNumSegments( + Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + return SparseSegmentMeanWithNumSegments.create(scope, data, indices, segmentIds, numSegments); + } + + /** + * Builds an {@link SparseSegmentMean} operation + * + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @return a new instance of SparseSegmentMean + * @see org.tensorflow.op.sparse.SparseSegmentMean + */ + public SparseSegmentMean sparseSegmentMean( + Operand data, Operand indices, Operand segmentIds) { + return SparseSegmentMean.create(scope, data, indices, segmentIds); + } + + /** + * Builds an {@link DenseToDenseSetOperation} operation + * + * @param set1 `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set2`. + * @param set2 `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set1`. + * @param setOperation + * @param options carries optional attributes values + * @return a new instance of DenseToDenseSetOperation + * @see org.tensorflow.op.sparse.DenseToDenseSetOperation + */ + public DenseToDenseSetOperation denseToDenseSetOperation(Operand set1, Operand set2, + String setOperation, DenseToDenseSetOperation.Options... options) { + return DenseToDenseSetOperation.create(scope, set1, set2, setOperation, options); + } + + /** + * Builds an {@link SparseAccumulatorApplyGradient} operation + * + * @param handle The handle to a accumulator. + * @param localStep The local_step value at which the sparse gradient was computed. + * @param gradientIndices Indices of the sparse gradient to be accumulated. Must be a + * @param gradientValues Values are the non-zero slices of the gradient, and must have + * @param gradientShape Shape of the sparse gradient to be accumulated. + * @param hasKnownShape Boolean indicating whether gradient_shape is unknown, in which + * @return a new instance of SparseAccumulatorApplyGradient + * @see org.tensorflow.op.sparse.SparseAccumulatorApplyGradient + */ + public SparseAccumulatorApplyGradient sparseAccumulatorApplyGradient(Operand handle, + Operand localStep, Operand gradientIndices, Operand gradientValues, + Operand gradientShape, Boolean hasKnownShape) { + return SparseAccumulatorApplyGradient.create(scope, handle, localStep, gradientIndices, gradientValues, gradientShape, hasKnownShape); + } + + /** + * Builds an {@link SparseReorder} operation + * + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @return a new instance of SparseReorder + * @see org.tensorflow.op.sparse.SparseReorder + */ + public SparseReorder sparseReorder(Operand inputIndices, Operand inputValues, + Operand inputShape) { + return SparseReorder.create(scope, inputIndices, inputValues, inputShape); + } + + /** + * Builds an {@link SparseCross} operation + * + * @param indices 2-D. Indices of each input `SparseTensor`. + * @param values 1-D. values of each `SparseTensor`. + * @param shapes 1-D. Shapes of each `SparseTensor`. + * @param denseInputs 2-D. Columns represented by dense `Tensor`. + * @param hashedOutput If true, returns the hash of the cross instead of the string. + * @param numBuckets It is used if hashed_output is true. + * @param hashKey Specify the hash_key that will be used by the `FingerprintCat64` + * @param outType + * @param internalType + * @return a new instance of SparseCross + * @see org.tensorflow.op.sparse.SparseCross + */ + public SparseCross sparseCross(Iterable> indices, + Iterable> values, Iterable> shapes, Iterable> denseInputs, + Boolean hashedOutput, Long numBuckets, Long hashKey, Class outType, + Class internalType) { + return SparseCross.create(scope, indices, values, shapes, denseInputs, hashedOutput, numBuckets, hashKey, outType, internalType); + } + + /** + * Builds an {@link SparseSegmentSqrtN} operation + * + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @return a new instance of SparseSegmentSqrtN + * @see org.tensorflow.op.sparse.SparseSegmentSqrtN + */ + public SparseSegmentSqrtN sparseSegmentSqrtN( + Operand data, Operand indices, Operand segmentIds) { + return SparseSegmentSqrtN.create(scope, data, indices, segmentIds); + } + + /** + * Builds an {@link SparseSlice} operation + * + * @param indices 2-D tensor represents the indices of the sparse tensor. + * @param values 1-D tensor represents the values of the sparse tensor. + * @param shape 1-D. tensor represents the shape of the sparse tensor. + * @param start 1-D. tensor represents the start of the slice. + * @param size 1-D. tensor represents the size of the slice. + * @return a new instance of SparseSlice + * @see org.tensorflow.op.sparse.SparseSlice + */ + public SparseSlice sparseSlice(Operand indices, Operand values, + Operand shape, Operand start, Operand size) { + return SparseSlice.create(scope, indices, values, shape, start, size); + } + + /** + * Builds an {@link SparseSoftmax} operation + * + * @param spIndices 2-D. `NNZ x R` matrix with the indices of non-empty values in a + * @param spValues 1-D. `NNZ` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @return a new instance of SparseSoftmax + * @see org.tensorflow.op.sparse.SparseSoftmax + */ + public SparseSoftmax sparseSoftmax(Operand spIndices, + Operand spValues, Operand spShape) { + return SparseSoftmax.create(scope, spIndices, spValues, spShape); + } + + /** + * Builds an {@link SparseSegmentSqrtNWithNumSegments} operation + * + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @param numSegments Should equal the number of distinct segment IDs. + * @return a new instance of SparseSegmentSqrtNWithNumSegments + * @see org.tensorflow.op.sparse.SparseSegmentSqrtNWithNumSegments + */ + public SparseSegmentSqrtNWithNumSegments sparseSegmentSqrtNWithNumSegments( + Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + return SparseSegmentSqrtNWithNumSegments.create(scope, data, indices, segmentIds, numSegments); + } + + /** + * Builds an {@link TakeManySparseFromTensorsMap} operation + * + * @param sparseHandles 1-D, The `N` serialized `SparseTensor` objects. + * @param dtype The `dtype` of the `SparseTensor` objects stored in the + * @param options carries optional attributes values + * @return a new instance of TakeManySparseFromTensorsMap + * @see org.tensorflow.op.sparse.TakeManySparseFromTensorsMap + */ + public TakeManySparseFromTensorsMap takeManySparseFromTensorsMap( + Operand sparseHandles, Class dtype, + TakeManySparseFromTensorsMap.Options... options) { + return TakeManySparseFromTensorsMap.create(scope, sparseHandles, dtype, options); + } + + /** + * Builds an {@link SparseTensorDenseMatMul} operation + * + * @param aIndices 2-D. The `indices` of the `SparseTensor`, size `[nnz, 2]` Matrix. + * @param aValues 1-D. The `values` of the `SparseTensor`, size `[nnz]` Vector. + * @param aShape 1-D. The `shape` of the `SparseTensor`, size `[2]` Vector. + * @param b 2-D. A dense Matrix. + * @param options carries optional attributes values + * @return a new instance of SparseTensorDenseMatMul + * @see org.tensorflow.op.sparse.SparseTensorDenseMatMul + */ + public SparseTensorDenseMatMul sparseTensorDenseMatMul( + Operand aIndices, Operand aValues, Operand aShape, Operand b, + SparseTensorDenseMatMul.Options... options) { + return SparseTensorDenseMatMul.create(scope, aIndices, aValues, aShape, b, options); + } + + /** + * Builds an {@link SparseSparseMaximum} operation + * + * @param aIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param aValues 1-D. `N` non-empty values corresponding to `a_indices`. + * @param aShape 1-D. Shape of the input SparseTensor. + * @param bIndices counterpart to `a_indices` for the other operand. + * @param bValues counterpart to `a_values` for the other operand; must be of the same dtype. + * @param bShape counterpart to `a_shape` for the other operand; the two shapes must be equal. + * @return a new instance of SparseSparseMaximum + * @see org.tensorflow.op.sparse.SparseSparseMaximum + */ + public SparseSparseMaximum sparseSparseMaximum(Operand aIndices, + Operand aValues, Operand aShape, Operand bIndices, Operand bValues, + Operand bShape) { + return SparseSparseMaximum.create(scope, aIndices, aValues, aShape, bIndices, bValues, bShape); + } + + /** + * Builds an {@link SparseDenseCwiseMul} operation + * + * @param spIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * @param spValues 1-D. `N` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @param dense `R`-D. The dense Tensor operand. + * @return a new instance of SparseDenseCwiseMul + * @see org.tensorflow.op.sparse.SparseDenseCwiseMul + */ + public SparseDenseCwiseMul sparseDenseCwiseMul(Operand spIndices, + Operand spValues, Operand spShape, Operand dense) { + return SparseDenseCwiseMul.create(scope, spIndices, spValues, spShape, dense); + } + + /** + * Builds an {@link SparseAdd} operation + * + * @param aIndices 2-D. The `indices` of the first `SparseTensor`, size `[nnz, ndims]` Matrix. + * @param aValues 1-D. The `values` of the first `SparseTensor`, size `[nnz]` Vector. + * @param aShape 1-D. The `shape` of the first `SparseTensor`, size `[ndims]` Vector. + * @param bIndices 2-D. The `indices` of the second `SparseTensor`, size `[nnz, ndims]` Matrix. + * @param bValues 1-D. The `values` of the second `SparseTensor`, size `[nnz]` Vector. + * @param bShape 1-D. The `shape` of the second `SparseTensor`, size `[ndims]` Vector. + * @param thresh 0-D. The magnitude threshold that determines if an output value/index + * @return a new instance of SparseAdd + * @see org.tensorflow.op.sparse.SparseAdd + */ + public SparseAdd sparseAdd(Operand aIndices, Operand aValues, + Operand aShape, Operand bIndices, Operand bValues, Operand bShape, + Operand thresh) { + return SparseAdd.create(scope, aIndices, aValues, aShape, bIndices, bValues, bShape, thresh); + } + + /** + * Builds an {@link SparseConcat} operation + * + * @param indices 2-D. Indices of each input `SparseTensor`. + * @param values 1-D. Non-empty values of each `SparseTensor`. + * @param shapes 1-D. Shapes of each `SparseTensor`. + * @param concatDim Dimension to concatenate along. Must be in range [-rank, rank), + * @return a new instance of SparseConcat + * @see org.tensorflow.op.sparse.SparseConcat + */ + public SparseConcat sparseConcat(Iterable> indices, + Iterable> values, Iterable> shapes, Long concatDim) { + return SparseConcat.create(scope, indices, values, shapes, concatDim); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/StringsOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/StringsOps.java new file mode 100644 index 00000000000..cb91a10752c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/StringsOps.java @@ -0,0 +1,236 @@ +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.op.strings.Join; +import org.tensorflow.op.strings.ReduceJoin; +import org.tensorflow.op.strings.RegexFullMatch; +import org.tensorflow.op.strings.RegexReplace; +import org.tensorflow.op.strings.StringFormat; +import org.tensorflow.op.strings.StringLength; +import org.tensorflow.op.strings.StringSplit; +import org.tensorflow.op.strings.Strip; +import org.tensorflow.op.strings.Substr; +import org.tensorflow.op.strings.ToHashBucket; +import org.tensorflow.op.strings.ToHashBucketFast; +import org.tensorflow.op.strings.ToHashBucketStrong; +import org.tensorflow.op.strings.ToNumber; +import org.tensorflow.op.strings.UnicodeScript; +import org.tensorflow.op.strings.UnicodeTranscode; + +/** + * An API for building {@code strings} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class StringsOps { + private final Scope scope; + + StringsOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link StringLength} operation + * + * @param input The string for which to compute the length. + * @param options carries optional attributes values + * @return a new instance of StringLength + * @see org.tensorflow.op.strings.StringLength + */ + public StringLength stringLength(Operand input, StringLength.Options... options) { + return StringLength.create(scope, input, options); + } + + /** + * Builds an {@link StringFormat} operation + * + * @param inputs The list of tensors to format into the placeholder string. + * @param options carries optional attributes values + * @return a new instance of StringFormat + * @see org.tensorflow.op.strings.StringFormat + */ + public StringFormat stringFormat(Iterable> inputs, StringFormat.Options... options) { + return StringFormat.create(scope, inputs, options); + } + + /** + * Builds an {@link ToHashBucketFast} operation + * + * @param input The strings to assign a hash bucket. + * @param numBuckets The number of buckets. + * @return a new instance of ToHashBucketFast + * @see org.tensorflow.op.strings.ToHashBucketFast + */ + public ToHashBucketFast toHashBucketFast(Operand input, Long numBuckets) { + return ToHashBucketFast.create(scope, input, numBuckets); + } + + /** + * Builds an {@link Join} operation + * + * @param inputs A list of string tensors. The tensors must all have the same shape, + * @param options carries optional attributes values + * @return a new instance of Join + * @see org.tensorflow.op.strings.Join + */ + public Join join(Iterable> inputs, Join.Options... options) { + return Join.create(scope, inputs, options); + } + + /** + * Builds an {@link ToHashBucket} operation + * + * @param stringTensor + * @param numBuckets The number of buckets. + * @return a new instance of ToHashBucket + * @see org.tensorflow.op.strings.ToHashBucket + */ + public ToHashBucket toHashBucket(Operand stringTensor, Long numBuckets) { + return ToHashBucket.create(scope, stringTensor, numBuckets); + } + + /** + * Builds an {@link RegexReplace} operation + * + * @param input The text to be processed. + * @param pattern The regular expression to be matched in the `input` strings. + * @param rewrite The rewrite string to be substituted for the `pattern` expression where it is + * @param options carries optional attributes values + * @return a new instance of RegexReplace + * @see org.tensorflow.op.strings.RegexReplace + */ + public RegexReplace regexReplace(Operand input, Operand pattern, + Operand rewrite, RegexReplace.Options... options) { + return RegexReplace.create(scope, input, pattern, rewrite, options); + } + + /** + * Builds an {@link ToNumber} operation + * + * @param stringTensor + * @return a new instance of ToNumber + * @see org.tensorflow.op.strings.ToNumber + */ + public ToNumber toNumber(Operand stringTensor) { + return ToNumber.create(scope, stringTensor); + } + + /** + * Builds an {@link ToNumber} operation + * + * @param stringTensor + * @param outType The numeric type to interpret each string in `string_tensor` as. + * @return a new instance of ToNumber + * @see org.tensorflow.op.strings.ToNumber + */ + public ToNumber toNumber(Operand stringTensor, Class outType) { + return ToNumber.create(scope, stringTensor, outType); + } + + /** + * Builds an {@link UnicodeTranscode} operation + * + * @param input The text to be processed. Can have any shape. + * @param inputEncoding Text encoding of the input strings. This is any of the encodings supported + * @param outputEncoding The unicode encoding to use in the output. Must be one of + * @param options carries optional attributes values + * @return a new instance of UnicodeTranscode + * @see org.tensorflow.op.strings.UnicodeTranscode + */ + public UnicodeTranscode unicodeTranscode(Operand input, String inputEncoding, + String outputEncoding, UnicodeTranscode.Options... options) { + return UnicodeTranscode.create(scope, input, inputEncoding, outputEncoding, options); + } + + /** + * Builds an {@link Strip} operation + * + * @param input A string `Tensor` of any shape. + * @return a new instance of Strip + * @see org.tensorflow.op.strings.Strip + */ + public Strip strip(Operand input) { + return Strip.create(scope, input); + } + + /** + * Builds an {@link UnicodeScript} operation + * + * @param input A Tensor of int32 Unicode code points. + * @return a new instance of UnicodeScript + * @see org.tensorflow.op.strings.UnicodeScript + */ + public UnicodeScript unicodeScript(Operand input) { + return UnicodeScript.create(scope, input); + } + + /** + * Builds an {@link ReduceJoin} operation + * + * @param inputs The input to be joined. All reduced indices must have non-zero size. + * @param reductionIndices The dimensions to reduce over. Dimensions are reduced in the + * @param options carries optional attributes values + * @return a new instance of ReduceJoin + * @see org.tensorflow.op.strings.ReduceJoin + */ + public ReduceJoin reduceJoin(Operand inputs, Operand reductionIndices, + ReduceJoin.Options... options) { + return ReduceJoin.create(scope, inputs, reductionIndices, options); + } + + /** + * Builds an {@link RegexFullMatch} operation + * + * @param input A string tensor of the text to be processed. + * @param pattern A scalar string tensor containing the regular expression to match the input. + * @return a new instance of RegexFullMatch + * @see org.tensorflow.op.strings.RegexFullMatch + */ + public RegexFullMatch regexFullMatch(Operand input, Operand pattern) { + return RegexFullMatch.create(scope, input, pattern); + } + + /** + * Builds an {@link ToHashBucketStrong} operation + * + * @param input The strings to assign a hash bucket. + * @param numBuckets The number of buckets. + * @param key The key used to seed the hash function, passed as a list of two uint64 + * @return a new instance of ToHashBucketStrong + * @see org.tensorflow.op.strings.ToHashBucketStrong + */ + public ToHashBucketStrong toHashBucketStrong(Operand input, Long numBuckets, + List key) { + return ToHashBucketStrong.create(scope, input, numBuckets, key); + } + + /** + * Builds an {@link Substr} operation + * + * @param input Tensor of strings + * @param pos Scalar defining the position of first character in each substring + * @param len Scalar defining the number of characters to include in each substring + * @param options carries optional attributes values + * @return a new instance of Substr + * @see org.tensorflow.op.strings.Substr + */ + public Substr substr(Operand input, Operand pos, Operand len, + Substr.Options... options) { + return Substr.create(scope, input, pos, len, options); + } + + /** + * Builds an {@link StringSplit} operation + * + * @param input `1-D` string `Tensor`, the strings to split. + * @param sep `0-D` string `Tensor`, the delimiter character. + * @param options carries optional attributes values + * @return a new instance of StringSplit + * @see org.tensorflow.op.strings.StringSplit + */ + public StringSplit stringSplit(Operand input, Operand sep, + StringSplit.Options... options) { + return StringSplit.create(scope, input, sep, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SummaryOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SummaryOps.java new file mode 100644 index 00000000000..e3ca7af8684 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SummaryOps.java @@ -0,0 +1,101 @@ +package org.tensorflow.op; + +import org.tensorflow.Operand; +import org.tensorflow.op.summary.AudioSummary; +import org.tensorflow.op.summary.HistogramSummary; +import org.tensorflow.op.summary.ImageSummary; +import org.tensorflow.op.summary.MergeSummary; +import org.tensorflow.op.summary.ScalarSummary; +import org.tensorflow.op.summary.TensorSummary; + +/** + * An API for building {@code summary} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class SummaryOps { + private final Scope scope; + + SummaryOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link HistogramSummary} operation + * + * @param tag Scalar. Tag to use for the `Summary.Value`. + * @param values Any shape. Values to use to build the histogram. + * @return a new instance of HistogramSummary + * @see org.tensorflow.op.summary.HistogramSummary + */ + public HistogramSummary histogramSummary(Operand tag, + Operand values) { + return HistogramSummary.create(scope, tag, values); + } + + /** + * Builds an {@link TensorSummary} operation + * + * @param tag A string attached to this summary. Used for organization in TensorBoard. + * @param tensor A tensor to serialize. + * @param serializedSummaryMetadata A serialized SummaryMetadata proto. Contains plugin + * @return a new instance of TensorSummary + * @see org.tensorflow.op.summary.TensorSummary + */ + public TensorSummary tensorSummary(Operand tag, Operand tensor, + Operand serializedSummaryMetadata) { + return TensorSummary.create(scope, tag, tensor, serializedSummaryMetadata); + } + + /** + * Builds an {@link MergeSummary} operation + * + * @param inputs Can be of any shape. Each must contain serialized `Summary` protocol + * @return a new instance of MergeSummary + * @see org.tensorflow.op.summary.MergeSummary + */ + public MergeSummary mergeSummary(Iterable> inputs) { + return MergeSummary.create(scope, inputs); + } + + /** + * Builds an {@link AudioSummary} operation + * + * @param tag Scalar. Used to build the `tag` attribute of the summary values. + * @param tensor 2-D of shape `[batch_size, frames]`. + * @param sampleRate The sample rate of the signal in hertz. + * @param options carries optional attributes values + * @return a new instance of AudioSummary + * @see org.tensorflow.op.summary.AudioSummary + */ + public AudioSummary audioSummary(Operand tag, Operand tensor, + Operand sampleRate, AudioSummary.Options... options) { + return AudioSummary.create(scope, tag, tensor, sampleRate, options); + } + + /** + * Builds an {@link ImageSummary} operation + * + * @param tag Scalar. Used to build the `tag` attribute of the summary values. + * @param tensor 4-D of shape `[batch_size, height, width, channels]` where + * @param options carries optional attributes values + * @return a new instance of ImageSummary + * @see org.tensorflow.op.summary.ImageSummary + */ + public ImageSummary imageSummary(Operand tag, Operand tensor, + ImageSummary.Options... options) { + return ImageSummary.create(scope, tag, tensor, options); + } + + /** + * Builds an {@link ScalarSummary} operation + * + * @param tags Tags for the summary. + * @param values Same shape as `tags. Values for the summary. + * @return a new instance of ScalarSummary + * @see org.tensorflow.op.summary.ScalarSummary + */ + public ScalarSummary scalarSummary(Operand tags, Operand values) { + return ScalarSummary.create(scope, tags, values); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TrainOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TrainOps.java new file mode 100644 index 00000000000..1e4d2016f68 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TrainOps.java @@ -0,0 +1,1197 @@ +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Shape; +import org.tensorflow.op.train.AccumulatorApplyGradient; +import org.tensorflow.op.train.AccumulatorNumAccumulated; +import org.tensorflow.op.train.AccumulatorSetGlobalStep; +import org.tensorflow.op.train.AccumulatorTakeGradient; +import org.tensorflow.op.train.ApplyAdadelta; +import org.tensorflow.op.train.ApplyAdagrad; +import org.tensorflow.op.train.ApplyAdagradDa; +import org.tensorflow.op.train.ApplyAdam; +import org.tensorflow.op.train.ApplyAddSign; +import org.tensorflow.op.train.ApplyCenteredRmsProp; +import org.tensorflow.op.train.ApplyFtrl; +import org.tensorflow.op.train.ApplyGradientDescent; +import org.tensorflow.op.train.ApplyMomentum; +import org.tensorflow.op.train.ApplyPowerSign; +import org.tensorflow.op.train.ApplyProximalAdagrad; +import org.tensorflow.op.train.ApplyProximalGradientDescent; +import org.tensorflow.op.train.ApplyRmsProp; +import org.tensorflow.op.train.ConditionalAccumulator; +import org.tensorflow.op.train.GenerateVocabRemapping; +import org.tensorflow.op.train.MergeV2Checkpoints; +import org.tensorflow.op.train.NegTrain; +import org.tensorflow.op.train.PreventGradient; +import org.tensorflow.op.train.ResourceApplyAdadelta; +import org.tensorflow.op.train.ResourceApplyAdagrad; +import org.tensorflow.op.train.ResourceApplyAdagradDa; +import org.tensorflow.op.train.ResourceApplyAdam; +import org.tensorflow.op.train.ResourceApplyAddSign; +import org.tensorflow.op.train.ResourceApplyCenteredRmsProp; +import org.tensorflow.op.train.ResourceApplyFtrl; +import org.tensorflow.op.train.ResourceApplyGradientDescent; +import org.tensorflow.op.train.ResourceApplyMomentum; +import org.tensorflow.op.train.ResourceApplyPowerSign; +import org.tensorflow.op.train.ResourceApplyProximalAdagrad; +import org.tensorflow.op.train.ResourceApplyProximalGradientDescent; +import org.tensorflow.op.train.ResourceApplyRmsProp; +import org.tensorflow.op.train.ResourceSparseApplyAdadelta; +import org.tensorflow.op.train.ResourceSparseApplyAdagrad; +import org.tensorflow.op.train.ResourceSparseApplyAdagradDa; +import org.tensorflow.op.train.ResourceSparseApplyCenteredRmsProp; +import org.tensorflow.op.train.ResourceSparseApplyFtrl; +import org.tensorflow.op.train.ResourceSparseApplyMomentum; +import org.tensorflow.op.train.ResourceSparseApplyProximalAdagrad; +import org.tensorflow.op.train.ResourceSparseApplyProximalGradientDescent; +import org.tensorflow.op.train.ResourceSparseApplyRmsProp; +import org.tensorflow.op.train.Restore; +import org.tensorflow.op.train.RestoreSlice; +import org.tensorflow.op.train.Save; +import org.tensorflow.op.train.SaveSlices; +import org.tensorflow.op.train.SdcaFprint; +import org.tensorflow.op.train.SdcaShrinkL1; +import org.tensorflow.op.train.SparseApplyAdadelta; +import org.tensorflow.op.train.SparseApplyAdagrad; +import org.tensorflow.op.train.SparseApplyAdagradDa; +import org.tensorflow.op.train.SparseApplyCenteredRmsProp; +import org.tensorflow.op.train.SparseApplyFtrl; +import org.tensorflow.op.train.SparseApplyMomentum; +import org.tensorflow.op.train.SparseApplyProximalAdagrad; +import org.tensorflow.op.train.SparseApplyProximalGradientDescent; +import org.tensorflow.op.train.SparseApplyRmsProp; +import org.tensorflow.op.train.TileGrad; + +/** + * An API for building {@code train} operations as {@link Op Op}s + * + * @see {@link Ops} + */ +public final class TrainOps { + private final Scope scope; + + TrainOps(Scope scope) { + this.scope = scope; + } + + /** + * Builds an {@link ResourceSparseApplyAdagradDa} operation + * + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyAdagradDa + * @see org.tensorflow.op.train.ResourceSparseApplyAdagradDa + */ + public ResourceSparseApplyAdagradDa resourceSparseApplyAdagradDa( + Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, + Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, + Operand globalStep, ResourceSparseApplyAdagradDa.Options... options) { + return ResourceSparseApplyAdagradDa.create(scope, var, gradientAccumulator, gradientSquaredAccumulator, grad, indices, lr, l1, l2, globalStep, options); + } + + /** + * Builds an {@link ResourceSparseApplyAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyAdagrad + * @see org.tensorflow.op.train.ResourceSparseApplyAdagrad + */ + public ResourceSparseApplyAdagrad resourceSparseApplyAdagrad(Operand var, + Operand accum, Operand lr, Operand grad, Operand indices, + ResourceSparseApplyAdagrad.Options... options) { + return ResourceSparseApplyAdagrad.create(scope, var, accum, lr, grad, indices, options); + } + + /** + * Builds an {@link ApplyMomentum} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ApplyMomentum + * @see org.tensorflow.op.train.ApplyMomentum + */ + public ApplyMomentum applyMomentum(Operand var, Operand accum, Operand lr, + Operand grad, Operand momentum, ApplyMomentum.Options... options) { + return ApplyMomentum.create(scope, var, accum, lr, grad, momentum, options); + } + + /** + * Builds an {@link AccumulatorApplyGradient} operation + * + * @param handle The handle to a accumulator. + * @param localStep The local_step value at which the gradient was computed. + * @param gradient A tensor of the gradient to be accumulated. + * @return a new instance of AccumulatorApplyGradient + * @see org.tensorflow.op.train.AccumulatorApplyGradient + */ + public AccumulatorApplyGradient accumulatorApplyGradient(Operand handle, + Operand localStep, Operand gradient) { + return AccumulatorApplyGradient.create(scope, handle, localStep, gradient); + } + + /** + * Builds an {@link ApplyAddSign} operation + * + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param alpha Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAddSign + * @see org.tensorflow.op.train.ApplyAddSign + */ + public ApplyAddSign applyAddSign(Operand var, Operand m, Operand lr, + Operand alpha, Operand signDecay, Operand beta, Operand grad, + ApplyAddSign.Options... options) { + return ApplyAddSign.create(scope, var, m, lr, alpha, signDecay, beta, grad, options); + } + + /** + * Builds an {@link ResourceApplyAddSign} operation + * + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param alpha Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAddSign + * @see org.tensorflow.op.train.ResourceApplyAddSign + */ + public ResourceApplyAddSign resourceApplyAddSign(Operand var, Operand m, Operand lr, + Operand alpha, Operand signDecay, Operand beta, Operand grad, + ResourceApplyAddSign.Options... options) { + return ResourceApplyAddSign.create(scope, var, m, lr, alpha, signDecay, beta, grad, options); + } + + /** + * Builds an {@link ApplyAdam} operation + * + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param beta2Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdam + * @see org.tensorflow.op.train.ApplyAdam + */ + public ApplyAdam applyAdam(Operand var, Operand m, Operand v, + Operand beta1Power, Operand beta2Power, Operand lr, Operand beta1, + Operand beta2, Operand epsilon, Operand grad, ApplyAdam.Options... options) { + return ApplyAdam.create(scope, var, m, v, beta1Power, beta2Power, lr, beta1, beta2, epsilon, grad, options); + } + + /** + * Builds an {@link SaveSlices} operation + * + * @param filename Must have a single element. The name of the file to which we write the + * @param tensorNames Shape `[N]`. The names of the tensors to be saved. + * @param shapesAndSlices Shape `[N]`. The shapes and slice specifications to use when + * @param data `N` tensors to save. + * @return a new instance of SaveSlices + * @see org.tensorflow.op.train.SaveSlices + */ + public SaveSlices saveSlices(Operand filename, Operand tensorNames, + Operand shapesAndSlices, Iterable> data) { + return SaveSlices.create(scope, filename, tensorNames, shapesAndSlices, data); + } + + /** + * Builds an {@link AccumulatorTakeGradient} operation + * + * @param handle The handle to an accumulator. + * @param numRequired Number of gradients required before we return an aggregate. + * @param dtype The data type of accumulated gradients. Needs to correspond to the type + * @return a new instance of AccumulatorTakeGradient + * @see org.tensorflow.op.train.AccumulatorTakeGradient + */ + public AccumulatorTakeGradient accumulatorTakeGradient(Operand handle, + Operand numRequired, Class dtype) { + return AccumulatorTakeGradient.create(scope, handle, numRequired, dtype); + } + + /** + * Builds an {@link NegTrain} operation + * + * @param wIn input word embedding. + * @param wOut output word embedding. + * @param examples A vector of word ids. + * @param labels A vector of word ids. + * @param lr + * @param vocabCount Count of words in the vocabulary. + * @param numNegativeSamples Number of negative samples per example. + * @return a new instance of NegTrain + * @see org.tensorflow.op.train.NegTrain + */ + public NegTrain negTrain(Operand wIn, Operand wOut, Operand examples, + Operand labels, Operand lr, List vocabCount, Long numNegativeSamples) { + return NegTrain.create(scope, wIn, wOut, examples, labels, lr, vocabCount, numNegativeSamples); + } + + /** + * Builds an {@link ResourceSparseApplyRmsProp} operation + * + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyRmsProp + * @see org.tensorflow.op.train.ResourceSparseApplyRmsProp + */ + public ResourceSparseApplyRmsProp resourceSparseApplyRmsProp(Operand var, + Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, + Operand epsilon, Operand grad, Operand indices, + ResourceSparseApplyRmsProp.Options... options) { + return ResourceSparseApplyRmsProp.create(scope, var, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); + } + + /** + * Builds an {@link SparseApplyProximalAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyProximalAdagrad + * @see org.tensorflow.op.train.SparseApplyProximalAdagrad + */ + public SparseApplyProximalAdagrad sparseApplyProximalAdagrad( + Operand var, Operand accum, Operand lr, Operand l1, Operand l2, + Operand grad, Operand indices, SparseApplyProximalAdagrad.Options... options) { + return SparseApplyProximalAdagrad.create(scope, var, accum, lr, l1, l2, grad, indices, options); + } + + /** + * Builds an {@link ResourceApplyAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdagrad + * @see org.tensorflow.op.train.ResourceApplyAdagrad + */ + public ResourceApplyAdagrad resourceApplyAdagrad(Operand var, Operand accum, + Operand lr, Operand grad, ResourceApplyAdagrad.Options... options) { + return ResourceApplyAdagrad.create(scope, var, accum, lr, grad, options); + } + + /** + * Builds an {@link ResourceApplyFtrl} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regulariation. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyFtrl + * @see org.tensorflow.op.train.ResourceApplyFtrl + */ + public ResourceApplyFtrl resourceApplyFtrl(Operand var, Operand accum, + Operand linear, Operand grad, Operand lr, Operand l1, Operand l2, + Operand l2Shrinkage, Operand lrPower, ResourceApplyFtrl.Options... options) { + return ResourceApplyFtrl.create(scope, var, accum, linear, grad, lr, l1, l2, l2Shrinkage, lrPower, options); + } + + /** + * Builds an {@link SparseApplyMomentum} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of SparseApplyMomentum + * @see org.tensorflow.op.train.SparseApplyMomentum + */ + public SparseApplyMomentum sparseApplyMomentum(Operand var, + Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, + SparseApplyMomentum.Options... options) { + return SparseApplyMomentum.create(scope, var, accum, lr, grad, indices, momentum, options); + } + + /** + * Builds an {@link ApplyAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdagrad + * @see org.tensorflow.op.train.ApplyAdagrad + */ + public ApplyAdagrad applyAdagrad(Operand var, Operand accum, Operand lr, + Operand grad, ApplyAdagrad.Options... options) { + return ApplyAdagrad.create(scope, var, accum, lr, grad, options); + } + + /** + * Builds an {@link ResourceApplyRmsProp} operation + * + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyRmsProp + * @see org.tensorflow.op.train.ResourceApplyRmsProp + */ + public ResourceApplyRmsProp resourceApplyRmsProp(Operand var, Operand ms, + Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, + Operand grad, ResourceApplyRmsProp.Options... options) { + return ResourceApplyRmsProp.create(scope, var, ms, mom, lr, rho, momentum, epsilon, grad, options); + } + + /** + * Builds an {@link ApplyProximalAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyProximalAdagrad + * @see org.tensorflow.op.train.ApplyProximalAdagrad + */ + public ApplyProximalAdagrad applyProximalAdagrad(Operand var, Operand accum, + Operand lr, Operand l1, Operand l2, Operand grad, + ApplyProximalAdagrad.Options... options) { + return ApplyProximalAdagrad.create(scope, var, accum, lr, l1, l2, grad, options); + } + + /** + * Builds an {@link Save} operation + * + * @param prefix Must have a single element. The prefix of the V2 checkpoint to which we + * @param tensorNames shape {N}. The names of the tensors to be saved. + * @param shapeAndSlices shape {N}. The slice specs of the tensors to be saved. + * @param tensors `N` tensors to save. + * @return a new instance of Save + * @see org.tensorflow.op.train.Save + */ + public Save save(Operand prefix, Operand tensorNames, + Operand shapeAndSlices, Iterable> tensors) { + return Save.create(scope, prefix, tensorNames, shapeAndSlices, tensors); + } + + /** + * Builds an {@link SparseApplyRmsProp} operation + * + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of SparseApplyRmsProp + * @see org.tensorflow.op.train.SparseApplyRmsProp + */ + public SparseApplyRmsProp sparseApplyRmsProp(Operand var, + Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, + Operand epsilon, Operand grad, Operand indices, + SparseApplyRmsProp.Options... options) { + return SparseApplyRmsProp.create(scope, var, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); + } + + /** + * Builds an {@link ApplyPowerSign} operation + * + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param logbase Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyPowerSign + * @see org.tensorflow.op.train.ApplyPowerSign + */ + public ApplyPowerSign applyPowerSign(Operand var, Operand m, Operand lr, + Operand logbase, Operand signDecay, Operand beta, Operand grad, + ApplyPowerSign.Options... options) { + return ApplyPowerSign.create(scope, var, m, lr, logbase, signDecay, beta, grad, options); + } + + /** + * Builds an {@link SparseApplyAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyAdagrad + * @see org.tensorflow.op.train.SparseApplyAdagrad + */ + public SparseApplyAdagrad sparseApplyAdagrad(Operand var, + Operand accum, Operand lr, Operand grad, Operand indices, + SparseApplyAdagrad.Options... options) { + return SparseApplyAdagrad.create(scope, var, accum, lr, grad, indices, options); + } + + /** + * Builds an {@link SparseApplyProximalGradientDescent} operation + * + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyProximalGradientDescent + * @see org.tensorflow.op.train.SparseApplyProximalGradientDescent + */ + public SparseApplyProximalGradientDescent sparseApplyProximalGradientDescent( + Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, + Operand indices, SparseApplyProximalGradientDescent.Options... options) { + return SparseApplyProximalGradientDescent.create(scope, var, alpha, l1, l2, grad, indices, options); + } + + /** + * Builds an {@link ApplyAdadelta} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param accumUpdate Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdadelta + * @see org.tensorflow.op.train.ApplyAdadelta + */ + public ApplyAdadelta applyAdadelta(Operand var, Operand accum, + Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, + ApplyAdadelta.Options... options) { + return ApplyAdadelta.create(scope, var, accum, accumUpdate, lr, rho, epsilon, grad, options); + } + + /** + * Builds an {@link SdcaShrinkL1} operation + * + * @param weights a list of vectors where each value is the weight associated with a + * @param l1 Symmetric l1 regularization strength. + * @param l2 Symmetric l2 regularization strength. Should be a positive float. + * @return a new instance of SdcaShrinkL1 + * @see org.tensorflow.op.train.SdcaShrinkL1 + */ + public SdcaShrinkL1 sdcaShrinkL1(Iterable> weights, Float l1, Float l2) { + return SdcaShrinkL1.create(scope, weights, l1, l2); + } + + /** + * Builds an {@link Restore} operation + * + * @param prefix Must have a single element. The prefix of a V2 checkpoint. + * @param tensorNames shape {N}. The names of the tensors to be restored. + * @param shapeAndSlices shape {N}. The slice specs of the tensors to be restored. + * @param dtypes shape {N}. The list of expected dtype for the tensors. Must match + * @return a new instance of Restore + * @see org.tensorflow.op.train.Restore + */ + public Restore restore(Operand prefix, Operand tensorNames, + Operand shapeAndSlices, List> dtypes) { + return Restore.create(scope, prefix, tensorNames, shapeAndSlices, dtypes); + } + + /** + * Builds an {@link ResourceSparseApplyAdadelta} operation + * + * @param var + * @param accum Should be from a Variable(). + * @param accumUpdate : Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyAdadelta + * @see org.tensorflow.op.train.ResourceSparseApplyAdadelta + */ + public ResourceSparseApplyAdadelta resourceSparseApplyAdadelta( + Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, + Operand epsilon, Operand grad, Operand indices, + ResourceSparseApplyAdadelta.Options... options) { + return ResourceSparseApplyAdadelta.create(scope, var, accum, accumUpdate, lr, rho, epsilon, grad, indices, options); + } + + /** + * Builds an {@link ResourceApplyCenteredRmsProp} operation + * + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyCenteredRmsProp + * @see org.tensorflow.op.train.ResourceApplyCenteredRmsProp + */ + public ResourceApplyCenteredRmsProp resourceApplyCenteredRmsProp(Operand var, + Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, + Operand momentum, Operand epsilon, Operand grad, + ResourceApplyCenteredRmsProp.Options... options) { + return ResourceApplyCenteredRmsProp.create(scope, var, mg, ms, mom, lr, rho, momentum, epsilon, grad, options); + } + + /** + * Builds an {@link SparseApplyAdagradDa} operation + * + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of SparseApplyAdagradDa + * @see org.tensorflow.op.train.SparseApplyAdagradDa + */ + public SparseApplyAdagradDa sparseApplyAdagradDa(Operand var, + Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, + Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, + SparseApplyAdagradDa.Options... options) { + return SparseApplyAdagradDa.create(scope, var, gradientAccumulator, gradientSquaredAccumulator, grad, indices, lr, l1, l2, globalStep, options); + } + + /** + * Builds an {@link AccumulatorSetGlobalStep} operation + * + * @param handle The handle to an accumulator. + * @param newGlobalStep The new global_step value to set. + * @return a new instance of AccumulatorSetGlobalStep + * @see org.tensorflow.op.train.AccumulatorSetGlobalStep + */ + public AccumulatorSetGlobalStep accumulatorSetGlobalStep(Operand handle, + Operand newGlobalStep) { + return AccumulatorSetGlobalStep.create(scope, handle, newGlobalStep); + } + + /** + * Builds an {@link ResourceSparseApplyFtrl} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyFtrl + * @see org.tensorflow.op.train.ResourceSparseApplyFtrl + */ + public ResourceSparseApplyFtrl resourceSparseApplyFtrl(Operand var, + Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, + Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, + ResourceSparseApplyFtrl.Options... options) { + return ResourceSparseApplyFtrl.create(scope, var, accum, linear, grad, indices, lr, l1, l2, l2Shrinkage, lrPower, options); + } + + /** + * Builds an {@link ApplyFtrl} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regulariation. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ApplyFtrl + * @see org.tensorflow.op.train.ApplyFtrl + */ + public ApplyFtrl applyFtrl(Operand var, Operand accum, Operand linear, + Operand grad, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, + Operand lrPower, ApplyFtrl.Options... options) { + return ApplyFtrl.create(scope, var, accum, linear, grad, lr, l1, l2, l2Shrinkage, lrPower, options); + } + + /** + * Builds an {@link ResourceApplyMomentum} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyMomentum + * @see org.tensorflow.op.train.ResourceApplyMomentum + */ + public ResourceApplyMomentum resourceApplyMomentum(Operand var, Operand accum, + Operand lr, Operand grad, Operand momentum, + ResourceApplyMomentum.Options... options) { + return ResourceApplyMomentum.create(scope, var, accum, lr, grad, momentum, options); + } + + /** + * Builds an {@link RestoreSlice} operation + * + * @param filePattern Must have a single element. The pattern of the files from + * @param tensorName Must have a single element. The name of the tensor to be + * @param shapeAndSlice Scalar. The shapes and slice specifications to use when + * @param dt The type of the tensor to be restored. + * @param options carries optional attributes values + * @return a new instance of RestoreSlice + * @see org.tensorflow.op.train.RestoreSlice + */ + public RestoreSlice restoreSlice(Operand filePattern, Operand tensorName, + Operand shapeAndSlice, Class dt, RestoreSlice.Options... options) { + return RestoreSlice.create(scope, filePattern, tensorName, shapeAndSlice, dt, options); + } + + /** + * Builds an {@link ResourceSparseApplyMomentum} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyMomentum + * @see org.tensorflow.op.train.ResourceSparseApplyMomentum + */ + public ResourceSparseApplyMomentum resourceSparseApplyMomentum( + Operand var, Operand accum, Operand lr, Operand grad, Operand indices, + Operand momentum, ResourceSparseApplyMomentum.Options... options) { + return ResourceSparseApplyMomentum.create(scope, var, accum, lr, grad, indices, momentum, options); + } + + /** + * Builds an {@link ResourceApplyGradientDescent} operation + * + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyGradientDescent + * @see org.tensorflow.op.train.ResourceApplyGradientDescent + */ + public ResourceApplyGradientDescent resourceApplyGradientDescent(Operand var, + Operand alpha, Operand delta, ResourceApplyGradientDescent.Options... options) { + return ResourceApplyGradientDescent.create(scope, var, alpha, delta, options); + } + + /** + * Builds an {@link AccumulatorNumAccumulated} operation + * + * @param handle The handle to an accumulator. + * @return a new instance of AccumulatorNumAccumulated + * @see org.tensorflow.op.train.AccumulatorNumAccumulated + */ + public AccumulatorNumAccumulated accumulatorNumAccumulated(Operand handle) { + return AccumulatorNumAccumulated.create(scope, handle); + } + + /** + * Builds an {@link PreventGradient} operation + * + * @param input any tensor. + * @param options carries optional attributes values + * @return a new instance of PreventGradient + * @see org.tensorflow.op.train.PreventGradient + */ + public PreventGradient preventGradient(Operand input, + PreventGradient.Options... options) { + return PreventGradient.create(scope, input, options); + } + + /** + * Builds an {@link ResourceApplyAdadelta} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param accumUpdate Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdadelta + * @see org.tensorflow.op.train.ResourceApplyAdadelta + */ + public ResourceApplyAdadelta resourceApplyAdadelta(Operand var, Operand accum, + Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, + ResourceApplyAdadelta.Options... options) { + return ResourceApplyAdadelta.create(scope, var, accum, accumUpdate, lr, rho, epsilon, grad, options); + } + + /** + * Builds an {@link ResourceApplyAdagradDa} operation + * + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdagradDa + * @see org.tensorflow.op.train.ResourceApplyAdagradDa + */ + public ResourceApplyAdagradDa resourceApplyAdagradDa(Operand var, + Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, + Operand lr, Operand l1, Operand l2, Operand globalStep, + ResourceApplyAdagradDa.Options... options) { + return ResourceApplyAdagradDa.create(scope, var, gradientAccumulator, gradientSquaredAccumulator, grad, lr, l1, l2, globalStep, options); + } + + /** + * Builds an {@link ApplyGradientDescent} operation + * + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ApplyGradientDescent + * @see org.tensorflow.op.train.ApplyGradientDescent + */ + public ApplyGradientDescent applyGradientDescent(Operand var, Operand alpha, + Operand delta, ApplyGradientDescent.Options... options) { + return ApplyGradientDescent.create(scope, var, alpha, delta, options); + } + + /** + * Builds an {@link ResourceApplyProximalGradientDescent} operation + * + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyProximalGradientDescent + * @see org.tensorflow.op.train.ResourceApplyProximalGradientDescent + */ + public ResourceApplyProximalGradientDescent resourceApplyProximalGradientDescent( + Operand var, Operand alpha, Operand l1, Operand l2, Operand delta, + ResourceApplyProximalGradientDescent.Options... options) { + return ResourceApplyProximalGradientDescent.create(scope, var, alpha, l1, l2, delta, options); + } + + /** + * Builds an {@link ResourceApplyAdam} operation + * + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param beta2Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdam + * @see org.tensorflow.op.train.ResourceApplyAdam + */ + public ResourceApplyAdam resourceApplyAdam(Operand var, Operand m, Operand v, + Operand beta1Power, Operand beta2Power, Operand lr, Operand beta1, + Operand beta2, Operand epsilon, Operand grad, ResourceApplyAdam.Options... options) { + return ResourceApplyAdam.create(scope, var, m, v, beta1Power, beta2Power, lr, beta1, beta2, epsilon, grad, options); + } + + /** + * Builds an {@link SdcaFprint} operation + * + * @param input vector of strings to compute fingerprints on. + * @return a new instance of SdcaFprint + * @see org.tensorflow.op.train.SdcaFprint + */ + public SdcaFprint sdcaFprint(Operand input) { + return SdcaFprint.create(scope, input); + } + + /** + * Builds an {@link ResourceSparseApplyProximalAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyProximalAdagrad + * @see org.tensorflow.op.train.ResourceSparseApplyProximalAdagrad + */ + public ResourceSparseApplyProximalAdagrad resourceSparseApplyProximalAdagrad( + Operand var, Operand accum, Operand lr, Operand l1, Operand l2, + Operand grad, Operand indices, ResourceSparseApplyProximalAdagrad.Options... options) { + return ResourceSparseApplyProximalAdagrad.create(scope, var, accum, lr, l1, l2, grad, indices, options); + } + + /** + * Builds an {@link ResourceSparseApplyProximalGradientDescent} operation + * + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyProximalGradientDescent + * @see org.tensorflow.op.train.ResourceSparseApplyProximalGradientDescent + */ + public ResourceSparseApplyProximalGradientDescent resourceSparseApplyProximalGradientDescent( + Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, + Operand indices, ResourceSparseApplyProximalGradientDescent.Options... options) { + return ResourceSparseApplyProximalGradientDescent.create(scope, var, alpha, l1, l2, grad, indices, options); + } + + /** + * Builds an {@link ApplyRmsProp} operation + * + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyRmsProp + * @see org.tensorflow.op.train.ApplyRmsProp + */ + public ApplyRmsProp applyRmsProp(Operand var, Operand ms, Operand mom, + Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, + ApplyRmsProp.Options... options) { + return ApplyRmsProp.create(scope, var, ms, mom, lr, rho, momentum, epsilon, grad, options); + } + + /** + * Builds an {@link GenerateVocabRemapping} operation + * + * @param newVocabFile Path to the new vocab file. + * @param oldVocabFile Path to the old vocab file. + * @param newVocabOffset How many entries into the new vocab file to start reading. + * @param numNewVocab Number of entries in the new vocab file to remap. + * @param options carries optional attributes values + * @return a new instance of GenerateVocabRemapping + * @see org.tensorflow.op.train.GenerateVocabRemapping + */ + public GenerateVocabRemapping generateVocabRemapping(Operand newVocabFile, + Operand oldVocabFile, Long newVocabOffset, Long numNewVocab, + GenerateVocabRemapping.Options... options) { + return GenerateVocabRemapping.create(scope, newVocabFile, oldVocabFile, newVocabOffset, numNewVocab, options); + } + + /** + * Builds an {@link SparseApplyAdadelta} operation + * + * @param var + * @param accum Should be from a Variable(). + * @param accumUpdate : Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyAdadelta + * @see org.tensorflow.op.train.SparseApplyAdadelta + */ + public SparseApplyAdadelta sparseApplyAdadelta(Operand var, + Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, + Operand grad, Operand indices, SparseApplyAdadelta.Options... options) { + return SparseApplyAdadelta.create(scope, var, accum, accumUpdate, lr, rho, epsilon, grad, indices, options); + } + + /** + * Builds an {@link ResourceApplyProximalAdagrad} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyProximalAdagrad + * @see org.tensorflow.op.train.ResourceApplyProximalAdagrad + */ + public ResourceApplyProximalAdagrad resourceApplyProximalAdagrad(Operand var, + Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, + ResourceApplyProximalAdagrad.Options... options) { + return ResourceApplyProximalAdagrad.create(scope, var, accum, lr, l1, l2, grad, options); + } + + /** + * Builds an {@link ConditionalAccumulator} operation + * + * @param dtype The type of the value being accumulated. + * @param shape The shape of the values, can be [], in which case shape is unknown. + * @param options carries optional attributes values + * @return a new instance of ConditionalAccumulator + * @see org.tensorflow.op.train.ConditionalAccumulator + */ + public ConditionalAccumulator conditionalAccumulator(Class dtype, Shape shape, + ConditionalAccumulator.Options... options) { + return ConditionalAccumulator.create(scope, dtype, shape, options); + } + + /** + * Builds an {@link ResourceApplyPowerSign} operation + * + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param logbase Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyPowerSign + * @see org.tensorflow.op.train.ResourceApplyPowerSign + */ + public ResourceApplyPowerSign resourceApplyPowerSign(Operand var, Operand m, + Operand lr, Operand logbase, Operand signDecay, Operand beta, Operand grad, + ResourceApplyPowerSign.Options... options) { + return ResourceApplyPowerSign.create(scope, var, m, lr, logbase, signDecay, beta, grad, options); + } + + /** + * Builds an {@link ApplyProximalGradientDescent} operation + * + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ApplyProximalGradientDescent + * @see org.tensorflow.op.train.ApplyProximalGradientDescent + */ + public ApplyProximalGradientDescent applyProximalGradientDescent(Operand var, + Operand alpha, Operand l1, Operand l2, Operand delta, + ApplyProximalGradientDescent.Options... options) { + return ApplyProximalGradientDescent.create(scope, var, alpha, l1, l2, delta, options); + } + + /** + * Builds an {@link ResourceSparseApplyCenteredRmsProp} operation + * + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyCenteredRmsProp + * @see org.tensorflow.op.train.ResourceSparseApplyCenteredRmsProp + */ + public ResourceSparseApplyCenteredRmsProp resourceSparseApplyCenteredRmsProp( + Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, + Operand momentum, Operand epsilon, Operand grad, Operand indices, + ResourceSparseApplyCenteredRmsProp.Options... options) { + return ResourceSparseApplyCenteredRmsProp.create(scope, var, mg, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); + } + + /** + * Builds an {@link SparseApplyFtrl} operation + * + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of SparseApplyFtrl + * @see org.tensorflow.op.train.SparseApplyFtrl + */ + public SparseApplyFtrl sparseApplyFtrl(Operand var, Operand accum, + Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, + Operand l2, Operand l2Shrinkage, Operand lrPower, + SparseApplyFtrl.Options... options) { + return SparseApplyFtrl.create(scope, var, accum, linear, grad, indices, lr, l1, l2, l2Shrinkage, lrPower, options); + } + + /** + * Builds an {@link SparseApplyCenteredRmsProp} operation + * + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of SparseApplyCenteredRmsProp + * @see org.tensorflow.op.train.SparseApplyCenteredRmsProp + */ + public SparseApplyCenteredRmsProp sparseApplyCenteredRmsProp( + Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, + Operand momentum, Operand epsilon, Operand grad, Operand indices, + SparseApplyCenteredRmsProp.Options... options) { + return SparseApplyCenteredRmsProp.create(scope, var, mg, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); + } + + /** + * Builds an {@link MergeV2Checkpoints} operation + * + * @param checkpointPrefixes prefixes of V2 checkpoints to merge. + * @param destinationPrefix scalar. The desired final prefix. Allowed to be the same + * @param options carries optional attributes values + * @return a new instance of MergeV2Checkpoints + * @see org.tensorflow.op.train.MergeV2Checkpoints + */ + public MergeV2Checkpoints mergeV2Checkpoints(Operand checkpointPrefixes, + Operand destinationPrefix, MergeV2Checkpoints.Options... options) { + return MergeV2Checkpoints.create(scope, checkpointPrefixes, destinationPrefix, options); + } + + /** + * Builds an {@link ApplyAdagradDa} operation + * + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ApplyAdagradDa + * @see org.tensorflow.op.train.ApplyAdagradDa + */ + public ApplyAdagradDa applyAdagradDa(Operand var, Operand gradientAccumulator, + Operand gradientSquaredAccumulator, Operand grad, Operand lr, Operand l1, + Operand l2, Operand globalStep, ApplyAdagradDa.Options... options) { + return ApplyAdagradDa.create(scope, var, gradientAccumulator, gradientSquaredAccumulator, grad, lr, l1, l2, globalStep, options); + } + + /** + * Builds an {@link TileGrad} operation + * + * @param input + * @param multiples + * @return a new instance of TileGrad + * @see org.tensorflow.op.train.TileGrad + */ + public TileGrad tileGrad(Operand input, Operand multiples) { + return TileGrad.create(scope, input, multiples); + } + + /** + * Builds an {@link ApplyCenteredRmsProp} operation + * + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyCenteredRmsProp + * @see org.tensorflow.op.train.ApplyCenteredRmsProp + */ + public ApplyCenteredRmsProp applyCenteredRmsProp(Operand var, Operand mg, + Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, + Operand epsilon, Operand grad, ApplyCenteredRmsProp.Options... options) { + return ApplyCenteredRmsProp.create(scope, var, mg, ms, mom, lr, rho, momentum, epsilon, grad, options); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Compute_func_Pointer_TF_OpKernelContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Compute_func_Pointer_TF_OpKernelContext.java new file mode 100644 index 00000000000..00cdd257eee --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Compute_func_Pointer_TF_OpKernelContext.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Compute_func_Pointer_TF_OpKernelContext extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Compute_func_Pointer_TF_OpKernelContext(Pointer p) { super(p); } + protected Compute_func_Pointer_TF_OpKernelContext() { allocate(); } + private native void allocate(); + public native void call(Pointer arg0, TF_OpKernelContext arg1); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Create_func_TF_OpKernelConstruction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Create_func_TF_OpKernelConstruction.java new file mode 100644 index 00000000000..b36f6f488b0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Create_func_TF_OpKernelConstruction.java @@ -0,0 +1,48 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Allocates a new kernel builder and returns a pointer to it. +// +// If non-null, TensorFlow will call create_func when it needs to instantiate +// the kernel. The pointer returned by create_func will be passed to +// compute_func and delete_func, thereby functioning as a "this" pointer for +// referring to kernel instances. +// +// The TF_OpKernelConstruction pointer passed to create_func is owned by +// TensorFlow and will be deleted once create_func returns. It must not be used +// after this. +// +// When TensorFlow needs to perform a computation with this kernel, it will +// call compute_func. This function will receive the pointer returned by +// create_func (or null if no create_func was provided), along with the inputs +// to the computation. +// +// The TF_OpKernelContext pointer received by compute_func is owned by +// TensorFlow and will be deleted once compute_func returns. It must not be used +// after this. +// +// Finally, when TensorFlow no longer needs the kernel, it will call +// delete_func if one is provided. This function will receive the pointer +// returned in `create_func` or nullptr if no `create_func` was provided. +// +// The caller should pass the result of this function to +// TF_RegisterKernelBuilder, which will take ownership of the pointer. If, for +// some reason, the kernel builder will not be registered, the caller should +// delete it with TF_DeleteKernelBuilder. +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Create_func_TF_OpKernelConstruction extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Create_func_TF_OpKernelConstruction(Pointer p) { super(p); } + protected Create_func_TF_OpKernelConstruction() { allocate(); } + private native void allocate(); + public native Pointer call(TF_OpKernelConstruction arg0); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Deallocator_Pointer_long_Pointer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Deallocator_Pointer_long_Pointer.java new file mode 100644 index 00000000000..30f542407da --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Deallocator_Pointer_long_Pointer.java @@ -0,0 +1,30 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Return a new tensor that holds the bytes data[0,len-1]. +// +// The data will be deallocated by a subsequent call to TF_DeleteTensor via: +// (*deallocator)(data, len, deallocator_arg) +// Clients must provide a custom deallocator function so they can pass in +// memory managed by something like numpy. +// +// May return NULL (and invoke the deallocator) if the provided data buffer +// (data, len) is inconsistent with a tensor of the given TF_DataType +// and the shape specified by (dima, num_dims). +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Deallocator_Pointer_long_Pointer extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Deallocator_Pointer_long_Pointer(Pointer p) { super(p); } + protected Deallocator_Pointer_long_Pointer() { allocate(); } + private native void allocate(); + public native void call(Pointer data, @Cast("size_t") long len, Pointer arg); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Delete_func_Pointer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Delete_func_Pointer.java new file mode 100644 index 00000000000..e19765c5be1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Delete_func_Pointer.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Delete_func_Pointer extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Delete_func_Pointer(Pointer p) { super(p); } + protected Delete_func_Pointer() { allocate(); } + private native void allocate(); + public native void call(Pointer arg0); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Listener_BytePointer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Listener_BytePointer.java new file mode 100644 index 00000000000..126bd63508b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Listener_BytePointer.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Register a listener method that processes printed messages. +// +// If any listeners are registered, the print operator will call all listeners +// with the printed messages and immediately return without writing to the +// logs. +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Listener_BytePointer extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Listener_BytePointer(Pointer p) { super(p); } + protected Listener_BytePointer() { allocate(); } + private native void allocate(); + public native void call(@Cast("const char*") BytePointer arg0); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Listener_String.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Listener_String.java new file mode 100644 index 00000000000..5f0924e8a04 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Listener_String.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Listener_String extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Listener_String(Pointer p) { super(p); } + protected Listener_String() { allocate(); } + private native void allocate(); + public native void call(String arg0); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java new file mode 100644 index 00000000000..dee746680a1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java @@ -0,0 +1,22 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Sets the shape inference function for the op. +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Shape_inference_func_TF_ShapeInferenceContext_TF_Status extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Shape_inference_func_TF_ShapeInferenceContext_TF_Status(Pointer p) { super(p); } + protected Shape_inference_func_TF_ShapeInferenceContext_TF_Status() { allocate(); } + private native void allocate(); + public native void call(TF_ShapeInferenceContext ctx, + TF_Status status); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_Context.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_Context.java new file mode 100644 index 00000000000..f0ec95e0916 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_Context.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// "Context" under which operations/functions are executed. It encapsulates +// things like the available devices, resource manager etc. +// TFE_Context must outlive all tensor handles created using it. In other +// words, TFE_DeleteContext() must be called after all tensor handles have +// been deleted (with TFE_DeleteTensorHandle). +// +// TODO(ashankar): Merge with TF_Session? +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TFE_Context extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TFE_Context() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TFE_Context(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_ContextOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_ContextOptions.java new file mode 100644 index 00000000000..2d14cb174c9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_ContextOptions.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +// #endif + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TFE_ContextOptions extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TFE_ContextOptions() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TFE_ContextOptions(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_Op.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_Op.java new file mode 100644 index 00000000000..71746288ce1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_Op.java @@ -0,0 +1,29 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Description of the TensorFlow op to execute. +// +// Assumes that the provided 'ctx' outlives the returned TFE_Op, i.e., +// TFE_DeleteOp() is called before TFE_DeleteContext(). +// +// Very similar to TF_OperationDescription with some differences: +// (1) TF_Output or TFE_TensorHandle* as arguments to TF_AddInput, +// TF_AddInputList +// (2) TF_ColocateWith, TF_AddControlInput etc. do not make sense. +// (3) Implementation detail: Avoid use of NodeBuilder/NodeDefBuilder since +// the additional sanity checks there seem unnecessary; +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TFE_Op extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TFE_Op() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TFE_Op(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_TensorDebugInfo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_TensorDebugInfo.java new file mode 100644 index 00000000000..6d416a2049e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_TensorDebugInfo.java @@ -0,0 +1,22 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Debugging/Profiling information for TFE_TensorHandle +// +// TFE_TensorDebugInfo contains information useful for debugging and +// profiling tensors. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TFE_TensorDebugInfo extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TFE_TensorDebugInfo() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TFE_TensorDebugInfo(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_TensorHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_TensorHandle.java new file mode 100644 index 00000000000..eb9f0807d0f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TFE_TensorHandle.java @@ -0,0 +1,23 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// A handle to a tensor on a device. +// +// Like a TF_Tensor, a TFE_TensorHandle refers to a tensor with a value, shape, +// type etc. Unlike a TF_Tensor, a TFE_TensorHandle may refer to such tensors +// placed in memory of different devices or remote address spaces. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TFE_TensorHandle extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TFE_TensorHandle() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TFE_TensorHandle(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ApiDefMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ApiDefMap.java new file mode 100644 index 00000000000..b44d0bcf86a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ApiDefMap.java @@ -0,0 +1,26 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// TF_ApiDefMap encapsulates a collection of API definitions for an operation. +// +// This object maps the name of a TensorFlow operation to a description of the +// API to generate for it, as defined by the ApiDef protocol buffer ( +// https://www.tensorflow.org/code/tensorflow/core/framework/api_def.proto) +// +// The ApiDef messages are typically used to generate convenience wrapper +// functions for TensorFlow operations in various language bindings. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_ApiDefMap extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_ApiDefMap() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_ApiDefMap(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_AttrMetadata.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_AttrMetadata.java new file mode 100644 index 00000000000..4a6f9127d6d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_AttrMetadata.java @@ -0,0 +1,55 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// TF_AttrMetadata describes the value of an attribute on an operation. +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_AttrMetadata extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public TF_AttrMetadata() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public TF_AttrMetadata(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_AttrMetadata(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public TF_AttrMetadata position(long position) { + return (TF_AttrMetadata)super.position(position); + } + + // A boolean: 1 if the attribute value is a list, 0 otherwise. + public native @Cast("unsigned char") byte is_list(); public native TF_AttrMetadata is_list(byte setter); + + // Length of the list if is_list is true. Undefined otherwise. + public native @Cast("int64_t") long list_size(); public native TF_AttrMetadata list_size(long setter); + + // Type of elements of the list if is_list != 0. + // Type of the single value stored in the attribute if is_list == 0. + public native @Cast("TF_AttrType") int type(); public native TF_AttrMetadata type(int setter); + + // Total size the attribute value. + // The units of total_size depend on is_list and type. + // (1) If type == TF_ATTR_STRING and is_list == 0 + // then total_size is the byte size of the string + // valued attribute. + // (2) If type == TF_ATTR_STRING and is_list == 1 + // then total_size is the cumulative byte size + // of all the strings in the list. + // (3) If type == TF_ATTR_SHAPE and is_list == 0 + // then total_size is the number of dimensions + // of the shape valued attribute, or -1 + // if its rank is unknown. + // (4) If type == TF_ATTR_SHAPE and is_list == 1 + // then total_size is the cumulative number + // of dimensions of all shapes in the list. + // (5) Otherwise, total_size is undefined. + public native @Cast("int64_t") long total_size(); public native TF_AttrMetadata total_size(long setter); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Buffer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Buffer.java new file mode 100644 index 00000000000..b091dff3712 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Buffer.java @@ -0,0 +1,46 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// -------------------------------------------------------------------------- +// TF_Buffer holds a pointer to a block of data and its associated length. +// Typically, the data consists of a serialized protocol buffer, but other data +// may also be held in a buffer. +// +// By default, TF_Buffer itself does not do any memory management of the +// pointed-to block. If need be, users of this struct should specify how to +// deallocate the block by setting the `data_deallocator` function pointer. +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Buffer extends org.tensorflow.c_api.AbstractTF_Buffer { + static { Loader.load(); } + /** Default native constructor. */ + public TF_Buffer() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public TF_Buffer(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Buffer(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public TF_Buffer position(long position) { + return (TF_Buffer)super.position(position); + } + + public native @Const Pointer data(); public native TF_Buffer data(Pointer data); + public native @Cast("size_t") long length(); public native TF_Buffer length(long setter); + public static class Data_deallocator_Pointer_long extends FunctionPointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Data_deallocator_Pointer_long(Pointer p) { super(p); } + protected Data_deallocator_Pointer_long() { allocate(); } + private native void allocate(); + public native void call(Pointer data, @Cast("size_t") long length); + } + public native Data_deallocator_Pointer_long data_deallocator(); public native TF_Buffer data_deallocator(Data_deallocator_Pointer_long setter); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DeprecatedSession.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DeprecatedSession.java new file mode 100644 index 00000000000..135364f6647 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DeprecatedSession.java @@ -0,0 +1,23 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// -------------------------------------------------------------------------- +// The deprecated session API. Please switch to the above instead of +// TF_ExtendGraph(). This deprecated API can be removed at any time without +// notice. + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_DeprecatedSession extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_DeprecatedSession() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_DeprecatedSession(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DeviceList.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DeviceList.java new file mode 100644 index 00000000000..61a95ccdee9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DeviceList.java @@ -0,0 +1,18 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_DeviceList extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_DeviceList() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_DeviceList(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DimensionHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DimensionHandle.java new file mode 100644 index 00000000000..7cb8ff0fcd3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_DimensionHandle.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +// #endif + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_DimensionHandle extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_DimensionHandle() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_DimensionHandle(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Function.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Function.java new file mode 100644 index 00000000000..89423c1da31 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Function.java @@ -0,0 +1,21 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// TF_Function is a grouping of operations with defined inputs and outputs. +// Once created and added to graphs, functions can be invoked by creating an +// operation whose operation type matches the function name. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Function extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Function() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Function(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_FunctionOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_FunctionOptions.java new file mode 100644 index 00000000000..4005db8ea6f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_FunctionOptions.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Function definition options. TODO(iga): Define and implement +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_FunctionOptions extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_FunctionOptions() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_FunctionOptions(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Graph.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Graph.java new file mode 100644 index 00000000000..1ed1bd83735 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Graph.java @@ -0,0 +1,26 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// TODO(jeff,sanjay): +// - export functions to set Config fields + +// -------------------------------------------------------------------------- +// The new graph construction API, still under development. + +// Represents a computation graph. Graphs may be shared between sessions. +// Graphs are thread-safe when used as directed below. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Graph extends org.tensorflow.c_api.AbstractTF_Graph { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Graph() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Graph(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ImportGraphDefOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ImportGraphDefOptions.java new file mode 100644 index 00000000000..3ced996c971 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ImportGraphDefOptions.java @@ -0,0 +1,20 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// TF_ImportGraphDefOptions holds options that can be passed to +// TF_GraphImportGraphDef. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_ImportGraphDefOptions extends org.tensorflow.c_api.AbstractTF_ImportGraphDefOptions { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_ImportGraphDefOptions() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_ImportGraphDefOptions(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ImportGraphDefResults.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ImportGraphDefResults.java new file mode 100644 index 00000000000..5a64982d866 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ImportGraphDefResults.java @@ -0,0 +1,20 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// TF_ImportGraphDefResults holds results that are generated by +// TF_GraphImportGraphDefWithResults(). +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_ImportGraphDefResults extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_ImportGraphDefResults() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_ImportGraphDefResults(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Input.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Input.java new file mode 100644 index 00000000000..2e1782d7fd6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Input.java @@ -0,0 +1,30 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Represents a specific input of an operation. +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Input extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public TF_Input() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public TF_Input(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Input(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public TF_Input position(long position) { + return (TF_Input)super.position(position); + } + + public native TF_Operation oper(); public native TF_Input oper(TF_Operation setter); + public native int index(); public native TF_Input index(int setter); // The index of the input within oper. +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_KernelBuilder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_KernelBuilder.java new file mode 100644 index 00000000000..3932251835a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_KernelBuilder.java @@ -0,0 +1,31 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// -------------------------------------------------------------------------- +// C API for TensorFlow Kernels. +// +// This API allows developers to register custom kernel implementations for +// TensorFlow. +// +// See c_api.h header comments for a discussion about API conventions. +// +// Users wishing to extend TensorFlow with new kernels will call +// `TF_NewKernelBuilder`. The resulting kernel builder can be registered with +// `TF_RegisterKernelBuilder`, which will allow TF to construct user-provided +// kernels when necessary. + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_KernelBuilder extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_KernelBuilder() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_KernelBuilder(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Library.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Library.java new file mode 100644 index 00000000000..48919a8fda1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Library.java @@ -0,0 +1,22 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// -------------------------------------------------------------------------- +// Load plugins containing custom ops and kernels + +// TF_Library holds information about dynamically loaded TensorFlow plugins. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Library extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Library() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Library(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpDefinitionBuilder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpDefinitionBuilder.java new file mode 100644 index 00000000000..184cd487f26 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpDefinitionBuilder.java @@ -0,0 +1,17 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_OpDefinitionBuilder extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_OpDefinitionBuilder() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_OpDefinitionBuilder(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpKernelConstruction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpKernelConstruction.java new file mode 100644 index 00000000000..b9b393859fd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpKernelConstruction.java @@ -0,0 +1,17 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_OpKernelConstruction extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_OpKernelConstruction() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_OpKernelConstruction(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpKernelContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpKernelContext.java new file mode 100644 index 00000000000..fbfa2527a67 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OpKernelContext.java @@ -0,0 +1,17 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_OpKernelContext extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_OpKernelContext() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_OpKernelContext(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Operation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Operation.java new file mode 100644 index 00000000000..4ea255b423d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Operation.java @@ -0,0 +1,21 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Operation that has been added to the graph. Valid until the graph is +// deleted -- in particular adding a new operation to the graph does not +// invalidate old TF_Operation* pointers. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Operation extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Operation() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Operation(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OperationDescription.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OperationDescription.java new file mode 100644 index 00000000000..04f526bab77 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_OperationDescription.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Operation being built. The underlying graph must outlive this. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_OperationDescription extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_OperationDescription() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_OperationDescription(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Output.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Output.java new file mode 100644 index 00000000000..3efb91eb7cd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Output.java @@ -0,0 +1,30 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// Represents a specific output of an operation. +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Output extends Pointer { + static { Loader.load(); } + /** Default native constructor. */ + public TF_Output() { super((Pointer)null); allocate(); } + /** Native array allocator. Access with {@link Pointer#position(long)}. */ + public TF_Output(long size) { super((Pointer)null); allocateArray(size); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Output(Pointer p) { super(p); } + private native void allocate(); + private native void allocateArray(long size); + @Override public TF_Output position(long position) { + return (TF_Output)super.position(position); + } + + public native TF_Operation oper(); public native TF_Output oper(TF_Operation setter); + public native int index(); public native TF_Output index(int setter); // The index of the output within oper. +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Server.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Server.java new file mode 100644 index 00000000000..00221c91734 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Server.java @@ -0,0 +1,27 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// -------------------------------------------------------------------------- +// In-process TensorFlow server functionality, for use in distributed training. +// A Server instance encapsulates a set of devices and a Session target that +// can participate in distributed training. A server belongs to a cluster +// (specified by a ClusterSpec), and corresponds to a particular task in a +// named job. The server can communicate with any other server in the same +// cluster. + +// In-process TensorFlow server. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Server extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Server() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Server(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Session.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Session.java new file mode 100644 index 00000000000..a85038a5670 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Session.java @@ -0,0 +1,24 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// TODO(josh11b): Register OpDef, available to all operations added +// to this graph. + +// -------------------------------------------------------------------------- +// API for driving Graph execution. + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Session extends org.tensorflow.c_api.AbstractTF_Session { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Session() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Session(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_SessionOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_SessionOptions.java new file mode 100644 index 00000000000..ae7d7d48bf9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_SessionOptions.java @@ -0,0 +1,20 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +// -------------------------------------------------------------------------- +// TF_SessionOptions holds options that can be passed during session creation. +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_SessionOptions extends org.tensorflow.c_api.AbstractTF_SessionOptions { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_SessionOptions() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_SessionOptions(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ShapeHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ShapeHandle.java new file mode 100644 index 00000000000..5c69f582182 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ShapeHandle.java @@ -0,0 +1,17 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_ShapeHandle extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_ShapeHandle() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_ShapeHandle(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ShapeInferenceContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ShapeInferenceContext.java new file mode 100644 index 00000000000..89c90706c56 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_ShapeInferenceContext.java @@ -0,0 +1,17 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_ShapeInferenceContext extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_ShapeInferenceContext() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_ShapeInferenceContext(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Status.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Status.java new file mode 100644 index 00000000000..cfa727ed7ff --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Status.java @@ -0,0 +1,19 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +// #endif + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Status extends org.tensorflow.c_api.AbstractTF_Status { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Status() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Status(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Tensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Tensor.java new file mode 100644 index 00000000000..e558ef6967e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_Tensor.java @@ -0,0 +1,36 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + +// #endif + +// -------------------------------------------------------------------------- +// TF_Tensor holds a multi-dimensional array of elements of a single data type. +// For all types other than TF_STRING, the data buffer stores elements +// in row major order. E.g. if data is treated as a vector of TF_DataType: +// +// element 0: index (0, ..., 0) +// element 1: index (0, ..., 1) +// ... +// +// The format for TF_STRING tensors is: +// start_offset: array[uint64] +// data: byte[...] +// +// The string length (as a varint), followed by the contents of the string +// is encoded at data[start_offset[i]]]. TF_StringEncode and TF_StringDecode +// facilitate this encoding. + +@Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_Tensor extends org.tensorflow.c_api.AbstractTF_Tensor { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public TF_Tensor() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_Tensor(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_WhileParams.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_WhileParams.java new file mode 100644 index 00000000000..8282de2d75e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/TF_WhileParams.java @@ -0,0 +1,37 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class TF_WhileParams extends Pointer { + static { Loader.load(); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public TF_WhileParams(Pointer p) { super(p); } + + // The number of inputs to the while loop, i.e. the number of loop variables. + // This is the size of cond_inputs, body_inputs, and body_outputs. + @MemberGetter public native int ninputs(); + + // The while condition graph. The inputs are the current values of the loop + // variables. The output should be a scalar boolean. + @MemberGetter public native TF_Graph cond_graph(); + @MemberGetter public native @Const TF_Output cond_inputs(); + public native @ByRef TF_Output cond_output(); public native TF_WhileParams cond_output(TF_Output setter); + + // The loop body graph. The inputs are the current values of the loop + // variables. The outputs are the updated values of the loop variables. + @MemberGetter public native TF_Graph body_graph(); + @MemberGetter public native @Const TF_Output body_inputs(); + @MemberGetter public native TF_Output body_outputs(); + + // Unique null-terminated name for this while loop. This is used as a prefix + // for created operations. + public native @Cast("const char*") BytePointer name(); public native TF_WhileParams name(BytePointer setter); +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Tensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Tensor.java new file mode 100644 index 00000000000..96c523c9030 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/Tensor.java @@ -0,0 +1,25 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +import static org.tensorflow.c_api.global.tensorflow.*; + /* end extern "C" */ +// #endif + +// #ifdef __cplusplus +// A workaround to ease conversion to and from numpy objects and +// TFE_TensorHandle's. +// +// TODO(ashankar): Figure out an alternative scheme that precludes the need for +// these API-boundary breaking methods. +@Namespace("tensorflow") @Opaque @Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public class Tensor extends Pointer { + /** Empty constructor. Calls {@code super((Pointer)null)}. */ + public Tensor() { super((Pointer)null); } + /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ + public Tensor(Pointer p) { super(p); } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/global/tensorflow.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/global/tensorflow.java new file mode 100644 index 00000000000..1b29fe5f693 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/c_api/global/tensorflow.java @@ -0,0 +1,3972 @@ +// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE + +package org.tensorflow.c_api.global; + +import org.tensorflow.c_api.*; + +import java.nio.*; +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.*; + +public class tensorflow extends org.tensorflow.c_api.presets.tensorflow { + static { Loader.load(); } + +// Parsed from tensorflow/c/tf_attrtype.h + +/* Copyright 2019 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_TF_ATTRTYPE_H_ +// #define TENSORFLOW_C_TF_ATTRTYPE_H_ + +// #ifdef __cplusplus +// #endif + +// TF_AttrType describes the type of the value of an attribute on an operation. +/** enum TF_AttrType */ +public static final int + TF_ATTR_STRING = 0, + TF_ATTR_INT = 1, + TF_ATTR_FLOAT = 2, + TF_ATTR_BOOL = 3, + TF_ATTR_TYPE = 4, + TF_ATTR_SHAPE = 5, + TF_ATTR_TENSOR = 6, + TF_ATTR_PLACEHOLDER = 7, + TF_ATTR_FUNC = 8; + +// #ifdef __cplusplus /* end extern "C" */ +// #endif + +// #endif // TENSORFLOW_C_TF_ATTRTYPE_H_ + + +// Parsed from tensorflow/c/tf_datatype.h + +/* Copyright 2019 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_TF_DATATYPE_H_ +// #define TENSORFLOW_C_TF_DATATYPE_H_ + +// #include + +// Macro to control visibility of exported symbols in the shared library (.so, +// .dylib, .dll). +// This duplicates the TF_EXPORT macro definition in +// tensorflow/core/platform/macros.h in order to keep this .h file independent +// of any other includes. +// #ifdef SWIG +// #define TF_CAPI_EXPORT +// #else +// #if defined(_WIN32) +// #ifdef TF_COMPILE_LIBRARY +// #define TF_CAPI_EXPORT __declspec(dllexport) +// #else +// #define TF_CAPI_EXPORT __declspec(dllimport) +// #endif // TF_COMPILE_LIBRARY +// #else +// #define TF_CAPI_EXPORT __attribute__((visibility("default"))) +// #endif // _WIN32 +// #endif // SWIG + +// #ifdef __cplusplus +// #endif + +// -------------------------------------------------------------------------- +// TF_DataType holds the type for a scalar value. E.g., one slot in a tensor. +// The enum values here are identical to corresponding values in types.proto. +/** enum TF_DataType */ +public static final int + TF_FLOAT = 1, + TF_DOUBLE = 2, + TF_INT32 = 3, // Int32 tensors are always in 'host' memory. + TF_UINT8 = 4, + TF_INT16 = 5, + TF_INT8 = 6, + TF_STRING = 7, + TF_COMPLEX64 = 8, // Single-precision complex + TF_COMPLEX = 8, // Old identifier kept for API backwards compatibility + TF_INT64 = 9, + TF_BOOL = 10, + TF_QINT8 = 11, // Quantized int8 + TF_QUINT8 = 12, // Quantized uint8 + TF_QINT32 = 13, // Quantized int32 + TF_BFLOAT16 = 14, // Float32 truncated to 16 bits. Only for cast ops. + TF_QINT16 = 15, // Quantized int16 + TF_QUINT16 = 16, // Quantized uint16 + TF_UINT16 = 17, + TF_COMPLEX128 = 18, // Double-precision complex + TF_HALF = 19, + TF_RESOURCE = 20, + TF_VARIANT = 21, + TF_UINT32 = 22, + TF_UINT64 = 23; + +// TF_DataTypeSize returns the sizeof() for the underlying type corresponding +// to the given TF_DataType enum value. Returns 0 for variable length types +// (eg. TF_STRING) or on failure. +public static native @Cast("size_t") long TF_DataTypeSize(@Cast("TF_DataType") int dt); + +// #ifdef __cplusplus /* end extern "C" */ +// #endif + +// #endif // TENSORFLOW_C_TF_DATATYPE_H_ + + +// Parsed from tensorflow/c/tf_status.h + +/* Copyright 2019 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_TF_STATUS_H_ +// #define TENSORFLOW_C_TF_STATUS_H_ + +// #ifdef SWIG +// #define TF_CAPI_EXPORT +// #else +// #if defined(_WIN32) +// #ifdef TF_COMPILE_LIBRARY +// #define TF_CAPI_EXPORT __declspec(dllexport) +// #else +// #define TF_CAPI_EXPORT __declspec(dllimport) +// #endif // TF_COMPILE_LIBRARY +// #else +// #define TF_CAPI_EXPORT __attribute__((visibility("default"))) +// #endif // _WIN32 +// #endif // SWIG + +// #ifdef __cplusplus +// Targeting ../TF_Status.java + + + +// -------------------------------------------------------------------------- +// TF_Code holds an error code. The enum values here are identical to +// corresponding values in error_codes.proto. +/** enum TF_Code */ +public static final int + TF_OK = 0, + TF_CANCELLED = 1, + TF_UNKNOWN = 2, + TF_INVALID_ARGUMENT = 3, + TF_DEADLINE_EXCEEDED = 4, + TF_NOT_FOUND = 5, + TF_ALREADY_EXISTS = 6, + TF_PERMISSION_DENIED = 7, + TF_UNAUTHENTICATED = 16, + TF_RESOURCE_EXHAUSTED = 8, + TF_FAILED_PRECONDITION = 9, + TF_ABORTED = 10, + TF_OUT_OF_RANGE = 11, + TF_UNIMPLEMENTED = 12, + TF_INTERNAL = 13, + TF_UNAVAILABLE = 14, + TF_DATA_LOSS = 15; + +// -------------------------------------------------------------------------- + +// Return a new status object. +public static native TF_Status TF_NewStatus(); + +// Delete a previously created status object. +public static native void TF_DeleteStatus(TF_Status arg0); + +// Record in *s. Any previous information is lost. +// A common use is to clear a status: TF_SetStatus(s, TF_OK, ""); +public static native void TF_SetStatus(TF_Status s, @Cast("TF_Code") int code, + @Cast("const char*") BytePointer msg); +public static native void TF_SetStatus(TF_Status s, @Cast("TF_Code") int code, + String msg); + +// Return the code record in *s. +public static native @Cast("TF_Code") int TF_GetCode(@Const TF_Status s); + +// Return a pointer to the (null-terminated) error message in *s. The +// return value points to memory that is only usable until the next +// mutation to *s. Always returns an empty string if TF_GetCode(s) is +// TF_OK. +public static native @Cast("const char*") BytePointer TF_Message(@Const TF_Status s); + +// #ifdef __cplusplus /* end extern "C" */ +// #endif + +// #endif // TENSORFLOW_C_TF_STATUS_H_ + + +// Parsed from tensorflow/c/tf_tensor.h + +/* Copyright 2019 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_TF_TENSOR_H_ +// #define TENSORFLOW_C_TF_TENSOR_H_ + +// #include +// #include + +// #include "tensorflow/c/tf_datatype.h" +// #include "tensorflow/c/tf_status.h" + +// Macro to control visibility of exported symbols in the shared library (.so, +// .dylib, .dll). +// This duplicates the TF_EXPORT macro definition in +// tensorflow/core/platform/macros.h in order to keep this .h file independent +// of any other includes. +// #ifdef SWIG +// #define TF_CAPI_EXPORT +// #else +// #if defined(_WIN32) +// #ifdef TF_COMPILE_LIBRARY +// #define TF_CAPI_EXPORT __declspec(dllexport) +// #else +// #define TF_CAPI_EXPORT __declspec(dllimport) +// #endif // TF_COMPILE_LIBRARY +// #else +// #define TF_CAPI_EXPORT __attribute__((visibility("default"))) +// #endif // _WIN32 +// #endif // SWIG + +// #ifdef __cplusplus +// Targeting ../TF_Tensor.java + + +// Targeting ../Deallocator_Pointer_long_Pointer.java + + +public static native TF_Tensor TF_NewTensor( + @Cast("TF_DataType") int arg0, @Cast("const int64_t*") LongPointer dims, int num_dims, Pointer data, @Cast("size_t") long len, + Deallocator_Pointer_long_Pointer deallocator, + Pointer deallocator_arg); +public static native TF_Tensor TF_NewTensor( + @Cast("TF_DataType") int arg0, @Cast("const int64_t*") LongBuffer dims, int num_dims, Pointer data, @Cast("size_t") long len, + Deallocator_Pointer_long_Pointer deallocator, + Pointer deallocator_arg); +public static native TF_Tensor TF_NewTensor( + @Cast("TF_DataType") int arg0, @Cast("const int64_t*") long[] dims, int num_dims, Pointer data, @Cast("size_t") long len, + Deallocator_Pointer_long_Pointer deallocator, + Pointer deallocator_arg); + +// Allocate and return a new Tensor. +// +// This function is an alternative to TF_NewTensor and should be used when +// memory is allocated to pass the Tensor to the C API. The allocated memory +// satisfies TensorFlow's memory alignment preferences and should be preferred +// over calling malloc and free. +// +// The caller must set the Tensor values by writing them to the pointer returned +// by TF_TensorData with length TF_TensorByteSize. +public static native TF_Tensor TF_AllocateTensor(@Cast("TF_DataType") int arg0, + @Cast("const int64_t*") LongPointer dims, + int num_dims, @Cast("size_t") long len); +public static native TF_Tensor TF_AllocateTensor(@Cast("TF_DataType") int arg0, + @Cast("const int64_t*") LongBuffer dims, + int num_dims, @Cast("size_t") long len); +public static native TF_Tensor TF_AllocateTensor(@Cast("TF_DataType") int arg0, + @Cast("const int64_t*") long[] dims, + int num_dims, @Cast("size_t") long len); + +// Deletes `tensor` and returns a new TF_Tensor with the same content if +// possible. Returns nullptr and leaves `tensor` untouched if not. +public static native TF_Tensor TF_TensorMaybeMove(TF_Tensor tensor); + +// Destroy a tensor. +public static native void TF_DeleteTensor(TF_Tensor arg0); + +// Return the type of a tensor element. +public static native @Cast("TF_DataType") int TF_TensorType(@Const TF_Tensor arg0); + +// Return the number of dimensions that the tensor has. +public static native int TF_NumDims(@Const TF_Tensor arg0); + +// Return the length of the tensor in the "dim_index" dimension. +// REQUIRES: 0 <= dim_index < TF_NumDims(tensor) +public static native @Cast("int64_t") long TF_Dim(@Const TF_Tensor tensor, int dim_index); + +// Return the size of the underlying data in bytes. +public static native @Cast("size_t") long TF_TensorByteSize(@Const TF_Tensor arg0); + +// Return a pointer to the underlying data buffer. +public static native Pointer TF_TensorData(@Const TF_Tensor arg0); + +// Returns the number of elements in the tensor. +public static native @Cast("int64_t") long TF_TensorElementCount(@Const TF_Tensor tensor); + +// Copy the internal data representation of `from` to `to`. `new_dims` and +// `num_new_dims` specify the new shape of the `to` tensor, `type` specifies its +// data type. On success, *status is set to TF_OK and the two tensors share the +// same data buffer. +// +// This call requires that the `from` tensor and the given type and shape (dims +// and num_dims) are "compatible" (i.e. they occupy the same number of bytes). +// Specifically, given from_type_size = TF_DataTypeSize(TF_TensorType(from)): +// +// ShapeElementCount(dims, num_dims) * TF_DataTypeSize(type) +// +// must equal +// +// TF_TensorElementCount(from) * from_type_size +// +// where TF_ShapeElementCount would be the number of elements in a tensor with +// the given shape. +// +// In addition, this function requires: +// * TF_DataTypeSize(TF_TensorType(from)) != 0 +// * TF_DataTypeSize(type) != 0 +// +// If any of the requirements are not met, *status is set to +// TF_INVALID_ARGUMENT. +public static native void TF_TensorBitcastFrom(@Const TF_Tensor from, + @Cast("TF_DataType") int type, TF_Tensor to, + @Cast("const int64_t*") LongPointer new_dims, + int num_new_dims, + TF_Status status); +public static native void TF_TensorBitcastFrom(@Const TF_Tensor from, + @Cast("TF_DataType") int type, TF_Tensor to, + @Cast("const int64_t*") LongBuffer new_dims, + int num_new_dims, + TF_Status status); +public static native void TF_TensorBitcastFrom(@Const TF_Tensor from, + @Cast("TF_DataType") int type, TF_Tensor to, + @Cast("const int64_t*") long[] new_dims, + int num_new_dims, + TF_Status status); + +// -------------------------------------------------------------------------- +// Encode the string `src` (`src_len` bytes long) into `dst` in the format +// required by TF_STRING tensors. Does not write to memory more than `dst_len` +// bytes beyond `*dst`. `dst_len` should be at least +// TF_StringEncodedSize(src_len). +// +// On success returns the size in bytes of the encoded string. +// Returns an error into `status` otherwise. +public static native @Cast("size_t") long TF_StringEncode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len, + @Cast("char*") BytePointer dst, @Cast("size_t") long dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringEncode(String src, @Cast("size_t") long src_len, + @Cast("char*") ByteBuffer dst, @Cast("size_t") long dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringEncode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len, + @Cast("char*") byte[] dst, @Cast("size_t") long dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringEncode(String src, @Cast("size_t") long src_len, + @Cast("char*") BytePointer dst, @Cast("size_t") long dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringEncode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len, + @Cast("char*") ByteBuffer dst, @Cast("size_t") long dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringEncode(String src, @Cast("size_t") long src_len, + @Cast("char*") byte[] dst, @Cast("size_t") long dst_len, + TF_Status status); + +// Decode a string encoded using TF_StringEncode. +// +// On success, sets `*dst` to the start of the decoded string and `*dst_len` to +// its length. Returns the number of bytes starting at `src` consumed while +// decoding. `*dst` points to memory within the encoded buffer. On failure, +// `*dst` and `*dst_len` are undefined and an error is set in `status`. +// +// Does not read memory more than `src_len` bytes beyond `src`. +public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len, + @Cast("const char**") PointerPointer dst, @Cast("size_t*") SizeTPointer dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len, + @Cast("const char**") @ByPtrPtr BytePointer dst, @Cast("size_t*") SizeTPointer dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringDecode(String src, @Cast("size_t") long src_len, + @Cast("const char**") @ByPtrPtr ByteBuffer dst, @Cast("size_t*") SizeTPointer dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len, + @Cast("const char**") @ByPtrPtr byte[] dst, @Cast("size_t*") SizeTPointer dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringDecode(String src, @Cast("size_t") long src_len, + @Cast("const char**") @ByPtrPtr BytePointer dst, @Cast("size_t*") SizeTPointer dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len, + @Cast("const char**") @ByPtrPtr ByteBuffer dst, @Cast("size_t*") SizeTPointer dst_len, + TF_Status status); +public static native @Cast("size_t") long TF_StringDecode(String src, @Cast("size_t") long src_len, + @Cast("const char**") @ByPtrPtr byte[] dst, @Cast("size_t*") SizeTPointer dst_len, + TF_Status status); + +// Return the size in bytes required to encode a string `len` bytes long into a +// TF_STRING tensor. +public static native @Cast("size_t") long TF_StringEncodedSize(@Cast("size_t") long len); + +// Returns bool iff this tensor is aligned. +public static native @Cast("bool") boolean TF_TensorIsAligned(@Const TF_Tensor arg0); + +// #ifdef __cplusplus /* end extern "C" */ +// #endif + +// #endif // TENSORFLOW_C_TF_TENSOR_H_ + + +// Parsed from tensorflow/c/c_api.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_C_C_API_H_ +// #define TENSORFLOW_C_C_API_H_ + +// #include +// #include + +// #include "tensorflow/c/tf_attrtype.h" +// #include "tensorflow/c/tf_datatype.h" +// #include "tensorflow/c/tf_status.h" +// #include "tensorflow/c/tf_tensor.h" + +// -------------------------------------------------------------------------- +// C API for TensorFlow. +// +// The API leans towards simplicity and uniformity instead of convenience +// since most usage will be by language specific wrappers. +// +// Conventions: +// * We use the prefix TF_ for everything in the API. +// * Objects are always passed around as pointers to opaque structs +// and these structs are allocated/deallocated via the API. +// * TF_Status holds error information. It is an object type +// and therefore is passed around as a pointer to an opaque +// struct as mentioned above. +// * Every call that has a TF_Status* argument clears it on success +// and fills it with error info on failure. +// * unsigned char is used for booleans (instead of the 'bool' type). +// In C++ bool is a keyword while in C99 bool is a macro defined +// in stdbool.h. It is possible for the two to be inconsistent. +// For example, neither the C99 nor the C++11 standard force a byte +// size on the bool type, so the macro defined in stdbool.h could +// be inconsistent with the bool keyword in C++. Thus, the use +// of stdbool.h is avoided and unsigned char is used instead. +// * size_t is used to represent byte sizes of objects that are +// materialized in the address space of the calling process. +// * int is used as an index into arrays. +// * Deletion functions are safe to call on nullptr. +// +// Questions left to address: +// * Might at some point need a way for callers to provide their own Env. +// * Maybe add TF_TensorShape that encapsulates dimension info. +// +// Design decisions made: +// * Backing store for tensor memory has an associated deallocation +// function. This deallocation function will point to client code +// for tensors populated by the client. So the client can do things +// like shadowing a numpy array. +// * We do not provide TF_OK since it is not strictly necessary and we +// are not optimizing for convenience. +// * We make assumption that one session has one graph. This should be +// fine since we have the ability to run sub-graphs. +// * We could allow NULL for some arguments (e.g., NULL options arg). +// However since convenience is not a primary goal, we don't do this. +// * Devices are not in this API. Instead, they are created/used internally +// and the API just provides high level controls over the number of +// devices of each type. + +// Macro to control visibility of exported symbols in the shared library (.so, +// .dylib, .dll). +// This duplicates the TF_EXPORT macro definition in +// tensorflow/core/platform/macros.h in order to keep this .h file independent +// of any other includes. +// #ifdef SWIG +// #define TF_CAPI_EXPORT +// #else +// #if defined(_WIN32) +// #ifdef TF_COMPILE_LIBRARY +// #define TF_CAPI_EXPORT __declspec(dllexport) +// #else +// #define TF_CAPI_EXPORT __declspec(dllimport) +// #endif // TF_COMPILE_LIBRARY +// #else +// #define TF_CAPI_EXPORT __attribute__((visibility("default"))) +// #endif // _WIN32 +// #endif // SWIG + +// #ifdef __cplusplus +// #endif + +// -------------------------------------------------------------------------- +// TF_Version returns a string describing version information of the +// TensorFlow library. TensorFlow using semantic versioning. +public static native @Cast("const char*") BytePointer TF_Version(); +// Targeting ../TF_Buffer.java + + + +// Makes a copy of the input and sets an appropriate deallocator. Useful for +// passing in read-only, input protobufs. +public static native TF_Buffer TF_NewBufferFromString(@Const Pointer proto, + @Cast("size_t") long proto_len); + +// Useful for passing *out* a protobuf. +public static native TF_Buffer TF_NewBuffer(); + +public static native void TF_DeleteBuffer(TF_Buffer arg0); + +public static native @ByVal TF_Buffer TF_GetBuffer(TF_Buffer buffer); +// Targeting ../TF_SessionOptions.java + + + +// Return a new options object. +public static native TF_SessionOptions TF_NewSessionOptions(); + +// Set the target in TF_SessionOptions.options. +// target can be empty, a single entry, or a comma separated list of entries. +// Each entry is in one of the following formats : +// "local" +// ip:port +// host:port +public static native void TF_SetTarget(TF_SessionOptions options, + @Cast("const char*") BytePointer target); +public static native void TF_SetTarget(TF_SessionOptions options, + String target); + +// Set the config in TF_SessionOptions.options. +// config should be a serialized tensorflow.ConfigProto proto. +// If config was not parsed successfully as a ConfigProto, record the +// error information in *status. +public static native void TF_SetConfig(TF_SessionOptions options, + @Const Pointer proto, @Cast("size_t") long proto_len, + TF_Status status); + +// Destroy an options object. +public static native void TF_DeleteSessionOptions(TF_SessionOptions arg0); +// Targeting ../TF_Graph.java + + + +// Return a new graph object. +public static native TF_Graph TF_NewGraph(); + +// Destroy an options object. Graph will be deleted once no more +// TFSession's are referencing it. +public static native void TF_DeleteGraph(TF_Graph arg0); +// Targeting ../TF_OperationDescription.java + + +// Targeting ../TF_Operation.java + + +// Targeting ../TF_Input.java + + +// Targeting ../TF_Output.java + + +// Targeting ../TF_Function.java + + +// Targeting ../TF_FunctionOptions.java + + + +// Sets the shape of the Tensor referenced by `output` in `graph` to +// the shape described by `dims` and `num_dims`. +// +// If the number of dimensions is unknown, `num_dims` must be set to +// -1 and `dims` can be null. If a dimension is unknown, the +// corresponding entry in the `dims` array must be -1. +// +// This does not overwrite the existing shape associated with `output`, +// but merges the input shape with the existing shape. For example, +// setting a shape of [-1, 2] with an existing shape [2, -1] would set +// a final shape of [2, 2] based on shape merging semantics. +// +// Returns an error into `status` if: +// * `output` is not in `graph`. +// * An invalid shape is being set (e.g., the shape being set +// is incompatible with the existing shape). +public static native void TF_GraphSetTensorShape(TF_Graph graph, + @ByVal TF_Output output, + @Cast("const int64_t*") LongPointer dims, + int num_dims, + TF_Status status); +public static native void TF_GraphSetTensorShape(TF_Graph graph, + @ByVal TF_Output output, + @Cast("const int64_t*") LongBuffer dims, + int num_dims, + TF_Status status); +public static native void TF_GraphSetTensorShape(TF_Graph graph, + @ByVal TF_Output output, + @Cast("const int64_t*") long[] dims, + int num_dims, + TF_Status status); + +// Returns the number of dimensions of the Tensor referenced by `output` +// in `graph`. +// +// If the number of dimensions in the shape is unknown, returns -1. +// +// Returns an error into `status` if: +// * `output` is not in `graph`. +public static native int TF_GraphGetTensorNumDims(TF_Graph graph, + @ByVal TF_Output output, + TF_Status status); + +// Returns the shape of the Tensor referenced by `output` in `graph` +// into `dims`. `dims` must be an array large enough to hold `num_dims` +// entries (e.g., the return value of TF_GraphGetTensorNumDims). +// +// If the number of dimensions in the shape is unknown or the shape is +// a scalar, `dims` will remain untouched. Otherwise, each element of +// `dims` will be set corresponding to the size of the dimension. An +// unknown dimension is represented by `-1`. +// +// Returns an error into `status` if: +// * `output` is not in `graph`. +// * `num_dims` does not match the actual number of dimensions. +public static native void TF_GraphGetTensorShape(TF_Graph graph, + @ByVal TF_Output output, + @Cast("int64_t*") LongPointer dims, int num_dims, + TF_Status status); +public static native void TF_GraphGetTensorShape(TF_Graph graph, + @ByVal TF_Output output, + @Cast("int64_t*") LongBuffer dims, int num_dims, + TF_Status status); +public static native void TF_GraphGetTensorShape(TF_Graph graph, + @ByVal TF_Output output, + @Cast("int64_t*") long[] dims, int num_dims, + TF_Status status); + +// Operation will only be added to *graph when TF_FinishOperation() is +// called (assuming TF_FinishOperation() does not return an error). +// *graph must not be deleted until after TF_FinishOperation() is +// called. +public static native TF_OperationDescription TF_NewOperation( + TF_Graph graph, @Cast("const char*") BytePointer op_type, @Cast("const char*") BytePointer oper_name); +public static native TF_OperationDescription TF_NewOperation( + TF_Graph graph, String op_type, String oper_name); + +// Specify the device for `desc`. Defaults to empty, meaning unconstrained. +public static native void TF_SetDevice(TF_OperationDescription desc, + @Cast("const char*") BytePointer device); +public static native void TF_SetDevice(TF_OperationDescription desc, + String device); + +// The calls to TF_AddInput and TF_AddInputList must match (in number, +// order, and type) the op declaration. For example, the "Concat" op +// has registration: +// REGISTER_OP("Concat") +// .Input("concat_dim: int32") +// .Input("values: N * T") +// .Output("output: T") +// .Attr("N: int >= 2") +// .Attr("T: type"); +// that defines two inputs, "concat_dim" and "values" (in that order). +// You must use TF_AddInput() for the first input (since it takes a +// single tensor), and TF_AddInputList() for the second input (since +// it takes a list, even if you were to pass a list with a single +// tensor), as in: +// TF_OperationDescription* desc = TF_NewOperation(graph, "Concat", "c"); +// TF_Output concat_dim_input = {...}; +// TF_AddInput(desc, concat_dim_input); +// TF_Output values_inputs[5] = {{...}, ..., {...}}; +// TF_AddInputList(desc, values_inputs, 5); + +// For inputs that take a single tensor. +public static native void TF_AddInput(TF_OperationDescription desc, + @ByVal TF_Output input); + +// For inputs that take a list of tensors. +// inputs must point to TF_Output[num_inputs]. +public static native void TF_AddInputList(TF_OperationDescription desc, + @Const TF_Output inputs, + int num_inputs); + +// Call once per control input to `desc`. +public static native void TF_AddControlInput(TF_OperationDescription desc, + TF_Operation input); + +// Request that `desc` be co-located on the device where `op` +// is placed. +// +// Use of this is discouraged since the implementation of device placement is +// subject to change. Primarily intended for internal libraries +public static native void TF_ColocateWith(TF_OperationDescription desc, + TF_Operation op); + +// Call some TF_SetAttr*() function for every attr that is not +// inferred from an input and doesn't have a default value you wish to +// keep. + +// `value` must point to a string of length `length` bytes. +public static native void TF_SetAttrString(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Const Pointer value, @Cast("size_t") long length); +public static native void TF_SetAttrString(TF_OperationDescription desc, + String attr_name, + @Const Pointer value, @Cast("size_t") long length); +// `values` and `lengths` each must have lengths `num_values`. +// `values[i]` must point to a string of length `lengths[i]` bytes. +public static native void TF_SetAttrStringList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const void*const*") PointerPointer values, + @Cast("const size_t*") SizeTPointer lengths, + int num_values); +public static native void TF_SetAttrStringList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const void*const*") @ByPtrPtr Pointer values, + @Cast("const size_t*") SizeTPointer lengths, + int num_values); +public static native void TF_SetAttrStringList(TF_OperationDescription desc, + String attr_name, + @Cast("const void*const*") @ByPtrPtr Pointer values, + @Cast("const size_t*") SizeTPointer lengths, + int num_values); +public static native void TF_SetAttrInt(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, @Cast("int64_t") long value); +public static native void TF_SetAttrInt(TF_OperationDescription desc, + String attr_name, @Cast("int64_t") long value); +public static native void TF_SetAttrIntList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongPointer values, + int num_values); +public static native void TF_SetAttrIntList(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*") LongBuffer values, + int num_values); +public static native void TF_SetAttrIntList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") long[] values, + int num_values); +public static native void TF_SetAttrIntList(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*") LongPointer values, + int num_values); +public static native void TF_SetAttrIntList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongBuffer values, + int num_values); +public static native void TF_SetAttrIntList(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*") long[] values, + int num_values); +public static native void TF_SetAttrFloat(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, float value); +public static native void TF_SetAttrFloat(TF_OperationDescription desc, + String attr_name, float value); +public static native void TF_SetAttrFloatList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Const FloatPointer values, + int num_values); +public static native void TF_SetAttrFloatList(TF_OperationDescription desc, + String attr_name, + @Const FloatBuffer values, + int num_values); +public static native void TF_SetAttrFloatList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Const float[] values, + int num_values); +public static native void TF_SetAttrFloatList(TF_OperationDescription desc, + String attr_name, + @Const FloatPointer values, + int num_values); +public static native void TF_SetAttrFloatList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Const FloatBuffer values, + int num_values); +public static native void TF_SetAttrFloatList(TF_OperationDescription desc, + String attr_name, + @Const float[] values, + int num_values); +public static native void TF_SetAttrBool(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char") byte value); +public static native void TF_SetAttrBool(TF_OperationDescription desc, + String attr_name, + @Cast("unsigned char") byte value); +public static native void TF_SetAttrBoolList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const unsigned char*") BytePointer values, + int num_values); +public static native void TF_SetAttrBoolList(TF_OperationDescription desc, + String attr_name, + @Cast("const unsigned char*") ByteBuffer values, + int num_values); +public static native void TF_SetAttrBoolList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const unsigned char*") byte[] values, + int num_values); +public static native void TF_SetAttrBoolList(TF_OperationDescription desc, + String attr_name, + @Cast("const unsigned char*") BytePointer values, + int num_values); +public static native void TF_SetAttrBoolList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const unsigned char*") ByteBuffer values, + int num_values); +public static native void TF_SetAttrBoolList(TF_OperationDescription desc, + String attr_name, + @Cast("const unsigned char*") byte[] values, + int num_values); +public static native void TF_SetAttrType(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType") int value); +public static native void TF_SetAttrType(TF_OperationDescription desc, + String attr_name, + @Cast("TF_DataType") int value); +public static native void TF_SetAttrTypeList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const TF_DataType*") IntPointer values, + int num_values); +public static native void TF_SetAttrTypeList(TF_OperationDescription desc, + String attr_name, + @Cast("const TF_DataType*") IntBuffer values, + int num_values); +public static native void TF_SetAttrTypeList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const TF_DataType*") int[] values, + int num_values); +public static native void TF_SetAttrTypeList(TF_OperationDescription desc, + String attr_name, + @Cast("const TF_DataType*") IntPointer values, + int num_values); +public static native void TF_SetAttrTypeList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const TF_DataType*") IntBuffer values, + int num_values); +public static native void TF_SetAttrTypeList(TF_OperationDescription desc, + String attr_name, + @Cast("const TF_DataType*") int[] values, + int num_values); +public static native void TF_SetAttrPlaceholder(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const char*") BytePointer placeholder); +public static native void TF_SetAttrPlaceholder(TF_OperationDescription desc, + String attr_name, + String placeholder); + +// Set a 'func' attribute to the specified name. +// `value` must point to a string of length `length` bytes. +public static native void TF_SetAttrFuncName(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const char*") BytePointer value, @Cast("size_t") long length); +public static native void TF_SetAttrFuncName(TF_OperationDescription desc, + String attr_name, + String value, @Cast("size_t") long length); + +// Set `num_dims` to -1 to represent "unknown rank". Otherwise, +// `dims` points to an array of length `num_dims`. `dims[i]` must be +// >= -1, with -1 meaning "unknown dimension". +public static native void TF_SetAttrShape(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongPointer dims, int num_dims); +public static native void TF_SetAttrShape(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*") LongBuffer dims, int num_dims); +public static native void TF_SetAttrShape(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") long[] dims, int num_dims); +public static native void TF_SetAttrShape(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*") LongPointer dims, int num_dims); +public static native void TF_SetAttrShape(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongBuffer dims, int num_dims); +public static native void TF_SetAttrShape(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*") long[] dims, int num_dims); +// `dims` and `num_dims` must point to arrays of length `num_shapes`. +// Set `num_dims[i]` to -1 to represent "unknown rank". Otherwise, +// `dims[i]` points to an array of length `num_dims[i]`. `dims[i][j]` +// must be >= -1, with -1 meaning "unknown dimension". +public static native void TF_SetAttrShapeList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*const*") PointerPointer dims, + @Const IntPointer num_dims, + int num_shapes); +public static native void TF_SetAttrShapeList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*const*") @ByPtrPtr LongPointer dims, + @Const IntPointer num_dims, + int num_shapes); +public static native void TF_SetAttrShapeList(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*const*") @ByPtrPtr LongBuffer dims, + @Const IntBuffer num_dims, + int num_shapes); +public static native void TF_SetAttrShapeList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*const*") @ByPtrPtr long[] dims, + @Const int[] num_dims, + int num_shapes); +public static native void TF_SetAttrShapeList(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*const*") @ByPtrPtr LongPointer dims, + @Const IntPointer num_dims, + int num_shapes); +public static native void TF_SetAttrShapeList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*const*") @ByPtrPtr LongBuffer dims, + @Const IntBuffer num_dims, + int num_shapes); +public static native void TF_SetAttrShapeList(TF_OperationDescription desc, + String attr_name, + @Cast("const int64_t*const*") @ByPtrPtr long[] dims, + @Const int[] num_dims, + int num_shapes); +// `proto` must point to an array of `proto_len` bytes representing a +// binary-serialized TensorShapeProto. +public static native void TF_SetAttrTensorShapeProto( + TF_OperationDescription desc, @Cast("const char*") BytePointer attr_name, @Const Pointer proto, + @Cast("size_t") long proto_len, TF_Status status); +public static native void TF_SetAttrTensorShapeProto( + TF_OperationDescription desc, String attr_name, @Const Pointer proto, + @Cast("size_t") long proto_len, TF_Status status); +// `protos` and `proto_lens` must point to arrays of length `num_shapes`. +// `protos[i]` must point to an array of `proto_lens[i]` bytes +// representing a binary-serialized TensorShapeProto. +public static native void TF_SetAttrTensorShapeProtoList( + TF_OperationDescription desc, @Cast("const char*") BytePointer attr_name, + @Cast("const void*const*") PointerPointer protos, @Cast("const size_t*") SizeTPointer proto_lens, int num_shapes, + TF_Status status); +public static native void TF_SetAttrTensorShapeProtoList( + TF_OperationDescription desc, @Cast("const char*") BytePointer attr_name, + @Cast("const void*const*") @ByPtrPtr Pointer protos, @Cast("const size_t*") SizeTPointer proto_lens, int num_shapes, + TF_Status status); +public static native void TF_SetAttrTensorShapeProtoList( + TF_OperationDescription desc, String attr_name, + @Cast("const void*const*") @ByPtrPtr Pointer protos, @Cast("const size_t*") SizeTPointer proto_lens, int num_shapes, + TF_Status status); + +public static native void TF_SetAttrTensor(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + TF_Tensor value, + TF_Status status); +public static native void TF_SetAttrTensor(TF_OperationDescription desc, + String attr_name, + TF_Tensor value, + TF_Status status); +public static native void TF_SetAttrTensorList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_Tensor*const*") PointerPointer values, + int num_values, + TF_Status status); +public static native void TF_SetAttrTensorList(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @ByPtrPtr TF_Tensor values, + int num_values, + TF_Status status); +public static native void TF_SetAttrTensorList(TF_OperationDescription desc, + String attr_name, + @ByPtrPtr TF_Tensor values, + int num_values, + TF_Status status); + +// `proto` should point to a sequence of bytes of length `proto_len` +// representing a binary serialization of an AttrValue protocol +// buffer. +public static native void TF_SetAttrValueProto(TF_OperationDescription desc, + @Cast("const char*") BytePointer attr_name, + @Const Pointer proto, + @Cast("size_t") long proto_len, + TF_Status status); +public static native void TF_SetAttrValueProto(TF_OperationDescription desc, + String attr_name, + @Const Pointer proto, + @Cast("size_t") long proto_len, + TF_Status status); + +// If this function succeeds: +// * *status is set to an OK value, +// * a TF_Operation is added to the graph, +// * a non-null value pointing to the added operation is returned -- +// this value is valid until the underlying graph is deleted. +// Otherwise: +// * *status is set to a non-OK value, +// * the graph is not modified, +// * a null value is returned. +// In either case, it deletes `desc`. +public static native TF_Operation TF_FinishOperation( + TF_OperationDescription desc, TF_Status status); + +// TF_Operation functions. Operations are immutable once created, so +// these are all query functions. + +public static native @Cast("const char*") BytePointer TF_OperationName(TF_Operation oper); +public static native @Cast("const char*") BytePointer TF_OperationOpType(TF_Operation oper); +public static native @Cast("const char*") BytePointer TF_OperationDevice(TF_Operation oper); + +public static native int TF_OperationNumOutputs(TF_Operation oper); +public static native @Cast("TF_DataType") int TF_OperationOutputType(@ByVal TF_Output oper_out); +public static native int TF_OperationOutputListLength(TF_Operation oper, + @Cast("const char*") BytePointer arg_name, + TF_Status status); +public static native int TF_OperationOutputListLength(TF_Operation oper, + String arg_name, + TF_Status status); + +public static native int TF_OperationNumInputs(TF_Operation oper); +public static native @Cast("TF_DataType") int TF_OperationInputType(@ByVal TF_Input oper_in); +public static native int TF_OperationInputListLength(TF_Operation oper, + @Cast("const char*") BytePointer arg_name, + TF_Status status); +public static native int TF_OperationInputListLength(TF_Operation oper, + String arg_name, + TF_Status status); + +// In this code: +// TF_Output producer = TF_OperationInput(consumer); +// There is an edge from producer.oper's output (given by +// producer.index) to consumer.oper's input (given by consumer.index). +public static native @ByVal TF_Output TF_OperationInput(@ByVal TF_Input oper_in); + +// Get the number of current consumers of a specific output of an +// operation. Note that this number can change when new operations +// are added to the graph. +public static native int TF_OperationOutputNumConsumers(@ByVal TF_Output oper_out); + +// Get list of all current consumers of a specific output of an +// operation. `consumers` must point to an array of length at least +// `max_consumers` (ideally set to +// TF_OperationOutputNumConsumers(oper_out)). Beware that a concurrent +// modification of the graph can increase the number of consumers of +// an operation. Returns the number of output consumers (should match +// TF_OperationOutputNumConsumers(oper_out)). +public static native int TF_OperationOutputConsumers(@ByVal TF_Output oper_out, + TF_Input consumers, + int max_consumers); + +// Get the number of control inputs to an operation. +public static native int TF_OperationNumControlInputs(TF_Operation oper); + +// Get list of all control inputs to an operation. `control_inputs` must +// point to an array of length `max_control_inputs` (ideally set to +// TF_OperationNumControlInputs(oper)). Returns the number of control +// inputs (should match TF_OperationNumControlInputs(oper)). +public static native int TF_OperationGetControlInputs( + TF_Operation oper, @Cast("TF_Operation**") PointerPointer control_inputs, int max_control_inputs); +public static native int TF_OperationGetControlInputs( + TF_Operation oper, @ByPtrPtr TF_Operation control_inputs, int max_control_inputs); + +// Get the number of operations that have `*oper` as a control input. +// Note that this number can change when new operations are added to +// the graph. +public static native int TF_OperationNumControlOutputs(TF_Operation oper); + +// Get the list of operations that have `*oper` as a control input. +// `control_outputs` must point to an array of length at least +// `max_control_outputs` (ideally set to +// TF_OperationNumControlOutputs(oper)). Beware that a concurrent +// modification of the graph can increase the number of control +// outputs. Returns the number of control outputs (should match +// TF_OperationNumControlOutputs(oper)). +public static native int TF_OperationGetControlOutputs( + TF_Operation oper, @Cast("TF_Operation**") PointerPointer control_outputs, + int max_control_outputs); +public static native int TF_OperationGetControlOutputs( + TF_Operation oper, @ByPtrPtr TF_Operation control_outputs, + int max_control_outputs); +// Targeting ../TF_AttrMetadata.java + + + +// Returns metadata about the value of the attribute `attr_name` of `oper`. +public static native @ByVal TF_AttrMetadata TF_OperationGetAttrMetadata( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, TF_Status status); +public static native @ByVal TF_AttrMetadata TF_OperationGetAttrMetadata( + TF_Operation oper, String attr_name, TF_Status status); + +// Fills in `value` with the value of the attribute `attr_name`. `value` must +// point to an array of length at least `max_length` (ideally set to +// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper, +// attr_name)). +public static native void TF_OperationGetAttrString(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + Pointer value, + @Cast("size_t") long max_length, + TF_Status status); +public static native void TF_OperationGetAttrString(TF_Operation oper, + String attr_name, + Pointer value, + @Cast("size_t") long max_length, + TF_Status status); + +// Get the list of strings in the value of the attribute `attr_name`. Fills in +// `values` and `lengths`, each of which must point to an array of length at +// least `max_values`. +// +// The elements of values will point to addresses in `storage` which must be at +// least `storage_size` bytes in length. Ideally, max_values would be set to +// TF_AttrMetadata.list_size and `storage` would be at least +// TF_AttrMetadata.total_size, obtained from TF_OperationGetAttrMetadata(oper, +// attr_name). +// +// Fails if storage_size is too small to hold the requested number of strings. +public static native void TF_OperationGetAttrStringList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @Cast("void**") PointerPointer values, @Cast("size_t*") SizeTPointer lengths, + int max_values, Pointer storage, @Cast("size_t") long storage_size, TF_Status status); +public static native void TF_OperationGetAttrStringList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @Cast("void**") @ByPtrPtr Pointer values, @Cast("size_t*") SizeTPointer lengths, + int max_values, Pointer storage, @Cast("size_t") long storage_size, TF_Status status); +public static native void TF_OperationGetAttrStringList( + TF_Operation oper, String attr_name, @Cast("void**") @ByPtrPtr Pointer values, @Cast("size_t*") SizeTPointer lengths, + int max_values, Pointer storage, @Cast("size_t") long storage_size, TF_Status status); + +public static native void TF_OperationGetAttrInt(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") LongPointer value, + TF_Status status); +public static native void TF_OperationGetAttrInt(TF_Operation oper, + String attr_name, + @Cast("int64_t*") LongBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrInt(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") long[] value, + TF_Status status); +public static native void TF_OperationGetAttrInt(TF_Operation oper, + String attr_name, + @Cast("int64_t*") LongPointer value, + TF_Status status); +public static native void TF_OperationGetAttrInt(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") LongBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrInt(TF_Operation oper, + String attr_name, + @Cast("int64_t*") long[] value, + TF_Status status); + +// Fills in `values` with the value of the attribute `attr_name` of `oper`. +// `values` must point to an array of length at least `max_values` (ideally set +// TF_AttrMetadata.list_size from TF_OperationGetAttrMetadata(oper, +// attr_name)). +public static native void TF_OperationGetAttrIntList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") LongPointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrIntList(TF_Operation oper, + String attr_name, + @Cast("int64_t*") LongBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrIntList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") long[] values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrIntList(TF_Operation oper, + String attr_name, + @Cast("int64_t*") LongPointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrIntList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") LongBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrIntList(TF_Operation oper, + String attr_name, + @Cast("int64_t*") long[] values, + int max_values, + TF_Status status); + +public static native void TF_OperationGetAttrFloat(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + FloatPointer value, + TF_Status status); +public static native void TF_OperationGetAttrFloat(TF_Operation oper, + String attr_name, + FloatBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrFloat(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + float[] value, + TF_Status status); +public static native void TF_OperationGetAttrFloat(TF_Operation oper, + String attr_name, + FloatPointer value, + TF_Status status); +public static native void TF_OperationGetAttrFloat(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + FloatBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrFloat(TF_Operation oper, + String attr_name, + float[] value, + TF_Status status); + +// Fills in `values` with the value of the attribute `attr_name` of `oper`. +// `values` must point to an array of length at least `max_values` (ideally set +// to TF_AttrMetadata.list_size from TF_OperationGetAttrMetadata(oper, +// attr_name)). +public static native void TF_OperationGetAttrFloatList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + FloatPointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrFloatList(TF_Operation oper, + String attr_name, + FloatBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrFloatList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + float[] values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrFloatList(TF_Operation oper, + String attr_name, + FloatPointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrFloatList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + FloatBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrFloatList(TF_Operation oper, + String attr_name, + float[] values, + int max_values, + TF_Status status); + +public static native void TF_OperationGetAttrBool(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") BytePointer value, + TF_Status status); +public static native void TF_OperationGetAttrBool(TF_Operation oper, + String attr_name, + @Cast("unsigned char*") ByteBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrBool(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") byte[] value, + TF_Status status); +public static native void TF_OperationGetAttrBool(TF_Operation oper, + String attr_name, + @Cast("unsigned char*") BytePointer value, + TF_Status status); +public static native void TF_OperationGetAttrBool(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") ByteBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrBool(TF_Operation oper, + String attr_name, + @Cast("unsigned char*") byte[] value, + TF_Status status); + +// Fills in `values` with the value of the attribute `attr_name` of `oper`. +// `values` must point to an array of length at least `max_values` (ideally set +// to TF_AttrMetadata.list_size from TF_OperationGetAttrMetadata(oper, +// attr_name)). +public static native void TF_OperationGetAttrBoolList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") BytePointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrBoolList(TF_Operation oper, + String attr_name, + @Cast("unsigned char*") ByteBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrBoolList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") byte[] values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrBoolList(TF_Operation oper, + String attr_name, + @Cast("unsigned char*") BytePointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrBoolList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") ByteBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrBoolList(TF_Operation oper, + String attr_name, + @Cast("unsigned char*") byte[] values, + int max_values, + TF_Status status); + +public static native void TF_OperationGetAttrType(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType*") IntPointer value, + TF_Status status); +public static native void TF_OperationGetAttrType(TF_Operation oper, + String attr_name, + @Cast("TF_DataType*") IntBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrType(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType*") int[] value, + TF_Status status); +public static native void TF_OperationGetAttrType(TF_Operation oper, + String attr_name, + @Cast("TF_DataType*") IntPointer value, + TF_Status status); +public static native void TF_OperationGetAttrType(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType*") IntBuffer value, + TF_Status status); +public static native void TF_OperationGetAttrType(TF_Operation oper, + String attr_name, + @Cast("TF_DataType*") int[] value, + TF_Status status); + +// Fills in `values` with the value of the attribute `attr_name` of `oper`. +// `values` must point to an array of length at least `max_values` (ideally set +// to TF_AttrMetadata.list_size from TF_OperationGetAttrMetadata(oper, +// attr_name)). +public static native void TF_OperationGetAttrTypeList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType*") IntPointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrTypeList(TF_Operation oper, + String attr_name, + @Cast("TF_DataType*") IntBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrTypeList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType*") int[] values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrTypeList(TF_Operation oper, + String attr_name, + @Cast("TF_DataType*") IntPointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrTypeList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType*") IntBuffer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrTypeList(TF_Operation oper, + String attr_name, + @Cast("TF_DataType*") int[] values, + int max_values, + TF_Status status); + +// Fills in `value` with the value of the attribute `attr_name` of `oper`. +// `values` must point to an array of length at least `num_dims` (ideally set to +// TF_Attr_Meta.size from TF_OperationGetAttrMetadata(oper, attr_name)). +public static native void TF_OperationGetAttrShape(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") LongPointer value, + int num_dims, + TF_Status status); +public static native void TF_OperationGetAttrShape(TF_Operation oper, + String attr_name, + @Cast("int64_t*") LongBuffer value, + int num_dims, + TF_Status status); +public static native void TF_OperationGetAttrShape(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") long[] value, + int num_dims, + TF_Status status); +public static native void TF_OperationGetAttrShape(TF_Operation oper, + String attr_name, + @Cast("int64_t*") LongPointer value, + int num_dims, + TF_Status status); +public static native void TF_OperationGetAttrShape(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("int64_t*") LongBuffer value, + int num_dims, + TF_Status status); +public static native void TF_OperationGetAttrShape(TF_Operation oper, + String attr_name, + @Cast("int64_t*") long[] value, + int num_dims, + TF_Status status); + +// Fills in `dims` with the list of shapes in the attribute `attr_name` of +// `oper` and `num_dims` with the corresponding number of dimensions. On return, +// for every i where `num_dims[i]` > 0, `dims[i]` will be an array of +// `num_dims[i]` elements. A value of -1 for `num_dims[i]` indicates that the +// i-th shape in the list is unknown. +// +// The elements of `dims` will point to addresses in `storage` which must be +// large enough to hold at least `storage_size` int64_ts. Ideally, `num_shapes` +// would be set to TF_AttrMetadata.list_size and `storage_size` would be set to +// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper, +// attr_name). +// +// Fails if storage_size is insufficient to hold the requested shapes. +public static native void TF_OperationGetAttrShapeList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @Cast("int64_t**") PointerPointer dims, IntPointer num_dims, + int num_shapes, @Cast("int64_t*") LongPointer storage, int storage_size, TF_Status status); +public static native void TF_OperationGetAttrShapeList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @Cast("int64_t**") @ByPtrPtr LongPointer dims, IntPointer num_dims, + int num_shapes, @Cast("int64_t*") LongPointer storage, int storage_size, TF_Status status); +public static native void TF_OperationGetAttrShapeList( + TF_Operation oper, String attr_name, @Cast("int64_t**") @ByPtrPtr LongBuffer dims, IntBuffer num_dims, + int num_shapes, @Cast("int64_t*") LongBuffer storage, int storage_size, TF_Status status); +public static native void TF_OperationGetAttrShapeList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @Cast("int64_t**") @ByPtrPtr long[] dims, int[] num_dims, + int num_shapes, @Cast("int64_t*") long[] storage, int storage_size, TF_Status status); +public static native void TF_OperationGetAttrShapeList( + TF_Operation oper, String attr_name, @Cast("int64_t**") @ByPtrPtr LongPointer dims, IntPointer num_dims, + int num_shapes, @Cast("int64_t*") LongPointer storage, int storage_size, TF_Status status); +public static native void TF_OperationGetAttrShapeList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @Cast("int64_t**") @ByPtrPtr LongBuffer dims, IntBuffer num_dims, + int num_shapes, @Cast("int64_t*") LongBuffer storage, int storage_size, TF_Status status); +public static native void TF_OperationGetAttrShapeList( + TF_Operation oper, String attr_name, @Cast("int64_t**") @ByPtrPtr long[] dims, int[] num_dims, + int num_shapes, @Cast("int64_t*") long[] storage, int storage_size, TF_Status status); + +// Sets `value` to the binary-serialized TensorShapeProto of the value of +// `attr_name` attribute of `oper`'. +public static native void TF_OperationGetAttrTensorShapeProto( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, TF_Buffer value, + TF_Status status); +public static native void TF_OperationGetAttrTensorShapeProto( + TF_Operation oper, String attr_name, TF_Buffer value, + TF_Status status); + +// Fills in `values` with binary-serialized TensorShapeProto values of the +// attribute `attr_name` of `oper`. `values` must point to an array of length at +// least `num_values` (ideally set to TF_AttrMetadata.list_size from +// TF_OperationGetAttrMetadata(oper, attr_name)). +public static native void TF_OperationGetAttrTensorShapeProtoList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @Cast("TF_Buffer**") PointerPointer values, + int max_values, TF_Status status); +public static native void TF_OperationGetAttrTensorShapeProtoList( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, @ByPtrPtr TF_Buffer values, + int max_values, TF_Status status); +public static native void TF_OperationGetAttrTensorShapeProtoList( + TF_Operation oper, String attr_name, @ByPtrPtr TF_Buffer values, + int max_values, TF_Status status); + +// Gets the TF_Tensor valued attribute of `attr_name` of `oper`. +// +// Allocates a new TF_Tensor which the caller is expected to take +// ownership of (and can deallocate using TF_DeleteTensor). +public static native void TF_OperationGetAttrTensor(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_Tensor**") PointerPointer value, + TF_Status status); +public static native void TF_OperationGetAttrTensor(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @ByPtrPtr TF_Tensor value, + TF_Status status); +public static native void TF_OperationGetAttrTensor(TF_Operation oper, + String attr_name, + @ByPtrPtr TF_Tensor value, + TF_Status status); + +// Fills in `values` with the TF_Tensor values of the attribute `attr_name` of +// `oper`. `values` must point to an array of TF_Tensor* of length at least +// `max_values` (ideally set to TF_AttrMetadata.list_size from +// TF_OperationGetAttrMetadata(oper, attr_name)). +// +// The caller takes ownership of all the non-null TF_Tensor* entries in `values` +// (which can be deleted using TF_DeleteTensor(values[i])). +public static native void TF_OperationGetAttrTensorList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @Cast("TF_Tensor**") PointerPointer values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrTensorList(TF_Operation oper, + @Cast("const char*") BytePointer attr_name, + @ByPtrPtr TF_Tensor values, + int max_values, + TF_Status status); +public static native void TF_OperationGetAttrTensorList(TF_Operation oper, + String attr_name, + @ByPtrPtr TF_Tensor values, + int max_values, + TF_Status status); + +// Sets `output_attr_value` to the binary-serialized AttrValue proto +// representation of the value of the `attr_name` attr of `oper`. +public static native void TF_OperationGetAttrValueProto( + TF_Operation oper, @Cast("const char*") BytePointer attr_name, TF_Buffer output_attr_value, + TF_Status status); +public static native void TF_OperationGetAttrValueProto( + TF_Operation oper, String attr_name, TF_Buffer output_attr_value, + TF_Status status); + +// Returns the operation in the graph with `oper_name`. Returns nullptr if +// no operation found. +public static native TF_Operation TF_GraphOperationByName( + TF_Graph graph, @Cast("const char*") BytePointer oper_name); +public static native TF_Operation TF_GraphOperationByName( + TF_Graph graph, String oper_name); + +// Iterate through the operations of a graph. To use: +// size_t pos = 0; +// TF_Operation* oper; +// while ((oper = TF_GraphNextOperation(graph, &pos)) != nullptr) { +// DoSomethingWithOperation(oper); +// } +public static native TF_Operation TF_GraphNextOperation(TF_Graph graph, + @Cast("size_t*") SizeTPointer pos); + +// Write out a serialized representation of `graph` (as a GraphDef protocol +// message) to `output_graph_def` (allocated by TF_NewBuffer()). +// `output_graph_def`'s underlying buffer will be freed when TF_DeleteBuffer() +// is called. +// +// May fail on very large graphs in the future. +public static native void TF_GraphToGraphDef(TF_Graph graph, + TF_Buffer output_graph_def, + TF_Status status); + +// Returns the serialized OpDef proto with name `op_name`, or a bad status if no +// such op exists. This can return OpDefs of functions copied into the graph. +public static native void TF_GraphGetOpDef(TF_Graph graph, + @Cast("const char*") BytePointer op_name, + TF_Buffer output_op_def, + TF_Status status); +public static native void TF_GraphGetOpDef(TF_Graph graph, + String op_name, + TF_Buffer output_op_def, + TF_Status status); + +// Returns the serialized VersionDef proto for this graph. +public static native void TF_GraphVersions(TF_Graph graph, + TF_Buffer output_version_def, + TF_Status status); +// Targeting ../TF_ImportGraphDefOptions.java + + + +public static native TF_ImportGraphDefOptions TF_NewImportGraphDefOptions(); +public static native void TF_DeleteImportGraphDefOptions( + TF_ImportGraphDefOptions opts); + +// Set the prefix to be prepended to the names of nodes in `graph_def` that will +// be imported into `graph`. `prefix` is copied and has no lifetime +// requirements. +public static native void TF_ImportGraphDefOptionsSetPrefix( + TF_ImportGraphDefOptions opts, @Cast("const char*") BytePointer prefix); +public static native void TF_ImportGraphDefOptionsSetPrefix( + TF_ImportGraphDefOptions opts, String prefix); + +// Set the execution device for nodes in `graph_def`. +// Only applies to nodes where a device was not already explicitly specified. +// `device` is copied and has no lifetime requirements. +public static native void TF_ImportGraphDefOptionsSetDefaultDevice( + TF_ImportGraphDefOptions opts, @Cast("const char*") BytePointer device); +public static native void TF_ImportGraphDefOptionsSetDefaultDevice( + TF_ImportGraphDefOptions opts, String device); + +// Set whether to uniquify imported operation names. If true, imported operation +// names will be modified if their name already exists in the graph. If false, +// conflicting names will be treated as an error. Note that this option has no +// effect if a prefix is set, since the prefix will guarantee all names are +// unique. Defaults to false. +public static native void TF_ImportGraphDefOptionsSetUniquifyNames( + TF_ImportGraphDefOptions opts, @Cast("unsigned char") byte uniquify_names); + +// If true, the specified prefix will be modified if it already exists as an +// operation name or prefix in the graph. If false, a conflicting prefix will be +// treated as an error. This option has no effect if no prefix is specified. +public static native void TF_ImportGraphDefOptionsSetUniquifyPrefix( + TF_ImportGraphDefOptions opts, @Cast("unsigned char") byte uniquify_prefix); + +// Set any imported nodes with input `src_name:src_index` to have that input +// replaced with `dst`. `src_name` refers to a node in the graph to be imported, +// `dst` references a node already existing in the graph being imported into. +// `src_name` is copied and has no lifetime requirements. +public static native void TF_ImportGraphDefOptionsAddInputMapping( + TF_ImportGraphDefOptions opts, @Cast("const char*") BytePointer src_name, int src_index, + @ByVal TF_Output dst); +public static native void TF_ImportGraphDefOptionsAddInputMapping( + TF_ImportGraphDefOptions opts, String src_name, int src_index, + @ByVal TF_Output dst); + +// Set any imported nodes with control input `src_name` to have that input +// replaced with `dst`. `src_name` refers to a node in the graph to be imported, +// `dst` references an operation already existing in the graph being imported +// into. `src_name` is copied and has no lifetime requirements. +public static native void TF_ImportGraphDefOptionsRemapControlDependency( + TF_ImportGraphDefOptions opts, @Cast("const char*") BytePointer src_name, TF_Operation dst); +public static native void TF_ImportGraphDefOptionsRemapControlDependency( + TF_ImportGraphDefOptions opts, String src_name, TF_Operation dst); + +// Cause the imported graph to have a control dependency on `oper`. `oper` +// should exist in the graph being imported into. +public static native void TF_ImportGraphDefOptionsAddControlDependency( + TF_ImportGraphDefOptions opts, TF_Operation oper); + +// Add an output in `graph_def` to be returned via the `return_outputs` output +// parameter of TF_GraphImportGraphDef(). If the output is remapped via an input +// mapping, the corresponding existing tensor in `graph` will be returned. +// `oper_name` is copied and has no lifetime requirements. +public static native void TF_ImportGraphDefOptionsAddReturnOutput( + TF_ImportGraphDefOptions opts, @Cast("const char*") BytePointer oper_name, int index); +public static native void TF_ImportGraphDefOptionsAddReturnOutput( + TF_ImportGraphDefOptions opts, String oper_name, int index); + +// Returns the number of return outputs added via +// TF_ImportGraphDefOptionsAddReturnOutput(). +public static native int TF_ImportGraphDefOptionsNumReturnOutputs( + @Const TF_ImportGraphDefOptions opts); + +// Add an operation in `graph_def` to be returned via the `return_opers` output +// parameter of TF_GraphImportGraphDef(). `oper_name` is copied and has no +// lifetime requirements. +public static native void TF_ImportGraphDefOptionsAddReturnOperation( + TF_ImportGraphDefOptions opts, @Cast("const char*") BytePointer oper_name); +public static native void TF_ImportGraphDefOptionsAddReturnOperation( + TF_ImportGraphDefOptions opts, String oper_name); + +// Returns the number of return operations added via +// TF_ImportGraphDefOptionsAddReturnOperation(). +public static native int TF_ImportGraphDefOptionsNumReturnOperations( + @Const TF_ImportGraphDefOptions opts); +// Targeting ../TF_ImportGraphDefResults.java + + + +// Fetches the return outputs requested via +// TF_ImportGraphDefOptionsAddReturnOutput(). The number of fetched outputs is +// returned in `num_outputs`. The array of return outputs is returned in +// `outputs`. `*outputs` is owned by and has the lifetime of `results`. +public static native void TF_ImportGraphDefResultsReturnOutputs( + TF_ImportGraphDefResults results, IntPointer num_outputs, @Cast("TF_Output**") PointerPointer outputs); +public static native void TF_ImportGraphDefResultsReturnOutputs( + TF_ImportGraphDefResults results, IntPointer num_outputs, @ByPtrPtr TF_Output outputs); +public static native void TF_ImportGraphDefResultsReturnOutputs( + TF_ImportGraphDefResults results, IntBuffer num_outputs, @ByPtrPtr TF_Output outputs); +public static native void TF_ImportGraphDefResultsReturnOutputs( + TF_ImportGraphDefResults results, int[] num_outputs, @ByPtrPtr TF_Output outputs); + +// Fetches the return operations requested via +// TF_ImportGraphDefOptionsAddReturnOperation(). The number of fetched +// operations is returned in `num_opers`. The array of return operations is +// returned in `opers`. `*opers` is owned by and has the lifetime of `results`. +public static native void TF_ImportGraphDefResultsReturnOperations( + TF_ImportGraphDefResults results, IntPointer num_opers, @Cast("TF_Operation***") @ByPtrPtr PointerPointer opers); +public static native void TF_ImportGraphDefResultsReturnOperations( + TF_ImportGraphDefResults results, IntBuffer num_opers, @Cast("TF_Operation***") @ByPtrPtr PointerPointer opers); +public static native void TF_ImportGraphDefResultsReturnOperations( + TF_ImportGraphDefResults results, int[] num_opers, @Cast("TF_Operation***") @ByPtrPtr PointerPointer opers); + +// Fetches any input mappings requested via +// TF_ImportGraphDefOptionsAddInputMapping() that didn't appear in the GraphDef +// and weren't used as input to any node in the imported graph def. The number +// of fetched mappings is returned in `num_missing_unused_input_mappings`. The +// array of each mapping's source node name is returned in `src_names`, and the +// array of each mapping's source index is returned in `src_indexes`. +// +// `*src_names`, `*src_indexes`, and the memory backing each string in +// `src_names` are owned by and have the lifetime of `results`. +public static native void TF_ImportGraphDefResultsMissingUnusedInputMappings( + TF_ImportGraphDefResults results, IntPointer num_missing_unused_input_mappings, + @Cast("const char***") @ByPtrPtr PointerPointer src_names, @Cast("int**") PointerPointer src_indexes); +public static native void TF_ImportGraphDefResultsMissingUnusedInputMappings( + TF_ImportGraphDefResults results, IntPointer num_missing_unused_input_mappings, + @Cast("const char***") @ByPtrPtr PointerPointer src_names, @ByPtrPtr IntPointer src_indexes); +public static native void TF_ImportGraphDefResultsMissingUnusedInputMappings( + TF_ImportGraphDefResults results, IntBuffer num_missing_unused_input_mappings, + @Cast("const char***") @ByPtrPtr PointerPointer src_names, @ByPtrPtr IntBuffer src_indexes); +public static native void TF_ImportGraphDefResultsMissingUnusedInputMappings( + TF_ImportGraphDefResults results, int[] num_missing_unused_input_mappings, + @Cast("const char***") @ByPtrPtr PointerPointer src_names, @ByPtrPtr int[] src_indexes); + +// Deletes a results object returned by TF_GraphImportGraphDefWithResults(). +public static native void TF_DeleteImportGraphDefResults( + TF_ImportGraphDefResults results); + +// Import the graph serialized in `graph_def` into `graph`. Returns nullptr and +// a bad status on error. Otherwise, returns a populated +// TF_ImportGraphDefResults instance. The returned instance must be deleted via +// TF_DeleteImportGraphDefResults(). +public static native TF_ImportGraphDefResults TF_GraphImportGraphDefWithResults(TF_Graph graph, @Const TF_Buffer graph_def, + @Const TF_ImportGraphDefOptions options, + TF_Status status); + +// Import the graph serialized in `graph_def` into `graph`. +// Convenience function for when only return outputs are needed. +// +// `num_return_outputs` must be the number of return outputs added (i.e. the +// result of TF_ImportGraphDefOptionsNumReturnOutputs()). If +// `num_return_outputs` is non-zero, `return_outputs` must be of length +// `num_return_outputs`. Otherwise it can be null. +public static native void TF_GraphImportGraphDefWithReturnOutputs( + TF_Graph graph, @Const TF_Buffer graph_def, + @Const TF_ImportGraphDefOptions options, TF_Output return_outputs, + int num_return_outputs, TF_Status status); + +// Import the graph serialized in `graph_def` into `graph`. +// Convenience function for when no results are needed. +public static native void TF_GraphImportGraphDef( + TF_Graph graph, @Const TF_Buffer graph_def, + @Const TF_ImportGraphDefOptions options, TF_Status status); + +// Adds a copy of function `func` and optionally its gradient function `grad` +// to `g`. Once `func`/`grad` is added to `g`, it can be called by creating +// an operation using the function's name. +// Any changes to `func`/`grad` (including deleting it) done after this method +// returns, won't affect the copy of `func`/`grad` in `g`. +// If `func` or `grad` are already in `g`, TF_GraphCopyFunction has no +// effect on them, but can establish the function->gradient relationship +// between them if `func` does not already have a gradient. If `func` already +// has a gradient different from `grad`, an error is returned. +// +// `func` must not be null. +// If `grad` is null and `func` is not in `g`, `func` is added without a +// gradient. +// If `grad` is null and `func` is in `g`, TF_GraphCopyFunction is a noop. +// `grad` must have appropriate signature as described in the doc of +// GradientDef in tensorflow/core/framework/function.proto. +// +// If successful, status is set to OK and `func` and `grad` are added to `g`. +// Otherwise, status is set to the encountered error and `g` is unmodified. +public static native void TF_GraphCopyFunction(TF_Graph g, + @Const TF_Function func, + @Const TF_Function grad, + TF_Status status); + +// Returns the number of TF_Functions registered in `g`. +public static native int TF_GraphNumFunctions(TF_Graph g); + +// Fills in `funcs` with the TF_Function* registered in `g`. +// `funcs` must point to an array of TF_Function* of length at least +// `max_func`. In usual usage, max_func should be set to the result of +// TF_GraphNumFunctions(g). In this case, all the functions registered in +// `g` will be returned. Else, an unspecified subset. +// +// If successful, returns the number of TF_Function* successfully set in +// `funcs` and sets status to OK. The caller takes ownership of +// all the returned TF_Functions. They must be deleted with TF_DeleteFunction. +// On error, returns 0, sets status to the encountered error, and the contents +// of funcs will be undefined. +public static native int TF_GraphGetFunctions(TF_Graph g, @Cast("TF_Function**") PointerPointer funcs, + int max_func, TF_Status status); +public static native int TF_GraphGetFunctions(TF_Graph g, @ByPtrPtr TF_Function funcs, + int max_func, TF_Status status); + +// Note: The following function may fail on very large protos in the future. + +public static native void TF_OperationToNodeDef(TF_Operation oper, + TF_Buffer output_node_def, + TF_Status status); +// Targeting ../TF_WhileParams.java + + + +// Creates a TF_WhileParams for creating a while loop in `g`. `inputs` are +// outputs that already exist in `g` used as initial values for the loop +// variables. +// +// The returned TF_WhileParams will have all fields initialized except +// `cond_output`, `body_outputs`, and `name`. The `body_outputs` buffer will be +// allocated to size `ninputs`. The caller should build `cond_graph` and +// `body_graph` starting from the inputs, and store the final outputs in +// `cond_output` and `body_outputs`. +// +// If `status` is OK, the caller must call either TF_FinishWhile or +// TF_AbortWhile on the returned TF_WhileParams. If `status` isn't OK, the +// returned TF_WhileParams is not valid, and the caller should not call +// TF_FinishWhile() or TF_AbortWhile(). +// +// Missing functionality (TODO): +// - Gradients +// - Reference-type inputs +// - Directly referencing external tensors from the cond/body graphs (this is +// possible in the Python API) +public static native @ByVal TF_WhileParams TF_NewWhile(TF_Graph g, TF_Output inputs, + int ninputs, + TF_Status status); + +// Builds the while loop specified by `params` and returns the output tensors of +// the while loop in `outputs`. `outputs` should be allocated to size +// `params.ninputs`. +// +// `params` is no longer valid once this returns. +// +// Either this or TF_AbortWhile() must be called after a successful +// TF_NewWhile() call. +public static native void TF_FinishWhile(@Const TF_WhileParams params, + TF_Status status, + TF_Output outputs); + +// Frees `params`s resources without building a while loop. `params` is no +// longer valid after this returns. Either this or TF_FinishWhile() must be +// called after a successful TF_NewWhile() call. +public static native void TF_AbortWhile(@Const TF_WhileParams params); + +// Adds operations to compute the partial derivatives of sum of `y`s w.r.t `x`s, +// i.e., d(y_1 + y_2 + ...)/dx_1, d(y_1 + y_2 + ...)/dx_2... +// +// `dx` are used as initial gradients (which represent the symbolic partial +// derivatives of some loss function `L` w.r.t. `y`). +// `dx` must be nullptr or have size `ny`. +// If `dx` is nullptr, the implementation will use dx of `OnesLike` for all +// shapes in `y`. +// The partial derivatives are returned in `dy`. `dy` should be allocated to +// size `nx`. +// +// Gradient nodes are automatically named under the "gradients/" prefix. To +// guarantee name uniqueness, subsequent calls to the same graph will +// append an incremental tag to the prefix: "gradients_1/", "gradients_2/", ... +// See TF_AddGradientsWithPrefix, which provides a means to specify a custom +// name prefix for operations added to a graph to compute the gradients. +// +// WARNING: This function does not yet support all the gradients that python +// supports. See +// https://www.tensorflow.org/code/tensorflow/cc/gradients/README.md +// for instructions on how to add C++ more gradients. +public static native void TF_AddGradients(TF_Graph g, TF_Output y, int ny, + TF_Output x, int nx, TF_Output dx, + TF_Status status, TF_Output dy); + +// Adds operations to compute the partial derivatives of sum of `y`s w.r.t `x`s, +// i.e., d(y_1 + y_2 + ...)/dx_1, d(y_1 + y_2 + ...)/dx_2... +// This is a variant of TF_AddGradients that allows to caller to pass a custom +// name prefix to the operations added to a graph to compute the gradients. +// +// `dx` are used as initial gradients (which represent the symbolic partial +// derivatives of some loss function `L` w.r.t. `y`). +// `dx` must be nullptr or have size `ny`. +// If `dx` is nullptr, the implementation will use dx of `OnesLike` for all +// shapes in `y`. +// The partial derivatives are returned in `dy`. `dy` should be allocated to +// size `nx`. +// `prefix` names the scope into which all gradients operations are being added. +// `prefix` must be unique within the provided graph otherwise this operation +// will fail. If `prefix` is nullptr, the default prefixing behaviour takes +// place, see TF_AddGradients for more details. +// +// WARNING: This function does not yet support all the gradients that python +// supports. See +// https://www.tensorflow.org/code/tensorflow/cc/gradients/README.md +// for instructions on how to add C++ more gradients. +public static native void TF_AddGradientsWithPrefix(TF_Graph g, @Cast("const char*") BytePointer prefix, + TF_Output y, int ny, + TF_Output x, int nx, + TF_Output dx, TF_Status status, + TF_Output dy); +public static native void TF_AddGradientsWithPrefix(TF_Graph g, String prefix, + TF_Output y, int ny, + TF_Output x, int nx, + TF_Output dx, TF_Status status, + TF_Output dy); + +// Create a TF_Function from a TF_Graph +// +// Params: +// fn_body - the graph whose operations (or subset of whose operations) will be +// converted to TF_Function. +// fn_name - the name of the new TF_Function. Should match the operation +// name (OpDef.name) regexp [A-Z][A-Za-z0-9_.\\-/]*. +// If `append_hash_to_fn_name` is false, `fn_name` must be distinct +// from other function and operation names (at least those +// registered in graphs where this function will be used). +// append_hash_to_fn_name - Must be 0 or 1. If set to 1, the actual name +// of the function will be `fn_name` appended with +// '_'. +// If set to 0, the function's name will be `fn_name`. +// num_opers - `num_opers` contains the number of elements in the `opers` array +// or a special value of -1 meaning that no array is given. +// The distinction between an empty array of operations and no +// array of operations is necessary to distinguish the case of +// creating a function with no body (e.g. identity or permutation) +// and the case of creating a function whose body contains all +// the nodes in the graph (except for the automatic skipping, see +// below). +// opers - Array of operations to become the body of the function or null. +// - If no array is given (`num_opers` = -1), all the +// operations in `fn_body` will become part of the function +// except operations referenced in `inputs`. These operations +// must have a single output (these operations are typically +// placeholders created for the sole purpose of representing +// an input. We can relax this constraint if there are +// compelling use cases). +// - If an array is given (`num_opers` >= 0), all operations +// in it will become part of the function. In particular, no +// automatic skipping of dummy input operations is performed. +// ninputs - number of elements in `inputs` array +// inputs - array of TF_Outputs that specify the inputs to the function. +// If `ninputs` is zero (the function takes no inputs), `inputs` +// can be null. The names used for function inputs are normalized +// names of the operations (usually placeholders) pointed to by +// `inputs`. These operation names should start with a letter. +// Normalization will convert all letters to lowercase and +// non-alphanumeric characters to '_' to make resulting names match +// the "[a-z][a-z0-9_]*" pattern for operation argument names. +// `inputs` cannot contain the same tensor twice. +// noutputs - number of elements in `outputs` array +// outputs - array of TF_Outputs that specify the outputs of the function. +// If `noutputs` is zero (the function returns no outputs), `outputs` +// can be null. `outputs` can contain the same tensor more than once. +// output_names - The names of the function's outputs. `output_names` array +// must either have the same length as `outputs` +// (i.e. `noutputs`) or be null. In the former case, +// the names should match the regular expression for ArgDef +// names - "[a-z][a-z0-9_]*". In the latter case, +// names for outputs will be generated automatically. +// opts - various options for the function, e.g. XLA's inlining control. +// description - optional human-readable description of this function. +// status - Set to OK on success and an appropriate error on failure. +// +// Note that when the same TF_Output is listed as both an input and an output, +// the corresponding function's output will equal to this input, +// instead of the original node's output. +// +// Callers must also satisfy the following constraints: +// - `inputs` cannot refer to TF_Outputs within a control flow context. For +// example, one cannot use the output of "switch" node as input. +// - `inputs` and `outputs` cannot have reference types. Reference types are +// not exposed through C API and are being replaced with Resources. We support +// reference types inside function's body to support legacy code. Do not +// use them in new code. +// - Every node in the function's body must have all of its inputs (including +// control inputs). In other words, for every node in the body, each input +// must be either listed in `inputs` or must come from another node in +// the body. In particular, it is an error to have a control edge going from +// a node outside of the body into a node in the body. This applies to control +// edges going from nodes referenced in `inputs` to nodes in the body when +// the former nodes are not in the body (automatically skipped or not +// included in explicitly specified body). +// +// Returns: +// On success, a newly created TF_Function instance. It must be deleted by +// calling TF_DeleteFunction. +// +// On failure, null. +public static native TF_Function TF_GraphToFunction( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Cast("const TF_Operation*const*") PointerPointer opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") PointerPointer output_names, + @Const TF_FunctionOptions opts, @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunction( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr BytePointer output_names, + @Const TF_FunctionOptions opts, @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunction( + @Const TF_Graph fn_body, String fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr ByteBuffer output_names, + @Const TF_FunctionOptions opts, String description, TF_Status status); +public static native TF_Function TF_GraphToFunction( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr byte[] output_names, + @Const TF_FunctionOptions opts, @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunction( + @Const TF_Graph fn_body, String fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr BytePointer output_names, + @Const TF_FunctionOptions opts, String description, TF_Status status); +public static native TF_Function TF_GraphToFunction( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr ByteBuffer output_names, + @Const TF_FunctionOptions opts, @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunction( + @Const TF_Graph fn_body, String fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr byte[] output_names, + @Const TF_FunctionOptions opts, String description, TF_Status status); + +// Similar to TF_GraphToFunction but allows specifying control outputs of the +// function. +// +// The arguments of TF_GraphToFunction have the same meaning, but the new +// arguments are as follows: +// +// ncontrol_outputs: Number of control outputs of the function. +// control_outputs: vector of TF_Operation objects to be marked as control +// outputs of the function. Operations marked as control outputs are +// guaranteed to execute. +// control_output_names: Optional. If not nullptr, vector of strings, one +// per control output, with their names to be added to the function's +// OpDef. +public static native TF_Function TF_GraphToFunctionWithControlOutputs( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Cast("const TF_Operation*const*") PointerPointer opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") PointerPointer output_names, + int ncontrol_outputs, @Cast("const TF_Operation*const*") PointerPointer control_outputs, + @Cast("const char*const*") PointerPointer control_output_names, @Const TF_FunctionOptions opts, + @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunctionWithControlOutputs( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr BytePointer output_names, + int ncontrol_outputs, @Const @ByPtrPtr TF_Operation control_outputs, + @Cast("const char*const*") @ByPtrPtr BytePointer control_output_names, @Const TF_FunctionOptions opts, + @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunctionWithControlOutputs( + @Const TF_Graph fn_body, String fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr ByteBuffer output_names, + int ncontrol_outputs, @Const @ByPtrPtr TF_Operation control_outputs, + @Cast("const char*const*") @ByPtrPtr ByteBuffer control_output_names, @Const TF_FunctionOptions opts, + String description, TF_Status status); +public static native TF_Function TF_GraphToFunctionWithControlOutputs( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr byte[] output_names, + int ncontrol_outputs, @Const @ByPtrPtr TF_Operation control_outputs, + @Cast("const char*const*") @ByPtrPtr byte[] control_output_names, @Const TF_FunctionOptions opts, + @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunctionWithControlOutputs( + @Const TF_Graph fn_body, String fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr BytePointer output_names, + int ncontrol_outputs, @Const @ByPtrPtr TF_Operation control_outputs, + @Cast("const char*const*") @ByPtrPtr BytePointer control_output_names, @Const TF_FunctionOptions opts, + String description, TF_Status status); +public static native TF_Function TF_GraphToFunctionWithControlOutputs( + @Const TF_Graph fn_body, @Cast("const char*") BytePointer fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr ByteBuffer output_names, + int ncontrol_outputs, @Const @ByPtrPtr TF_Operation control_outputs, + @Cast("const char*const*") @ByPtrPtr ByteBuffer control_output_names, @Const TF_FunctionOptions opts, + @Cast("const char*") BytePointer description, TF_Status status); +public static native TF_Function TF_GraphToFunctionWithControlOutputs( + @Const TF_Graph fn_body, String fn_name, + @Cast("unsigned char") byte append_hash_to_fn_name, int num_opers, + @Const @ByPtrPtr TF_Operation opers, int ninputs, @Const TF_Output inputs, + int noutputs, @Const TF_Output outputs, @Cast("const char*const*") @ByPtrPtr byte[] output_names, + int ncontrol_outputs, @Const @ByPtrPtr TF_Operation control_outputs, + @Cast("const char*const*") @ByPtrPtr byte[] control_output_names, @Const TF_FunctionOptions opts, + String description, TF_Status status); + +// Returns the name of the graph function. +// The return value points to memory that is only usable until the next +// mutation to *func. +public static native @Cast("const char*") BytePointer TF_FunctionName(TF_Function func); + +// Write out a serialized representation of `func` (as a FunctionDef protocol +// message) to `output_func_def` (allocated by TF_NewBuffer()). +// `output_func_def`'s underlying buffer will be freed when TF_DeleteBuffer() +// is called. +// +// May fail on very large graphs in the future. +public static native void TF_FunctionToFunctionDef(TF_Function func, + TF_Buffer output_func_def, + TF_Status status); + +// Construct and return the function whose FunctionDef representation is +// serialized in `proto`. `proto_len` must equal the number of bytes +// pointed to by `proto`. +// Returns: +// On success, a newly created TF_Function instance. It must be deleted by +// calling TF_DeleteFunction. +// +// On failure, null. +public static native TF_Function TF_FunctionImportFunctionDef( + @Const Pointer proto, @Cast("size_t") long proto_len, TF_Status status); + +// Sets function attribute named `attr_name` to value stored in `proto`. +// If this attribute is already set to another value, it is overridden. +// `proto` should point to a sequence of bytes of length `proto_len` +// representing a binary serialization of an AttrValue protocol +// buffer. +public static native void TF_FunctionSetAttrValueProto(TF_Function func, + @Cast("const char*") BytePointer attr_name, + @Const Pointer proto, + @Cast("size_t") long proto_len, + TF_Status status); +public static native void TF_FunctionSetAttrValueProto(TF_Function func, + String attr_name, + @Const Pointer proto, + @Cast("size_t") long proto_len, + TF_Status status); + +// Sets `output_attr_value` to the binary-serialized AttrValue proto +// representation of the value of the `attr_name` attr of `func`. +// If `attr_name` attribute is not present, status is set to an error. +public static native void TF_FunctionGetAttrValueProto( + TF_Function func, @Cast("const char*") BytePointer attr_name, TF_Buffer output_attr_value, + TF_Status status); +public static native void TF_FunctionGetAttrValueProto( + TF_Function func, String attr_name, TF_Buffer output_attr_value, + TF_Status status); + +// Frees the memory used by the `func` struct. +// TF_DeleteFunction is a noop if `func` is null. +// Deleting a function does not remove it from any graphs it was copied to. +public static native void TF_DeleteFunction(TF_Function func); + +// Attempts to evaluate `output`. This will only be possible if `output` doesn't +// depend on any graph inputs (this function is safe to call if this isn't the +// case though). +// +// If the evaluation is successful, this function returns true and `output`s +// value is returned in `result`. Otherwise returns false. An error status is +// returned if something is wrong with the graph or input. Note that this may +// return false even if no error status is set. +public static native @Cast("unsigned char") byte TF_TryEvaluateConstant(TF_Graph graph, + @ByVal TF_Output output, + @Cast("TF_Tensor**") PointerPointer result, + TF_Status status); +public static native @Cast("unsigned char") byte TF_TryEvaluateConstant(TF_Graph graph, + @ByVal TF_Output output, + @ByPtrPtr TF_Tensor result, + TF_Status status); +// Targeting ../TF_Session.java + + + +// Return a new execution session with the associated graph, or NULL on +// error. Does not take ownership of any input parameters. +// +// *`graph` must be a valid graph (not deleted or nullptr). `graph` will be be +// kept alive for the lifetime of the returned TF_Session. New nodes can still +// be added to `graph` after this call. +public static native TF_Session TF_NewSession(TF_Graph graph, + @Const TF_SessionOptions opts, + TF_Status status); + +// This function creates a new TF_Session (which is created on success) using +// `session_options`, and then initializes state (restoring tensors and other +// assets) using `run_options`. +// +// Any NULL and non-NULL value combinations for (`run_options, `meta_graph_def`) +// are valid. +// +// - `export_dir` must be set to the path of the exported SavedModel. +// - `tags` must include the set of tags used to identify one MetaGraphDef in +// the SavedModel. +// - `graph` must be a graph newly allocated with TF_NewGraph(). +// +// If successful, populates `graph` with the contents of the Graph and +// `meta_graph_def` with the MetaGraphDef of the loaded model. +public static native TF_Session TF_LoadSessionFromSavedModel( + @Const TF_SessionOptions session_options, @Const TF_Buffer run_options, + @Cast("const char*") BytePointer export_dir, @Cast("const char*const*") PointerPointer tags, int tags_len, + TF_Graph graph, TF_Buffer meta_graph_def, TF_Status status); +public static native TF_Session TF_LoadSessionFromSavedModel( + @Const TF_SessionOptions session_options, @Const TF_Buffer run_options, + @Cast("const char*") BytePointer export_dir, @Cast("const char*const*") @ByPtrPtr BytePointer tags, int tags_len, + TF_Graph graph, TF_Buffer meta_graph_def, TF_Status status); +public static native TF_Session TF_LoadSessionFromSavedModel( + @Const TF_SessionOptions session_options, @Const TF_Buffer run_options, + String export_dir, @Cast("const char*const*") @ByPtrPtr ByteBuffer tags, int tags_len, + TF_Graph graph, TF_Buffer meta_graph_def, TF_Status status); +public static native TF_Session TF_LoadSessionFromSavedModel( + @Const TF_SessionOptions session_options, @Const TF_Buffer run_options, + @Cast("const char*") BytePointer export_dir, @Cast("const char*const*") @ByPtrPtr byte[] tags, int tags_len, + TF_Graph graph, TF_Buffer meta_graph_def, TF_Status status); +public static native TF_Session TF_LoadSessionFromSavedModel( + @Const TF_SessionOptions session_options, @Const TF_Buffer run_options, + String export_dir, @Cast("const char*const*") @ByPtrPtr BytePointer tags, int tags_len, + TF_Graph graph, TF_Buffer meta_graph_def, TF_Status status); +public static native TF_Session TF_LoadSessionFromSavedModel( + @Const TF_SessionOptions session_options, @Const TF_Buffer run_options, + @Cast("const char*") BytePointer export_dir, @Cast("const char*const*") @ByPtrPtr ByteBuffer tags, int tags_len, + TF_Graph graph, TF_Buffer meta_graph_def, TF_Status status); +public static native TF_Session TF_LoadSessionFromSavedModel( + @Const TF_SessionOptions session_options, @Const TF_Buffer run_options, + String export_dir, @Cast("const char*const*") @ByPtrPtr byte[] tags, int tags_len, + TF_Graph graph, TF_Buffer meta_graph_def, TF_Status status); + +// Close a session. +// +// Contacts any other processes associated with the session, if applicable. +// May not be called after TF_DeleteSession(). +public static native void TF_CloseSession(TF_Session arg0, TF_Status status); + +// Destroy a session object. +// +// Even if error information is recorded in *status, this call discards all +// local resources associated with the session. The session may not be used +// during or after this call (and the session drops its reference to the +// corresponding graph). +public static native void TF_DeleteSession(TF_Session arg0, TF_Status status); + +// Run the graph associated with the session starting with the supplied inputs +// (inputs[0,ninputs-1] with corresponding values in input_values[0,ninputs-1]). +// +// Any NULL and non-NULL value combinations for (`run_options`, +// `run_metadata`) are valid. +// +// - `run_options` may be NULL, in which case it will be ignored; or +// non-NULL, in which case it must point to a `TF_Buffer` containing the +// serialized representation of a `RunOptions` protocol buffer. +// - `run_metadata` may be NULL, in which case it will be ignored; or +// non-NULL, in which case it must point to an empty, freshly allocated +// `TF_Buffer` that may be updated to contain the serialized representation +// of a `RunMetadata` protocol buffer. +// +// The caller retains ownership of `input_values` (which can be deleted using +// TF_DeleteTensor). The caller also retains ownership of `run_options` and/or +// `run_metadata` (when not NULL) and should manually call TF_DeleteBuffer on +// them. +// +// On success, the tensors corresponding to outputs[0,noutputs-1] are placed in +// output_values[]. Ownership of the elements of output_values[] is transferred +// to the caller, which must eventually call TF_DeleteTensor on them. +// +// On failure, output_values[] contains NULLs. +public static native void TF_SessionRun( + TF_Session session, + @Const TF_Buffer run_options, + @Const TF_Output inputs, @Cast("TF_Tensor*const*") PointerPointer input_values, int ninputs, + @Const TF_Output outputs, @Cast("TF_Tensor**") PointerPointer output_values, int noutputs, + @Cast("const TF_Operation*const*") PointerPointer target_opers, int ntargets, + TF_Buffer run_metadata, + TF_Status arg11); +public static native void TF_SessionRun( + TF_Session session, + @Const TF_Buffer run_options, + @Const TF_Output inputs, @ByPtrPtr TF_Tensor input_values, int ninputs, + @Const TF_Output outputs, @ByPtrPtr TF_Tensor output_values, int noutputs, + @Const @ByPtrPtr TF_Operation target_opers, int ntargets, + TF_Buffer run_metadata, + TF_Status arg11); + +// Set up the graph with the intended feeds (inputs) and fetches (outputs) for a +// sequence of partial run calls. +// +// On success, returns a handle that is used for subsequent PRun calls. The +// handle should be deleted with TF_DeletePRunHandle when it is no longer +// needed. +// +// On failure, out_status contains a tensorflow::Status with an error +// message. *handle is set to nullptr. +public static native void TF_SessionPRunSetup( + TF_Session arg0, + @Const TF_Output inputs, int ninputs, + @Const TF_Output outputs, int noutputs, + @Cast("const TF_Operation*const*") PointerPointer target_opers, int ntargets, + @Cast("const char**") PointerPointer handle, + TF_Status arg8); +public static native void TF_SessionPRunSetup( + TF_Session arg0, + @Const TF_Output inputs, int ninputs, + @Const TF_Output outputs, int noutputs, + @Const @ByPtrPtr TF_Operation target_opers, int ntargets, + @Cast("const char**") @ByPtrPtr BytePointer handle, + TF_Status arg8); +public static native void TF_SessionPRunSetup( + TF_Session arg0, + @Const TF_Output inputs, int ninputs, + @Const TF_Output outputs, int noutputs, + @Const @ByPtrPtr TF_Operation target_opers, int ntargets, + @Cast("const char**") @ByPtrPtr ByteBuffer handle, + TF_Status arg8); +public static native void TF_SessionPRunSetup( + TF_Session arg0, + @Const TF_Output inputs, int ninputs, + @Const TF_Output outputs, int noutputs, + @Const @ByPtrPtr TF_Operation target_opers, int ntargets, + @Cast("const char**") @ByPtrPtr byte[] handle, + TF_Status arg8); + +// Continue to run the graph with additional feeds and fetches. The +// execution state is uniquely identified by the handle. +public static native void TF_SessionPRun( + TF_Session arg0, @Cast("const char*") BytePointer handle, + @Const TF_Output inputs, @Cast("TF_Tensor*const*") PointerPointer input_values, int ninputs, + @Const TF_Output outputs, @Cast("TF_Tensor**") PointerPointer output_values, int noutputs, + @Cast("const TF_Operation*const*") PointerPointer target_opers, int ntargets, + TF_Status arg10); +public static native void TF_SessionPRun( + TF_Session arg0, @Cast("const char*") BytePointer handle, + @Const TF_Output inputs, @ByPtrPtr TF_Tensor input_values, int ninputs, + @Const TF_Output outputs, @ByPtrPtr TF_Tensor output_values, int noutputs, + @Const @ByPtrPtr TF_Operation target_opers, int ntargets, + TF_Status arg10); +public static native void TF_SessionPRun( + TF_Session arg0, String handle, + @Const TF_Output inputs, @ByPtrPtr TF_Tensor input_values, int ninputs, + @Const TF_Output outputs, @ByPtrPtr TF_Tensor output_values, int noutputs, + @Const @ByPtrPtr TF_Operation target_opers, int ntargets, + TF_Status arg10); + +// Deletes a handle allocated by TF_SessionPRunSetup. +// Once called, no more calls to TF_SessionPRun should be made. +public static native void TF_DeletePRunHandle(@Cast("const char*") BytePointer handle); +public static native void TF_DeletePRunHandle(String handle); +// Targeting ../TF_DeprecatedSession.java + + + +public static native TF_DeprecatedSession TF_NewDeprecatedSession( + @Const TF_SessionOptions arg0, TF_Status status); +public static native void TF_CloseDeprecatedSession(TF_DeprecatedSession arg0, + TF_Status status); +public static native void TF_DeleteDeprecatedSession(TF_DeprecatedSession arg0, + TF_Status status); +public static native void TF_Reset(@Const TF_SessionOptions opt, + @Cast("const char**") PointerPointer containers, int ncontainers, + TF_Status status); +public static native void TF_Reset(@Const TF_SessionOptions opt, + @Cast("const char**") @ByPtrPtr BytePointer containers, int ncontainers, + TF_Status status); +public static native void TF_Reset(@Const TF_SessionOptions opt, + @Cast("const char**") @ByPtrPtr ByteBuffer containers, int ncontainers, + TF_Status status); +public static native void TF_Reset(@Const TF_SessionOptions opt, + @Cast("const char**") @ByPtrPtr byte[] containers, int ncontainers, + TF_Status status); +// Treat the bytes proto[0,proto_len-1] as a serialized GraphDef and +// add the nodes in that GraphDef to the graph for the session. +// +// Prefer use of TF_Session and TF_GraphImportGraphDef over this. +public static native void TF_ExtendGraph(TF_DeprecatedSession arg0, + @Const Pointer proto, @Cast("size_t") long proto_len, + TF_Status arg3); + +// See TF_SessionRun() above. +public static native void TF_Run(TF_DeprecatedSession arg0, + @Const TF_Buffer run_options, + @Cast("const char**") PointerPointer input_names, @Cast("TF_Tensor**") PointerPointer inputs, + int ninputs, @Cast("const char**") PointerPointer output_names, + @Cast("TF_Tensor**") PointerPointer outputs, int noutputs, + @Cast("const char**") PointerPointer target_oper_names, int ntargets, + TF_Buffer run_metadata, TF_Status arg11); +public static native void TF_Run(TF_DeprecatedSession arg0, + @Const TF_Buffer run_options, + @Cast("const char**") @ByPtrPtr BytePointer input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr BytePointer output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr BytePointer target_oper_names, int ntargets, + TF_Buffer run_metadata, TF_Status arg11); +public static native void TF_Run(TF_DeprecatedSession arg0, + @Const TF_Buffer run_options, + @Cast("const char**") @ByPtrPtr ByteBuffer input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr ByteBuffer output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr ByteBuffer target_oper_names, int ntargets, + TF_Buffer run_metadata, TF_Status arg11); +public static native void TF_Run(TF_DeprecatedSession arg0, + @Const TF_Buffer run_options, + @Cast("const char**") @ByPtrPtr byte[] input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr byte[] output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr byte[] target_oper_names, int ntargets, + TF_Buffer run_metadata, TF_Status arg11); + +// See TF_SessionPRunSetup() above. +public static native void TF_PRunSetup(TF_DeprecatedSession arg0, + @Cast("const char**") PointerPointer input_names, int ninputs, + @Cast("const char**") PointerPointer output_names, int noutputs, + @Cast("const char**") PointerPointer target_oper_names, + int ntargets, @Cast("const char**") PointerPointer handle, + TF_Status arg8); +public static native void TF_PRunSetup(TF_DeprecatedSession arg0, + @Cast("const char**") @ByPtrPtr BytePointer input_names, int ninputs, + @Cast("const char**") @ByPtrPtr BytePointer output_names, int noutputs, + @Cast("const char**") @ByPtrPtr BytePointer target_oper_names, + int ntargets, @Cast("const char**") @ByPtrPtr BytePointer handle, + TF_Status arg8); +public static native void TF_PRunSetup(TF_DeprecatedSession arg0, + @Cast("const char**") @ByPtrPtr ByteBuffer input_names, int ninputs, + @Cast("const char**") @ByPtrPtr ByteBuffer output_names, int noutputs, + @Cast("const char**") @ByPtrPtr ByteBuffer target_oper_names, + int ntargets, @Cast("const char**") @ByPtrPtr ByteBuffer handle, + TF_Status arg8); +public static native void TF_PRunSetup(TF_DeprecatedSession arg0, + @Cast("const char**") @ByPtrPtr byte[] input_names, int ninputs, + @Cast("const char**") @ByPtrPtr byte[] output_names, int noutputs, + @Cast("const char**") @ByPtrPtr byte[] target_oper_names, + int ntargets, @Cast("const char**") @ByPtrPtr byte[] handle, + TF_Status arg8); + +// See TF_SessionPRun above. +public static native void TF_PRun(TF_DeprecatedSession arg0, @Cast("const char*") BytePointer handle, + @Cast("const char**") PointerPointer input_names, @Cast("TF_Tensor**") PointerPointer inputs, + int ninputs, @Cast("const char**") PointerPointer output_names, + @Cast("TF_Tensor**") PointerPointer outputs, int noutputs, + @Cast("const char**") PointerPointer target_oper_names, int ntargets, + TF_Status arg10); +public static native void TF_PRun(TF_DeprecatedSession arg0, @Cast("const char*") BytePointer handle, + @Cast("const char**") @ByPtrPtr BytePointer input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr BytePointer output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr BytePointer target_oper_names, int ntargets, + TF_Status arg10); +public static native void TF_PRun(TF_DeprecatedSession arg0, String handle, + @Cast("const char**") @ByPtrPtr ByteBuffer input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr ByteBuffer output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr ByteBuffer target_oper_names, int ntargets, + TF_Status arg10); +public static native void TF_PRun(TF_DeprecatedSession arg0, @Cast("const char*") BytePointer handle, + @Cast("const char**") @ByPtrPtr byte[] input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr byte[] output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr byte[] target_oper_names, int ntargets, + TF_Status arg10); +public static native void TF_PRun(TF_DeprecatedSession arg0, String handle, + @Cast("const char**") @ByPtrPtr BytePointer input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr BytePointer output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr BytePointer target_oper_names, int ntargets, + TF_Status arg10); +public static native void TF_PRun(TF_DeprecatedSession arg0, @Cast("const char*") BytePointer handle, + @Cast("const char**") @ByPtrPtr ByteBuffer input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr ByteBuffer output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr ByteBuffer target_oper_names, int ntargets, + TF_Status arg10); +public static native void TF_PRun(TF_DeprecatedSession arg0, String handle, + @Cast("const char**") @ByPtrPtr byte[] input_names, @ByPtrPtr TF_Tensor inputs, + int ninputs, @Cast("const char**") @ByPtrPtr byte[] output_names, + @ByPtrPtr TF_Tensor outputs, int noutputs, + @Cast("const char**") @ByPtrPtr byte[] target_oper_names, int ntargets, + TF_Status arg10); +// Targeting ../TF_DeviceList.java + + + +// Lists all devices in a TF_Session. +// +// Caller takes ownership of the returned TF_DeviceList* which must eventually +// be freed with a call to TF_DeleteDeviceList. +public static native TF_DeviceList TF_SessionListDevices(TF_Session session, + TF_Status status); + +// Lists all devices in a TF_Session. +// +// Caller takes ownership of the returned TF_DeviceList* which must eventually +// be freed with a call to TF_DeleteDeviceList. +public static native TF_DeviceList TF_DeprecatedSessionListDevices( + TF_DeprecatedSession session, TF_Status status); + +// Deallocates the device list. +public static native void TF_DeleteDeviceList(TF_DeviceList list); + +// Counts the number of elements in the device list. +public static native int TF_DeviceListCount(@Const TF_DeviceList list); + +// Retrieves the full name of the device (e.g. /job:worker/replica:0/...) +// The return value will be a pointer to a null terminated string. The caller +// must not modify or delete the string. It will be deallocated upon a call to +// TF_DeleteDeviceList. +// +// If index is out of bounds, an error code will be set in the status object, +// and a null pointer will be returned. +public static native @Cast("const char*") BytePointer TF_DeviceListName(@Const TF_DeviceList list, + int index, + TF_Status status); + +// Retrieves the type of the device at the given index. +// +// The caller must not modify or delete the string. It will be deallocated upon +// a call to TF_DeleteDeviceList. +// +// If index is out of bounds, an error code will be set in the status object, +// and a null pointer will be returned. +public static native @Cast("const char*") BytePointer TF_DeviceListType(@Const TF_DeviceList list, + int index, + TF_Status status); + +// Retrieve the amount of memory associated with a given device. +// +// If index is out of bounds, an error code will be set in the status object, +// and -1 will be returned. +public static native @Cast("int64_t") long TF_DeviceListMemoryBytes( + @Const TF_DeviceList list, int index, TF_Status status); + +// Retrieve the incarnation number of a given device. +// +// If index is out of bounds, an error code will be set in the status object, +// and 0 will be returned. +public static native @Cast("uint64_t") long TF_DeviceListIncarnation( + @Const TF_DeviceList list, int index, TF_Status status); +// Targeting ../TF_Library.java + + + +// Load the library specified by library_filename and register the ops and +// kernels present in that library. +// +// Pass "library_filename" to a platform-specific mechanism for dynamically +// loading a library. The rules for determining the exact location of the +// library are platform-specific and are not documented here. +// +// On success, place OK in status and return the newly created library handle. +// The caller owns the library handle. +// +// On failure, place an error status in status and return NULL. +public static native TF_Library TF_LoadLibrary(@Cast("const char*") BytePointer library_filename, + TF_Status status); +public static native TF_Library TF_LoadLibrary(String library_filename, + TF_Status status); + +// Get the OpList of OpDefs defined in the library pointed by lib_handle. +// +// Returns a TF_Buffer. The memory pointed to by the result is owned by +// lib_handle. The data in the buffer will be the serialized OpList proto for +// ops defined in the library. +public static native @ByVal TF_Buffer TF_GetOpList(TF_Library lib_handle); + +// Frees the memory associated with the library handle. +// Does NOT unload the library. +public static native void TF_DeleteLibraryHandle(TF_Library lib_handle); + +// Get the OpList of all OpDefs defined in this address space. +// Returns a TF_Buffer, ownership of which is transferred to the caller +// (and can be freed using TF_DeleteBuffer). +// +// The data in the buffer will be the serialized OpList proto for ops registered +// in this address space. +public static native TF_Buffer TF_GetAllOpList(); +// Targeting ../TF_ApiDefMap.java + + + +// Creates a new TF_ApiDefMap instance. +// +// Params: +// op_list_buffer - TF_Buffer instance containing serialized OpList +// protocol buffer. (See +// https://www.tensorflow.org/code/tensorflow/core/framework/op_def.proto +// for the OpList proto definition). +// status - Set to OK on success and an appropriate error on failure. +public static native TF_ApiDefMap TF_NewApiDefMap(TF_Buffer op_list_buffer, + TF_Status status); + +// Deallocates a TF_ApiDefMap. +public static native void TF_DeleteApiDefMap(TF_ApiDefMap apimap); + +// Add ApiDefs to the map. +// +// `text` corresponds to a text representation of an ApiDefs protocol message. +// (https://www.tensorflow.org/code/tensorflow/core/framework/api_def.proto). +// +// The provided ApiDefs will be merged with existing ones in the map, with +// precedence given to the newly added version in case of conflicts with +// previous calls to TF_ApiDefMapPut. +public static native void TF_ApiDefMapPut(TF_ApiDefMap api_def_map, + @Cast("const char*") BytePointer text, @Cast("size_t") long text_len, + TF_Status status); +public static native void TF_ApiDefMapPut(TF_ApiDefMap api_def_map, + String text, @Cast("size_t") long text_len, + TF_Status status); + +// Returns a serialized ApiDef protocol buffer for the TensorFlow operation +// named `name`. +public static native TF_Buffer TF_ApiDefMapGet(TF_ApiDefMap api_def_map, + @Cast("const char*") BytePointer name, + @Cast("size_t") long name_len, + TF_Status status); +public static native TF_Buffer TF_ApiDefMapGet(TF_ApiDefMap api_def_map, + String name, + @Cast("size_t") long name_len, + TF_Status status); + +// -------------------------------------------------------------------------- +// Kernel definition information. + +// Returns a serialized KernelList protocol buffer containing KernelDefs for all +// registered kernels. +public static native TF_Buffer TF_GetAllRegisteredKernels(TF_Status status); + +// Returns a serialized KernelList protocol buffer containing KernelDefs for all +// kernels registered for the operation named `name`. +public static native TF_Buffer TF_GetRegisteredKernelsForOp( + @Cast("const char*") BytePointer name, TF_Status status); +public static native TF_Buffer TF_GetRegisteredKernelsForOp( + String name, TF_Status status); +// Targeting ../TF_Server.java + + + +// Creates a new in-process TensorFlow server configured using a serialized +// ServerDef protocol buffer provided via `proto` and `proto_len`. +// +// The server will not serve any requests until TF_ServerStart is invoked. +// The server will stop serving requests once TF_ServerStop or +// TF_DeleteServer is invoked. +public static native TF_Server TF_NewServer(@Const Pointer proto, + @Cast("size_t") long proto_len, + TF_Status status); + +// Starts an in-process TensorFlow server. +public static native void TF_ServerStart(TF_Server server, TF_Status status); + +// Stops an in-process TensorFlow server. +public static native void TF_ServerStop(TF_Server server, TF_Status status); + +// Blocks until the server has been successfully stopped (via TF_ServerStop or +// TF_ServerClose). +public static native void TF_ServerJoin(TF_Server server, TF_Status status); + +// Returns the target string that can be provided to TF_SetTarget() to connect +// a TF_Session to `server`. +// +// The returned string is valid only until TF_DeleteServer is invoked. +public static native @Cast("const char*") BytePointer TF_ServerTarget(TF_Server server); + +// Destroy an in-process TensorFlow server, frees memory. If server is running +// it will be stopped and joined. +public static native void TF_DeleteServer(TF_Server server); +// Targeting ../Listener_BytePointer.java + + +public static native void TF_RegisterLogListener( + Listener_BytePointer listener); +// Targeting ../Listener_String.java + + +public static native void TF_RegisterLogListener( + Listener_String listener); + +// #ifdef __cplusplus /* end extern "C" */ +// #endif + +// #endif // TENSORFLOW_C_C_API_H_ + + +// Parsed from tensorflow/c/kernels.h + +/* Copyright 2018 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_KERNELS_H_ +// #define TENSORFLOW_C_KERNELS_H_ + +// #include + +// #include "tensorflow/c/tf_datatype.h" +// #include "tensorflow/c/tf_status.h" + +// Macro to control visibility of exported symbols in the shared library (.so, +// .dylib, .dll). +// This duplicates the TF_EXPORT macro definition in +// tensorflow/core/platform/macros.h in order to keep this .h file independent +// of any other includes. +// #ifdef SWIG +// #define TF_CAPI_EXPORT +// #else +// #if defined(_WIN32) +// #ifdef TF_COMPILE_LIBRARY +// #define TF_CAPI_EXPORT __declspec(dllexport) +// #else +// #define TF_CAPI_EXPORT __declspec(dllimport) +// #endif // TF_COMPILE_LIBRARY +// #else +// #define TF_CAPI_EXPORT __attribute__((visibility("default"))) +// #endif // _WIN32 +// #endif // SWIG + +// #ifdef __cplusplus +// #endif +// Targeting ../TF_KernelBuilder.java + + +// Targeting ../TF_OpKernelConstruction.java + + +// Targeting ../TF_OpKernelContext.java + + +// Targeting ../Create_func_TF_OpKernelConstruction.java + + +// Targeting ../Compute_func_Pointer_TF_OpKernelContext.java + + +// Targeting ../Delete_func_Pointer.java + + +public static native TF_KernelBuilder TF_NewKernelBuilder( + @Cast("const char*") BytePointer op_name, @Cast("const char*") BytePointer device_name, + Create_func_TF_OpKernelConstruction create_func, + Compute_func_Pointer_TF_OpKernelContext compute_func, + Delete_func_Pointer delete_func); +public static native TF_KernelBuilder TF_NewKernelBuilder( + String op_name, String device_name, + Create_func_TF_OpKernelConstruction create_func, + Compute_func_Pointer_TF_OpKernelContext compute_func, + Delete_func_Pointer delete_func); + +// Specifies that this kernel's attribute only supports the given type. +public static native void TF_KernelBuilder_TypeConstraint( + TF_KernelBuilder kernel_builder, @Cast("const char*") BytePointer attr_name, + @Cast("const TF_DataType") int type, TF_Status status); +public static native void TF_KernelBuilder_TypeConstraint( + TF_KernelBuilder kernel_builder, String attr_name, + @Cast("const TF_DataType") int type, TF_Status status); + +// Specify that this kernel requires/provides an input/output arg +// in host memory (instead of the default, device memory). +public static native void TF_KernelBuilder_HostMemory( + TF_KernelBuilder kernel_builder, @Cast("const char*") BytePointer arg_name); +public static native void TF_KernelBuilder_HostMemory( + TF_KernelBuilder kernel_builder, String arg_name); + +// Register the given kernel builder with the TensorFlow runtime. If +// registration fails, the given status will be populated. +// +// This call takes ownership of the `builder` pointer. +public static native void TF_RegisterKernelBuilder(@Cast("const char*") BytePointer kernel_name, + TF_KernelBuilder builder, + TF_Status status); +public static native void TF_RegisterKernelBuilder(String kernel_name, + TF_KernelBuilder builder, + TF_Status status); + +// Deletes the given TF_KernelBuilder. This should be called only if the kernel +// builder is not registered with TensorFlow via TF_RegisterKernelBuilder. +public static native void TF_DeleteKernelBuilder(TF_KernelBuilder builder); + +// -------------------------------------------------------------------------- +// OpKernelContext routines + +// TF_NumInputs returns the number of inputs available in ctx. +public static native int TF_NumInputs(TF_OpKernelContext ctx); + +// TF_NumOutputs returns the number of outputs to be placed in *ctx by the +// kernel. +public static native int TF_NumOutputs(TF_OpKernelContext ctx); + +// Retrieves the ith input from ctx. If TF_GetCode(status) is TF_OK, *tensor is +// populated and its ownership is passed to the caller. In any other case, +// *tensor is not modified. +// +// If i < 0 or i >= TF_NumInputs(ctx), *status is set to TF_OUT_OF_RANGE. +public static native void TF_GetInput(TF_OpKernelContext ctx, int i, + @Cast("TF_Tensor**") PointerPointer tensor, TF_Status status); +public static native void TF_GetInput(TF_OpKernelContext ctx, int i, + @ByPtrPtr TF_Tensor tensor, TF_Status status); + +// Sets the ith output of ctx to tensor. If TF_GetCode(status) is anything but +// TF_OK, ctx is left unmodified. +// +// If i < 0 or i >= TF_NumOutputs(ctx), *status is set to TF_OUT_OF_RANGE. +public static native void TF_SetOutput(TF_OpKernelContext ctx, int i, + @Const TF_Tensor tensor, + TF_Status status); + +// Notifies the given OpKernelConstruction that kernel construction has failed. +public static native void TF_OpKernelConstruction_Failure( + TF_OpKernelConstruction ctx, TF_Status status); + +// Notifies the given OpKernelContext that the kernel's compute function has +// failed. +public static native void TF_OpKernelContext_Failure(TF_OpKernelContext ctx, + TF_Status status); + +// Returns the expected output data type of the ith output. If i < 0 or +// i >= TF_NumOutputs(ctx), the program aborts. +public static native @Cast("TF_DataType") int TF_ExpectedOutputDataType( + TF_OpKernelContext ctx, int i); + +// Returns the step ID of the given context. +public static native @Cast("int64_t") long TF_StepId(TF_OpKernelContext ctx); + +// Interprets the named kernel construction attribute as a TF_DataType and +// places it into *val. *status is set to TF_OK. +// +// If the attribute could not be found or could not be interpreted as +// TF_DataType, *status is populated with an error. +public static native void TF_OpKernelConstruction_GetAttrType( + TF_OpKernelConstruction ctx, @Cast("const char*") BytePointer attr_name, @Cast("TF_DataType*") IntPointer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrType( + TF_OpKernelConstruction ctx, String attr_name, @Cast("TF_DataType*") IntBuffer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrType( + TF_OpKernelConstruction ctx, @Cast("const char*") BytePointer attr_name, @Cast("TF_DataType*") int[] val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrType( + TF_OpKernelConstruction ctx, String attr_name, @Cast("TF_DataType*") IntPointer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrType( + TF_OpKernelConstruction ctx, @Cast("const char*") BytePointer attr_name, @Cast("TF_DataType*") IntBuffer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrType( + TF_OpKernelConstruction ctx, String attr_name, @Cast("TF_DataType*") int[] val, + TF_Status status); + +// Interprets the named kernel construction attribute as int32_t and +// places it into *val. *status is set to TF_OK. +// +// If the attribute could not be found or could not be interpreted as +// int32, *status is populated with an error. +public static native void TF_OpKernelConstruction_GetAttrInt32( + TF_OpKernelConstruction ctx, @Cast("const char*") BytePointer attr_name, IntPointer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrInt32( + TF_OpKernelConstruction ctx, String attr_name, IntBuffer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrInt32( + TF_OpKernelConstruction ctx, @Cast("const char*") BytePointer attr_name, int[] val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrInt32( + TF_OpKernelConstruction ctx, String attr_name, IntPointer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrInt32( + TF_OpKernelConstruction ctx, @Cast("const char*") BytePointer attr_name, IntBuffer val, + TF_Status status); +public static native void TF_OpKernelConstruction_GetAttrInt32( + TF_OpKernelConstruction ctx, String attr_name, int[] val, + TF_Status status); + +// Allocates Tensor for output at given index. Caller takes ownership of +// returned TF_Tensor and should deallocate it using TF_DeleteTensor(tensor). +// +// This function should be used to allocate outputs inside kernel +// compute function. +public static native TF_Tensor TF_AllocateOutput(TF_OpKernelContext context, + int index, @Cast("TF_DataType") int dtype, + @Cast("int64_t*") LongPointer dims, int num_dims, + @Cast("size_t") long len); +public static native TF_Tensor TF_AllocateOutput(TF_OpKernelContext context, + int index, @Cast("TF_DataType") int dtype, + @Cast("int64_t*") LongBuffer dims, int num_dims, + @Cast("size_t") long len); +public static native TF_Tensor TF_AllocateOutput(TF_OpKernelContext context, + int index, @Cast("TF_DataType") int dtype, + @Cast("int64_t*") long[] dims, int num_dims, + @Cast("size_t") long len); + +// #ifdef __cplusplus /* end extern "C" */ +// #endif + +// #endif // TENSORFLOW_C_KERNELS_H_ + + +// Parsed from tensorflow/c/ops.h + +/* Copyright 2019 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. +==============================================================================*/ + +// Routines for registering new ops and for implementing op shape inference +// functions. +// +// This API is alpha software and is subject to change. +// +// REGISTRATION +// ------------ +// +// In order to register a new op, create a new TF_OpDefinitionBuilder: +// +// TF_OpDefinitionBuilder* builder = TF_NewOpDefinitionBuilder("OpName"); +// +// Inputs, outputs and attributes can be added to the builder with the +// corresponding functions, e.g. +// +// TF_OpDefinitionBuilderAddInput(builder, "input1: int32"); +// TF_OpDefinitionBuilderAddOutput(builder, "output1: int64"); +// TF_OpDefinitionBuilderAddAttr(builder, "attr: int32"); +// +// The builder may then be registered with TensorFlow using the +// TF_RegisterOpDefinition function. E.g. +// +// TF_Status* status = TF_NewStatus(); +// TF_RegisterOpDefinition(builder, &status); +// if (TF_GetCode(status) != TF_OK) { +// // handle error +// } +// +// SHAPE INFERENCE +// --------------- +// +// You can provide a shape inference function that TensorFlow will call when it +// wants to understand the shape of outputs that the op will produce. Use the +// TF_OpDefinitionBuilderSetShapeInferenceFunction function to register a shape +// inference function pointer with TensorFlow. The following is an example of a +// very simple shape inference function: +// +// void identity_shape_fn(TF_ShapeInferenceContext* ctx, TF_Status* status) { +// TF_ShapeHandle* input = TF_NewShapeHandle(); +// TF_ShapeInferenceContextGetInput(ctx, 0, input, status); +// if (TF_GetCode(status) == TF_OK) { +// TF_ShapeInferenceContextSetOutput(ctx, 0, input, status); +// } +// TF_DeleteShapeHandle(input); +// } +// +// The following code registers the inference function with TensorFlow: +// +// TF_OpDefinitionBuilderSetShapeInferenceFunction(builder, &identity_shape_fn); +// +// For more details about shape inference, see the documentation for +// TF_OpDefinitionBuilderSetShapeInferenceFunction. + +// #ifndef TENSORFLOW_C_OPS_H_ +// #define TENSORFLOW_C_OPS_H_ + +// #include +// #include +// #include + +// #include "tensorflow/c/tf_datatype.h" +// #include "tensorflow/c/tf_status.h" + +// #ifdef SWIG +// #define TF_CAPI_EXPORT +// #else +// #if defined(_WIN32) +// #ifdef TF_COMPILE_LIBRARY +// #define TF_CAPI_EXPORT __declspec(dllexport) +// #else +// #define TF_CAPI_EXPORT __declspec(dllimport) +// #endif // TF_COMPILE_LIBRARY +// #else +// #define TF_CAPI_EXPORT __attribute__((visibility("default"))) +// #endif // _WIN32 +// #endif // SWIG + +// #ifdef __cplusplus +// Targeting ../TF_DimensionHandle.java + + +// Targeting ../TF_OpDefinitionBuilder.java + + +// Targeting ../TF_ShapeHandle.java + + +// Targeting ../TF_ShapeInferenceContext.java + + + +// Returns a newly allocated op definition builder for the given op name. The +// returned builder may be customized with the `TF_OpDefinitionBuilder...` +// functions and then registered with TensorFlow with TF_RegisterOpDefinition. +// +// The returned pointer is either freed by a call to TF_RegisterOpDefinition, or +// can be manually deleted by TF_DeleteOpDefinitionBuilder if it is never +// registered. +public static native TF_OpDefinitionBuilder TF_NewOpDefinitionBuilder( + @Cast("const char*") BytePointer op_name); +public static native TF_OpDefinitionBuilder TF_NewOpDefinitionBuilder( + String op_name); + +// Registers the given op builder with TensorFlow. Indicates success or +// otherwise in the given status. +// +// `builder` is freed whether the op was successfully registered or not. You +// must call either this function or TF_DeleteOpDefinitionBuilder to free the +// builder, but never both. +public static native void TF_RegisterOpDefinition( + TF_OpDefinitionBuilder builder, TF_Status status); + +// Frees the given op definition builder. You must call either this function or +// TF_RegisterOpDefinition to free the builder, but never both. +public static native void TF_DeleteOpDefinitionBuilder( + TF_OpDefinitionBuilder builder); + +//---------------------------------------------------- +// Attribute functions. + +// Adds an attr to the given TF_OpDefinitionBuilder. The spec has +// format ":" or ":=" +// where matches regexp [a-zA-Z][a-zA-Z0-9_]*. +// By convention, names containing only capital letters are reserved for +// attributes whose values can be inferred by the operator implementation if not +// supplied by the user. If the attribute name contains characters other than +// capital letters, the operator expects the user to provide the attribute value +// at operation runtime. +// +// can be: +// "string", "int", "float", "bool", "type", "shape", or "tensor" +// "numbertype", "realnumbertype", "quantizedtype" +// (meaning "type" with a restriction on valid values) +// "{int32,int64}" or {realnumbertype,quantizedtype,string}" +// (meaning "type" with a restriction containing unions of value types) +// "{\"foo\", \"bar\n baz\"}", or "{'foo', 'bar\n baz'}" +// (meaning "string" with a restriction on valid values) +// "list(string)", ..., "list(tensor)", "list(numbertype)", ... +// (meaning lists of the above types) +// "int >= 2" (meaning "int" with a restriction on valid values) +// "list(string) >= 2", "list(int) >= 2" +// (meaning "list(string)" / "list(int)" with length at least 2) +// , if included, should use the Proto text format +// of . For lists use [a, b, c] format. +// +// Note that any attr specifying the length of an input or output will +// get a default minimum of 1 unless the >= # syntax is used. +public static native void TF_OpDefinitionBuilderAddAttr( + TF_OpDefinitionBuilder builder, @Cast("const char*") BytePointer attr_spec); +public static native void TF_OpDefinitionBuilderAddAttr( + TF_OpDefinitionBuilder builder, String attr_spec); + +// Adds an input to this TF_OpDefinitionBuilder. +// The spec has form ":" or ":Ref()" +// where matches regexp [a-z][a-z0-9_]* and can be: +// * For a single tensor: +// * For a sequence of tensors with the same type: * +// * For a sequence of tensors with different types: +// Where: +// is either one of "float", "int32", "string", ... +// or the name of an attr (see TF_OpDefinitionBuilderAddAttr) +// with type "type". +// is the name of an attr with type "int". +// is the name of an attr with type "list(type)". +public static native void TF_OpDefinitionBuilderAddInput( + TF_OpDefinitionBuilder builder, @Cast("const char*") BytePointer input_spec); +public static native void TF_OpDefinitionBuilderAddInput( + TF_OpDefinitionBuilder builder, String input_spec); + +// Adds an output to this TF_OpDefinitionBuilder. +// The spec has form ":" or ":Ref()" +// where matches regexp [a-z][a-z0-9_]* and can be: +// * For a single tensor: +// * For a sequence of tensors with the same type: * +// * For a sequence of tensors with different types: +// Where: +// is either one of "float", "int32", "string", ... +// or the name of an attr (see TF_OpDefinitionBuilderAddAttr) +// with type "type". +// is the name of an attr with type "int". +// is the name of an attr with type "list(type)". +public static native void TF_OpDefinitionBuilderAddOutput( + TF_OpDefinitionBuilder builder, @Cast("const char*") BytePointer output_spec); +public static native void TF_OpDefinitionBuilderAddOutput( + TF_OpDefinitionBuilder builder, String output_spec); + +// Sets the commutative property for the op built by the given builder. +public static native void TF_OpDefinitionBuilderSetIsCommutative( + TF_OpDefinitionBuilder builder, @Cast("bool") boolean is_commutative); + +// Sets the is_aggregate property of the builder to the given value. +// +// If is_aggregate is true, then the operation produced by this builder accepts +// N >= 2 inputs and produces 1 output all of the same type. Should be +// associative and commutative, and produce output with the same shape as the +// input. The optimizer may replace an aggregate op taking input from multiple +// devices with a tree of aggregate ops that aggregate locally within each +// device (and possibly within groups of nearby devices) before communicating. +public static native void TF_OpDefinitionBuilderSetIsAggregate( + TF_OpDefinitionBuilder builder, @Cast("bool") boolean is_aggregate); + +// Sets the is_stateful property of the builder to the given value. +// +// The op built by this builder is stateful if its behavior depends on some +// state beyond its input tensors (e.g. variable reading op) or if it has a +// side-effect (e.g. printing or asserting ops). Equivalently, stateless ops +// must always produce the same output for the same input and have no +// side-effects. +// +// By default Ops may be moved between devices. Stateful ops should either not +// be moved, or should only be moved if that state can also be moved (e.g. via +// some sort of save / restore). Stateful ops are guaranteed to never be +// optimized away by Common Subexpression Elimination (CSE). +public static native void TF_OpDefinitionBuilderSetIsStateful( + TF_OpDefinitionBuilder builder, @Cast("bool") boolean is_stateful); + +// Sets the allows_uninitialized_input property of the operation built by this +// builder. +// +// By default, all inputs to an Op must be initialized Tensors. Ops that may +// initialize tensors for the first time should set this field to true, to allow +// the Op to take an uninitialized Tensor as input. +public static native void TF_OpDefinitionBuilderSetAllowsUninitializedInput( + TF_OpDefinitionBuilder builder, @Cast("bool") boolean allows_uninitialized_input); + +// Adds a deprecation warning for the given op. This indicates to the user that +// `version` is the first TensorFlow GraphDef version for which the operation is +// deprecated. `explanation` should contain the reason for the deprecation and +// what to use instead. +// +// This function is only an indicator that the operation may disappear in a +// version of TensorFlow after `version`. It does not affect op registration. +public static native void TF_OpDefinitionBuilderDeprecated( + TF_OpDefinitionBuilder builder, int version, @Cast("const char*") BytePointer explanation); +public static native void TF_OpDefinitionBuilderDeprecated( + TF_OpDefinitionBuilder builder, int version, String explanation); +// Targeting ../Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java + + +public static native void TF_OpDefinitionBuilderSetShapeInferenceFunction( + TF_OpDefinitionBuilder builder, + Shape_inference_func_TF_ShapeInferenceContext_TF_Status shape_inference_func); + +//---------------------------------------------------- +// Functions for TF_ShapeInferenceContext. +// +// Functions for implementing shape inference functions. TensorFlow uses these +// functions to determine the shape of tensors produced by an operation without +// having to actually run the operation. If an operation chooses to provide a +// shape inference function, it will be invoked by TensorFlow as needed. +// +// When invoked by TensorFlow, the shape inference function is provided with a +// TF_ShapeInferenceContext pointer. The function's implementation will use the +// accessor and mutator functions with names beginning with +// TF_ShapeInferenceContext to examine the input state and determine the output +// shape. + +// Returns the number of inputs in the given shape inference context. +public static native @Cast("int64_t") long TF_ShapeInferenceContextNumInputs( + TF_ShapeInferenceContext ctx); + +// Returns a newly allocated shape handle. The shapes represented by these +// handles may be queried or mutated with the corresponding +// TF_ShapeInferenceContext... functions. +public static native TF_ShapeHandle TF_NewShapeHandle(); + +// Places the ith input of the given shape inference context into the given +// shape handle, or returns a status other than TF_OK indicating why the input +// could not be retrieved +// (for example, if i < 0 || i >= TF_ShapeInferenceContextNumInputs(ctx)). +public static native void TF_ShapeInferenceContextGetInput( + TF_ShapeInferenceContext ctx, int i, TF_ShapeHandle handle, + TF_Status status); + +// Places the given shape handle into the `i`th output position of the given +// context. Internally, the shape handle is copied; the caller may subsequently +// delete `handle`. +public static native void TF_ShapeInferenceContextSetOutput(TF_ShapeInferenceContext ctx, + int i, TF_ShapeHandle handle, + TF_Status status); + +// Returns a newly-allocate shape handle representing a vector of the given +// size. The returned handle should be freed with TF_DeleteShapeHandle. +public static native TF_ShapeHandle TF_ShapeInferenceContextVectorFromSize( + TF_ShapeInferenceContext ctx, @Cast("size_t") long size); + +// Returns a newly allocated dimension handle. It must be freed with +// TF_DeleteDimensionHandle. +public static native TF_DimensionHandle TF_NewDimensionHandle(); + +// Interprets the named shape inference context attribute as a TF_DataType and +// places it into *val. *status is set to TF_OK. +// +// If the attribute could not be found or could not be interpreted as +// TF_DataType, *status is populated with an error. +public static native void TF_ShapeInferenceContext_GetAttrType( + TF_ShapeInferenceContext ctx, @Cast("const char*") BytePointer attr_name, @Cast("TF_DataType*") IntPointer val, + TF_Status status); +public static native void TF_ShapeInferenceContext_GetAttrType( + TF_ShapeInferenceContext ctx, String attr_name, @Cast("TF_DataType*") IntBuffer val, + TF_Status status); +public static native void TF_ShapeInferenceContext_GetAttrType( + TF_ShapeInferenceContext ctx, @Cast("const char*") BytePointer attr_name, @Cast("TF_DataType*") int[] val, + TF_Status status); +public static native void TF_ShapeInferenceContext_GetAttrType( + TF_ShapeInferenceContext ctx, String attr_name, @Cast("TF_DataType*") IntPointer val, + TF_Status status); +public static native void TF_ShapeInferenceContext_GetAttrType( + TF_ShapeInferenceContext ctx, @Cast("const char*") BytePointer attr_name, @Cast("TF_DataType*") IntBuffer val, + TF_Status status); +public static native void TF_ShapeInferenceContext_GetAttrType( + TF_ShapeInferenceContext ctx, String attr_name, @Cast("TF_DataType*") int[] val, + TF_Status status); + +// Returns the rank of the shape represented by the given handle. +public static native @Cast("int64_t") long TF_ShapeInferenceContextRank( + TF_ShapeInferenceContext ctx, TF_ShapeHandle handle); + +// Returns 1 if `handle` has a known rank, 0 otherwise. +public static native int TF_ShapeInferenceContextRankKnown( + TF_ShapeInferenceContext ctx, TF_ShapeHandle handle); + +// If has rank , or its rank is unknown, return OK and return the +// shape with asserted rank in <*result>. Otherwise an error is placed into +// `status`. +public static native void TF_ShapeInferenceContextWithRank( + TF_ShapeInferenceContext ctx, TF_ShapeHandle handle, @Cast("int64_t") long rank, + TF_ShapeHandle result, TF_Status status); + +// If has rank at least , or its rank is unknown, return OK and +// return the shape with asserted rank in <*result>. Otherwise an error is +// placed into `status`. +public static native void TF_ShapeInferenceContextWithRankAtLeast( + TF_ShapeInferenceContext ctx, TF_ShapeHandle handle, @Cast("int64_t") long rank, + TF_ShapeHandle result, TF_Status status); + +// If has rank at most , or its rank is unknown, return OK and +// return the shape with asserted rank in <*result>. Otherwise an error is +// placed into `status`. +public static native void TF_ShapeInferenceContextWithRankAtMost( + TF_ShapeInferenceContext ctx, TF_ShapeHandle handle, @Cast("int64_t") long rank, + TF_ShapeHandle result, TF_Status status); + +// Places a handle to the ith dimension of the given shape into *result. +public static native void TF_ShapeInferenceContextDim( + TF_ShapeInferenceContext ctx, TF_ShapeHandle shape_handle, @Cast("int64_t") long i, + TF_DimensionHandle result); + +// Returns in <*result> a sub-shape of , with dimensions +// [start:end]. and can be negative, to index from the end of the +// shape. and are set to the rank of if > rank of +// . +public static native void TF_ShapeInferenceContextSubshape( + TF_ShapeInferenceContext ctx, TF_ShapeHandle shape_handle, @Cast("int64_t") long start, + @Cast("int64_t") long end, TF_ShapeHandle result, TF_Status status); + +// Places an unknown shape in all outputs for the given inference context. Used +// for shape inference functions with ops whose output shapes are unknown. +public static native void TF_ShapeInferenceContextSetUnknownShape( + TF_ShapeInferenceContext ctx, TF_Status status); + +// Returns whether the given handle represents a known dimension. +public static native int TF_DimensionHandleValueKnown( + TF_DimensionHandle dim_handle); + +// Returns the value of the given dimension. +public static native @Cast("int64_t") long TF_DimensionHandleValue( + TF_DimensionHandle dim_handle); + +// Returns in <*result> the result of appending the dimensions of to +// those of . +public static native void TF_ShapeInferenceContextConcatenateShapes( + TF_ShapeInferenceContext ctx, TF_ShapeHandle first, + TF_ShapeHandle second, TF_ShapeHandle result, TF_Status status); + +// Frees the given shape handle. +public static native void TF_DeleteShapeHandle(TF_ShapeHandle handle); + +// Frees the given dimension handle. +public static native void TF_DeleteDimensionHandle(TF_DimensionHandle handle); + +// #ifdef __cplusplus /* end extern "C" */ +// #endif + +// #endif // TENSORFLOW_C_OPS_H_ + + +// Parsed from tensorflow/c/eager/c_api.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_C_API_H_ +// #define TENSORFLOW_C_EAGER_C_API_H_ + +// C API extensions to experiment with eager execution of kernels. +// WARNING: Unlike tensorflow/c/c_api.h, the API here is not guaranteed to be +// stable and can change without notice. + +// #include "tensorflow/c/c_api.h" + +// Macro to control visibility of exported symbols in the shared library (.so, +// .dylib, .dll). +// This duplicates the TF_EXPORT macro definition in +// tensorflow/core/platform/macros.h in order to keep this .h file independent +// of any other includes.$a +// #ifdef SWIG +// #define TF_CAPI_EXPORT +// #else +// #if defined(_WIN32) +// #ifdef TF_COMPILE_LIBRARY +// #define TF_CAPI_EXPORT __declspec(dllexport) +// #else +// #define TF_CAPI_EXPORT __declspec(dllimport) +// #endif // TF_COMPILE_LIBRARY +// #else +// #define TF_CAPI_EXPORT __attribute__((visibility("default"))) +// #endif // _WIN32 +// #endif // SWIG + +// #ifdef __cplusplus +// Targeting ../TFE_ContextOptions.java + + + +// Return a new options object. +public static native TFE_ContextOptions TFE_NewContextOptions(); + +// Set the config in TF_ContextOptions.options. +// config should be a serialized tensorflow.ConfigProto proto. +// If config was not parsed successfully as a ConfigProto, record the +// error information in *status. +public static native void TFE_ContextOptionsSetConfig( + TFE_ContextOptions options, @Const Pointer proto, @Cast("size_t") long proto_len, + TF_Status status); + +// Controls how to act when we try to run an operation on a given device but +// some input tensors are not on that device. +// LINT.IfChange +// Note: Keep in sync with internal copy of enum in eager/context.h. +/** enum TFE_ContextDevicePlacementPolicy */ +public static final int + // Running operations with input tensors on the wrong device will fail. + TFE_DEVICE_PLACEMENT_EXPLICIT = 0, + // Copy the tensor to the right device but log a warning. + TFE_DEVICE_PLACEMENT_WARN = 1, + // Silently copy the tensor, which has a performance cost since the operation + // will be blocked till the copy completes. This is the default placement + // policy. + TFE_DEVICE_PLACEMENT_SILENT = 2, + // Placement policy which silently copies int32 tensors but not other dtypes. + TFE_DEVICE_PLACEMENT_SILENT_FOR_INT32 = 3; +// LINT.ThenChange(//tensorflow/core/common_runtime/eager/context.h) + +// Sets the default execution mode (sync/async). Note that this can be +// overridden per thread using TFE_ContextSetExecutorForThread. +public static native void TFE_ContextOptionsSetAsync(TFE_ContextOptions arg0, + @Cast("unsigned char") byte enable); + +public static native void TFE_ContextOptionsSetDevicePlacementPolicy( + TFE_ContextOptions arg0, @Cast("TFE_ContextDevicePlacementPolicy") int arg1); + +// Destroy an options object. +public static native void TFE_DeleteContextOptions(TFE_ContextOptions arg0); +// Targeting ../TFE_Context.java + + + +public static native TFE_Context TFE_NewContext( + @Const TFE_ContextOptions opts, TF_Status status); +public static native void TFE_DeleteContext(TFE_Context ctx); +public static native TF_DeviceList TFE_ContextListDevices(TFE_Context ctx, + TF_Status status); + +// Clears the internal caches in the TFE context. Useful when reseeding random +// ops. +public static native void TFE_ContextClearCaches(TFE_Context ctx); + +// Sets a thread-local device placement policy. After this call, other calls to +// TFE_Execute in the same thread will use the device policy specified here +// instead of the device policy used to construct the context. This has no +// effect on the device policy used by other program threads. +public static native void TFE_ContextSetThreadLocalDevicePlacementPolicy( + TFE_Context ctx, @Cast("TFE_ContextDevicePlacementPolicy") int policy); + +// Returns the device placement policy to be used by this context in the current +// thread. +public static native @Cast("TFE_ContextDevicePlacementPolicy") int TFE_ContextGetDevicePlacementPolicy(TFE_Context ctx); + +// A tensorflow.ServerDef specifies remote workers (in addition to the current +// workers name). Operations created on this context can then be executed on +// any of these remote workers by setting an appropriate device. +// +// If the following is set, all servers identified by the +// ServerDef must be up when the context is created. +public static native void TFE_ContextSetServerDef(TFE_Context ctx, + int keep_alive_secs, + @Const Pointer proto, + @Cast("size_t") long proto_len, + TF_Status status); + +// Causes the calling thread to block till all ops dispatched in async mode +// have been executed. Note that "execution" here refers to kernel execution / +// scheduling of copies, etc. Similar to sync execution, it doesn't guarantee +// that lower level device queues (like GPU streams) have been flushed. +// +// This call may not block for execution of ops enqueued concurrently with this +// call. +public static native void TFE_ContextAsyncWait(TFE_Context arg0, + TF_Status status); + +// When an error happens, any pending operations are discarded and newly issued +// ops return an error. This call clears the error state and re-enables +// execution of newly issued ops. +// +// Note that outputs of discarded ops remain in a corrupt state and should not +// be used for future calls. +// TODO(agarwal): mark the affected handles and raise errors if they are used. +public static native void TFE_ContextAsyncClearError(TFE_Context arg0); +// Targeting ../TFE_TensorHandle.java + + + +public static native TFE_TensorHandle TFE_NewTensorHandle(TF_Tensor t, + TF_Status status); +// Indicates that the caller will not be using `h` any more. +public static native void TFE_DeleteTensorHandle(TFE_TensorHandle h); +public static native @Cast("TF_DataType") int TFE_TensorHandleDataType(TFE_TensorHandle h); +// This function will block till the operation that produces `h` has completed. +public static native int TFE_TensorHandleNumDims(TFE_TensorHandle h, + TF_Status status); +public static native @Cast("int64_t") long TFE_TensorHandleNumElements(TFE_TensorHandle h, + TF_Status status); +// This function will block till the operation that produces `h` has completed. +public static native @Cast("int64_t") long TFE_TensorHandleDim(TFE_TensorHandle h, + int dim_index, + TF_Status status); + +// Returns the device of the operation that produced `h`. If `h` was produced by +// a copy, returns the destination device of the copy. Note that the returned +// device name is not always the device holding the tensor handle's memory. If +// you want the latter, use TFE_TensorHandleBackingDeviceName. This function +// will block till the operation that produces `h` has completed. +public static native @Cast("const char*") BytePointer TFE_TensorHandleDeviceName( + TFE_TensorHandle h, TF_Status status); + +// Returns the name of the device in whose memory `h` resides. +// +// This function will block till the operation that produces `h` has completed. +public static native @Cast("const char*") BytePointer TFE_TensorHandleBackingDeviceName( + TFE_TensorHandle h, TF_Status status); + +// Return a pointer to a new TFE_TensorHandle that shares the underlying tensor +// with `h`. On success, `status` is set to OK. On failure, `status` reflects +// the error and a nullptr is returned. +public static native TFE_TensorHandle TFE_TensorHandleCopySharingTensor( + TFE_TensorHandle h, TF_Status status); + +// This function will block till the operation that produces `h` has +// completed. The memory returned might alias the internal memory used by +// TensorFlow. Hence, callers should not mutate this memory (for example by +// modifying the memory region pointed to by TF_TensorData() on the returned +// TF_Tensor). +public static native TF_Tensor TFE_TensorHandleResolve(TFE_TensorHandle h, + TF_Status status); + +// Create a new TFE_TensorHandle with the same contents as 'h' but placed +// in the memory of the device name 'device_name'. +// If source and destination are the same device, then this creates a new handle +// that shares the underlying buffer. Otherwise, it currently requires at least +// one of the source or destination devices to be CPU (i.e., for the source or +// destination tensor to be placed in host memory). +// If async execution is enabled, the copy may be enqueued and the call will +// return "non-ready" handle. Else, this function returns after the copy has +// been done. +public static native TFE_TensorHandle TFE_TensorHandleCopyToDevice( + TFE_TensorHandle h, TFE_Context ctx, @Cast("const char*") BytePointer device_name, + TF_Status status); +public static native TFE_TensorHandle TFE_TensorHandleCopyToDevice( + TFE_TensorHandle h, TFE_Context ctx, String device_name, + TF_Status status); +// Targeting ../TFE_TensorDebugInfo.java + + + +// Retrieves TFE_TensorDebugInfo for `handle`. +// If TFE_TensorHandleTensorDebugInfo succeeds, `status` is set to OK and caller +// is responsible for deleting returned TFE_TensorDebugInfo. +// If TFE_TensorHandleTensorDebugInfo fails, `status` is set to appropriate +// error and nullptr is returned. This function can block till the operation +// that produces `handle` has completed. +public static native TFE_TensorDebugInfo TFE_TensorHandleTensorDebugInfo( + TFE_TensorHandle handle, TF_Status status); + +// Deletes `debug_info`. +public static native void TFE_DeleteTensorDebugInfo( + TFE_TensorDebugInfo debug_info); + +// Returns the number of dimensions used to represent the tensor on its device. +// The number of dimensions used to reprensent the tensor on device can be +// different from the number returned by TFE_TensorHandleNumDims. +// The return value was current at the time of TFE_TensorDebugInfo creation. +public static native int TFE_TensorDebugInfoOnDeviceNumDims( + TFE_TensorDebugInfo debug_info); + +// Returns the number of elements in dimension `dim_index`. +// Tensor representation on device can be transposed from its representation +// on host. The data contained in dimension `dim_index` on device +// can correspond to the data contained in another dimension in on-host +// representation. The dimensions are indexed using the standard TensorFlow +// major-to-minor order (slowest varying dimension first), +// not the XLA's minor-to-major order. +// On-device dimensions can be padded. TFE_TensorDebugInfoOnDeviceDim returns +// the number of elements in a dimension after padding. +// The return value was current at the time of TFE_TensorDebugInfo creation. +public static native @Cast("int64_t") long TFE_TensorDebugInfoOnDeviceDim( + TFE_TensorDebugInfo debug_info, int dim_index); +// Targeting ../TFE_Op.java + + + +public static native TFE_Op TFE_NewOp(TFE_Context ctx, + @Cast("const char*") BytePointer op_or_function_name, + TF_Status status); +public static native TFE_Op TFE_NewOp(TFE_Context ctx, + String op_or_function_name, + TF_Status status); + +public static native void TFE_DeleteOp(TFE_Op op); + +public static native void TFE_OpSetDevice(TFE_Op op, @Cast("const char*") BytePointer device_name, + TF_Status status); +public static native void TFE_OpSetDevice(TFE_Op op, String device_name, + TF_Status status); +// The returned string remains valid throughout the lifetime of 'op'. +public static native @Cast("const char*") BytePointer TFE_OpGetDevice(TFE_Op op, + TF_Status status); + +// When 'enable' is set to 1, and if TensorFlow library is built with XLA +// support, a subsequent TFE_Execute() call on `op` will run the op via XLA. +// +// If the library is not built with XLA support, this call would be a no-op. +public static native void TFE_OpSetXLACompilation(TFE_Op op, + @Cast("unsigned char") byte enable); + +public static native void TFE_OpAddInput(TFE_Op op, TFE_TensorHandle input, + TF_Status status); + +public static native void TFE_OpAddInputList(TFE_Op op, + @Cast("TFE_TensorHandle**") PointerPointer inputs, + int num_inputs, + TF_Status status); +public static native void TFE_OpAddInputList(TFE_Op op, + @ByPtrPtr TFE_TensorHandle inputs, + int num_inputs, + TF_Status status); + +public static native @Cast("TF_AttrType") int TFE_OpGetAttrType(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") BytePointer is_list, + TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpGetAttrType(TFE_Op op, + String attr_name, + @Cast("unsigned char*") ByteBuffer is_list, + TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpGetAttrType(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") byte[] is_list, + TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpGetAttrType(TFE_Op op, + String attr_name, + @Cast("unsigned char*") BytePointer is_list, + TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpGetAttrType(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") ByteBuffer is_list, + TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpGetAttrType(TFE_Op op, + String attr_name, + @Cast("unsigned char*") byte[] is_list, + TF_Status status); +// Get an attribute type given an op name; a fusion of TFE_NewOp and +// TFE_OpGetAttrType for use from Python without the overhead of the individual +// calls and memory management of TFE_Op. +public static native @Cast("TF_AttrType") int TFE_OpNameGetAttrType( + TFE_Context ctx, @Cast("const char*") BytePointer op_or_function_name, @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") BytePointer is_list, TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpNameGetAttrType( + TFE_Context ctx, String op_or_function_name, String attr_name, + @Cast("unsigned char*") ByteBuffer is_list, TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpNameGetAttrType( + TFE_Context ctx, @Cast("const char*") BytePointer op_or_function_name, @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") byte[] is_list, TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpNameGetAttrType( + TFE_Context ctx, String op_or_function_name, String attr_name, + @Cast("unsigned char*") BytePointer is_list, TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpNameGetAttrType( + TFE_Context ctx, @Cast("const char*") BytePointer op_or_function_name, @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char*") ByteBuffer is_list, TF_Status status); +public static native @Cast("TF_AttrType") int TFE_OpNameGetAttrType( + TFE_Context ctx, String op_or_function_name, String attr_name, + @Cast("unsigned char*") byte[] is_list, TF_Status status); + +public static native void TFE_OpSetAttrString(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Const Pointer value, + @Cast("size_t") long length); +public static native void TFE_OpSetAttrString(TFE_Op op, + String attr_name, + @Const Pointer value, + @Cast("size_t") long length); +public static native void TFE_OpSetAttrInt(TFE_Op op, @Cast("const char*") BytePointer attr_name, + @Cast("int64_t") long value); +public static native void TFE_OpSetAttrInt(TFE_Op op, String attr_name, + @Cast("int64_t") long value); +public static native void TFE_OpSetAttrFloat(TFE_Op op, @Cast("const char*") BytePointer attr_name, + float value); +public static native void TFE_OpSetAttrFloat(TFE_Op op, String attr_name, + float value); +public static native void TFE_OpSetAttrBool(TFE_Op op, @Cast("const char*") BytePointer attr_name, + @Cast("unsigned char") byte value); +public static native void TFE_OpSetAttrBool(TFE_Op op, String attr_name, + @Cast("unsigned char") byte value); +public static native void TFE_OpSetAttrType(TFE_Op op, @Cast("const char*") BytePointer attr_name, + @Cast("TF_DataType") int value); +public static native void TFE_OpSetAttrType(TFE_Op op, String attr_name, + @Cast("TF_DataType") int value); +// If the number of dimensions is unknown, `num_dims` must be set to +// -1 and `dims` can be null. If a dimension is unknown, the +// corresponding entry in the `dims` array must be -1. +public static native void TFE_OpSetAttrShape(TFE_Op op, @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongPointer dims, + int num_dims, + TF_Status out_status); +public static native void TFE_OpSetAttrShape(TFE_Op op, String attr_name, + @Cast("const int64_t*") LongBuffer dims, + int num_dims, + TF_Status out_status); +public static native void TFE_OpSetAttrShape(TFE_Op op, @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") long[] dims, + int num_dims, + TF_Status out_status); +public static native void TFE_OpSetAttrShape(TFE_Op op, String attr_name, + @Cast("const int64_t*") LongPointer dims, + int num_dims, + TF_Status out_status); +public static native void TFE_OpSetAttrShape(TFE_Op op, @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongBuffer dims, + int num_dims, + TF_Status out_status); +public static native void TFE_OpSetAttrShape(TFE_Op op, String attr_name, + @Cast("const int64_t*") long[] dims, + int num_dims, + TF_Status out_status); + +// Sets the attribute attr_name to be a function specified by 'function'. +// +// TODO(ashankar,iga): Add this functionality to the C API for graph +// construction. Perhaps we want an AttrValueMap equivalent in the C API? +public static native void TFE_OpSetAttrFunction(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Const TFE_Op value); +public static native void TFE_OpSetAttrFunction(TFE_Op op, + String attr_name, + @Const TFE_Op value); + +public static native void TFE_OpSetAttrFunctionName(TFE_Op op, @Cast("const char*") BytePointer attr_name, + @Cast("const char*") BytePointer data, @Cast("size_t") long length); +public static native void TFE_OpSetAttrFunctionName(TFE_Op op, String attr_name, + String data, @Cast("size_t") long length); + +public static native void TFE_OpSetAttrTensor(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + TF_Tensor tensor, + TF_Status status); +public static native void TFE_OpSetAttrTensor(TFE_Op op, + String attr_name, + TF_Tensor tensor, + TF_Status status); + +public static native void TFE_OpSetAttrStringList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const void*const*") PointerPointer values, + @Cast("const size_t*") SizeTPointer lengths, + int num_values); +public static native void TFE_OpSetAttrStringList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const void*const*") @ByPtrPtr Pointer values, + @Cast("const size_t*") SizeTPointer lengths, + int num_values); +public static native void TFE_OpSetAttrStringList(TFE_Op op, + String attr_name, + @Cast("const void*const*") @ByPtrPtr Pointer values, + @Cast("const size_t*") SizeTPointer lengths, + int num_values); +public static native void TFE_OpSetAttrIntList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongPointer values, + int num_values); +public static native void TFE_OpSetAttrIntList(TFE_Op op, + String attr_name, + @Cast("const int64_t*") LongBuffer values, + int num_values); +public static native void TFE_OpSetAttrIntList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") long[] values, + int num_values); +public static native void TFE_OpSetAttrIntList(TFE_Op op, + String attr_name, + @Cast("const int64_t*") LongPointer values, + int num_values); +public static native void TFE_OpSetAttrIntList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const int64_t*") LongBuffer values, + int num_values); +public static native void TFE_OpSetAttrIntList(TFE_Op op, + String attr_name, + @Cast("const int64_t*") long[] values, + int num_values); +public static native void TFE_OpSetAttrFloatList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Const FloatPointer values, + int num_values); +public static native void TFE_OpSetAttrFloatList(TFE_Op op, + String attr_name, + @Const FloatBuffer values, + int num_values); +public static native void TFE_OpSetAttrFloatList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Const float[] values, + int num_values); +public static native void TFE_OpSetAttrFloatList(TFE_Op op, + String attr_name, + @Const FloatPointer values, + int num_values); +public static native void TFE_OpSetAttrFloatList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Const FloatBuffer values, + int num_values); +public static native void TFE_OpSetAttrFloatList(TFE_Op op, + String attr_name, + @Const float[] values, + int num_values); +public static native void TFE_OpSetAttrBoolList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const unsigned char*") BytePointer values, + int num_values); +public static native void TFE_OpSetAttrBoolList(TFE_Op op, + String attr_name, + @Cast("const unsigned char*") ByteBuffer values, + int num_values); +public static native void TFE_OpSetAttrBoolList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const unsigned char*") byte[] values, + int num_values); +public static native void TFE_OpSetAttrBoolList(TFE_Op op, + String attr_name, + @Cast("const unsigned char*") BytePointer values, + int num_values); +public static native void TFE_OpSetAttrBoolList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const unsigned char*") ByteBuffer values, + int num_values); +public static native void TFE_OpSetAttrBoolList(TFE_Op op, + String attr_name, + @Cast("const unsigned char*") byte[] values, + int num_values); +public static native void TFE_OpSetAttrTypeList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const TF_DataType*") IntPointer values, + int num_values); +public static native void TFE_OpSetAttrTypeList(TFE_Op op, + String attr_name, + @Cast("const TF_DataType*") IntBuffer values, + int num_values); +public static native void TFE_OpSetAttrTypeList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const TF_DataType*") int[] values, + int num_values); +public static native void TFE_OpSetAttrTypeList(TFE_Op op, + String attr_name, + @Cast("const TF_DataType*") IntPointer values, + int num_values); +public static native void TFE_OpSetAttrTypeList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const TF_DataType*") IntBuffer values, + int num_values); +public static native void TFE_OpSetAttrTypeList(TFE_Op op, + String attr_name, + @Cast("const TF_DataType*") int[] values, + int num_values); +public static native void TFE_OpSetAttrShapeList( + TFE_Op op, @Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") PointerPointer dims, + @Const IntPointer num_dims, int num_values, TF_Status out_status); +public static native void TFE_OpSetAttrShapeList( + TFE_Op op, @Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") @ByPtrPtr LongPointer dims, + @Const IntPointer num_dims, int num_values, TF_Status out_status); +public static native void TFE_OpSetAttrShapeList( + TFE_Op op, String attr_name, @Cast("const int64_t**") @ByPtrPtr LongBuffer dims, + @Const IntBuffer num_dims, int num_values, TF_Status out_status); +public static native void TFE_OpSetAttrShapeList( + TFE_Op op, @Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") @ByPtrPtr long[] dims, + @Const int[] num_dims, int num_values, TF_Status out_status); +public static native void TFE_OpSetAttrShapeList( + TFE_Op op, String attr_name, @Cast("const int64_t**") @ByPtrPtr LongPointer dims, + @Const IntPointer num_dims, int num_values, TF_Status out_status); +public static native void TFE_OpSetAttrShapeList( + TFE_Op op, @Cast("const char*") BytePointer attr_name, @Cast("const int64_t**") @ByPtrPtr LongBuffer dims, + @Const IntBuffer num_dims, int num_values, TF_Status out_status); +public static native void TFE_OpSetAttrShapeList( + TFE_Op op, String attr_name, @Cast("const int64_t**") @ByPtrPtr long[] dims, + @Const int[] num_dims, int num_values, TF_Status out_status); +public static native void TFE_OpSetAttrFunctionList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Cast("const TFE_Op**") PointerPointer value, + int num_values); +public static native void TFE_OpSetAttrFunctionList(TFE_Op op, + @Cast("const char*") BytePointer attr_name, + @Const @ByPtrPtr TFE_Op value, + int num_values); +public static native void TFE_OpSetAttrFunctionList(TFE_Op op, + String attr_name, + @Const @ByPtrPtr TFE_Op value, + int num_values); + +// Returns the length (number of tensors) of the input argument `input_name` +// found in the provided `op`. +public static native int TFE_OpGetInputLength(TFE_Op op, + @Cast("const char*") BytePointer input_name, + TF_Status status); +public static native int TFE_OpGetInputLength(TFE_Op op, + String input_name, + TF_Status status); + +// Returns the length (number of tensors) of the output argument `output_name` +// found in the provided `op`. +public static native int TFE_OpGetOutputLength(TFE_Op op, + @Cast("const char*") BytePointer output_name, + TF_Status status); +public static native int TFE_OpGetOutputLength(TFE_Op op, + String output_name, + TF_Status status); + +// Execute the operation defined by 'op' and return handles to computed +// tensors in `retvals`. +// +// 'retvals' must point to a pre-allocated array of TFE_TensorHandle* and +// '*num_retvals' should be set to the size of this array. It is an error if +// the size of 'retvals' is less than the number of outputs. This call sets +// *num_retvals to the number of outputs. +// +// If async execution is enabled, the call may simply enqueue the execution +// and return "non-ready" handles in `retvals`. Note that any handles contained +// in 'op' should not be mutated till the kernel execution actually finishes. +// +// For sync execution, if any of the inputs to `op` are not ready, this call +// will block till they become ready and then return when the kernel execution +// is done. +// TODO(agarwal): change num_retvals to int from int*. +public static native void TFE_Execute(TFE_Op op, @Cast("TFE_TensorHandle**") PointerPointer retvals, + IntPointer num_retvals, TF_Status status); +public static native void TFE_Execute(TFE_Op op, @ByPtrPtr TFE_TensorHandle retvals, + IntPointer num_retvals, TF_Status status); +public static native void TFE_Execute(TFE_Op op, @ByPtrPtr TFE_TensorHandle retvals, + IntBuffer num_retvals, TF_Status status); +public static native void TFE_Execute(TFE_Op op, @ByPtrPtr TFE_TensorHandle retvals, + int[] num_retvals, TF_Status status); + +// Add a function (serialized FunctionDef protocol buffer) to ctx so +// that it can be invoked using TFE_Execute. +public static native void TFE_ContextAddFunctionDef( + TFE_Context ctx, @Cast("const char*") BytePointer serialized_function_def, @Cast("size_t") long size, + TF_Status status); +public static native void TFE_ContextAddFunctionDef( + TFE_Context ctx, String serialized_function_def, @Cast("size_t") long size, + TF_Status status); + +// Adds a function (created from TF_GraphToFunction or +// TF_FunctionImportFunctionDef) to the context, allowing it to be executed with +// TFE_Execute by creating an op with the same name as the function. +public static native void TFE_ContextAddFunction(TFE_Context ctx, + TF_Function function, + TF_Status status); + +// Removes a function from the context. Once removed, you can no longer +// TFE_Execute it or TFE_Execute any TFE_Op which has it as an attribute or any +// other function which calls it as an attribute. +public static native void TFE_ContextRemoveFunction(TFE_Context ctx, + @Cast("const char*") BytePointer name, + TF_Status status); +public static native void TFE_ContextRemoveFunction(TFE_Context ctx, + String name, + TF_Status status); + +// Checks whether a function is registered under `name`. +public static native @Cast("unsigned char") byte TFE_ContextHasFunction(TFE_Context ctx, + @Cast("const char*") BytePointer name); +public static native @Cast("unsigned char") byte TFE_ContextHasFunction(TFE_Context ctx, + String name); + +// Enables tracing of RunMetadata on the ops executed from this context. +public static native void TFE_ContextEnableRunMetadata(TFE_Context ctx); + +// Disables tracing of RunMetadata on the ops executed from this context. +public static native void TFE_ContextDisableRunMetadata(TFE_Context ctx); + +// Populates the passed-in buffer with a serialized RunMetadata protocol buffer +// containing any run metadata information accumulated so far and clears this +// information. +// If async mode is enabled, this call blocks till all currently pending ops are +// done. +public static native void TFE_ContextExportRunMetadata(TFE_Context ctx, + TF_Buffer buf, + TF_Status status); + +// Some TF ops need a step container to be set to limit the lifetime of some +// resources (mostly TensorArray and Stack, used in while loop gradients in +// graph mode). Calling this on a context tells it to start a step. +public static native void TFE_ContextStartStep(TFE_Context ctx); + +// Ends a step. When there is no active step (that is, every started step has +// been ended) step containers will be cleared. Note: it is not safe to call +// TFE_ContextEndStep while ops which rely on the step container may be running. +public static native void TFE_ContextEndStep(TFE_Context ctx); + +// #ifdef __cplusplus +// Targeting ../Tensor.java + + + // namespace tensorflow + + +// #endif + +// #endif // TENSORFLOW_C_EAGER_C_API_H_ + + +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/AudioSpectrogram.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/AudioSpectrogram.java new file mode 100644 index 00000000000..bf5df8c5108 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/AudioSpectrogram.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.audio; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Produces a visualization of audio data over time. + *

+ * Spectrograms are a standard way of representing audio information as a series of + * slices of frequency information, one slice for each window of time. By joining + * these together into a sequence, they form a distinctive fingerprint of the sound + * over time. + *

+ * This op expects to receive audio data as an input, stored as floats in the range + * -1 to 1, together with a window width in samples, and a stride specifying how + * far to move the window between slices. From this it generates a three + * dimensional output. The first dimension is for the channels in the input, so a + * stereo audio input would have two here for example. The second dimension is time, + * with successive frequency slices. The third dimension has an amplitude value for + * each frequency during that time slice. + *

+ * This means the layout when converted and saved as an image is rotated 90 degrees + * clockwise from a typical spectrogram. Time is descending down the Y axis, and + * the frequency decreases from left to right. + *

+ * Each value in the result represents the square root of the sum of the real and + * imaginary parts of an FFT on the current window of samples. In this way, the + * lowest dimension represents the power of each frequency in the current window, + * and adjacent windows are concatenated in the next dimension. + *

+ * To get a more intuitive and visual look at what this operation does, you can run + * tensorflow/examples/wav_to_spectrogram to read in an audio file and save out the + * resulting spectrogram as a PNG image. + */ +@Operator(group = "audio") +public final class AudioSpectrogram extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.audio.AudioSpectrogram} + */ + public static class Options { + + /** + * @param magnitudeSquared Whether to return the squared magnitude or just the + * magnitude. Using squared magnitude can avoid extra calculations. + */ + public Options magnitudeSquared(Boolean magnitudeSquared) { + this.magnitudeSquared = magnitudeSquared; + return this; + } + + private Boolean magnitudeSquared; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AudioSpectrogram operation. + * + * @param scope current scope + * @param input Float representation of audio data. + * @param windowSize How wide the input window is in samples. For the highest efficiency + * this should be a power of two, but other values are accepted. + * @param stride How widely apart the center of adjacent sample windows should be. + * @param options carries optional attributes values + * @return a new instance of AudioSpectrogram + */ + public static AudioSpectrogram create(Scope scope, Operand input, Long windowSize, Long stride, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AudioSpectrogram", scope.makeOpName("AudioSpectrogram")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("window_size", windowSize); + opBuilder.setAttr("stride", stride); + if (options != null) { + for (Options opts : options) { + if (opts.magnitudeSquared != null) { + opBuilder.setAttr("magnitude_squared", opts.magnitudeSquared); + } + } + } + return new AudioSpectrogram(opBuilder.build()); + } + + /** + * @param magnitudeSquared Whether to return the squared magnitude or just the + * magnitude. Using squared magnitude can avoid extra calculations. + */ + public static Options magnitudeSquared(Boolean magnitudeSquared) { + return new Options().magnitudeSquared(magnitudeSquared); + } + + /** + * 3D representation of the audio frequencies as an image. + */ + public Output spectrogram() { + return spectrogram; + } + + @Override + public Output asOutput() { + return spectrogram; + } + + private Output spectrogram; + + private AudioSpectrogram(Operation operation) { + super(operation); + int outputIdx = 0; + spectrogram = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/DecodeWav.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/DecodeWav.java new file mode 100644 index 00000000000..edfa440525f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/DecodeWav.java @@ -0,0 +1,139 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.audio; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Decode a 16-bit PCM WAV file to a float tensor. + *

+ * The -32768 to 32767 signed 16-bit values will be scaled to -1.0 to 1.0 in float. + *

+ * When desired_channels is set, if the input contains fewer channels than this + * then the last channel will be duplicated to give the requested number, else if + * the input has more channels than requested then the additional channels will be + * ignored. + *

+ * If desired_samples is set, then the audio will be cropped or padded with zeroes + * to the requested length. + *

+ * The first output contains a Tensor with the content of the audio samples. The + * lowest dimension will be the number of channels, and the second will be the + * number of samples. For example, a ten-sample-long stereo WAV file should give an + * output shape of [10, 2]. + */ +@Operator(group = "audio") +public final class DecodeWav extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.audio.DecodeWav} + */ + public static class Options { + + /** + * @param desiredChannels Number of sample channels wanted. + */ + public Options desiredChannels(Long desiredChannels) { + this.desiredChannels = desiredChannels; + return this; + } + + /** + * @param desiredSamples Length of audio requested. + */ + public Options desiredSamples(Long desiredSamples) { + this.desiredSamples = desiredSamples; + return this; + } + + private Long desiredChannels; + private Long desiredSamples; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeWav operation. + * + * @param scope current scope + * @param contents The WAV-encoded audio, usually from a file. + * @param options carries optional attributes values + * @return a new instance of DecodeWav + */ + public static DecodeWav create(Scope scope, Operand contents, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeWav", scope.makeOpName("DecodeWav")); + opBuilder.addInput(contents.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.desiredChannels != null) { + opBuilder.setAttr("desired_channels", opts.desiredChannels); + } + if (opts.desiredSamples != null) { + opBuilder.setAttr("desired_samples", opts.desiredSamples); + } + } + } + return new DecodeWav(opBuilder.build()); + } + + /** + * @param desiredChannels Number of sample channels wanted. + */ + public static Options desiredChannels(Long desiredChannels) { + return new Options().desiredChannels(desiredChannels); + } + + /** + * @param desiredSamples Length of audio requested. + */ + public static Options desiredSamples(Long desiredSamples) { + return new Options().desiredSamples(desiredSamples); + } + + /** + * 2-D with shape `[length, channels]`. + */ + public Output audio() { + return audio; + } + + /** + * Scalar holding the sample rate found in the WAV header. + */ + public Output sampleRate() { + return sampleRate; + } + + private Output audio; + private Output sampleRate; + + private DecodeWav(Operation operation) { + super(operation); + int outputIdx = 0; + audio = operation.output(outputIdx++); + sampleRate = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/EncodeWav.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/EncodeWav.java new file mode 100644 index 00000000000..d27962e74b1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/EncodeWav.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.audio; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Encode audio data using the WAV file format. + *

+ * This operation will generate a string suitable to be saved out to create a .wav + * audio file. It will be encoded in the 16-bit PCM format. It takes in float + * values in the range -1.0f to 1.0f, and any outside that value will be clamped to + * that range. + *

+ * `audio` is a 2-D float Tensor of shape `[length, channels]`. + * `sample_rate` is a scalar Tensor holding the rate to use (e.g. 44100). + */ +@Operator(group = "audio") +public final class EncodeWav extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new EncodeWav operation. + * + * @param scope current scope + * @param audio 2-D with shape `[length, channels]`. + * @param sampleRate Scalar containing the sample frequency. + * @return a new instance of EncodeWav + */ + public static EncodeWav create(Scope scope, Operand audio, Operand sampleRate) { + OperationBuilder opBuilder = scope.env().opBuilder("EncodeWav", scope.makeOpName("EncodeWav")); + opBuilder.addInput(audio.asOutput()); + opBuilder.addInput(sampleRate.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new EncodeWav(opBuilder.build()); + } + + /** + * 0-D. WAV-encoded file contents. + */ + public Output contents() { + return contents; + } + + @Override + public Output asOutput() { + return contents; + } + + private Output contents; + + private EncodeWav(Operation operation) { + super(operation); + int outputIdx = 0; + contents = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/Mfcc.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/Mfcc.java new file mode 100644 index 00000000000..46dd8f7de39 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/audio/Mfcc.java @@ -0,0 +1,171 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.audio; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transforms a spectrogram into a form that's useful for speech recognition. + *

+ * Mel Frequency Cepstral Coefficients are a way of representing audio data that's + * been effective as an input feature for machine learning. They are created by + * taking the spectrum of a spectrogram (a 'cepstrum'), and discarding some of the + * higher frequencies that are less significant to the human ear. They have a long + * history in the speech recognition world, and https://en.wikipedia.org/wiki/Mel-frequency_cepstrum + * is a good resource to learn more. + */ +@Operator(group = "audio") +public final class Mfcc extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.audio.Mfcc} + */ + public static class Options { + + /** + * @param upperFrequencyLimit The highest frequency to use when calculating the + * ceptstrum. + */ + public Options upperFrequencyLimit(Float upperFrequencyLimit) { + this.upperFrequencyLimit = upperFrequencyLimit; + return this; + } + + /** + * @param lowerFrequencyLimit The lowest frequency to use when calculating the + * ceptstrum. + */ + public Options lowerFrequencyLimit(Float lowerFrequencyLimit) { + this.lowerFrequencyLimit = lowerFrequencyLimit; + return this; + } + + /** + * @param filterbankChannelCount Resolution of the Mel bank used internally. + */ + public Options filterbankChannelCount(Long filterbankChannelCount) { + this.filterbankChannelCount = filterbankChannelCount; + return this; + } + + /** + * @param dctCoefficientCount How many output channels to produce per time slice. + */ + public Options dctCoefficientCount(Long dctCoefficientCount) { + this.dctCoefficientCount = dctCoefficientCount; + return this; + } + + private Float upperFrequencyLimit; + private Float lowerFrequencyLimit; + private Long filterbankChannelCount; + private Long dctCoefficientCount; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Mfcc operation. + * + * @param scope current scope + * @param spectrogram Typically produced by the Spectrogram op, with magnitude_squared + * set to true. + * @param sampleRate How many samples per second the source audio used. + * @param options carries optional attributes values + * @return a new instance of Mfcc + */ + public static Mfcc create(Scope scope, Operand spectrogram, Operand sampleRate, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Mfcc", scope.makeOpName("Mfcc")); + opBuilder.addInput(spectrogram.asOutput()); + opBuilder.addInput(sampleRate.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.upperFrequencyLimit != null) { + opBuilder.setAttr("upper_frequency_limit", opts.upperFrequencyLimit); + } + if (opts.lowerFrequencyLimit != null) { + opBuilder.setAttr("lower_frequency_limit", opts.lowerFrequencyLimit); + } + if (opts.filterbankChannelCount != null) { + opBuilder.setAttr("filterbank_channel_count", opts.filterbankChannelCount); + } + if (opts.dctCoefficientCount != null) { + opBuilder.setAttr("dct_coefficient_count", opts.dctCoefficientCount); + } + } + } + return new Mfcc(opBuilder.build()); + } + + /** + * @param upperFrequencyLimit The highest frequency to use when calculating the + * ceptstrum. + */ + public static Options upperFrequencyLimit(Float upperFrequencyLimit) { + return new Options().upperFrequencyLimit(upperFrequencyLimit); + } + + /** + * @param lowerFrequencyLimit The lowest frequency to use when calculating the + * ceptstrum. + */ + public static Options lowerFrequencyLimit(Float lowerFrequencyLimit) { + return new Options().lowerFrequencyLimit(lowerFrequencyLimit); + } + + /** + * @param filterbankChannelCount Resolution of the Mel bank used internally. + */ + public static Options filterbankChannelCount(Long filterbankChannelCount) { + return new Options().filterbankChannelCount(filterbankChannelCount); + } + + /** + * @param dctCoefficientCount How many output channels to produce per time slice. + */ + public static Options dctCoefficientCount(Long dctCoefficientCount) { + return new Options().dctCoefficientCount(dctCoefficientCount); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Mfcc(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseAnd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseAnd.java new file mode 100644 index 00000000000..0ce6491da8d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseAnd.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.bitwise; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Elementwise computes the bitwise AND of `x` and `y`. + *

+ * The result will have those bits set, that are set in both `x` and `y`. The + * computation is performed on the underlying representations of `x` and `y`. + *

+ * For example: + *

{@code
+ * import tensorflow as tf
+ * from tensorflow.python.ops import bitwise_ops
+ * dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
+ *               tf.uint8, tf.uint16, tf.uint32, tf.uint64]
+ * 
+ * for dtype in dtype_list:
+ *   lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
+ *   rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
+ *   exp = tf.constant([0, 0, 3, 10], dtype=tf.float32)
+ * 
+ *   res = bitwise_ops.bitwise_and(lhs, rhs)
+ *   tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE
+ * }
+ * + * + * @param data type for {@code z()} output + */ +@Operator(group = "bitwise") +public final class BitwiseAnd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BitwiseAnd operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of BitwiseAnd + */ + public static BitwiseAnd create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("BitwiseAnd", scope.makeOpName("BitwiseAnd")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BitwiseAnd(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private BitwiseAnd(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseOr.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseOr.java new file mode 100644 index 00000000000..f90a598b69d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseOr.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.bitwise; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Elementwise computes the bitwise OR of `x` and `y`. + *

+ * The result will have those bits set, that are set in `x`, `y` or both. The + * computation is performed on the underlying representations of `x` and `y`. + *

+ * For example: + *

{@code
+ * import tensorflow as tf
+ * from tensorflow.python.ops import bitwise_ops
+ * dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
+ *               tf.uint8, tf.uint16, tf.uint32, tf.uint64]
+ * 
+ * for dtype in dtype_list:
+ *   lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
+ *   rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
+ *   exp = tf.constant([5, 5, 7, 15], dtype=tf.float32)
+ * 
+ *   res = bitwise_ops.bitwise_or(lhs, rhs)
+ *   tf.assert_equal(tf.cast(res,  tf.float32), exp)  # TRUE
+ * }
+ * + * + * @param data type for {@code z()} output + */ +@Operator(group = "bitwise") +public final class BitwiseOr extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BitwiseOr operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of BitwiseOr + */ + public static BitwiseOr create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("BitwiseOr", scope.makeOpName("BitwiseOr")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BitwiseOr(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private BitwiseOr(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseXor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseXor.java new file mode 100644 index 00000000000..143cf06cd47 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/BitwiseXor.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.bitwise; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Elementwise computes the bitwise XOR of `x` and `y`. + *

+ * The result will have those bits set, that are different in `x` and `y`. The + * computation is performed on the underlying representations of `x` and `y`. + *

+ * For example: + *

{@code
+ * import tensorflow as tf
+ * from tensorflow.python.ops import bitwise_ops
+ * dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
+ *               tf.uint8, tf.uint16, tf.uint32, tf.uint64]
+ * 
+ * for dtype in dtype_list:
+ *   lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
+ *   rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
+ *   exp = tf.constant([5, 5, 4, 5],  dtype=tf.float32)
+ * 
+ *   res = bitwise_ops.bitwise_xor(lhs, rhs)
+ *   tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE
+ * }
+ * + * + * @param data type for {@code z()} output + */ +@Operator(group = "bitwise") +public final class BitwiseXor extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BitwiseXor operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of BitwiseXor + */ + public static BitwiseXor create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("BitwiseXor", scope.makeOpName("BitwiseXor")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BitwiseXor(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private BitwiseXor(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/Invert.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/Invert.java new file mode 100644 index 00000000000..820b767124c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/Invert.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.bitwise; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Invert (flip) each bit of supported types; for example, type `uint8` value 01010101 becomes 10101010. + *

+ * Flip each bit of supported types. For example, type `int8` (decimal 2) binary 00000010 becomes (decimal -3) binary 11111101. + * This operation is performed on each element of the tensor argument `x`. + *

+ * Example: + *

{@code
+ * import tensorflow as tf
+ * from tensorflow.python.ops import bitwise_ops
+ * 
+ * # flip 2 (00000010) to -3 (11111101)
+ * tf.assert_equal(-3, bitwise_ops.invert(2))
+ * 
+ * dtype_list = [dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64,
+ *               dtypes.uint8, dtypes.uint16, dtypes.uint32, dtypes.uint64]
+ * 
+ * inputs = [0, 5, 3, 14]
+ * for dtype in dtype_list:
+ *   # Because of issues with negative numbers, let's test this indirectly.
+ *   # 1. invert(a) and a = 0
+ *   # 2. invert(a) or a = invert(0)
+ *   input_tensor = tf.constant([0, 5, 3, 14], dtype=dtype)
+ *   not_a_and_a, not_a_or_a, not_0 = [bitwise_ops.bitwise_and(
+ *                                       input_tensor, bitwise_ops.invert(input_tensor)),
+ *                                     bitwise_ops.bitwise_or(
+ *                                       input_tensor, bitwise_ops.invert(input_tensor)),
+ *                                     bitwise_ops.invert(
+ *                                       tf.constant(0, dtype=dtype))]
+ * 
+ *   expected = tf.constant([0, 0, 0, 0], dtype=tf.float32)
+ *   tf.assert_equal(tf.cast(not_a_and_a, tf.float32), expected)
+ * 
+ *   expected = tf.cast([not_0] * 4, tf.float32)
+ *   tf.assert_equal(tf.cast(not_a_or_a, tf.float32), expected)
+ * 
+ *   # For unsigned dtypes let's also check the result directly.
+ *   if dtype.is_unsigned:
+ *     inverted = bitwise_ops.invert(input_tensor)
+ *     expected = tf.constant([dtype.max - x for x in inputs], dtype=tf.float32)
+ *     tf.assert_equal(tf.cast(inverted, tf.float32), tf.cast(expected, tf.float32))
+ * }
+ * + * + * @param data type for {@code y()} output + */ +@Operator(group = "bitwise") +public final class Invert extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Invert operation. + * + * @param scope current scope + * @param x + * @return a new instance of Invert + */ + public static Invert create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Invert", scope.makeOpName("Invert")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Invert(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Invert(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/LeftShift.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/LeftShift.java new file mode 100644 index 00000000000..542d99fa858 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/LeftShift.java @@ -0,0 +1,101 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.bitwise; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Elementwise computes the bitwise left-shift of `x` and `y`. + *

+ * If `y` is negative, or greater than or equal to the width of `x` in bits the + * result is implementation defined. + *

+ * Example: + *

{@code
+ * import tensorflow as tf
+ * from tensorflow.python.ops import bitwise_ops
+ * import numpy as np
+ * dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64]
+ * 
+ * for dtype in dtype_list:
+ *   lhs = tf.constant([-1, -5, -3, -14], dtype=dtype)
+ *   rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
+ *   
+ *   left_shift_result = bitwise_ops.left_shift(lhs, rhs)
+ *   
+ *   print(left_shift_result)
+ * 
+ * # This will print:
+ * # tf.Tensor([ -32   -5 -128    0], shape=(4,), dtype=int8)
+ * # tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int16)
+ * # tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int32)
+ * # tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int64)
+ * 
+ * lhs = np.array([-2, 64, 101, 32], dtype=np.int8)
+ * rhs = np.array([-1, -5, -3, -14], dtype=np.int8)
+ * bitwise_ops.left_shift(lhs, rhs)
+ * # 
+ * }
+ * + * + * @param data type for {@code z()} output + */ +@Operator(group = "bitwise") +public final class LeftShift extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LeftShift operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of LeftShift + */ + public static LeftShift create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("LeftShift", scope.makeOpName("LeftShift")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LeftShift(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private LeftShift(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/RightShift.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/RightShift.java new file mode 100644 index 00000000000..7056bcd0bd7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/bitwise/RightShift.java @@ -0,0 +1,104 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.bitwise; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Elementwise computes the bitwise right-shift of `x` and `y`. + *

+ * Performs a logical shift for unsigned integer types, and an arithmetic shift + * for signed integer types. + *

+ * If `y` is negative, or greater than or equal to than the width of `x` in bits + * the result is implementation defined. + *

+ * Example: + *

{@code
+ * import tensorflow as tf
+ * from tensorflow.python.ops import bitwise_ops
+ * import numpy as np
+ * dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64]
+ * 
+ * for dtype in dtype_list:
+ *   lhs = tf.constant([-1, -5, -3, -14], dtype=dtype)
+ *   rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
+ *   
+ *   right_shift_result = bitwise_ops.right_shift(lhs, rhs)
+ *   
+ *   print(right_shift_result)
+ *   
+ * # This will print:
+ * # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int8)
+ * # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int16)
+ * # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int32)
+ * # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int64)
+ * 
+ * lhs = np.array([-2, 64, 101, 32], dtype=np.int8)
+ * rhs = np.array([-1, -5, -3, -14], dtype=np.int8)
+ * bitwise_ops.right_shift(lhs, rhs)
+ * # 
+ * }
+ * + * + * @param data type for {@code z()} output + */ +@Operator(group = "bitwise") +public final class RightShift extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RightShift operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of RightShift + */ + public static RightShift create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("RightShift", scope.makeOpName("RightShift")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RightShift(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private RightShift(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java new file mode 100644 index 00000000000..4de01a25eb3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.collective; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Mutually reduces multiple tensors of identical type and shape. + * + * @param data type for {@code data()} output + */ +public final class AllReduce extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.collective.AllReduce} + */ + public static class Options { + + /** + * @param waitFor + */ + public Options waitFor(List waitFor) { + this.waitFor = waitFor; + return this; + } + + private List waitFor; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AllReduce operation. + * + * @param scope current scope + * @param input + * @param groupSize + * @param groupKey + * @param instanceKey + * @param mergeOp + * @param finalOp + * @param subdivOffsets + * @param options carries optional attributes values + * @return a new instance of AllReduce + */ + public static AllReduce create(Scope scope, Operand input, Long groupSize, Long groupKey, Long instanceKey, String mergeOp, String finalOp, List subdivOffsets, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CollectiveReduce", scope.makeOpName("AllReduce")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("group_size", groupSize); + opBuilder.setAttr("group_key", groupKey); + opBuilder.setAttr("instance_key", instanceKey); + opBuilder.setAttr("merge_op", mergeOp); + opBuilder.setAttr("final_op", finalOp); + long[] subdivOffsetsArray = new long[subdivOffsets.size()]; + for (int i = 0; i < subdivOffsetsArray.length; ++i) { + subdivOffsetsArray[i] = subdivOffsets.get(i); + } + opBuilder.setAttr("subdiv_offsets", subdivOffsetsArray); + if (options != null) { + for (Options opts : options) { + if (opts.waitFor != null) { + long[] waitForArray = new long[opts.waitFor.size()]; + for (int i = 0; i < waitForArray.length; ++i) { + waitForArray[i] = opts.waitFor.get(i); + } + opBuilder.setAttr("wait_for", waitForArray); + } + } + } + return new AllReduce(opBuilder.build()); + } + + /** + * @param waitFor + */ + public static Options waitFor(List waitFor) { + return new Options().waitFor(waitFor); + } + + /** + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + private Output data; + + private AllReduce(Operation operation) { + super(operation); + int outputIdx = 0; + data = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java new file mode 100644 index 00000000000..a4139051b33 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.collective; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Receives a tensor value broadcast from another device. + * + * @param data type for {@code data()} output + */ +public final class BroadcastRecv extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BroadcastRecv operation. + * + * @param scope current scope + * @param T + * @param groupSize + * @param groupKey + * @param instanceKey + * @param shape + * @return a new instance of BroadcastRecv + */ + public static BroadcastRecv create(Scope scope, Class T, Long groupSize, Long groupKey, Long instanceKey, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("CollectiveBcastRecv", scope.makeOpName("BroadcastRecv")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("T", DataType.fromClass(T)); + opBuilder.setAttr("group_size", groupSize); + opBuilder.setAttr("group_key", groupKey); + opBuilder.setAttr("instance_key", instanceKey); + opBuilder.setAttr("shape", shape); + return new BroadcastRecv(opBuilder.build()); + } + + /** + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + private Output data; + + private BroadcastRecv(Operation operation) { + super(operation); + int outputIdx = 0; + data = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java new file mode 100644 index 00000000000..e841263806c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.collective; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Broadcasts a tensor value to one or more other devices. + * + * @param data type for {@code data()} output + */ +public final class BroadcastSend extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BroadcastSend operation. + * + * @param scope current scope + * @param input + * @param groupSize + * @param groupKey + * @param instanceKey + * @param shape + * @return a new instance of BroadcastSend + */ + public static BroadcastSend create(Scope scope, Operand input, Long groupSize, Long groupKey, Long instanceKey, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("CollectiveBcastSend", scope.makeOpName("BroadcastSend")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("group_size", groupSize); + opBuilder.setAttr("group_key", groupKey); + opBuilder.setAttr("instance_key", instanceKey); + opBuilder.setAttr("shape", shape); + return new BroadcastSend(opBuilder.build()); + } + + /** + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + private Output data; + + private BroadcastSend(Operation operation) { + super(operation); + int outputIdx = 0; + data = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Abort.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Abort.java new file mode 100644 index 00000000000..39c22032b8c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Abort.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Raise a exception to abort the process when called. + *

+ * If exit_without_error is true, the process will exit normally, + * otherwise it will exit with a SIGABORT signal. + *

+ * Returns nothing but an exception. + */ +@Operator +public final class Abort extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Abort} + */ + public static class Options { + + /** + * @param errorMsg A string which is the message associated with the exception. + */ + public Options errorMsg(String errorMsg) { + this.errorMsg = errorMsg; + return this; + } + + /** + * @param exitWithoutError + */ + public Options exitWithoutError(Boolean exitWithoutError) { + this.exitWithoutError = exitWithoutError; + return this; + } + + private String errorMsg; + private Boolean exitWithoutError; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Abort operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of Abort + */ + public static Abort create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Abort", scope.makeOpName("Abort")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.errorMsg != null) { + opBuilder.setAttr("error_msg", opts.errorMsg); + } + if (opts.exitWithoutError != null) { + opBuilder.setAttr("exit_without_error", opts.exitWithoutError); + } + } + } + return new Abort(opBuilder.build()); + } + + /** + * @param errorMsg A string which is the message associated with the exception. + */ + public static Options errorMsg(String errorMsg) { + return new Options().errorMsg(errorMsg); + } + + /** + * @param exitWithoutError + */ + public static Options exitWithoutError(Boolean exitWithoutError) { + return new Options().exitWithoutError(exitWithoutError); + } + + + private Abort(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/All.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/All.java new file mode 100644 index 00000000000..39e34318b0d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/All.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the "logical and" of elements across dimensions of a tensor. + *

+ * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + */ +@Operator +public final class All extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.All} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new All operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of All + */ + public static All create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("All", scope.makeOpName("All")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new All(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private All(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AllToAll.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AllToAll.java new file mode 100644 index 00000000000..03a58e54eac --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AllToAll.java @@ -0,0 +1,95 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An Op to exchange data across TPU replicas. + *

+ * On each replica, the input is split into `split_count` blocks along + * `split_dimension` and send to the other replicas given group_assignment. After + * receiving `split_count` - 1 blocks from other replicas, we concatenate the + * blocks along `concat_dimension` as the output. + *

+ * For example, suppose there are 2 TPU replicas: + * replica 0 receives input: `[[A, B]]` + * replica 1 receives input: `[[C, D]]` + *

+ * group_assignment=`[[0, 1]]` + * concat_dimension=0 + * split_dimension=1 + * split_count=2 + *

+ * replica 0's output: `[[A], [C]]` + * replica 1's output: `[[B], [D]]` + * + * @param data type for {@code output()} output + */ +public final class AllToAll extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AllToAll operation. + * + * @param scope current scope + * @param input The local input to the sum. + * @param groupAssignment An int32 tensor with shape + * [num_groups, num_replicas_per_group]. `group_assignment[i]` represents the + * replica ids in the ith subgroup. + * @param concatDimension The dimension number to concatenate. + * @param splitDimension The dimension number to split. + * @param splitCount The number of splits, this number must equal to the sub-group + * size(group_assignment.get_shape()[1]) + * @return a new instance of AllToAll + */ + public static AllToAll create(Scope scope, Operand input, Operand groupAssignment, Long concatDimension, Long splitDimension, Long splitCount) { + OperationBuilder opBuilder = scope.env().opBuilder("AllToAll", scope.makeOpName("AllToAll")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(groupAssignment.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("concat_dimension", concatDimension); + opBuilder.setAttr("split_dimension", splitDimension); + opBuilder.setAttr("split_count", splitCount); + return new AllToAll(opBuilder.build()); + } + + /** + * The exchanged result. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AllToAll(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousIteratorV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousIteratorV2.java new file mode 100644 index 00000000000..cf6443c0096 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousIteratorV2.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A container for an iterator resource. + */ +public final class AnonymousIteratorV2 extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AnonymousIteratorV2 operation. + * + * @param scope current scope + * @param outputTypes + * @param outputShapes + * @return a new instance of AnonymousIteratorV2 + */ + public static AnonymousIteratorV2 create(Scope scope, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("AnonymousIteratorV2", scope.makeOpName("AnonymousIteratorV2")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new AnonymousIteratorV2(opBuilder.build()); + } + + /** + * A handle to the iterator that can be passed to a "MakeIterator" or + * "IteratorGetNext" op. In contrast to Iterator, AnonymousIterator prevents + * resource sharing by name, and does not keep a reference to the resource + * container. + */ + public Output handle() { + return handle; + } + + /** + * A variant deleter that should be passed into the op that deletes the iterator. + */ + public Output deleter() { + return deleter; + } + + private Output handle; + private Output deleter; + + private AnonymousIteratorV2(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + deleter = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMemoryCache.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMemoryCache.java new file mode 100644 index 00000000000..6ad9c51d392 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMemoryCache.java @@ -0,0 +1,63 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class AnonymousMemoryCache extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AnonymousMemoryCache operation. + * + * @param scope current scope + * @return a new instance of AnonymousMemoryCache + */ + public static AnonymousMemoryCache create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("AnonymousMemoryCache", scope.makeOpName("AnonymousMemoryCache")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AnonymousMemoryCache(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + /** + */ + public Output deleter() { + return deleter; + } + + private Output handle; + private Output deleter; + + private AnonymousMemoryCache(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + deleter = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMultiDeviceIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMultiDeviceIterator.java new file mode 100644 index 00000000000..1928b0a7e5a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMultiDeviceIterator.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A container for a multi device iterator resource. + */ +public final class AnonymousMultiDeviceIterator extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AnonymousMultiDeviceIterator operation. + * + * @param scope current scope + * @param devices + * @param outputTypes + * @param outputShapes + * @return a new instance of AnonymousMultiDeviceIterator + */ + public static AnonymousMultiDeviceIterator create(Scope scope, List devices, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("AnonymousMultiDeviceIterator", scope.makeOpName("AnonymousMultiDeviceIterator")); + opBuilder = scope.applyControlDependencies(opBuilder); + String[] devicesArray = new String[devices.size()]; + for (int i = 0; i < devicesArray.length; ++i) { + devicesArray[i] = devices.get(i); + } + opBuilder.setAttr("devices", devicesArray); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new AnonymousMultiDeviceIterator(opBuilder.build()); + } + + /** + * A handle to a multi device iterator that can be passed to a + * "MultiDeviceIteratorGetNextFromShard" op. In contrast to MultiDeviceIterator, + * AnonymousIterator prevents resource sharing by name, and does not keep a + * reference to the resource container. + */ + public Output handle() { + return handle; + } + + /** + * A variant deleter that should be passed into the op that deletes the iterator. + */ + public Output deleter() { + return deleter; + } + + private Output handle; + private Output deleter; + + private AnonymousMultiDeviceIterator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + deleter = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousRandomSeedGenerator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousRandomSeedGenerator.java new file mode 100644 index 00000000000..4730df2cfd0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousRandomSeedGenerator.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class AnonymousRandomSeedGenerator extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AnonymousRandomSeedGenerator operation. + * + * @param scope current scope + * @param seed + * @param seed2 + * @return a new instance of AnonymousRandomSeedGenerator + */ + public static AnonymousRandomSeedGenerator create(Scope scope, Operand seed, Operand seed2) { + OperationBuilder opBuilder = scope.env().opBuilder("AnonymousRandomSeedGenerator", scope.makeOpName("AnonymousRandomSeedGenerator")); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(seed2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AnonymousRandomSeedGenerator(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + /** + */ + public Output deleter() { + return deleter; + } + + private Output handle; + private Output deleter; + + private AnonymousRandomSeedGenerator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + deleter = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Any.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Any.java new file mode 100644 index 00000000000..e068c220781 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Any.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the "logical or" of elements across dimensions of a tensor. + *

+ * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + */ +@Operator +public final class Any extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Any} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Any operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of Any + */ + public static Any create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Any", scope.makeOpName("Any")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new Any(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Any(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ApplyAdagradV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ApplyAdagradV2.java new file mode 100644 index 00000000000..56dea982b75 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ApplyAdagradV2.java @@ -0,0 +1,135 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Update '*var' according to the adagrad scheme. + *

+ * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) + * + * @param data type for {@code out()} output + */ +public final class ApplyAdagradV2 extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ApplyAdagradV2} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyAdagradV2 operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdagradV2 + */ + public static ApplyAdagradV2 create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyAdagradV2", scope.makeOpName("ApplyAdagradV2")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new ApplyAdagradV2(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyAdagradV2(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssertNextDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssertNextDataset.java new file mode 100644 index 00000000000..9cb09ac9bda --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssertNextDataset.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class AssertNextDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AssertNextDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param transformations + * @param outputTypes + * @param outputShapes + * @return a new instance of AssertNextDataset + */ + public static AssertNextDataset create(Scope scope, Operand inputDataset, Operand transformations, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("AssertNextDataset", scope.makeOpName("AssertNextDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(transformations.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new AssertNextDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private AssertNextDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssertThat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssertThat.java new file mode 100644 index 00000000000..8b5b9a08602 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssertThat.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Asserts that the given condition is true. + *

+ * If `condition` evaluates to false, print the list of tensors in `data`. + * `summarize` determines how many entries of the tensors to print. + */ +@Operator +public final class AssertThat extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.AssertThat} + */ + public static class Options { + + /** + * @param summarize Print this many entries of each tensor. + */ + public Options summarize(Long summarize) { + this.summarize = summarize; + return this; + } + + private Long summarize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AssertThat operation. + * + * @param scope current scope + * @param condition The condition to evaluate. + * @param data The tensors to print out when condition is false. + * @param options carries optional attributes values + * @return a new instance of AssertThat + */ + public static AssertThat create(Scope scope, Operand condition, Iterable> data, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Assert", scope.makeOpName("AssertThat")); + opBuilder.addInput(condition.asOutput()); + opBuilder.addInputList(Operands.asOutputs(data)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.summarize != null) { + opBuilder.setAttr("summarize", opts.summarize); + } + } + } + return new AssertThat(opBuilder.build()); + } + + /** + * @param summarize Print this many entries of each tensor. + */ + public static Options summarize(Long summarize) { + return new Options().summarize(summarize); + } + + + private AssertThat(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Assign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Assign.java new file mode 100644 index 00000000000..b91facf3af9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Assign.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update 'ref' by assigning 'value' to it. + *

+ * This operation outputs "ref" after the assignment is done. + * This makes it easier to chain operations that need to use the reset value. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class Assign extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Assign} + */ + public static class Options { + + /** + * @param validateShape If true, the operation will validate that the shape + * of 'value' matches the shape of the Tensor being assigned to. If false, + * 'ref' will take on the shape of 'value'. + */ + public Options validateShape(Boolean validateShape) { + this.validateShape = validateShape; + return this; + } + + /** + * @param useLocking If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean validateShape; + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Assign operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. May be uninitialized. + * @param value The value to be assigned to the variable. + * @param options carries optional attributes values + * @return a new instance of Assign + */ + public static Assign create(Scope scope, Operand ref, Operand value, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Assign", scope.makeOpName("Assign")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.validateShape != null) { + opBuilder.setAttr("validate_shape", opts.validateShape); + } + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new Assign(opBuilder.build()); + } + + /** + * @param validateShape If true, the operation will validate that the shape + * of 'value' matches the shape of the Tensor being assigned to. If false, + * 'ref' will take on the shape of 'value'. + */ + public static Options validateShape(Boolean validateShape) { + return new Options().validateShape(validateShape); + } + + /** + * @param useLocking If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as "ref". Returned as a convenience for operations that want + * to use the new value after the variable has been reset. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private Assign(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAdd.java new file mode 100644 index 00000000000..38933f52219 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAdd.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update 'ref' by adding 'value' to it. + *

+ * This operation outputs "ref" after the update is done. + * This makes it easier to chain operations that need to use the reset value. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class AssignAdd extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.AssignAdd} + */ + public static class Options { + + /** + * @param useLocking If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AssignAdd operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param value The value to be added to the variable. + * @param options carries optional attributes values + * @return a new instance of AssignAdd + */ + public static AssignAdd create(Scope scope, Operand ref, Operand value, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AssignAdd", scope.makeOpName("AssignAdd")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new AssignAdd(opBuilder.build()); + } + + /** + * @param useLocking If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as "ref". Returned as a convenience for operations that want + * to use the new value after the variable has been updated. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private AssignAdd(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAddVariableOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAddVariableOp.java new file mode 100644 index 00000000000..63fc170c793 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAddVariableOp.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds a value to the current value of a variable. + *

+ * Any ReadVariableOp with a control dependency on this op is guaranteed to + * see the incremented value or a subsequent newer one. + */ +@Operator +public final class AssignAddVariableOp extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AssignAddVariableOp operation. + * + * @param scope current scope + * @param resource handle to the resource in which to store the variable. + * @param value the value by which the variable will be incremented. + * @return a new instance of AssignAddVariableOp + */ + public static AssignAddVariableOp create(Scope scope, Operand resource, Operand value) { + OperationBuilder opBuilder = scope.env().opBuilder("AssignAddVariableOp", scope.makeOpName("AssignAddVariableOp")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AssignAddVariableOp(opBuilder.build()); + } + + + private AssignAddVariableOp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSub.java new file mode 100644 index 00000000000..8c8b37f34ba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSub.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update 'ref' by subtracting 'value' from it. + *

+ * This operation outputs "ref" after the update is done. + * This makes it easier to chain operations that need to use the reset value. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class AssignSub extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.AssignSub} + */ + public static class Options { + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AssignSub operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param value The value to be subtracted to the variable. + * @param options carries optional attributes values + * @return a new instance of AssignSub + */ + public static AssignSub create(Scope scope, Operand ref, Operand value, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AssignSub", scope.makeOpName("AssignSub")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new AssignSub(opBuilder.build()); + } + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as "ref". Returned as a convenience for operations that want + * to use the new value after the variable has been updated. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private AssignSub(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSubVariableOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSubVariableOp.java new file mode 100644 index 00000000000..1348c02a966 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSubVariableOp.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Subtracts a value from the current value of a variable. + *

+ * Any ReadVariableOp with a control dependency on this op is guaranteed to + * see the decremented value or a subsequent newer one. + */ +@Operator +public final class AssignSubVariableOp extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AssignSubVariableOp operation. + * + * @param scope current scope + * @param resource handle to the resource in which to store the variable. + * @param value the value by which the variable will be incremented. + * @return a new instance of AssignSubVariableOp + */ + public static AssignSubVariableOp create(Scope scope, Operand resource, Operand value) { + OperationBuilder opBuilder = scope.env().opBuilder("AssignSubVariableOp", scope.makeOpName("AssignSubVariableOp")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AssignSubVariableOp(opBuilder.build()); + } + + + private AssignSubVariableOp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignVariableOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignVariableOp.java new file mode 100644 index 00000000000..a3363c6db92 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignVariableOp.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Assigns a new value to a variable. + *

+ * Any ReadVariableOp with a control dependency on this op is guaranteed to return + * this value or a subsequent newer value of the variable. + */ +@Operator +public final class AssignVariableOp extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AssignVariableOp operation. + * + * @param scope current scope + * @param resource handle to the resource in which to store the variable. + * @param value the value to set the new tensor to use. + * @return a new instance of AssignVariableOp + */ + public static AssignVariableOp create(Scope scope, Operand resource, Operand value) { + OperationBuilder opBuilder = scope.env().opBuilder("AssignVariableOp", scope.makeOpName("AssignVariableOp")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AssignVariableOp(opBuilder.build()); + } + + + private AssignVariableOp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AutoShardDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AutoShardDataset.java new file mode 100644 index 00000000000..2a2842ffa70 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AutoShardDataset.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that shards the input dataset. + *

+ * Creates a dataset that shards the input dataset by num_workers, returning a + * sharded dataset for the index-th worker. This attempts to automatically shard + * a dataset by examining the Dataset graph and inserting a shard op before the + * inputs to a reader Dataset (e.g. CSVDataset, TFRecordDataset). + *

+ * This dataset will throw a NotFound error if we cannot shard the dataset + * automatically. + */ +public final class AutoShardDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AutoShardDataset operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @param numWorkers A scalar representing the number of workers to distribute this dataset across. + * @param index A scalar representing the index of the current worker out of num_workers. + * @param outputTypes + * @param outputShapes + * @return a new instance of AutoShardDataset + */ + public static AutoShardDataset create(Scope scope, Operand inputDataset, Operand numWorkers, Operand index, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("AutoShardDataset", scope.makeOpName("AutoShardDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numWorkers.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new AutoShardDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private AutoShardDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Barrier.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Barrier.java new file mode 100644 index 00000000000..ddd2d81aa28 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Barrier.java @@ -0,0 +1,188 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Defines a barrier that persists across different graph executions. + *

+ * A barrier represents a key-value map, where each key is a string, and + * each value is a tuple of tensors. + *

+ * At runtime, the barrier contains 'complete' and 'incomplete' + * elements. A complete element has defined tensors for all components of + * its value tuple, and may be accessed using BarrierTakeMany. An + * incomplete element has some undefined components in its value tuple, + * and may be updated using BarrierInsertMany. + */ +@Operator +public final class Barrier extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Barrier} + */ + public static class Options { + + /** + * @param shapes The shape of each component in a value. Each shape must be 1 in the + * first dimension. The length of this attr must be the same as the length of + * component_types. + */ + public Options shapes(List shapes) { + this.shapes = shapes; + return this; + } + + /** + * @param capacity The capacity of the barrier. The default capacity is MAX_INT32, + * which is the largest capacity of the underlying queue. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param container If non-empty, this barrier is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this barrier will be shared under the given name + * across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private List shapes; + private Long capacity; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Barrier operation. + * + * @param scope current scope + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of Barrier + */ + public static Barrier create(Scope scope, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Barrier", scope.makeOpName("Barrier")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.shapes != null) { + Shape[] shapesArray = new Shape[opts.shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = opts.shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + } + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new Barrier(opBuilder.build()); + } + + /** + * @param shapes The shape of each component in a value. Each shape must be 1 in the + * first dimension. The length of this attr must be the same as the length of + * component_types. + */ + public static Options shapes(List shapes) { + return new Options().shapes(shapes); + } + + /** + * @param capacity The capacity of the barrier. The default capacity is MAX_INT32, + * which is the largest capacity of the underlying queue. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param container If non-empty, this barrier is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this barrier will be shared under the given name + * across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to the barrier. + */ + public Output handle() { + return handle; + } + + @Override + public Output asOutput() { + return handle; + } + + private Output handle; + + private Barrier(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierClose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierClose.java new file mode 100644 index 00000000000..d0128be4bf5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierClose.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Closes the given barrier. + *

+ * This operation signals that no more new elements will be inserted in the + * given barrier. Subsequent InsertMany that try to introduce a new key will fail. + * Subsequent InsertMany operations that just add missing components to already + * existing elements will continue to succeed. Subsequent TakeMany operations will + * continue to succeed if sufficient completed elements remain in the barrier. + * Subsequent TakeMany operations that would block will fail immediately. + */ +@Operator +public final class BarrierClose extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BarrierClose} + */ + public static class Options { + + /** + * @param cancelPendingEnqueues If true, all pending enqueue requests that are + * blocked on the barrier's queue will be canceled. InsertMany will fail, even + * if no new key is introduced. + */ + public Options cancelPendingEnqueues(Boolean cancelPendingEnqueues) { + this.cancelPendingEnqueues = cancelPendingEnqueues; + return this; + } + + private Boolean cancelPendingEnqueues; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BarrierClose operation. + * + * @param scope current scope + * @param handle The handle to a barrier. + * @param options carries optional attributes values + * @return a new instance of BarrierClose + */ + public static BarrierClose create(Scope scope, Operand handle, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BarrierClose", scope.makeOpName("BarrierClose")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.cancelPendingEnqueues != null) { + opBuilder.setAttr("cancel_pending_enqueues", opts.cancelPendingEnqueues); + } + } + } + return new BarrierClose(opBuilder.build()); + } + + /** + * @param cancelPendingEnqueues If true, all pending enqueue requests that are + * blocked on the barrier's queue will be canceled. InsertMany will fail, even + * if no new key is introduced. + */ + public static Options cancelPendingEnqueues(Boolean cancelPendingEnqueues) { + return new Options().cancelPendingEnqueues(cancelPendingEnqueues); + } + + + private BarrierClose(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierIncompleteSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierIncompleteSize.java new file mode 100644 index 00000000000..6a7a68f9f17 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierIncompleteSize.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the number of incomplete elements in the given barrier. + */ +@Operator +public final class BarrierIncompleteSize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BarrierIncompleteSize operation. + * + * @param scope current scope + * @param handle The handle to a barrier. + * @return a new instance of BarrierIncompleteSize + */ + public static BarrierIncompleteSize create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("BarrierIncompleteSize", scope.makeOpName("BarrierIncompleteSize")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BarrierIncompleteSize(opBuilder.build()); + } + + /** + * The number of incomplete elements (i.e. those with some of their value + * components not set) in the barrier. + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private BarrierIncompleteSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierInsertMany.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierInsertMany.java new file mode 100644 index 00000000000..396b099eda3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierInsertMany.java @@ -0,0 +1,63 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * For each key, assigns the respective value to the specified component. + *

+ * If a key is not found in the barrier, this operation will create a new + * incomplete element. If a key is found in the barrier, and the element + * already has a value at component_index, this operation will fail with + * INVALID_ARGUMENT, and leave the barrier in an undefined state. + */ +@Operator +public final class BarrierInsertMany extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BarrierInsertMany operation. + * + * @param scope current scope + * @param handle The handle to a barrier. + * @param keys A one-dimensional tensor of keys, with length n. + * @param values An any-dimensional tensor of values, which are associated with the + * respective keys. The 0th dimension must have length n. + * @param componentIndex The component of the barrier elements that is being assigned. + * @return a new instance of BarrierInsertMany + */ + public static BarrierInsertMany create(Scope scope, Operand handle, Operand keys, Operand values, Long componentIndex) { + OperationBuilder opBuilder = scope.env().opBuilder("BarrierInsertMany", scope.makeOpName("BarrierInsertMany")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(keys.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("component_index", componentIndex); + return new BarrierInsertMany(opBuilder.build()); + } + + + private BarrierInsertMany(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierReadySize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierReadySize.java new file mode 100644 index 00000000000..224d7c35f62 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierReadySize.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the number of complete elements in the given barrier. + */ +@Operator +public final class BarrierReadySize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BarrierReadySize operation. + * + * @param scope current scope + * @param handle The handle to a barrier. + * @return a new instance of BarrierReadySize + */ + public static BarrierReadySize create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("BarrierReadySize", scope.makeOpName("BarrierReadySize")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BarrierReadySize(opBuilder.build()); + } + + /** + * The number of complete elements (i.e. those with all of their value + * components set) in the barrier. + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private BarrierReadySize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierTakeMany.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierTakeMany.java new file mode 100644 index 00000000000..cc665d85999 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierTakeMany.java @@ -0,0 +1,183 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Takes the given number of completed elements from a barrier. + *

+ * This operation concatenates completed-element component tensors along + * the 0th dimension to make a single component tensor. + *

+ * Elements come out of the barrier when they are complete, and in the order + * in which they were placed into the barrier. The indices output provides + * information about the batch in which each element was originally inserted + * into the barrier. + */ +@Operator +public final class BarrierTakeMany extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BarrierTakeMany} + */ + public static class Options { + + /** + * @param allowSmallBatch Allow to return less than num_elements items if barrier is + * already closed. + */ + public Options allowSmallBatch(Boolean allowSmallBatch) { + this.allowSmallBatch = allowSmallBatch; + return this; + } + + /** + * @param waitForIncomplete + */ + public Options waitForIncomplete(Boolean waitForIncomplete) { + this.waitForIncomplete = waitForIncomplete; + return this; + } + + /** + * @param timeoutMs If the queue is empty, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public Options timeoutMs(Long timeoutMs) { + this.timeoutMs = timeoutMs; + return this; + } + + private Boolean allowSmallBatch; + private Boolean waitForIncomplete; + private Long timeoutMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BarrierTakeMany operation. + * + * @param scope current scope + * @param handle The handle to a barrier. + * @param numElements A single-element tensor containing the number of elements to + * take. + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of BarrierTakeMany + */ + public static BarrierTakeMany create(Scope scope, Operand handle, Operand numElements, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BarrierTakeMany", scope.makeOpName("BarrierTakeMany")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(numElements.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.allowSmallBatch != null) { + opBuilder.setAttr("allow_small_batch", opts.allowSmallBatch); + } + if (opts.waitForIncomplete != null) { + opBuilder.setAttr("wait_for_incomplete", opts.waitForIncomplete); + } + if (opts.timeoutMs != null) { + opBuilder.setAttr("timeout_ms", opts.timeoutMs); + } + } + } + return new BarrierTakeMany(opBuilder.build()); + } + + /** + * @param allowSmallBatch Allow to return less than num_elements items if barrier is + * already closed. + */ + public static Options allowSmallBatch(Boolean allowSmallBatch) { + return new Options().allowSmallBatch(allowSmallBatch); + } + + /** + * @param waitForIncomplete + */ + public static Options waitForIncomplete(Boolean waitForIncomplete) { + return new Options().waitForIncomplete(waitForIncomplete); + } + + /** + * @param timeoutMs If the queue is empty, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public static Options timeoutMs(Long timeoutMs) { + return new Options().timeoutMs(timeoutMs); + } + + /** + * A one-dimensional tensor of indices, with length num_elems. + * These indices refer to the batch in which the values were placed into the + * barrier (starting with MIN_LONG and increasing with each BarrierInsertMany). + */ + public Output indices() { + return indices; + } + + /** + * A one-dimensional tensor of keys, with length num_elements. + */ + public Output keys() { + return keys; + } + + /** + * One any-dimensional tensor per component in a barrier element. All + * values have length num_elements in the 0th dimension. + */ + public List> values() { + return values; + } + + private Output indices; + private Output keys; + private List> values; + + private BarrierTakeMany(Operation operation) { + super(operation); + int outputIdx = 0; + indices = operation.output(outputIdx++); + keys = operation.output(outputIdx++); + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Batch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Batch.java new file mode 100644 index 00000000000..bda8162d846 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Batch.java @@ -0,0 +1,241 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Batches all input tensors nondeterministically. + *

+ * When many instances of this Op are being run concurrently with the same + * container/shared_name in the same device, some will output zero-shaped Tensors + * and others will output Tensors of size up to max_batch_size. + *

+ * All Tensors in in_tensors are batched together (so, for example, labels and + * features should be batched with a single instance of this operation. + *

+ * Each invocation of batch emits an `id` scalar which will be used to identify + * this particular invocation when doing unbatch or its gradient. + *

+ * Each op which emits a non-empty batch will also emit a non-empty batch_index + * Tensor, which, is a [K, 3] matrix where each row contains the invocation's id, + * start, and length of elements of each set of Tensors present in batched_tensors. + *

+ * Batched tensors are concatenated along the first dimension, and all tensors in + * in_tensors must have the first dimension of the same size. + *

+ * in_tensors: The tensors to be batched. + * num_batch_threads: Number of scheduling threads for processing batches of work. + * Determines the number of batches processed in parallel. + * max_batch_size: Batch sizes will never be bigger than this. + * batch_timeout_micros: Maximum number of microseconds to wait before outputting + * an incomplete batch. + * allowed_batch_sizes: Optional list of allowed batch sizes. If left empty, does + * nothing. Otherwise, supplies a list of batch sizes, causing the op to pad + * batches up to one of those sizes. The entries must increase monotonically, and + * the final entry must equal max_batch_size. + * grad_timeout_micros: The timeout to use for the gradient. See Unbatch. + * batched_tensors: Either empty tensors or a batch of concatenated Tensors. + * batch_index: If out_tensors is non-empty, has information to invert it. + * container: Controls the scope of sharing of this batch. + * id: always contains a scalar with a unique ID for this invocation of Batch. + * shared_name: Concurrently running instances of batch in the same device with the + * same container and shared_name will batch their elements together. If left + * empty, the op name will be used as the shared name. + * T: the types of tensors to be batched. + */ +@Operator +public final class Batch extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Batch} + */ + public static class Options { + + /** + * @param maxEnqueuedBatches + */ + public Options maxEnqueuedBatches(Long maxEnqueuedBatches) { + this.maxEnqueuedBatches = maxEnqueuedBatches; + return this; + } + + /** + * @param allowedBatchSizes + */ + public Options allowedBatchSizes(List allowedBatchSizes) { + this.allowedBatchSizes = allowedBatchSizes; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param batchingQueue + */ + public Options batchingQueue(String batchingQueue) { + this.batchingQueue = batchingQueue; + return this; + } + + private Long maxEnqueuedBatches; + private List allowedBatchSizes; + private String container; + private String sharedName; + private String batchingQueue; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Batch operation. + * + * @param scope current scope + * @param inTensors + * @param numBatchThreads + * @param maxBatchSize + * @param batchTimeoutMicros + * @param gradTimeoutMicros + * @param options carries optional attributes values + * @return a new instance of Batch + */ + public static Batch create(Scope scope, Iterable> inTensors, Long numBatchThreads, Long maxBatchSize, Long batchTimeoutMicros, Long gradTimeoutMicros, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Batch", scope.makeOpName("Batch")); + opBuilder.addInputList(Operands.asOutputs(inTensors)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_batch_threads", numBatchThreads); + opBuilder.setAttr("max_batch_size", maxBatchSize); + opBuilder.setAttr("batch_timeout_micros", batchTimeoutMicros); + opBuilder.setAttr("grad_timeout_micros", gradTimeoutMicros); + if (options != null) { + for (Options opts : options) { + if (opts.maxEnqueuedBatches != null) { + opBuilder.setAttr("max_enqueued_batches", opts.maxEnqueuedBatches); + } + if (opts.allowedBatchSizes != null) { + long[] allowedBatchSizesArray = new long[opts.allowedBatchSizes.size()]; + for (int i = 0; i < allowedBatchSizesArray.length; ++i) { + allowedBatchSizesArray[i] = opts.allowedBatchSizes.get(i); + } + opBuilder.setAttr("allowed_batch_sizes", allowedBatchSizesArray); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.batchingQueue != null) { + opBuilder.setAttr("batching_queue", opts.batchingQueue); + } + } + } + return new Batch(opBuilder.build()); + } + + /** + * @param maxEnqueuedBatches + */ + public static Options maxEnqueuedBatches(Long maxEnqueuedBatches) { + return new Options().maxEnqueuedBatches(maxEnqueuedBatches); + } + + /** + * @param allowedBatchSizes + */ + public static Options allowedBatchSizes(List allowedBatchSizes) { + return new Options().allowedBatchSizes(allowedBatchSizes); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param batchingQueue + */ + public static Options batchingQueue(String batchingQueue) { + return new Options().batchingQueue(batchingQueue); + } + + /** + */ + public List> batchedTensors() { + return batchedTensors; + } + + /** + */ + public Output batchIndex() { + return batchIndex; + } + + /** + */ + public Output id() { + return id; + } + + private List> batchedTensors; + private Output batchIndex; + private Output id; + + private Batch(Operation operation) { + super(operation); + int outputIdx = 0; + int batchedTensorsLength = operation.outputListLength("batched_tensors"); + batchedTensors = Arrays.asList(operation.outputList(outputIdx, batchedTensorsLength)); + outputIdx += batchedTensorsLength; + batchIndex = operation.output(outputIdx++); + id = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchMatMulV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchMatMulV2.java new file mode 100644 index 00000000000..765d92975c8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchMatMulV2.java @@ -0,0 +1,148 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Multiplies slices of two tensors in batches. + *

+ * Multiplies all slices of `Tensor` `x` and `y` (each slice can be + * viewed as an element of a batch), and arranges the individual results + * in a single output tensor of the same batch size. Each of the + * individual slices can optionally be adjointed (to adjoint a matrix + * means to transpose and conjugate it) before multiplication by setting + * the `adj_x` or `adj_y` flag to `True`, which are by default `False`. + *

+ * The input tensors `x` and `y` are 2-D or higher with shape `[..., r_x, c_x]` + * and `[..., r_y, c_y]`. + *

+ * The output tensor is 2-D or higher with shape `[..., r_o, c_o]`, where: + *

+ * r_o = c_x if adj_x else r_x + * c_o = r_y if adj_y else c_y + *

+ * It is computed as: + *

+ * output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :]) + *

+ * NOTE: `BatchMatMulV2` supports broadcasting in the batch dimensions. More + * about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html). + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class BatchMatMulV2 extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BatchMatMulV2} + */ + public static class Options { + + /** + * @param adjX If `True`, adjoint the slices of `x`. Defaults to `False`. + */ + public Options adjX(Boolean adjX) { + this.adjX = adjX; + return this; + } + + /** + * @param adjY If `True`, adjoint the slices of `y`. Defaults to `False`. + */ + public Options adjY(Boolean adjY) { + this.adjY = adjY; + return this; + } + + private Boolean adjX; + private Boolean adjY; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchMatMulV2 operation. + * + * @param scope current scope + * @param x 2-D or higher with shape `[..., r_x, c_x]`. + * @param y 2-D or higher with shape `[..., r_y, c_y]`. + * @param options carries optional attributes values + * @return a new instance of BatchMatMulV2 + */ + public static BatchMatMulV2 create(Scope scope, Operand x, Operand y, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatMulV2", scope.makeOpName("BatchMatMulV2")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.adjX != null) { + opBuilder.setAttr("adj_x", opts.adjX); + } + if (opts.adjY != null) { + opBuilder.setAttr("adj_y", opts.adjY); + } + } + } + return new BatchMatMulV2(opBuilder.build()); + } + + /** + * @param adjX If `True`, adjoint the slices of `x`. Defaults to `False`. + */ + public static Options adjX(Boolean adjX) { + return new Options().adjX(adjX); + } + + /** + * @param adjY If `True`, adjoint the slices of `y`. Defaults to `False`. + */ + public static Options adjY(Boolean adjY) { + return new Options().adjY(adjY); + } + + /** + * 3-D or higher with shape `[..., r_o, c_o]` + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatMulV2(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpace.java new file mode 100644 index 00000000000..331b44ff979 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpace.java @@ -0,0 +1,140 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * BatchToSpace for 4-D tensors of type T. + *

+ * This is a legacy version of the more general BatchToSpaceND. + *

+ * Rearranges (permutes) data from batch into blocks of spatial data, followed by + * cropping. This is the reverse transformation of SpaceToBatch. More specifically, + * this op outputs a copy of the input tensor where values from the `batch` + * dimension are moved in spatial blocks to the `height` and `width` dimensions, + * followed by cropping along the `height` and `width` dimensions. + * + * @param data type for {@code output()} output + */ +@Operator +public final class BatchToSpace extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchToSpace operation. + * + * @param scope current scope + * @param input 4-D tensor with shape + * `[batchblock_sizeblock_size, height_pad/block_size, width_pad/block_size, + * depth]`. Note that the batch size of the input tensor must be divisible by + * `block_size * block_size`. + * @param crops 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies + * how many elements to crop from the intermediate result across the spatial + * dimensions as follows: + *

+ * crops = [[crop_top, crop_bottom], [crop_left, crop_right]] + * @param blockSize + * @return a new instance of BatchToSpace + */ + public static BatchToSpace create(Scope scope, Operand input, Operand crops, Long blockSize) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchToSpace", scope.makeOpName("BatchToSpace")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(crops.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("block_size", blockSize); + return new BatchToSpace(opBuilder.build()); + } + + /** + * 4-D with shape `[batch, height, width, depth]`, where: + *

+ * height = height_pad - crop_top - crop_bottom + * width = width_pad - crop_left - crop_right + *

+ * The attr `block_size` must be greater than one. It indicates the block size. + *

+ * Some examples: + *

+ * (1) For the following input of shape `[4, 1, 1, 1]` and block_size of 2: + *

{@code
+   * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
+   * }
+ * The output tensor has shape `[1, 2, 2, 1]` and value: + *
{@code
+   * x = [[[[1], [2]], [[3], [4]]]]
+   * }
+ * (2) For the following input of shape `[4, 1, 1, 3]` and block_size of 2: + *
{@code
+   * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
+   * }
+ * The output tensor has shape `[1, 2, 2, 3]` and value: + *
{@code
+   * x = [[[[1, 2, 3], [4, 5, 6]],
+   *       [[7, 8, 9], [10, 11, 12]]]]
+   * }
+ * (3) For the following input of shape `[4, 2, 2, 1]` and block_size of 2: + *
{@code
+   * x = [[[[1], [3]], [[9], [11]]],
+   *      [[[2], [4]], [[10], [12]]],
+   *      [[[5], [7]], [[13], [15]]],
+   *      [[[6], [8]], [[14], [16]]]]
+   * }
+ * The output tensor has shape `[1, 4, 4, 1]` and value: + *
{@code
+   * x = [[[[1],   [2],  [3],  [4]],
+   *      [[5],   [6],  [7],  [8]],
+   *      [[9],  [10], [11],  [12]],
+   *      [[13], [14], [15],  [16]]]]
+   * }
+ * (4) For the following input of shape `[8, 1, 2, 1]` and block_size of 2: + *
{@code
+   * x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],
+   *      [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]
+   * }
+ * The output tensor has shape `[2, 2, 4, 1]` and value: + *
{@code
+   * x = [[[[1], [3]], [[5], [7]]],
+   *      [[[2], [4]], [[10], [12]]],
+   *      [[[5], [7]], [[13], [15]]],
+   *      [[[6], [8]], [[14], [16]]]]
+   * }
+ * + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchToSpace(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpaceNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpaceNd.java new file mode 100644 index 00000000000..93b8e560911 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpaceNd.java @@ -0,0 +1,174 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * BatchToSpace for N-D tensors of type T. + *

+ * This operation reshapes the "batch" dimension 0 into `M + 1` dimensions of shape + * `block_shape + [batch]`, interleaves these blocks back into the grid defined by + * the spatial dimensions `[1, ..., M]`, to obtain a result with the same rank as + * the input. The spatial dimensions of this intermediate result are then + * optionally cropped according to `crops` to produce the output. This is the + * reverse of SpaceToBatch. See below for a precise description. + * + * @param data type for {@code output()} output + */ +@Operator +public final class BatchToSpaceNd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchToSpaceNd operation. + * + * @param scope current scope + * @param input N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, + * where spatial_shape has M dimensions. + * @param blockShape 1-D with shape `[M]`, all values must be >= 1. + * @param crops 2-D with shape `[M, 2]`, all values must be >= 0. + * `crops[i] = [crop_start, crop_end]` specifies the amount to crop from input + * dimension `i + 1`, which corresponds to spatial dimension `i`. It is + * required that + * `crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]`. + *

+ * This operation is equivalent to the following steps: + *

+ * 1. Reshape `input` to `reshaped` of shape: + * [block_shape[0], ..., block_shape[M-1], + * batch / prod(block_shape), + * input_shape[1], ..., input_shape[N-1]] + *

+ * 2. Permute dimensions of `reshaped` to produce `permuted` of shape + * [batch / prod(block_shape), + *

+ * input_shape[1], block_shape[0], + * ..., + * input_shape[M], block_shape[M-1], + *

+ * input_shape[M+1], ..., input_shape[N-1]] + *

+ * 3. Reshape `permuted` to produce `reshaped_permuted` of shape + * [batch / prod(block_shape), + *

+ * input_shape[1] * block_shape[0], + * ..., + * input_shape[M] * block_shape[M-1], + *

+ * input_shape[M+1], + * ..., + * input_shape[N-1]] + *

+ * 4. Crop the start and end of dimensions `[1, ..., M]` of + * `reshaped_permuted` according to `crops` to produce the output of shape: + * [batch / prod(block_shape), + *

+ * input_shape[1] * block_shape[0] - crops[0,0] - crops[0,1], + * ..., + * input_shape[M] * block_shape[M-1] - crops[M-1,0] - crops[M-1,1], + *

+ * input_shape[M+1], ..., input_shape[N-1]] + *

+ * Some examples: + *

+ * (1) For the following input of shape `[4, 1, 1, 1]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [0, 0]]`: + *

{@code
+   * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
+   * }
+ * The output tensor has shape `[1, 2, 2, 1]` and value: + *
{@code
+   * x = [[[[1], [2]], [[3], [4]]]]
+   * }
+ * (2) For the following input of shape `[4, 1, 1, 3]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [0, 0]]`: + *
{@code
+   * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
+   * }
+ * The output tensor has shape `[1, 2, 2, 3]` and value: + *
{@code
+   * x = [[[[1, 2, 3], [4, 5, 6]],
+   *       [[7, 8, 9], [10, 11, 12]]]]
+   * }
+ * (3) For the following input of shape `[4, 2, 2, 1]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [0, 0]]`: + *
{@code
+   * x = [[[[1], [3]], [[9], [11]]],
+   *      [[[2], [4]], [[10], [12]]],
+   *      [[[5], [7]], [[13], [15]]],
+   *      [[[6], [8]], [[14], [16]]]]
+   * }
+ * The output tensor has shape `[1, 4, 4, 1]` and value: + *
{@code
+   * x = [[[[1],   [2],  [3],  [4]],
+   *      [[5],   [6],  [7],  [8]],
+   *      [[9],  [10], [11],  [12]],
+   *      [[13], [14], [15],  [16]]]]
+   * }
+ * (4) For the following input of shape `[8, 1, 3, 1]`, `block_shape = [2, 2]`, and + * `crops = [[0, 0], [2, 0]]`: + *
{@code
+   * x = [[[[0], [1], [3]]], [[[0], [9], [11]]],
+   *      [[[0], [2], [4]]], [[[0], [10], [12]]],
+   *      [[[0], [5], [7]]], [[[0], [13], [15]]],
+   *      [[[0], [6], [8]]], [[[0], [14], [16]]]]
+   * }
+ * The output tensor has shape `[2, 2, 4, 1]` and value: + *
{@code
+   * x = [[[[1],   [2],  [3],  [4]],
+   *       [[5],   [6],  [7],  [8]]],
+   *      [[[9],  [10], [11],  [12]],
+   *       [[13], [14], [15],  [16]]]]
+   * }
+ * + * @return a new instance of BatchToSpaceNd + */ + public static BatchToSpaceNd create(Scope scope, Operand input, Operand blockShape, Operand crops) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchToSpaceND", scope.makeOpName("BatchToSpaceNd")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(blockShape.asOutput()); + opBuilder.addInput(crops.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchToSpaceNd(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchToSpaceNd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bitcast.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bitcast.java new file mode 100644 index 00000000000..868b3655460 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bitcast.java @@ -0,0 +1,120 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Bitcasts a tensor from one type to another without copying data. + *

+ * Given a tensor `input`, this operation returns a tensor that has the same buffer + * data as `input` with datatype `type`. + *

+ * If the input datatype `T` is larger than the output datatype `type` then the + * shape changes from [...] to [..., sizeof(`T`)/sizeof(`type`)]. + *

+ * If `T` is smaller than `type`, the operator requires that the rightmost + * dimension be equal to sizeof(`type`)/sizeof(`T`). The shape then goes from + * [..., sizeof(`type`)/sizeof(`T`)] to [...]. + *

+ * tf.bitcast() and tf.cast() work differently when real dtype is casted as a complex dtype + * (e.g. tf.complex64 or tf.complex128) as tf.cast() make imaginary part 0 while tf.bitcast() + * gives module error. + * For example, + *

+ * Example 1: + *

{@code
+ * >>> a = [1., 2., 3.]
+ * >>> equality_bitcast = tf.bitcast(a,tf.complex128)
+ * tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot bitcast from float to complex128: shape [3] [Op:Bitcast]
+ * >>> equality_cast = tf.cast(a,tf.complex128)
+ * >>> print(equality_cast)
+ * tf.Tensor([1.+0.j 2.+0.j 3.+0.j], shape=(3,), dtype=complex128)
+ * }
+ * Example 2: + *
{@code
+ * >>> tf.bitcast(tf.constant(0xffffffff, dtype=tf.uint32), tf.uint8)
+ * 
+ * }
+ * Example 3: + *
{@code
+ * >>> x = [1., 2., 3.]
+ * >>> y = [0., 2., 3.]
+ * >>> equality= tf.equal(x,y)
+ * >>> equality_cast = tf.cast(equality,tf.float32)
+ * >>> equality_bitcast = tf.bitcast(equality_cast,tf.uint8)
+ * >>> print(equality)
+ * tf.Tensor([False True True], shape=(3,), dtype=bool)
+ * >>> print(equality_cast)
+ * tf.Tensor([0. 1. 1.], shape=(3,), dtype=float32)
+ * >>> print(equality_bitcast)
+ * tf.Tensor(
+ * [[ 0 0 0 0]
+ *  [ 0 0 128 63]
+ *  [ 0 0 128 63]], shape=(3, 4), dtype=uint8)
+ * }
+ * NOTE: Bitcast is implemented as a low-level cast, so machines with different + * endian orderings will give different results. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Bitcast extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Bitcast operation. + * + * @param scope current scope + * @param input + * @param type + * @return a new instance of Bitcast + */ + public static Bitcast create(Scope scope, Operand input, Class type) { + OperationBuilder opBuilder = scope.env().opBuilder("Bitcast", scope.makeOpName("Bitcast")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("type", DataType.fromClass(type)); + return new Bitcast(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Bitcast(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTM.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTM.java new file mode 100644 index 00000000000..b0397841588 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTM.java @@ -0,0 +1,223 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the LSTM cell forward propagation for all the time steps. + *

+ * This is equivalent to applying LSTMBlockCell in a loop, like so: + *

{@code
+ * for x1 in unpack(x):
+ *   i1, cs1, f1, o1, ci1, co1, h1 = LSTMBlock(
+ *     x1, cs_prev, h_prev, w, wci, wcf, wco, b)
+ *   cs_prev = cs1
+ *   h_prev = h1
+ *   i.append(i1)
+ *   cs.append(cs1)
+ *   f.append(f1)
+ *   o.append(o1)
+ *   ci.append(ci1)
+ *   co.append(co1)
+ *   h.append(h1)
+ * return pack(i), pack(cs), pack(f), pack(o), pack(ci), pack(ch), pack(h)
+ * }
+ * + * + * @param data type for {@code i()} output + */ +public final class BlockLSTM extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BlockLSTM} + */ + public static class Options { + + /** + * @param forgetBias The forget gate bias. + */ + public Options forgetBias(Float forgetBias) { + this.forgetBias = forgetBias; + return this; + } + + /** + * @param cellClip Value to clip the 'cs' value to. + */ + public Options cellClip(Float cellClip) { + this.cellClip = cellClip; + return this; + } + + /** + * @param usePeephole Whether to use peephole weights. + */ + public Options usePeephole(Boolean usePeephole) { + this.usePeephole = usePeephole; + return this; + } + + private Float forgetBias; + private Float cellClip; + private Boolean usePeephole; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BlockLSTM operation. + * + * @param scope current scope + * @param seqLenMax Maximum time length actually used by this input. Outputs are padded + * with zeros beyond this length. + * @param x The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). + * @param csPrev Value of the initial cell state. + * @param hPrev Initial output of cell (to be used for peephole). + * @param w The weight matrix. + * @param wci The weight matrix for input gate peephole connection. + * @param wcf The weight matrix for forget gate peephole connection. + * @param wco The weight matrix for output gate peephole connection. + * @param b The bias vector. + * @param options carries optional attributes values + * @return a new instance of BlockLSTM + */ + public static BlockLSTM create(Scope scope, Operand seqLenMax, Operand x, Operand csPrev, Operand hPrev, Operand w, Operand wci, Operand wcf, Operand wco, Operand b, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BlockLSTM", scope.makeOpName("BlockLSTM")); + opBuilder.addInput(seqLenMax.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(csPrev.asOutput()); + opBuilder.addInput(hPrev.asOutput()); + opBuilder.addInput(w.asOutput()); + opBuilder.addInput(wci.asOutput()); + opBuilder.addInput(wcf.asOutput()); + opBuilder.addInput(wco.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.forgetBias != null) { + opBuilder.setAttr("forget_bias", opts.forgetBias); + } + if (opts.cellClip != null) { + opBuilder.setAttr("cell_clip", opts.cellClip); + } + if (opts.usePeephole != null) { + opBuilder.setAttr("use_peephole", opts.usePeephole); + } + } + } + return new BlockLSTM(opBuilder.build()); + } + + /** + * @param forgetBias The forget gate bias. + */ + public static Options forgetBias(Float forgetBias) { + return new Options().forgetBias(forgetBias); + } + + /** + * @param cellClip Value to clip the 'cs' value to. + */ + public static Options cellClip(Float cellClip) { + return new Options().cellClip(cellClip); + } + + /** + * @param usePeephole Whether to use peephole weights. + */ + public static Options usePeephole(Boolean usePeephole) { + return new Options().usePeephole(usePeephole); + } + + /** + * The input gate over the whole time sequence. + */ + public Output i() { + return i; + } + + /** + * The cell state before the tanh over the whole time sequence. + */ + public Output cs() { + return cs; + } + + /** + * The forget gate over the whole time sequence. + */ + public Output f() { + return f; + } + + /** + * The output gate over the whole time sequence. + */ + public Output o() { + return o; + } + + /** + * The cell input over the whole time sequence. + */ + public Output ci() { + return ci; + } + + /** + * The cell after the tanh over the whole time sequence. + */ + public Output co() { + return co; + } + + /** + * The output h vector over the whole time sequence. + */ + public Output h() { + return h; + } + + private Output i; + private Output cs; + private Output f; + private Output o; + private Output ci; + private Output co; + private Output h; + + private BlockLSTM(Operation operation) { + super(operation); + int outputIdx = 0; + i = operation.output(outputIdx++); + cs = operation.output(outputIdx++); + f = operation.output(outputIdx++); + o = operation.output(outputIdx++); + ci = operation.output(outputIdx++); + co = operation.output(outputIdx++); + h = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTMGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTMGrad.java new file mode 100644 index 00000000000..07877ee24fd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTMGrad.java @@ -0,0 +1,164 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the LSTM cell backward propagation for the entire time sequence. + *

+ * This implementation is to be used in conjunction of LSTMBlock. + * + * @param data type for {@code xGrad()} output + */ +public final class BlockLSTMGrad extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BlockLSTMGrad operation. + * + * @param scope current scope + * @param seqLenMax Maximum time length actually used by this input. Outputs are padded + * with zeros beyond this length. + * @param x The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). + * @param csPrev Value of the initial cell state. + * @param hPrev Initial output of cell (to be used for peephole). + * @param w The weight matrix. + * @param wci The weight matrix for input gate peephole connection. + * @param wcf The weight matrix for forget gate peephole connection. + * @param wco The weight matrix for output gate peephole connection. + * @param b The bias vector. + * @param i The input gate over the whole time sequence. + * @param cs The cell state before the tanh over the whole time sequence. + * @param f The forget gate over the whole time sequence. + * @param o The output gate over the whole time sequence. + * @param ci The cell input over the whole time sequence. + * @param co The cell after the tanh over the whole time sequence. + * @param h The output h vector over the whole time sequence. + * @param csGrad The current gradient of cs. + * @param hGrad The gradient of h vector. + * @param usePeephole Whether to use peephole weights. + * @return a new instance of BlockLSTMGrad + */ + public static BlockLSTMGrad create(Scope scope, Operand seqLenMax, Operand x, Operand csPrev, Operand hPrev, Operand w, Operand wci, Operand wcf, Operand wco, Operand b, Operand i, Operand cs, Operand f, Operand o, Operand ci, Operand co, Operand h, Operand csGrad, Operand hGrad, Boolean usePeephole) { + OperationBuilder opBuilder = scope.env().opBuilder("BlockLSTMGrad", scope.makeOpName("BlockLSTMGrad")); + opBuilder.addInput(seqLenMax.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(csPrev.asOutput()); + opBuilder.addInput(hPrev.asOutput()); + opBuilder.addInput(w.asOutput()); + opBuilder.addInput(wci.asOutput()); + opBuilder.addInput(wcf.asOutput()); + opBuilder.addInput(wco.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder.addInput(i.asOutput()); + opBuilder.addInput(cs.asOutput()); + opBuilder.addInput(f.asOutput()); + opBuilder.addInput(o.asOutput()); + opBuilder.addInput(ci.asOutput()); + opBuilder.addInput(co.asOutput()); + opBuilder.addInput(h.asOutput()); + opBuilder.addInput(csGrad.asOutput()); + opBuilder.addInput(hGrad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("use_peephole", usePeephole); + return new BlockLSTMGrad(opBuilder.build()); + } + + /** + * The gradient of x to be back-propped. + */ + public Output xGrad() { + return xGrad; + } + + /** + * The gradient of cs_prev to be back-propped. + */ + public Output csPrevGrad() { + return csPrevGrad; + } + + /** + * The gradient of h_prev to be back-propped. + */ + public Output hPrevGrad() { + return hPrevGrad; + } + + /** + * The gradient for w to be back-propped. + */ + public Output wGrad() { + return wGrad; + } + + /** + * The gradient for wci to be back-propped. + */ + public Output wciGrad() { + return wciGrad; + } + + /** + * The gradient for wcf to be back-propped. + */ + public Output wcfGrad() { + return wcfGrad; + } + + /** + * The gradient for wco to be back-propped. + */ + public Output wcoGrad() { + return wcoGrad; + } + + /** + * The gradient for w to be back-propped. + */ + public Output bGrad() { + return bGrad; + } + + private Output xGrad; + private Output csPrevGrad; + private Output hPrevGrad; + private Output wGrad; + private Output wciGrad; + private Output wcfGrad; + private Output wcoGrad; + private Output bGrad; + + private BlockLSTMGrad(Operation operation) { + super(operation); + int outputIdx = 0; + xGrad = operation.output(outputIdx++); + csPrevGrad = operation.output(outputIdx++); + hPrevGrad = operation.output(outputIdx++); + wGrad = operation.output(outputIdx++); + wciGrad = operation.output(outputIdx++); + wcfGrad = operation.output(outputIdx++); + wcoGrad = operation.output(outputIdx++); + bGrad = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesAggregateStats.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesAggregateStats.java new file mode 100644 index 00000000000..f17db08d961 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesAggregateStats.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Aggregates the summary of accumulated stats for the batch. + *

+ * The summary stats contains gradients and hessians accumulated for each node, feature dimension id and bucket. + */ +public final class BoostedTreesAggregateStats extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BoostedTreesAggregateStats operation. + * + * @param scope current scope + * @param nodeIds int32; Rank 1 Tensor containing node ids for each example, shape [batch_size]. + * @param gradients float32; Rank 2 Tensor (shape=[batch_size, logits_dimension]) with gradients for each example. + * @param hessians float32; Rank 2 Tensor (shape=[batch_size, hessian_dimension]) with hessians for each example. + * @param feature int32; Rank 2 feature Tensors (shape=[batch_size, feature_dimension]). + * @param maxSplits int; the maximum number of splits possible in the whole tree. + * @param numBuckets int; equals to the maximum possible value of bucketized feature. + * @return a new instance of BoostedTreesAggregateStats + */ + public static BoostedTreesAggregateStats create(Scope scope, Operand nodeIds, Operand gradients, Operand hessians, Operand feature, Long maxSplits, Long numBuckets) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesAggregateStats", scope.makeOpName("BoostedTreesAggregateStats")); + opBuilder.addInput(nodeIds.asOutput()); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(hessians.asOutput()); + opBuilder.addInput(feature.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("max_splits", maxSplits); + opBuilder.setAttr("num_buckets", numBuckets); + return new BoostedTreesAggregateStats(opBuilder.build()); + } + + /** + * output Rank 4 Tensor (shape=[splits, feature_dimension, buckets, logits_dimension + hessian_dimension]) + * containing accumulated stats for each node, feature dimension and bucket. + */ + public Output statsSummary() { + return statsSummary; + } + + @Override + public Output asOutput() { + return statsSummary; + } + + private Output statsSummary; + + private BoostedTreesAggregateStats(Operation operation) { + super(operation); + int outputIdx = 0; + statsSummary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesBucketize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesBucketize.java new file mode 100644 index 00000000000..8b401786262 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesBucketize.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Bucketize each feature based on bucket boundaries. + *

+ * An op that returns a list of float tensors, where each tensor represents the + * bucketized values for a single feature. + */ +public final class BoostedTreesBucketize extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new BoostedTreesBucketize operation. + * + * @param scope current scope + * @param floatValues float; List of Rank 1 Tensor each containing float values for a single feature. + * @param bucketBoundaries float; List of Rank 1 Tensors each containing the bucket boundaries for a single + * feature. + * @return a new instance of BoostedTreesBucketize + */ + public static BoostedTreesBucketize create(Scope scope, Iterable> floatValues, Iterable> bucketBoundaries) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesBucketize", scope.makeOpName("BoostedTreesBucketize")); + opBuilder.addInputList(Operands.asOutputs(floatValues)); + opBuilder.addInputList(Operands.asOutputs(bucketBoundaries)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesBucketize(opBuilder.build()); + } + + /** + * int; List of Rank 1 Tensors each containing the bucketized values for a single feature. + */ + public List> buckets() { + return buckets; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) buckets.iterator(); + } + + private List> buckets; + + @SuppressWarnings("unchecked") + private BoostedTreesBucketize(Operation operation) { + super(operation); + int outputIdx = 0; + int bucketsLength = operation.outputListLength("buckets"); + buckets = Arrays.asList((Output[])operation.outputList(outputIdx, bucketsLength)); + outputIdx += bucketsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestFeatureSplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestFeatureSplit.java new file mode 100644 index 00000000000..20c180ca72e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestFeatureSplit.java @@ -0,0 +1,169 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Calculates gains for each feature and returns the best possible split information for the feature. + *

+ * The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature. + *

+ * It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split. + *

+ * In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features). + *

+ * The output shapes are compatible in a way that the first dimension of all tensors are the same and equal to the number of possible split nodes for each feature. + */ +public final class BoostedTreesCalculateBestFeatureSplit extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BoostedTreesCalculateBestFeatureSplit} + */ + public static class Options { + + /** + * @param splitType A string indicating if this Op should perform inequality split or equality split. + */ + public Options splitType(String splitType) { + this.splitType = splitType; + return this; + } + + private String splitType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BoostedTreesCalculateBestFeatureSplit operation. + * + * @param scope current scope + * @param nodeIdRange A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive). + * @param statsSummary A Rank 4 tensor (#shape=[max_splits, feature_dims, bucket, stats_dims]) for accumulated stats summary (gradient/hessian) per node, per dimension, per buckets for each feature. + * The first dimension of the tensor is the maximum number of splits, and thus not all elements of it will be used, but only the indexes specified by node_ids will be used. + * @param l1 l1 regularization factor on leaf weights, per instance based. + * @param l2 l2 regularization factor on leaf weights, per instance based. + * @param treeComplexity adjustment to the gain, per leaf based. + * @param minNodeWeight mininum avg of hessians in a node before required for the node to be considered for splitting. + * @param logitsDimension The dimension of logit, i.e., number of classes. + * @param options carries optional attributes values + * @return a new instance of BoostedTreesCalculateBestFeatureSplit + */ + public static BoostedTreesCalculateBestFeatureSplit create(Scope scope, Operand nodeIdRange, Operand statsSummary, Operand l1, Operand l2, Operand treeComplexity, Operand minNodeWeight, Long logitsDimension, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesCalculateBestFeatureSplit", scope.makeOpName("BoostedTreesCalculateBestFeatureSplit")); + opBuilder.addInput(nodeIdRange.asOutput()); + opBuilder.addInput(statsSummary.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(treeComplexity.asOutput()); + opBuilder.addInput(minNodeWeight.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("logits_dimension", logitsDimension); + if (options != null) { + for (Options opts : options) { + if (opts.splitType != null) { + opBuilder.setAttr("split_type", opts.splitType); + } + } + } + return new BoostedTreesCalculateBestFeatureSplit(opBuilder.build()); + } + + /** + * @param splitType A string indicating if this Op should perform inequality split or equality split. + */ + public static Options splitType(String splitType) { + return new Options().splitType(splitType); + } + + /** + * A Rank 1 tensors indicating possible split node ids for each feature. The length of the list is num_features, but each tensor has different size as each feature provides different possible nodes. See above for details like shapes and sizes. + */ + public Output nodeIds() { + return nodeIds; + } + + /** + * A Rank 1 tensors indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes. + */ + public Output gains() { + return gains; + } + + /** + * A Rank 1 tensors indicating the best feature dimension for each feature to split for certain nodes if the feature is multi-dimension. See above for details like shapes and sizes. + */ + public Output featureDimensions() { + return featureDimensions; + } + + /** + * A Rank 1 tensors indicating the bucket id to compare with (as a threshold) for split in each node. See above for details like shapes and sizes. + */ + public Output thresholds() { + return thresholds; + } + + /** + * A Rank 2 tensors indicating the contribution of the left nodes when branching from parent nodes (given by the tensor element in the output node_ids_list) to the left direction by the given threshold for each feature. This value will be used to make the left node value by adding to the parent node value. Second dimension size is 1 for 1-dimensional logits, but would be larger for multi-class problems. See above for details like shapes and sizes. + */ + public Output leftNodeContribs() { + return leftNodeContribs; + } + + /** + * A Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. + */ + public Output rightNodeContribs() { + return rightNodeContribs; + } + + /** + * A Rank 1 tensors indicating the which direction to go if data is missing. See above for details like shapes and sizes. + */ + public Output splitWithDefaultDirections() { + return splitWithDefaultDirections; + } + + private Output nodeIds; + private Output gains; + private Output featureDimensions; + private Output thresholds; + private Output leftNodeContribs; + private Output rightNodeContribs; + private Output splitWithDefaultDirections; + + private BoostedTreesCalculateBestFeatureSplit(Operation operation) { + super(operation); + int outputIdx = 0; + nodeIds = operation.output(outputIdx++); + gains = operation.output(outputIdx++); + featureDimensions = operation.output(outputIdx++); + thresholds = operation.output(outputIdx++); + leftNodeContribs = operation.output(outputIdx++); + rightNodeContribs = operation.output(outputIdx++); + splitWithDefaultDirections = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestGainsPerFeature.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestGainsPerFeature.java new file mode 100644 index 00000000000..42494896ec2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestGainsPerFeature.java @@ -0,0 +1,131 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Calculates gains for each feature and returns the best possible split information for the feature. + *

+ * The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature. + *

+ * It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split. + *

+ * In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features). + *

+ * The length of output lists are all of the same length, `num_features`. + * The output shapes are compatible in a way that the first dimension of all tensors of all lists are the same and equal to the number of possible split nodes for each feature. + */ +public final class BoostedTreesCalculateBestGainsPerFeature extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesCalculateBestGainsPerFeature operation. + * + * @param scope current scope + * @param nodeIdRange A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive). + * @param statsSummaryList A list of Rank 3 tensor (#shape=[max_splits, bucket, 2]) for accumulated stats summary (gradient/hessian) per node per buckets for each feature. The first dimension of the tensor is the maximum number of splits, and thus not all elements of it will be used, but only the indexes specified by node_ids will be used. + * @param l1 l1 regularization factor on leaf weights, per instance based. + * @param l2 l2 regularization factor on leaf weights, per instance based. + * @param treeComplexity adjustment to the gain, per leaf based. + * @param minNodeWeight mininum avg of hessians in a node before required for the node to be considered for splitting. + * @param maxSplits the number of nodes that can be split in the whole tree. Used as a dimension of output tensors. + * @return a new instance of BoostedTreesCalculateBestGainsPerFeature + */ + public static BoostedTreesCalculateBestGainsPerFeature create(Scope scope, Operand nodeIdRange, Iterable> statsSummaryList, Operand l1, Operand l2, Operand treeComplexity, Operand minNodeWeight, Long maxSplits) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesCalculateBestGainsPerFeature", scope.makeOpName("BoostedTreesCalculateBestGainsPerFeature")); + opBuilder.addInput(nodeIdRange.asOutput()); + opBuilder.addInputList(Operands.asOutputs(statsSummaryList)); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(treeComplexity.asOutput()); + opBuilder.addInput(minNodeWeight.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("max_splits", maxSplits); + return new BoostedTreesCalculateBestGainsPerFeature(opBuilder.build()); + } + + /** + * An output list of Rank 1 tensors indicating possible split node ids for each feature. The length of the list is num_features, but each tensor has different size as each feature provides different possible nodes. See above for details like shapes and sizes. + */ + public List> nodeIdsList() { + return nodeIdsList; + } + + /** + * An output list of Rank 1 tensors indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes. + */ + public List> gainsList() { + return gainsList; + } + + /** + * An output list of Rank 1 tensors indicating the bucket id to compare with (as a threshold) for split in each node. See above for details like shapes and sizes. + */ + public List> thresholdsList() { + return thresholdsList; + } + + /** + * A list of Rank 2 tensors indicating the contribution of the left nodes when branching from parent nodes (given by the tensor element in the output node_ids_list) to the left direction by the given threshold for each feature. This value will be used to make the left node value by adding to the parent node value. Second dimension size is 1 for 1-dimensional logits, but would be larger for multi-class problems. See above for details like shapes and sizes. + */ + public List> leftNodeContribsList() { + return leftNodeContribsList; + } + + /** + * A list of Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. + */ + public List> rightNodeContribsList() { + return rightNodeContribsList; + } + + private List> nodeIdsList; + private List> gainsList; + private List> thresholdsList; + private List> leftNodeContribsList; + private List> rightNodeContribsList; + + @SuppressWarnings("unchecked") + private BoostedTreesCalculateBestGainsPerFeature(Operation operation) { + super(operation); + int outputIdx = 0; + int nodeIdsListLength = operation.outputListLength("node_ids_list"); + nodeIdsList = Arrays.asList((Output[])operation.outputList(outputIdx, nodeIdsListLength)); + outputIdx += nodeIdsListLength; + int gainsListLength = operation.outputListLength("gains_list"); + gainsList = Arrays.asList((Output[])operation.outputList(outputIdx, gainsListLength)); + outputIdx += gainsListLength; + int thresholdsListLength = operation.outputListLength("thresholds_list"); + thresholdsList = Arrays.asList((Output[])operation.outputList(outputIdx, thresholdsListLength)); + outputIdx += thresholdsListLength; + int leftNodeContribsListLength = operation.outputListLength("left_node_contribs_list"); + leftNodeContribsList = Arrays.asList((Output[])operation.outputList(outputIdx, leftNodeContribsListLength)); + outputIdx += leftNodeContribsListLength; + int rightNodeContribsListLength = operation.outputListLength("right_node_contribs_list"); + rightNodeContribsList = Arrays.asList((Output[])operation.outputList(outputIdx, rightNodeContribsListLength)); + outputIdx += rightNodeContribsListLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCenterBias.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCenterBias.java new file mode 100644 index 00000000000..073c7c08d70 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCenterBias.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Calculates the prior from the training data (the bias) and fills in the first node with the logits' prior. Returns a boolean indicating whether to continue centering. + */ +public final class BoostedTreesCenterBias extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BoostedTreesCenterBias operation. + * + * @param scope current scope + * @param treeEnsembleHandle Handle to the tree ensemble. + * @param meanGradients A tensor with shape=[logits_dimension] with mean of gradients for a first node. + * @param meanHessians A tensor with shape=[logits_dimension] mean of hessians for a first node. + * @param l1 l1 regularization factor on leaf weights, per instance based. + * @param l2 l2 regularization factor on leaf weights, per instance based. + * @return a new instance of BoostedTreesCenterBias + */ + public static BoostedTreesCenterBias create(Scope scope, Operand treeEnsembleHandle, Operand meanGradients, Operand meanHessians, Operand l1, Operand l2) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesCenterBias", scope.makeOpName("BoostedTreesCenterBias")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder.addInput(meanGradients.asOutput()); + opBuilder.addInput(meanHessians.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesCenterBias(opBuilder.build()); + } + + /** + * Bool, whether to continue bias centering. + */ + public Output continueCentering() { + return continueCentering; + } + + @Override + public Output asOutput() { + return continueCentering; + } + + private Output continueCentering; + + private BoostedTreesCenterBias(Operation operation) { + super(operation); + int outputIdx = 0; + continueCentering = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateEnsemble.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateEnsemble.java new file mode 100644 index 00000000000..e2b119b58db --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateEnsemble.java @@ -0,0 +1,53 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a tree ensemble model and returns a handle to it. + */ +public final class BoostedTreesCreateEnsemble extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesCreateEnsemble operation. + * + * @param scope current scope + * @param treeEnsembleHandle Handle to the tree ensemble resource to be created. + * @param stampToken Token to use as the initial value of the resource stamp. + * @param treeEnsembleSerialized Serialized proto of the tree ensemble. + * @return a new instance of BoostedTreesCreateEnsemble + */ + public static BoostedTreesCreateEnsemble create(Scope scope, Operand treeEnsembleHandle, Operand stampToken, Operand treeEnsembleSerialized) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesCreateEnsemble", scope.makeOpName("BoostedTreesCreateEnsemble")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder.addInput(stampToken.asOutput()); + opBuilder.addInput(treeEnsembleSerialized.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesCreateEnsemble(opBuilder.build()); + } + + + private BoostedTreesCreateEnsemble(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateQuantileStreamResource.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateQuantileStreamResource.java new file mode 100644 index 00000000000..bb0a22e376b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateQuantileStreamResource.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Create the Resource for Quantile Streams. + */ +public final class BoostedTreesCreateQuantileStreamResource extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BoostedTreesCreateQuantileStreamResource} + */ + public static class Options { + + /** + * @param maxElements int; The maximum number of data points that can be fed to the stream. + */ + public Options maxElements(Long maxElements) { + this.maxElements = maxElements; + return this; + } + + private Long maxElements; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BoostedTreesCreateQuantileStreamResource operation. + * + * @param scope current scope + * @param quantileStreamResourceHandle resource; Handle to quantile stream resource. + * @param epsilon float; The required approximation error of the stream resource. + * @param numStreams int; The number of streams managed by the resource that shares the same epsilon. + * @param options carries optional attributes values + * @return a new instance of BoostedTreesCreateQuantileStreamResource + */ + public static BoostedTreesCreateQuantileStreamResource create(Scope scope, Operand quantileStreamResourceHandle, Operand epsilon, Operand numStreams, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesCreateQuantileStreamResource", scope.makeOpName("BoostedTreesCreateQuantileStreamResource")); + opBuilder.addInput(quantileStreamResourceHandle.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(numStreams.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.maxElements != null) { + opBuilder.setAttr("max_elements", opts.maxElements); + } + } + } + return new BoostedTreesCreateQuantileStreamResource(opBuilder.build()); + } + + /** + * @param maxElements int; The maximum number of data points that can be fed to the stream. + */ + public static Options maxElements(Long maxElements) { + return new Options().maxElements(maxElements); + } + + + private BoostedTreesCreateQuantileStreamResource(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesDeserializeEnsemble.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesDeserializeEnsemble.java new file mode 100644 index 00000000000..2e92849ccbc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesDeserializeEnsemble.java @@ -0,0 +1,55 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Deserializes a serialized tree ensemble config and replaces current tree + *

+ * ensemble. + */ +public final class BoostedTreesDeserializeEnsemble extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesDeserializeEnsemble operation. + * + * @param scope current scope + * @param treeEnsembleHandle Handle to the tree ensemble. + * @param stampToken Token to use as the new value of the resource stamp. + * @param treeEnsembleSerialized Serialized proto of the ensemble. + * @return a new instance of BoostedTreesDeserializeEnsemble + */ + public static BoostedTreesDeserializeEnsemble create(Scope scope, Operand treeEnsembleHandle, Operand stampToken, Operand treeEnsembleSerialized) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesDeserializeEnsemble", scope.makeOpName("BoostedTreesDeserializeEnsemble")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder.addInput(stampToken.asOutput()); + opBuilder.addInput(treeEnsembleSerialized.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesDeserializeEnsemble(opBuilder.build()); + } + + + private BoostedTreesDeserializeEnsemble(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesEnsembleResourceHandleOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesEnsembleResourceHandleOp.java new file mode 100644 index 00000000000..1e05ca72128 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesEnsembleResourceHandleOp.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a handle to a BoostedTreesEnsembleResource + */ +public final class BoostedTreesEnsembleResourceHandleOp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BoostedTreesEnsembleResourceHandleOp} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BoostedTreesEnsembleResourceHandleOp operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of BoostedTreesEnsembleResourceHandleOp + */ + public static BoostedTreesEnsembleResourceHandleOp create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesEnsembleResourceHandleOp", scope.makeOpName("BoostedTreesEnsembleResourceHandleOp")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new BoostedTreesEnsembleResourceHandleOp(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output resource() { + return resource; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) resource; + } + + private Output resource; + + private BoostedTreesEnsembleResourceHandleOp(Operation operation) { + super(operation); + int outputIdx = 0; + resource = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesExampleDebugOutputs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesExampleDebugOutputs.java new file mode 100644 index 00000000000..e52e99387d0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesExampleDebugOutputs.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Debugging/model interpretability outputs for each example. + *

+ * It traverses all the trees and computes debug metrics for individual examples, + * such as getting split feature ids and logits after each split along the decision + * path used to compute directional feature contributions. + */ +public final class BoostedTreesExampleDebugOutputs extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BoostedTreesExampleDebugOutputs operation. + * + * @param scope current scope + * @param treeEnsembleHandle + * @param bucketizedFeatures A list of rank 1 Tensors containing bucket id for each + * feature. + * @param logitsDimension scalar, dimension of the logits, to be used for constructing the protos in + * examples_debug_outputs_serialized. + * @return a new instance of BoostedTreesExampleDebugOutputs + */ + public static BoostedTreesExampleDebugOutputs create(Scope scope, Operand treeEnsembleHandle, Iterable> bucketizedFeatures, Long logitsDimension) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesExampleDebugOutputs", scope.makeOpName("BoostedTreesExampleDebugOutputs")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder.addInputList(Operands.asOutputs(bucketizedFeatures)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("logits_dimension", logitsDimension); + return new BoostedTreesExampleDebugOutputs(opBuilder.build()); + } + + /** + * Output rank 1 Tensor containing a proto serialized as a string for each example. + */ + public Output examplesDebugOutputsSerialized() { + return examplesDebugOutputsSerialized; + } + + @Override + public Output asOutput() { + return examplesDebugOutputsSerialized; + } + + private Output examplesDebugOutputsSerialized; + + private BoostedTreesExampleDebugOutputs(Operation operation) { + super(operation); + int outputIdx = 0; + examplesDebugOutputsSerialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesFlushQuantileSummaries.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesFlushQuantileSummaries.java new file mode 100644 index 00000000000..24c2a3398e5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesFlushQuantileSummaries.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Flush the quantile summaries from each quantile stream resource. + *

+ * An op that outputs a list of quantile summaries of a quantile stream resource. + * Each summary Tensor is rank 2, containing summaries (value, weight, min_rank, + * max_rank) for a single feature. + */ +public final class BoostedTreesFlushQuantileSummaries extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new BoostedTreesFlushQuantileSummaries operation. + * + * @param scope current scope + * @param quantileStreamResourceHandle resource handle referring to a QuantileStreamResource. + * @param numFeatures + * @return a new instance of BoostedTreesFlushQuantileSummaries + */ + public static BoostedTreesFlushQuantileSummaries create(Scope scope, Operand quantileStreamResourceHandle, Long numFeatures) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesFlushQuantileSummaries", scope.makeOpName("BoostedTreesFlushQuantileSummaries")); + opBuilder.addInput(quantileStreamResourceHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_features", numFeatures); + return new BoostedTreesFlushQuantileSummaries(opBuilder.build()); + } + + /** + */ + public List> summaries() { + return summaries; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) summaries.iterator(); + } + + private List> summaries; + + @SuppressWarnings("unchecked") + private BoostedTreesFlushQuantileSummaries(Operation operation) { + super(operation); + int outputIdx = 0; + int summariesLength = operation.outputListLength("summaries"); + summaries = Arrays.asList((Output[])operation.outputList(outputIdx, summariesLength)); + outputIdx += summariesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesGetEnsembleStates.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesGetEnsembleStates.java new file mode 100644 index 00000000000..1795701419e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesGetEnsembleStates.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieves the tree ensemble resource stamp token, number of trees and growing statistics. + */ +public final class BoostedTreesGetEnsembleStates extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesGetEnsembleStates operation. + * + * @param scope current scope + * @param treeEnsembleHandle Handle to the tree ensemble. + * @return a new instance of BoostedTreesGetEnsembleStates + */ + public static BoostedTreesGetEnsembleStates create(Scope scope, Operand treeEnsembleHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesGetEnsembleStates", scope.makeOpName("BoostedTreesGetEnsembleStates")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesGetEnsembleStates(opBuilder.build()); + } + + /** + * Stamp token of the tree ensemble resource. + */ + public Output stampToken() { + return stampToken; + } + + /** + * The number of trees in the tree ensemble resource. + */ + public Output numTrees() { + return numTrees; + } + + /** + * The number of trees that were finished successfully. + */ + public Output numFinalizedTrees() { + return numFinalizedTrees; + } + + /** + * The number of layers we attempted to build (but not necessarily succeeded). + */ + public Output numAttemptedLayers() { + return numAttemptedLayers; + } + + /** + * Rank size 2 tensor that contains start and end ids of the nodes in the latest + * layer. + */ + public Output lastLayerNodesRange() { + return lastLayerNodesRange; + } + + private Output stampToken; + private Output numTrees; + private Output numFinalizedTrees; + private Output numAttemptedLayers; + private Output lastLayerNodesRange; + + private BoostedTreesGetEnsembleStates(Operation operation) { + super(operation); + int outputIdx = 0; + stampToken = operation.output(outputIdx++); + numTrees = operation.output(outputIdx++); + numFinalizedTrees = operation.output(outputIdx++); + numAttemptedLayers = operation.output(outputIdx++); + lastLayerNodesRange = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeQuantileSummaries.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeQuantileSummaries.java new file mode 100644 index 00000000000..8dc77b16bc8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeQuantileSummaries.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Makes the summary of quantiles for the batch. + *

+ * An op that takes a list of tensors (one tensor per feature) and outputs the + * quantile summaries for each tensor. + */ +public final class BoostedTreesMakeQuantileSummaries extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new BoostedTreesMakeQuantileSummaries operation. + * + * @param scope current scope + * @param floatValues float; List of Rank 1 Tensors each containing values for a single feature. + * @param exampleWeights float; Rank 1 Tensor with weights per instance. + * @param epsilon float; The required maximum approximation error. + * @return a new instance of BoostedTreesMakeQuantileSummaries + */ + public static BoostedTreesMakeQuantileSummaries create(Scope scope, Iterable> floatValues, Operand exampleWeights, Operand epsilon) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesMakeQuantileSummaries", scope.makeOpName("BoostedTreesMakeQuantileSummaries")); + opBuilder.addInputList(Operands.asOutputs(floatValues)); + opBuilder.addInput(exampleWeights.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesMakeQuantileSummaries(opBuilder.build()); + } + + /** + * float; List of Rank 2 Tensors each containing the quantile summary + * (value, weight, min_rank, max_rank) of a single feature. + */ + public List> summaries() { + return summaries; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) summaries.iterator(); + } + + private List> summaries; + + @SuppressWarnings("unchecked") + private BoostedTreesMakeQuantileSummaries(Operation operation) { + super(operation); + int outputIdx = 0; + int summariesLength = operation.outputListLength("summaries"); + summaries = Arrays.asList((Output[])operation.outputList(outputIdx, summariesLength)); + outputIdx += summariesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeStatsSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeStatsSummary.java new file mode 100644 index 00000000000..b6275455cfc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeStatsSummary.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Makes the summary of accumulated stats for the batch. + *

+ * The summary stats contains gradients and hessians accumulated into the corresponding node and bucket for each example. + */ +public final class BoostedTreesMakeStatsSummary extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BoostedTreesMakeStatsSummary operation. + * + * @param scope current scope + * @param nodeIds int32 Rank 1 Tensor containing node ids, which each example falls into for the requested layer. + * @param gradients float32; Rank 2 Tensor (shape=[#examples, 1]) for gradients. + * @param hessians float32; Rank 2 Tensor (shape=[#examples, 1]) for hessians. + * @param bucketizedFeaturesList int32 list of Rank 1 Tensors, each containing the bucketized feature (for each feature column). + * @param maxSplits int; the maximum number of splits possible in the whole tree. + * @param numBuckets int; equals to the maximum possible value of bucketized feature. + * @return a new instance of BoostedTreesMakeStatsSummary + */ + public static BoostedTreesMakeStatsSummary create(Scope scope, Operand nodeIds, Operand gradients, Operand hessians, Iterable> bucketizedFeaturesList, Long maxSplits, Long numBuckets) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesMakeStatsSummary", scope.makeOpName("BoostedTreesMakeStatsSummary")); + opBuilder.addInput(nodeIds.asOutput()); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(hessians.asOutput()); + opBuilder.addInputList(Operands.asOutputs(bucketizedFeaturesList)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("max_splits", maxSplits); + opBuilder.setAttr("num_buckets", numBuckets); + return new BoostedTreesMakeStatsSummary(opBuilder.build()); + } + + /** + * output Rank 4 Tensor (shape=[#features, #splits, #buckets, 2]) containing accumulated stats put into the corresponding node and bucket. The first index of 4th dimension refers to gradients, and the second to hessians. + */ + public Output statsSummary() { + return statsSummary; + } + + @Override + public Output asOutput() { + return statsSummary; + } + + private Output statsSummary; + + private BoostedTreesMakeStatsSummary(Operation operation) { + super(operation); + int outputIdx = 0; + statsSummary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesPredict.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesPredict.java new file mode 100644 index 00000000000..2c23019ed58 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesPredict.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Runs multiple additive regression ensemble predictors on input instances and + *

+ * computes the logits. It is designed to be used during prediction. + * It traverses all the trees and calculates the final score for each instance. + */ +public final class BoostedTreesPredict extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BoostedTreesPredict operation. + * + * @param scope current scope + * @param treeEnsembleHandle + * @param bucketizedFeatures A list of rank 1 Tensors containing bucket id for each + * feature. + * @param logitsDimension scalar, dimension of the logits, to be used for partial logits + * shape. + * @return a new instance of BoostedTreesPredict + */ + public static BoostedTreesPredict create(Scope scope, Operand treeEnsembleHandle, Iterable> bucketizedFeatures, Long logitsDimension) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesPredict", scope.makeOpName("BoostedTreesPredict")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder.addInputList(Operands.asOutputs(bucketizedFeatures)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("logits_dimension", logitsDimension); + return new BoostedTreesPredict(opBuilder.build()); + } + + /** + * Output rank 2 Tensor containing logits for each example. + */ + public Output logits() { + return logits; + } + + @Override + public Output asOutput() { + return logits; + } + + private Output logits; + + private BoostedTreesPredict(Operation operation) { + super(operation); + int outputIdx = 0; + logits = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceAddSummaries.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceAddSummaries.java new file mode 100644 index 00000000000..e53d3020267 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceAddSummaries.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Add the quantile summaries to each quantile stream resource. + *

+ * An op that adds a list of quantile summaries to a quantile stream resource. Each + * summary Tensor is rank 2, containing summaries (value, weight, min_rank, max_rank) + * for a single feature. + */ +public final class BoostedTreesQuantileStreamResourceAddSummaries extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesQuantileStreamResourceAddSummaries operation. + * + * @param scope current scope + * @param quantileStreamResourceHandle resource handle referring to a QuantileStreamResource. + * @param summaries string; List of Rank 2 Tensor each containing the summaries for a single feature. + * @return a new instance of BoostedTreesQuantileStreamResourceAddSummaries + */ + public static BoostedTreesQuantileStreamResourceAddSummaries create(Scope scope, Operand quantileStreamResourceHandle, Iterable> summaries) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesQuantileStreamResourceAddSummaries", scope.makeOpName("BoostedTreesQuantileStreamResourceAddSummaries")); + opBuilder.addInput(quantileStreamResourceHandle.asOutput()); + opBuilder.addInputList(Operands.asOutputs(summaries)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesQuantileStreamResourceAddSummaries(opBuilder.build()); + } + + + private BoostedTreesQuantileStreamResourceAddSummaries(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceDeserialize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceDeserialize.java new file mode 100644 index 00000000000..35541661a6c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceDeserialize.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Deserialize bucket boundaries and ready flag into current QuantileAccumulator. + *

+ * An op that deserializes bucket boundaries and are boundaries ready flag into current QuantileAccumulator. + */ +public final class BoostedTreesQuantileStreamResourceDeserialize extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesQuantileStreamResourceDeserialize operation. + * + * @param scope current scope + * @param quantileStreamResourceHandle resource handle referring to a QuantileStreamResource. + * @param bucketBoundaries float; List of Rank 1 Tensors each containing the bucket boundaries for a feature. + * @return a new instance of BoostedTreesQuantileStreamResourceDeserialize + */ + public static BoostedTreesQuantileStreamResourceDeserialize create(Scope scope, Operand quantileStreamResourceHandle, Iterable> bucketBoundaries) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesQuantileStreamResourceDeserialize", scope.makeOpName("BoostedTreesQuantileStreamResourceDeserialize")); + opBuilder.addInput(quantileStreamResourceHandle.asOutput()); + opBuilder.addInputList(Operands.asOutputs(bucketBoundaries)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesQuantileStreamResourceDeserialize(opBuilder.build()); + } + + + private BoostedTreesQuantileStreamResourceDeserialize(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceFlush.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceFlush.java new file mode 100644 index 00000000000..0420c6b2842 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceFlush.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Flush the summaries for a quantile stream resource. + *

+ * An op that flushes the summaries for a quantile stream resource. + */ +public final class BoostedTreesQuantileStreamResourceFlush extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BoostedTreesQuantileStreamResourceFlush} + */ + public static class Options { + + /** + * @param generateQuantiles bool; If True, the output will be the num_quantiles for each stream where the ith + * entry is the ith quantile of the input with an approximation error of epsilon. + * Duplicate values may be present. + * If False, the output will be the points in the histogram that we got which roughly + * translates to 1/epsilon boundaries and without any duplicates. + * Default to False. + */ + public Options generateQuantiles(Boolean generateQuantiles) { + this.generateQuantiles = generateQuantiles; + return this; + } + + private Boolean generateQuantiles; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BoostedTreesQuantileStreamResourceFlush operation. + * + * @param scope current scope + * @param quantileStreamResourceHandle resource handle referring to a QuantileStreamResource. + * @param numBuckets int; approximate number of buckets unless using generate_quantiles. + * @param options carries optional attributes values + * @return a new instance of BoostedTreesQuantileStreamResourceFlush + */ + public static BoostedTreesQuantileStreamResourceFlush create(Scope scope, Operand quantileStreamResourceHandle, Operand numBuckets, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesQuantileStreamResourceFlush", scope.makeOpName("BoostedTreesQuantileStreamResourceFlush")); + opBuilder.addInput(quantileStreamResourceHandle.asOutput()); + opBuilder.addInput(numBuckets.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.generateQuantiles != null) { + opBuilder.setAttr("generate_quantiles", opts.generateQuantiles); + } + } + } + return new BoostedTreesQuantileStreamResourceFlush(opBuilder.build()); + } + + /** + * @param generateQuantiles bool; If True, the output will be the num_quantiles for each stream where the ith + * entry is the ith quantile of the input with an approximation error of epsilon. + * Duplicate values may be present. + * If False, the output will be the points in the histogram that we got which roughly + * translates to 1/epsilon boundaries and without any duplicates. + * Default to False. + */ + public static Options generateQuantiles(Boolean generateQuantiles) { + return new Options().generateQuantiles(generateQuantiles); + } + + + private BoostedTreesQuantileStreamResourceFlush(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceGetBucketBoundaries.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceGetBucketBoundaries.java new file mode 100644 index 00000000000..2226f9c8084 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceGetBucketBoundaries.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Generate the bucket boundaries for each feature based on accumulated summaries. + *

+ * An op that returns a list of float tensors for a quantile stream resource. Each + * tensor is Rank 1 containing bucket boundaries for a single feature. + */ +public final class BoostedTreesQuantileStreamResourceGetBucketBoundaries extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new BoostedTreesQuantileStreamResourceGetBucketBoundaries operation. + * + * @param scope current scope + * @param quantileStreamResourceHandle resource handle referring to a QuantileStreamResource. + * @param numFeatures inferred int; number of features to get bucket boundaries for. + * @return a new instance of BoostedTreesQuantileStreamResourceGetBucketBoundaries + */ + public static BoostedTreesQuantileStreamResourceGetBucketBoundaries create(Scope scope, Operand quantileStreamResourceHandle, Long numFeatures) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesQuantileStreamResourceGetBucketBoundaries", scope.makeOpName("BoostedTreesQuantileStreamResourceGetBucketBoundaries")); + opBuilder.addInput(quantileStreamResourceHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_features", numFeatures); + return new BoostedTreesQuantileStreamResourceGetBucketBoundaries(opBuilder.build()); + } + + /** + * float; List of Rank 1 Tensors each containing the bucket boundaries for a feature. + */ + public List> bucketBoundaries() { + return bucketBoundaries; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) bucketBoundaries.iterator(); + } + + private List> bucketBoundaries; + + @SuppressWarnings("unchecked") + private BoostedTreesQuantileStreamResourceGetBucketBoundaries(Operation operation) { + super(operation); + int outputIdx = 0; + int bucketBoundariesLength = operation.outputListLength("bucket_boundaries"); + bucketBoundaries = Arrays.asList((Output[])operation.outputList(outputIdx, bucketBoundariesLength)); + outputIdx += bucketBoundariesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceHandleOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceHandleOp.java new file mode 100644 index 00000000000..c7740b142ea --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceHandleOp.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a handle to a BoostedTreesQuantileStreamResource. + */ +public final class BoostedTreesQuantileStreamResourceHandleOp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BoostedTreesQuantileStreamResourceHandleOp} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BoostedTreesQuantileStreamResourceHandleOp operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of BoostedTreesQuantileStreamResourceHandleOp + */ + public static BoostedTreesQuantileStreamResourceHandleOp create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesQuantileStreamResourceHandleOp", scope.makeOpName("BoostedTreesQuantileStreamResourceHandleOp")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new BoostedTreesQuantileStreamResourceHandleOp(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output resource() { + return resource; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) resource; + } + + private Output resource; + + private BoostedTreesQuantileStreamResourceHandleOp(Operation operation) { + super(operation); + int outputIdx = 0; + resource = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSerializeEnsemble.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSerializeEnsemble.java new file mode 100644 index 00000000000..fc5f528d3e3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSerializeEnsemble.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Serializes the tree ensemble to a proto. + */ +public final class BoostedTreesSerializeEnsemble extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesSerializeEnsemble operation. + * + * @param scope current scope + * @param treeEnsembleHandle Handle to the tree ensemble. + * @return a new instance of BoostedTreesSerializeEnsemble + */ + public static BoostedTreesSerializeEnsemble create(Scope scope, Operand treeEnsembleHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesSerializeEnsemble", scope.makeOpName("BoostedTreesSerializeEnsemble")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BoostedTreesSerializeEnsemble(opBuilder.build()); + } + + /** + * Stamp token of the tree ensemble resource. + */ + public Output stampToken() { + return stampToken; + } + + /** + * Serialized proto of the ensemble. + */ + public Output treeEnsembleSerialized() { + return treeEnsembleSerialized; + } + + private Output stampToken; + private Output treeEnsembleSerialized; + + private BoostedTreesSerializeEnsemble(Operation operation) { + super(operation); + int outputIdx = 0; + stampToken = operation.output(outputIdx++); + treeEnsembleSerialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseAggregateStats.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseAggregateStats.java new file mode 100644 index 00000000000..5c73e14a295 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseAggregateStats.java @@ -0,0 +1,107 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Aggregates the summary of accumulated stats for the batch. + *

+ * The summary stats contains gradients and hessians accumulated for each node, bucket and dimension id. + */ +public final class BoostedTreesSparseAggregateStats extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesSparseAggregateStats operation. + * + * @param scope current scope + * @param nodeIds int32; Rank 1 Tensor containing node ids for each example, shape [batch_size]. + * @param gradients float32; Rank 2 Tensor (shape=[batch_size, logits_dimension]) with gradients for each example. + * @param hessians float32; Rank 2 Tensor (shape=[batch_size, hessian_dimension]) with hessians for each example. + * @param featureIndices int32; Rank 2 indices of feature sparse Tensors (shape=[number of sparse entries, 2]). + * Number of sparse entries across all instances from the batch. The first value is + * the index of the instance, the second is dimension of the feature. The second axis + * can only have 2 values, i.e., the input dense version of Tensor can only be matrix. + * @param featureValues int32; Rank 1 values of feature sparse Tensors (shape=[number of sparse entries]). + * Number of sparse entries across all instances from the batch. The first value is + * the index of the instance, the second is dimension of the feature. + * @param featureShape int32; Rank 1 dense shape of feature sparse Tensors (shape=[2]). + * The first axis can only have 2 values, [batch_size, feature_dimension]. + * @param maxSplits int; the maximum number of splits possible in the whole tree. + * @param numBuckets int; equals to the maximum possible value of bucketized feature + 1. + * @return a new instance of BoostedTreesSparseAggregateStats + */ + public static BoostedTreesSparseAggregateStats create(Scope scope, Operand nodeIds, Operand gradients, Operand hessians, Operand featureIndices, Operand featureValues, Operand featureShape, Long maxSplits, Long numBuckets) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesSparseAggregateStats", scope.makeOpName("BoostedTreesSparseAggregateStats")); + opBuilder.addInput(nodeIds.asOutput()); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(hessians.asOutput()); + opBuilder.addInput(featureIndices.asOutput()); + opBuilder.addInput(featureValues.asOutput()); + opBuilder.addInput(featureShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("max_splits", maxSplits); + opBuilder.setAttr("num_buckets", numBuckets); + return new BoostedTreesSparseAggregateStats(opBuilder.build()); + } + + /** + * int32; Rank 2 indices of summary sparse Tensors (shape=[number of non zero statistics, 4]) + * The second axis can only be 4 including node id, feature dimension, bucket id, and statistics_dimension. + * statistics_dimension = logits_dimension + hessian_dimension. + */ + public Output statsSummaryIndices() { + return statsSummaryIndices; + } + + /** + * output Rank 1 Tensor (shape=[number of non zero statistics]) + */ + public Output statsSummaryValues() { + return statsSummaryValues; + } + + /** + * output Rank 1 Tensor (shape=[4]) + * The tensor has following 4 values: [max_splits, feature_dimension, num_buckets, statistics_dimension], + * where statistics_dimension = gradient_dimension + hessian_dimension. gradient_dimension + * is the same as label_dimension, i.e., the output space. hessian_dimension can be the same + * as logits dimension when diagonal hessian is used, or label_dimension^2 when full + * hessian is used. + */ + public Output statsSummaryShape() { + return statsSummaryShape; + } + + private Output statsSummaryIndices; + private Output statsSummaryValues; + private Output statsSummaryShape; + + private BoostedTreesSparseAggregateStats(Operation operation) { + super(operation); + int outputIdx = 0; + statsSummaryIndices = operation.output(outputIdx++); + statsSummaryValues = operation.output(outputIdx++); + statsSummaryShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseCalculateBestFeatureSplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseCalculateBestFeatureSplit.java new file mode 100644 index 00000000000..4818a57985b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseCalculateBestFeatureSplit.java @@ -0,0 +1,174 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Calculates gains for each feature and returns the best possible split information for the feature. + *

+ * The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature. + *

+ * It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split. + *

+ * In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features). + *

+ * The output shapes are compatible in a way that the first dimension of all tensors are the same and equal to the number of possible split nodes for each feature. + */ +public final class BoostedTreesSparseCalculateBestFeatureSplit extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.BoostedTreesSparseCalculateBestFeatureSplit} + */ + public static class Options { + + /** + * @param splitType A string indicating if this Op should perform inequality split or equality split. + */ + public Options splitType(String splitType) { + this.splitType = splitType; + return this; + } + + private String splitType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BoostedTreesSparseCalculateBestFeatureSplit operation. + * + * @param scope current scope + * @param nodeIdRange A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive). + * @param statsSummaryIndices A Rank 2 int64 tensor of dense shape [N, 4] (N specifies the number of non-zero values) for accumulated stats summary (gradient/hessian) per node per bucket for each feature. The second dimension contains node id, feature dimension, bucket id, and stats dim. + * stats dim is the sum of logits dimension and hessian dimension, hessian dimension can either be logits dimension if diagonal hessian is used, or logits dimension^2 if full hessian is used. + * @param statsSummaryValues A Rank 1 float tensor of dense shape [N] (N specifies the number of non-zero values), which supplies the values for each element in summary_indices. + * @param statsSummaryShape A Rank 1 float tensor of dense shape [4], which specifies the dense shape of the sparse tensor, which is [num tree nodes, feature dimensions, num buckets, stats dim]. + * @param l1 l1 regularization factor on leaf weights, per instance based. + * @param l2 l2 regularization factor on leaf weights, per instance based. + * @param treeComplexity adjustment to the gain, per leaf based. + * @param minNodeWeight mininum avg of hessians in a node before required for the node to be considered for splitting. + * @param logitsDimension The dimension of logit, i.e., number of classes. + * @param options carries optional attributes values + * @return a new instance of BoostedTreesSparseCalculateBestFeatureSplit + */ + public static BoostedTreesSparseCalculateBestFeatureSplit create(Scope scope, Operand nodeIdRange, Operand statsSummaryIndices, Operand statsSummaryValues, Operand statsSummaryShape, Operand l1, Operand l2, Operand treeComplexity, Operand minNodeWeight, Long logitsDimension, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesSparseCalculateBestFeatureSplit", scope.makeOpName("BoostedTreesSparseCalculateBestFeatureSplit")); + opBuilder.addInput(nodeIdRange.asOutput()); + opBuilder.addInput(statsSummaryIndices.asOutput()); + opBuilder.addInput(statsSummaryValues.asOutput()); + opBuilder.addInput(statsSummaryShape.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(treeComplexity.asOutput()); + opBuilder.addInput(minNodeWeight.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("logits_dimension", logitsDimension); + if (options != null) { + for (Options opts : options) { + if (opts.splitType != null) { + opBuilder.setAttr("split_type", opts.splitType); + } + } + } + return new BoostedTreesSparseCalculateBestFeatureSplit(opBuilder.build()); + } + + /** + * @param splitType A string indicating if this Op should perform inequality split or equality split. + */ + public static Options splitType(String splitType) { + return new Options().splitType(splitType); + } + + /** + * A Rank 1 tensor indicating possible node ids that can be split. + */ + public Output nodeIds() { + return nodeIds; + } + + /** + * A Rank 1 tensor indicating the best gains to split each node. + */ + public Output gains() { + return gains; + } + + /** + * A Rank 1 tensor indicating the best feature dimension for each feature to split for each node. + */ + public Output featureDimensions() { + return featureDimensions; + } + + /** + * A Rank 1 tensor indicating the bucket id to compare with (as a threshold) for split in each node. + */ + public Output thresholds() { + return thresholds; + } + + /** + * A Rank 2 tensor indicating the contribution of the left nodes when branching from parent nodes to the left direction by the given threshold for each feature. + * This value will be used to make the left node value by adding to the parent node value. Second dimension size is logits dimension. + */ + public Output leftNodeContribs() { + return leftNodeContribs; + } + + /** + * A Rank 2 tensor, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node. + */ + public Output rightNodeContribs() { + return rightNodeContribs; + } + + /** + * A Rank 1 tensor indicating which direction to go if data is missing. + */ + public Output splitWithDefaultDirections() { + return splitWithDefaultDirections; + } + + private Output nodeIds; + private Output gains; + private Output featureDimensions; + private Output thresholds; + private Output leftNodeContribs; + private Output rightNodeContribs; + private Output splitWithDefaultDirections; + + private BoostedTreesSparseCalculateBestFeatureSplit(Operation operation) { + super(operation); + int outputIdx = 0; + nodeIds = operation.output(outputIdx++); + gains = operation.output(outputIdx++); + featureDimensions = operation.output(outputIdx++); + thresholds = operation.output(outputIdx++); + leftNodeContribs = operation.output(outputIdx++); + rightNodeContribs = operation.output(outputIdx++); + splitWithDefaultDirections = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesTrainingPredict.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesTrainingPredict.java new file mode 100644 index 00000000000..44c950bb510 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesTrainingPredict.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Runs multiple additive regression ensemble predictors on input instances and + *

+ * computes the update to cached logits. It is designed to be used during training. + * It traverses the trees starting from cached tree id and cached node id and + * calculates the updates to be pushed to the cache. + */ +public final class BoostedTreesTrainingPredict extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesTrainingPredict operation. + * + * @param scope current scope + * @param treeEnsembleHandle + * @param cachedTreeIds Rank 1 Tensor containing cached tree ids which is the starting + * tree of prediction. + * @param cachedNodeIds Rank 1 Tensor containing cached node id which is the starting + * node of prediction. + * @param bucketizedFeatures A list of rank 1 Tensors containing bucket id for each + * feature. + * @param logitsDimension scalar, dimension of the logits, to be used for partial logits + * shape. + * @return a new instance of BoostedTreesTrainingPredict + */ + public static BoostedTreesTrainingPredict create(Scope scope, Operand treeEnsembleHandle, Operand cachedTreeIds, Operand cachedNodeIds, Iterable> bucketizedFeatures, Long logitsDimension) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesTrainingPredict", scope.makeOpName("BoostedTreesTrainingPredict")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder.addInput(cachedTreeIds.asOutput()); + opBuilder.addInput(cachedNodeIds.asOutput()); + opBuilder.addInputList(Operands.asOutputs(bucketizedFeatures)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("logits_dimension", logitsDimension); + return new BoostedTreesTrainingPredict(opBuilder.build()); + } + + /** + * Rank 2 Tensor containing logits update (with respect to cached + * values stored) for each example. + */ + public Output partialLogits() { + return partialLogits; + } + + /** + * Rank 1 Tensor containing new tree ids for each example. + */ + public Output treeIds() { + return treeIds; + } + + /** + * Rank 1 Tensor containing new node ids in the new tree_ids. + */ + public Output nodeIds() { + return nodeIds; + } + + private Output partialLogits; + private Output treeIds; + private Output nodeIds; + + private BoostedTreesTrainingPredict(Operation operation) { + super(operation); + int outputIdx = 0; + partialLogits = operation.output(outputIdx++); + treeIds = operation.output(outputIdx++); + nodeIds = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesUpdateEnsemble.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesUpdateEnsemble.java new file mode 100644 index 00000000000..982e6d2a751 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesUpdateEnsemble.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Updates the tree ensemble by either adding a layer to the last tree being grown + *

+ * or by starting a new tree. + */ +public final class BoostedTreesUpdateEnsemble extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BoostedTreesUpdateEnsemble operation. + * + * @param scope current scope + * @param treeEnsembleHandle Handle to the ensemble variable. + * @param featureIds Rank 1 tensor with ids for each feature. This is the real id of + * the feature that will be used in the split. + * @param nodeIds List of rank 1 tensors representing the nodes for which this feature + * has a split. + * @param gains List of rank 1 tensors representing the gains for each of the feature's + * split. + * @param thresholds List of rank 1 tensors representing the thesholds for each of the + * feature's split. + * @param leftNodeContribs List of rank 2 tensors with left leaf contribs for each of + * the feature's splits. Will be added to the previous node values to constitute + * the values of the left nodes. + * @param rightNodeContribs List of rank 2 tensors with right leaf contribs for each + * of the feature's splits. Will be added to the previous node values to constitute + * the values of the right nodes. + * @param maxDepth Max depth of the tree to build. + * @param learningRate shrinkage const for each new tree. + * @param pruningMode 0-No pruning, 1-Pre-pruning, 2-Post-pruning. + * @return a new instance of BoostedTreesUpdateEnsemble + */ + public static BoostedTreesUpdateEnsemble create(Scope scope, Operand treeEnsembleHandle, Operand featureIds, Iterable> nodeIds, Iterable> gains, Iterable> thresholds, Iterable> leftNodeContribs, Iterable> rightNodeContribs, Operand maxDepth, Operand learningRate, Long pruningMode) { + OperationBuilder opBuilder = scope.env().opBuilder("BoostedTreesUpdateEnsemble", scope.makeOpName("BoostedTreesUpdateEnsemble")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder.addInput(featureIds.asOutput()); + opBuilder.addInputList(Operands.asOutputs(nodeIds)); + opBuilder.addInputList(Operands.asOutputs(gains)); + opBuilder.addInputList(Operands.asOutputs(thresholds)); + opBuilder.addInputList(Operands.asOutputs(leftNodeContribs)); + opBuilder.addInputList(Operands.asOutputs(rightNodeContribs)); + opBuilder.addInput(maxDepth.asOutput()); + opBuilder.addInput(learningRate.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("pruning_mode", pruningMode); + return new BoostedTreesUpdateEnsemble(opBuilder.build()); + } + + + private BoostedTreesUpdateEnsemble(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastDynamicShape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastDynamicShape.java new file mode 100644 index 00000000000..cccaa287ae4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastDynamicShape.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Return the shape of s0 op s1 with broadcast. + *

+ * Given `s0` and `s1`, tensors that represent shapes, compute `r0`, the + * broadcasted shape. `s0`, `s1` and `r0` are all integer vectors. + * + * @param data type for {@code r0()} output + */ +@Operator +public final class BroadcastDynamicShape extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BroadcastDynamicShape operation. + * + * @param scope current scope + * @param s0 + * @param s1 + * @return a new instance of BroadcastDynamicShape + */ + public static BroadcastDynamicShape create(Scope scope, Operand s0, Operand s1) { + OperationBuilder opBuilder = scope.env().opBuilder("BroadcastArgs", scope.makeOpName("BroadcastDynamicShape")); + opBuilder.addInput(s0.asOutput()); + opBuilder.addInput(s1.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BroadcastDynamicShape(opBuilder.build()); + } + + /** + */ + public Output r0() { + return r0; + } + + @Override + public Output asOutput() { + return r0; + } + + private Output r0; + + private BroadcastDynamicShape(Operation operation) { + super(operation); + int outputIdx = 0; + r0 = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastGradientArgs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastGradientArgs.java new file mode 100644 index 00000000000..4669ffd6ec7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastGradientArgs.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Return the reduction indices for computing gradients of s0 op s1 with broadcast. + *

+ * This is typically used by gradient computations for a broadcasting operation. + * + * @param data type for {@code r0()} output + */ +public final class BroadcastGradientArgs extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BroadcastGradientArgs operation. + * + * @param scope current scope + * @param s0 + * @param s1 + * @return a new instance of BroadcastGradientArgs + */ + public static BroadcastGradientArgs create(Scope scope, Operand s0, Operand s1) { + OperationBuilder opBuilder = scope.env().opBuilder("BroadcastGradientArgs", scope.makeOpName("BroadcastGradientArgs")); + opBuilder.addInput(s0.asOutput()); + opBuilder.addInput(s1.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BroadcastGradientArgs(opBuilder.build()); + } + + /** + */ + public Output r0() { + return r0; + } + + /** + */ + public Output r1() { + return r1; + } + + private Output r0; + private Output r1; + + private BroadcastGradientArgs(Operation operation) { + super(operation); + int outputIdx = 0; + r0 = operation.output(outputIdx++); + r1 = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastTo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastTo.java new file mode 100644 index 00000000000..85b41994abc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastTo.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Broadcast an array for a compatible shape. + *

+ * Broadcasting is the process of making arrays to have compatible shapes + * for arithmetic operations. Two shapes are compatible if for each + * dimension pair they are either equal or one of them is one. When trying + * to broadcast a Tensor to a shape, it starts with the trailing dimensions, + * and works its way forward. + *

+ * For example, + *

{@code
+ * >>> x = tf.constant([1, 2, 3])
+ * >>> y = tf.broadcast_to(x, [3, 3])
+ * >>> sess.run(y)
+ * array([[1, 2, 3],
+ *        [1, 2, 3],
+ *        [1, 2, 3]], dtype=int32)
+ * }
+ * In the above example, the input Tensor with the shape of `[1, 3]` + * is broadcasted to output Tensor with shape of `[3, 3]`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class BroadcastTo extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BroadcastTo operation. + * + * @param scope current scope + * @param input A Tensor to broadcast. + * @param shape An 1-D `int` Tensor. The shape of the desired output. + * @return a new instance of BroadcastTo + */ + public static BroadcastTo create(Scope scope, Operand input, Operand shape) { + OperationBuilder opBuilder = scope.env().opBuilder("BroadcastTo", scope.makeOpName("BroadcastTo")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BroadcastTo(opBuilder.build()); + } + + /** + * A Tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BroadcastTo(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bucketize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bucketize.java new file mode 100644 index 00000000000..b0c7c71e1f6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bucketize.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Bucketizes 'input' based on 'boundaries'. + *

+ * For example, if the inputs are + * boundaries = [0, 10, 100] + * input = [[-5, 10000] + * [150, 10] + * [5, 100]] + *

+ * then the output will be + * output = [[0, 3] + * [3, 2] + * [1, 3]] + */ +@Operator +public final class Bucketize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Bucketize operation. + * + * @param scope current scope + * @param input Any shape of Tensor contains with int or float type. + * @param boundaries A sorted list of floats gives the boundary of the buckets. + * @return a new instance of Bucketize + */ + public static Bucketize create(Scope scope, Operand input, List boundaries) { + OperationBuilder opBuilder = scope.env().opBuilder("Bucketize", scope.makeOpName("Bucketize")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + float[] boundariesArray = new float[boundaries.size()]; + for (int i = 0; i < boundariesArray.length; ++i) { + boundariesArray[i] = boundaries.get(i); + } + opBuilder.setAttr("boundaries", boundariesArray); + return new Bucketize(opBuilder.build()); + } + + /** + * Same shape with 'input', each value of input replaced with bucket index. + *

+ * @compatibility(numpy) + * Equivalent to np.digitize. + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Bucketize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CSVDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CSVDataset.java new file mode 100644 index 00000000000..715c9c48d16 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CSVDataset.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class CSVDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CSVDataset operation. + * + * @param scope current scope + * @param filenames + * @param compressionType + * @param bufferSize + * @param header + * @param fieldDelim + * @param useQuoteDelim + * @param naValue + * @param selectCols + * @param recordDefaults + * @param outputShapes + * @return a new instance of CSVDataset + */ + public static CSVDataset create(Scope scope, Operand filenames, Operand compressionType, Operand bufferSize, Operand header, Operand fieldDelim, Operand useQuoteDelim, Operand naValue, Operand selectCols, Iterable> recordDefaults, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("CSVDataset", scope.makeOpName("CSVDataset")); + opBuilder.addInput(filenames.asOutput()); + opBuilder.addInput(compressionType.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder.addInput(header.asOutput()); + opBuilder.addInput(fieldDelim.asOutput()); + opBuilder.addInput(useQuoteDelim.asOutput()); + opBuilder.addInput(naValue.asOutput()); + opBuilder.addInput(selectCols.asOutput()); + opBuilder.addInputList(Operands.asOutputs(recordDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new CSVDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private CSVDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CacheDatasetV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CacheDatasetV2.java new file mode 100644 index 00000000000..622e8984f2d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CacheDatasetV2.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class CacheDatasetV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CacheDatasetV2 operation. + * + * @param scope current scope + * @param inputDataset + * @param filename + * @param cache + * @param outputTypes + * @param outputShapes + * @return a new instance of CacheDatasetV2 + */ + public static CacheDatasetV2 create(Scope scope, Operand inputDataset, Operand filename, Operand cache, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("CacheDatasetV2", scope.makeOpName("CacheDatasetV2")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(filename.asOutput()); + opBuilder.addInput(cache.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new CacheDatasetV2(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private CacheDatasetV2(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ChooseFastestDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ChooseFastestDataset.java new file mode 100644 index 00000000000..a6f8594b793 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ChooseFastestDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ChooseFastestDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ChooseFastestDataset operation. + * + * @param scope current scope + * @param inputDatasets + * @param numExperiments + * @param outputTypes + * @param outputShapes + * @return a new instance of ChooseFastestDataset + */ + public static ChooseFastestDataset create(Scope scope, Iterable> inputDatasets, Long numExperiments, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ChooseFastestDataset", scope.makeOpName("ChooseFastestDataset")); + opBuilder.addInputList(Operands.asOutputs(inputDatasets)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_experiments", numExperiments); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ChooseFastestDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ChooseFastestDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ClipByValue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ClipByValue.java new file mode 100644 index 00000000000..a6c33cde3f3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ClipByValue.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Clips tensor values to a specified min and max. + *

+ * Given a tensor `t`, this operation returns a tensor of the same type and + * shape as `t` with its values clipped to `clip_value_min` and `clip_value_max`. + * Any values less than `clip_value_min` are set to `clip_value_min`. Any values + * greater than `clip_value_max` are set to `clip_value_max`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ClipByValue extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ClipByValue operation. + * + * @param scope current scope + * @param t A `Tensor`. + * @param clipValueMin A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape + * as `t`. The minimum value to clip by. + * @param clipValueMax A 0-D (scalar) `Tensor`, or a `Tensor` with the same shape + * as `t`. The maximum value to clip by. + * @return a new instance of ClipByValue + */ + public static ClipByValue create(Scope scope, Operand t, Operand clipValueMin, Operand clipValueMax) { + OperationBuilder opBuilder = scope.env().opBuilder("ClipByValue", scope.makeOpName("ClipByValue")); + opBuilder.addInput(t.asOutput()); + opBuilder.addInput(clipValueMin.asOutput()); + opBuilder.addInput(clipValueMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ClipByValue(opBuilder.build()); + } + + /** + * A clipped `Tensor` with the same shape as input 't'. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ClipByValue(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectiveGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectiveGather.java new file mode 100644 index 00000000000..cde655cedc0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectiveGather.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Mutually accumulates multiple tensors of identical type and shape. + * + * @param data type for {@code data()} output + */ +public final class CollectiveGather extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CollectiveGather operation. + * + * @param scope current scope + * @param input + * @param groupSize + * @param groupKey + * @param instanceKey + * @param shape + * @return a new instance of CollectiveGather + */ + public static CollectiveGather create(Scope scope, Operand input, Long groupSize, Long groupKey, Long instanceKey, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("CollectiveGather", scope.makeOpName("CollectiveGather")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("group_size", groupSize); + opBuilder.setAttr("group_key", groupKey); + opBuilder.setAttr("instance_key", instanceKey); + opBuilder.setAttr("shape", shape); + return new CollectiveGather(opBuilder.build()); + } + + /** + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + private Output data; + + private CollectiveGather(Operation operation) { + super(operation); + int outputIdx = 0; + data = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectivePermute.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectivePermute.java new file mode 100644 index 00000000000..c27139b06d9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectivePermute.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An Op to permute tensors across replicated TPU instances. + *

+ * Each instance supplies its own input. + *

+ * For example, suppose there are 4 TPU instances: `[A, B, C, D]`. Passing + * source_target_pairs=`[[0,1],[1,2],[2,3],[3,0]]` gets the outputs: + * `[D, A, B, C]`. + * + * @param data type for {@code output()} output + */ +public final class CollectivePermute extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CollectivePermute operation. + * + * @param scope current scope + * @param input The local input to be permuted. Currently only supports float and + * bfloat16. + * @param sourceTargetPairs A tensor with shape [num_pairs, 2]. + * @return a new instance of CollectivePermute + */ + public static CollectivePermute create(Scope scope, Operand input, Operand sourceTargetPairs) { + OperationBuilder opBuilder = scope.env().opBuilder("CollectivePermute", scope.makeOpName("CollectivePermute")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(sourceTargetPairs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new CollectivePermute(opBuilder.build()); + } + + /** + * The permuted input. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CollectivePermute(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CombinedNonMaxSuppression.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CombinedNonMaxSuppression.java new file mode 100644 index 00000000000..f24124aa0fd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CombinedNonMaxSuppression.java @@ -0,0 +1,190 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Greedily selects a subset of bounding boxes in descending order of score, + *

+ * This operation performs non_max_suppression on the inputs per batch, across + * all classes. + * Prunes away boxes that have high intersection-over-union (IOU) overlap + * with previously selected boxes. Bounding boxes are supplied as + * [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any + * diagonal pair of box corners and the coordinates can be provided as normalized + * (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm + * is agnostic to where the origin is in the coordinate system. Also note that + * this algorithm is invariant to orthogonal transformations and translations + * of the coordinate system; thus translating or reflections of the coordinate + * system result in the same boxes being selected by the algorithm. + * The output of this operation is the final boxes, scores and classes tensor + * returned after performing non_max_suppression. + */ +@Operator +public final class CombinedNonMaxSuppression extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.CombinedNonMaxSuppression} + */ + public static class Options { + + /** + * @param padPerClass If false, the output nmsed boxes, scores and classes + * are padded/clipped to `max_total_size`. If true, the + * output nmsed boxes, scores and classes are padded to be of length + * `max_size_per_class`*`num_classes`, unless it exceeds `max_total_size` in + * which case it is clipped to `max_total_size`. Defaults to false. + */ + public Options padPerClass(Boolean padPerClass) { + this.padPerClass = padPerClass; + return this; + } + + /** + * @param clipBoxes If true, assume the box coordinates are between [0, 1] and clip the output boxes + * if they fall beyond [0, 1]. If false, do not do clipping and output the box + * coordinates as it is. + */ + public Options clipBoxes(Boolean clipBoxes) { + this.clipBoxes = clipBoxes; + return this; + } + + private Boolean padPerClass; + private Boolean clipBoxes; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CombinedNonMaxSuppression operation. + * + * @param scope current scope + * @param boxes A 4-D float tensor of shape `[batch_size, num_boxes, q, 4]`. If `q` is 1 then + * same boxes are used for all classes otherwise, if `q` is equal to number of + * classes, class-specific boxes are used. + * @param scores A 3-D float tensor of shape `[batch_size, num_boxes, num_classes]` + * representing a single score corresponding to each box (each row of boxes). + * @param maxOutputSizePerClass A scalar integer tensor representing the maximum number of + * boxes to be selected by non max suppression per class + * @param maxTotalSize A scalar representing maximum number of boxes retained over all classes. + * @param iouThreshold A 0-D float tensor representing the threshold for deciding whether + * boxes overlap too much with respect to IOU. + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * boxes based on score. + * @param options carries optional attributes values + * @return a new instance of CombinedNonMaxSuppression + */ + public static CombinedNonMaxSuppression create(Scope scope, Operand boxes, Operand scores, Operand maxOutputSizePerClass, Operand maxTotalSize, Operand iouThreshold, Operand scoreThreshold, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CombinedNonMaxSuppression", scope.makeOpName("CombinedNonMaxSuppression")); + opBuilder.addInput(boxes.asOutput()); + opBuilder.addInput(scores.asOutput()); + opBuilder.addInput(maxOutputSizePerClass.asOutput()); + opBuilder.addInput(maxTotalSize.asOutput()); + opBuilder.addInput(iouThreshold.asOutput()); + opBuilder.addInput(scoreThreshold.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.padPerClass != null) { + opBuilder.setAttr("pad_per_class", opts.padPerClass); + } + if (opts.clipBoxes != null) { + opBuilder.setAttr("clip_boxes", opts.clipBoxes); + } + } + } + return new CombinedNonMaxSuppression(opBuilder.build()); + } + + /** + * @param padPerClass If false, the output nmsed boxes, scores and classes + * are padded/clipped to `max_total_size`. If true, the + * output nmsed boxes, scores and classes are padded to be of length + * `max_size_per_class`*`num_classes`, unless it exceeds `max_total_size` in + * which case it is clipped to `max_total_size`. Defaults to false. + */ + public static Options padPerClass(Boolean padPerClass) { + return new Options().padPerClass(padPerClass); + } + + /** + * @param clipBoxes If true, assume the box coordinates are between [0, 1] and clip the output boxes + * if they fall beyond [0, 1]. If false, do not do clipping and output the box + * coordinates as it is. + */ + public static Options clipBoxes(Boolean clipBoxes) { + return new Options().clipBoxes(clipBoxes); + } + + /** + * A [batch_size, max_detections, 4] float32 tensor + * containing the non-max suppressed boxes. + */ + public Output nmsedBoxes() { + return nmsedBoxes; + } + + /** + * A [batch_size, max_detections] float32 tensor + * containing the scores for the boxes. + */ + public Output nmsedScores() { + return nmsedScores; + } + + /** + * A [batch_size, max_detections] float32 tensor + * containing the classes for the boxes. + */ + public Output nmsedClasses() { + return nmsedClasses; + } + + /** + * A [batch_size] int32 tensor indicating the number of + * valid detections per batch item. Only the top num_detections[i] entries in + * nms_boxes[i], nms_scores[i] and nms_class[i] are valid. The rest of the + * entries are zero paddings. + */ + public Output validDetections() { + return validDetections; + } + + private Output nmsedBoxes; + private Output nmsedScores; + private Output nmsedClasses; + private Output validDetections; + + private CombinedNonMaxSuppression(Operation operation) { + super(operation); + int outputIdx = 0; + nmsedBoxes = operation.output(outputIdx++); + nmsedScores = operation.output(outputIdx++); + nmsedClasses = operation.output(outputIdx++); + validDetections = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Concat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Concat.java new file mode 100644 index 00000000000..b14f6c04f42 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Concat.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Concatenates tensors along one dimension. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Concat extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Concat operation. + * + * @param scope current scope + * @param values List of `N` Tensors to concatenate. Their ranks and types must match, + * and their sizes must match in all dimensions except `concat_dim`. + * @param axis 0-D. The dimension along which to concatenate. Must be in the + * range [-rank(values), rank(values)). + * @return a new instance of Concat + */ + public static Concat create(Scope scope, Iterable> values, Operand axis) { + OperationBuilder opBuilder = scope.env().opBuilder("ConcatV2", scope.makeOpName("Concat")); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Concat(opBuilder.build()); + } + + /** + * A `Tensor` with the concatenation of values stacked along the + * `concat_dim` dimension. This tensor's shape matches that of `values` except + * in `concat_dim` where it has the sum of the sizes. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Concat(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureDistributedTPU.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureDistributedTPU.java new file mode 100644 index 00000000000..c1e9a06e03f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureDistributedTPU.java @@ -0,0 +1,138 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Sets up the centralized structures for a distributed TPU system. + */ +public final class ConfigureDistributedTPU extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ConfigureDistributedTPU} + */ + public static class Options { + + /** + * @param embeddingConfig Reserved. Do not use. + */ + public Options embeddingConfig(String embeddingConfig) { + this.embeddingConfig = embeddingConfig; + return this; + } + + /** + * @param tpuEmbeddingConfig Serialized tensorflow.tpu.TPUEmbeddingConfiguration that + * describes the embedding lookups of the program. + */ + public Options tpuEmbeddingConfig(String tpuEmbeddingConfig) { + this.tpuEmbeddingConfig = tpuEmbeddingConfig; + return this; + } + + /** + * @param isGlobalInit Reserved. Do not use. + */ + public Options isGlobalInit(Boolean isGlobalInit) { + this.isGlobalInit = isGlobalInit; + return this; + } + + private String embeddingConfig; + private String tpuEmbeddingConfig; + private Boolean isGlobalInit; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ConfigureDistributedTPU operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of ConfigureDistributedTPU + */ + public static ConfigureDistributedTPU create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ConfigureDistributedTPU", scope.makeOpName("ConfigureDistributedTPU")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.embeddingConfig != null) { + opBuilder.setAttr("embedding_config", opts.embeddingConfig); + } + if (opts.tpuEmbeddingConfig != null) { + opBuilder.setAttr("tpu_embedding_config", opts.tpuEmbeddingConfig); + } + if (opts.isGlobalInit != null) { + opBuilder.setAttr("is_global_init", opts.isGlobalInit); + } + } + } + return new ConfigureDistributedTPU(opBuilder.build()); + } + + /** + * @param embeddingConfig Reserved. Do not use. + */ + public static Options embeddingConfig(String embeddingConfig) { + return new Options().embeddingConfig(embeddingConfig); + } + + /** + * @param tpuEmbeddingConfig Serialized tensorflow.tpu.TPUEmbeddingConfiguration that + * describes the embedding lookups of the program. + */ + public static Options tpuEmbeddingConfig(String tpuEmbeddingConfig) { + return new Options().tpuEmbeddingConfig(tpuEmbeddingConfig); + } + + /** + * @param isGlobalInit Reserved. Do not use. + */ + public static Options isGlobalInit(Boolean isGlobalInit) { + return new Options().isGlobalInit(isGlobalInit); + } + + /** + * A serialized tensorflow.tpu.TopologyProto that describes the TPU + * topology. + */ + public Output topology() { + return topology; + } + + @Override + public Output asOutput() { + return topology; + } + + private Output topology; + + private ConfigureDistributedTPU(Operation operation) { + super(operation); + int outputIdx = 0; + topology = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureTPUEmbedding.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureTPUEmbedding.java new file mode 100644 index 00000000000..29a175c5c3c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureTPUEmbedding.java @@ -0,0 +1,49 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Sets up TPUEmbedding in a distributed TPU system. + */ +public final class ConfigureTPUEmbedding extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ConfigureTPUEmbedding operation. + * + * @param scope current scope + * @param config Serialized tensorflow.tpu.TPUEmbeddingConfiguration that + * describes the embedding lookups of the program. + * @return a new instance of ConfigureTPUEmbedding + */ + public static ConfigureTPUEmbedding create(Scope scope, String config) { + OperationBuilder opBuilder = scope.env().opBuilder("ConfigureTPUEmbedding", scope.makeOpName("ConfigureTPUEmbedding")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("config", config); + return new ConfigureTPUEmbedding(opBuilder.build()); + } + + + private ConfigureTPUEmbedding(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConsumeMutexLock.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConsumeMutexLock.java new file mode 100644 index 00000000000..aeeaba81c43 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConsumeMutexLock.java @@ -0,0 +1,59 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * This op consumes a lock created by `MutexLock`. + *

+ * This op exists to consume a tensor created by `MutexLock` (other than + * direct control dependencies). It should be the only that consumes the tensor, + * and will raise an error if it is not. Its only purpose is to keep the + * mutex lock tensor alive until it is consumed by this op. + *

+ * NOTE: This operation must run on the same device as its input. This may + * be enforced via the `colocate_with` mechanism. + */ +@Operator +public final class ConsumeMutexLock extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ConsumeMutexLock operation. + * + * @param scope current scope + * @param mutexLock A tensor returned by `MutexLock`. + * @return a new instance of ConsumeMutexLock + */ + public static ConsumeMutexLock create(Scope scope, Operand mutexLock) { + OperationBuilder opBuilder = scope.env().opBuilder("ConsumeMutexLock", scope.makeOpName("ConsumeMutexLock")); + opBuilder.addInput(mutexLock.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ConsumeMutexLock(opBuilder.build()); + } + + + private ConsumeMutexLock(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ControlTrigger.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ControlTrigger.java new file mode 100644 index 00000000000..4c53112a808 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ControlTrigger.java @@ -0,0 +1,50 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Does nothing. Serves as a control trigger for scheduling. + *

+ * Only useful as a placeholder for control edges. + */ +@Operator +public final class ControlTrigger extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ControlTrigger operation. + * + * @param scope current scope + * @return a new instance of ControlTrigger + */ + public static ControlTrigger create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("ControlTrigger", scope.makeOpName("ControlTrigger")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ControlTrigger(opBuilder.build()); + } + + + private ControlTrigger(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CountUpTo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CountUpTo.java new file mode 100644 index 00000000000..a3bedbfa400 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CountUpTo.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Increments 'ref' until it reaches 'limit'. + * + * @param data type for {@code output()} output + */ +@Operator +public final class CountUpTo extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CountUpTo operation. + * + * @param scope current scope + * @param ref Should be from a scalar `Variable` node. + * @param limit If incrementing ref would bring it above limit, instead generates an + * 'OutOfRange' error. + * @return a new instance of CountUpTo + */ + public static CountUpTo create(Scope scope, Operand ref, Long limit) { + OperationBuilder opBuilder = scope.env().opBuilder("CountUpTo", scope.makeOpName("CountUpTo")); + opBuilder.addInput(ref.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("limit", limit); + return new CountUpTo(opBuilder.build()); + } + + /** + * A copy of the input before increment. If nothing else modifies the + * input, the values produced will all be distinct. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CountUpTo(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CrossReplicaSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CrossReplicaSum.java new file mode 100644 index 00000000000..0fd6d9177b6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CrossReplicaSum.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An Op to sum inputs across replicated TPU instances. + *

+ * Each instance supplies its own input. + *

+ * For example, suppose there are 8 TPU instances: `[A, B, C, D, E, F, G, H]`. + * Passing group_assignment=`[[0,2,4,6],[1,3,5,7]]` sets `A, C, E, G` as group 0, + * and `B, D, F, H` as group 1. Thus we get the outputs: + * `[A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H]`. + * + * @param data type for {@code output()} output + */ +public final class CrossReplicaSum extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CrossReplicaSum operation. + * + * @param scope current scope + * @param input The local input to the sum. + * @param groupAssignment An int32 tensor with shape + * [num_groups, num_replicas_per_group]. `group_assignment[i]` represents the + * replica ids in the ith subgroup. + * @return a new instance of CrossReplicaSum + */ + public static CrossReplicaSum create(Scope scope, Operand input, Operand groupAssignment) { + OperationBuilder opBuilder = scope.env().opBuilder("CrossReplicaSum", scope.makeOpName("CrossReplicaSum")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(groupAssignment.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new CrossReplicaSum(opBuilder.build()); + } + + /** + * The sum of all the distributed inputs. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CrossReplicaSum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNBackpropV3.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNBackpropV3.java new file mode 100644 index 00000000000..2be49c97997 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNBackpropV3.java @@ -0,0 +1,324 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Backprop step of CudnnRNNV3. + *

+ * Compute the backprop of both data and weights in a RNN. Takes an extra + * "sequence_lengths" input than CudnnRNNBackprop. + *

+ * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicates whether there is a linear projection between the input and + * the actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. Should be + * "unidirectional" or "bidirectional". + * dropout: Dropout probability. When set to 0., dropout is disabled. + * seed: The 1st part of a seed to initialize dropout. + * seed2: The 2nd part of a seed to initialize dropout. + * input: If time_major is true, this is a 3-D tensor with the shape of + * [seq_length, batch_size, input_size]. If time_major is false, the shape is + * [batch_size, seq_length, input_size]. + * input_h: If time_major is true, this is a 3-D tensor with the shape of + * [num_layer * dir, batch_size, num_units]. If time_major is false, the shape + * is [batch_size, num_layer * dir, num_units]. + * input_c: For LSTM, a 3-D tensor with the shape of + * [num_layer * dir, batch, num_units]. For other models, it is ignored. + * params: A 1-D tensor that contains the weights and biases in an opaque layout. + * The size must be created through CudnnRNNParamsSize, and initialized + * separately. Note that they might not be compatible across different + * generations. So it is a good idea to save and restore + * sequence_lengths: a vector of lengths of each input sequence. + * output: If time_major is true, this is a 3-D tensor with the shape of + * [seq_length, batch_size, dir * num_units]. If time_major is false, the + * shape is [batch_size, seq_length, dir * num_units]. + * output_h: The same shape has input_h. + * output_c: The same shape as input_c for LSTM. An empty tensor for other models. + * output_backprop: A 3-D tensor with the same shape as output in the forward pass. + * output_h_backprop: A 3-D tensor with the same shape as output_h in the forward + * pass. + * output_c_backprop: A 3-D tensor with the same shape as output_c in the forward + * pass. + * time_major: Indicates whether the input/output format is time major or batch + * major. + * reserve_space: The same reserve_space produced in the forward operation. + * input_backprop: The backprop to input in the forward pass. Has the same shape + * as input. + * input_h_backprop: The backprop to input_h in the forward pass. Has the same + * shape as input_h. + * input_c_backprop: The backprop to input_c in the forward pass. Has the same + * shape as input_c. + * params_backprop: The backprop to the params buffer in the forward pass. Has the + * same shape as params. + * + * @param data type for {@code inputBackprop()} output + */ +public final class CudnnRNNBackpropV3 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.CudnnRNNBackpropV3} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param numProj + */ + public Options numProj(Long numProj) { + this.numProj = numProj; + return this; + } + + /** + * @param timeMajor + */ + public Options timeMajor(Boolean timeMajor) { + this.timeMajor = timeMajor; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + private Long numProj; + private Boolean timeMajor; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRNNBackpropV3 operation. + * + * @param scope current scope + * @param input + * @param inputH + * @param inputC + * @param params + * @param sequenceLengths + * @param output + * @param outputH + * @param outputC + * @param outputBackprop + * @param outputHBackprop + * @param outputCBackprop + * @param reserveSpace + * @param hostReserved + * @param options carries optional attributes values + * @return a new instance of CudnnRNNBackpropV3 + */ + public static CudnnRNNBackpropV3 create(Scope scope, Operand input, Operand inputH, Operand inputC, Operand params, Operand sequenceLengths, Operand output, Operand outputH, Operand outputC, Operand outputBackprop, Operand outputHBackprop, Operand outputCBackprop, Operand reserveSpace, Operand hostReserved, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNBackpropV3", scope.makeOpName("CudnnRNNBackpropV3")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputH.asOutput()); + opBuilder.addInput(inputC.asOutput()); + opBuilder.addInput(params.asOutput()); + opBuilder.addInput(sequenceLengths.asOutput()); + opBuilder.addInput(output.asOutput()); + opBuilder.addInput(outputH.asOutput()); + opBuilder.addInput(outputC.asOutput()); + opBuilder.addInput(outputBackprop.asOutput()); + opBuilder.addInput(outputHBackprop.asOutput()); + opBuilder.addInput(outputCBackprop.asOutput()); + opBuilder.addInput(reserveSpace.asOutput()); + opBuilder.addInput(hostReserved.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.numProj != null) { + opBuilder.setAttr("num_proj", opts.numProj); + } + if (opts.timeMajor != null) { + opBuilder.setAttr("time_major", opts.timeMajor); + } + } + } + return new CudnnRNNBackpropV3(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param numProj + */ + public static Options numProj(Long numProj) { + return new Options().numProj(numProj); + } + + /** + * @param timeMajor + */ + public static Options timeMajor(Boolean timeMajor) { + return new Options().timeMajor(timeMajor); + } + + /** + */ + public Output inputBackprop() { + return inputBackprop; + } + + /** + */ + public Output inputHBackprop() { + return inputHBackprop; + } + + /** + */ + public Output inputCBackprop() { + return inputCBackprop; + } + + /** + */ + public Output paramsBackprop() { + return paramsBackprop; + } + + private Output inputBackprop; + private Output inputHBackprop; + private Output inputCBackprop; + private Output paramsBackprop; + + private CudnnRNNBackpropV3(Operation operation) { + super(operation); + int outputIdx = 0; + inputBackprop = operation.output(outputIdx++); + inputHBackprop = operation.output(outputIdx++); + inputCBackprop = operation.output(outputIdx++); + paramsBackprop = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNCanonicalToParamsV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNCanonicalToParamsV2.java new file mode 100644 index 00000000000..acc0913384a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNCanonicalToParamsV2.java @@ -0,0 +1,256 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts CudnnRNN params from canonical form to usable form. It supports the projection in LSTM. + *

+ * Writes a set of weights into the opaque params buffer so they can be used in + * upcoming training or inferences. + *

+ * Note that the params buffer may not be compatible across different GPUs. So any + * save and restoration should be converted to and from the canonical weights and + * biases. + *

+ * num_layers: Specifies the number of layers in the RNN model. + * num_units: Specifies the size of the hidden state. + * input_size: Specifies the size of the input state. + * weights: the canonical form of weights that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * biases: the canonical form of biases that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * num_params_weigths: number of weight parameter matrix for all layers. + * num_params_biases: number of bias parameter vector for all layers. + * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicate whether there is a linear projection between the input and + * The actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. + * dir = (direction == bidirectional) ? 2 : 1 + * dropout: dropout probability. When set to 0., dropout is disabled. + * seed: the 1st part of a seed to initialize dropout. + * seed2: the 2nd part of a seed to initialize dropout. + * num_proj: The output dimensionality for the projection matrices. If None or 0, + * no projection is performed. + * + * @param data type for {@code params()} output + */ +@Operator +public final class CudnnRNNCanonicalToParamsV2 extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.CudnnRNNCanonicalToParamsV2} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param numProj + */ + public Options numProj(Long numProj) { + this.numProj = numProj; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + private Long numProj; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRNNCanonicalToParamsV2 operation. + * + * @param scope current scope + * @param numLayers + * @param numUnits + * @param inputSize + * @param weights + * @param biases + * @param options carries optional attributes values + * @return a new instance of CudnnRNNCanonicalToParamsV2 + */ + public static CudnnRNNCanonicalToParamsV2 create(Scope scope, Operand numLayers, Operand numUnits, Operand inputSize, Iterable> weights, Iterable> biases, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNCanonicalToParamsV2", scope.makeOpName("CudnnRNNCanonicalToParamsV2")); + opBuilder.addInput(numLayers.asOutput()); + opBuilder.addInput(numUnits.asOutput()); + opBuilder.addInput(inputSize.asOutput()); + opBuilder.addInputList(Operands.asOutputs(weights)); + opBuilder.addInputList(Operands.asOutputs(biases)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.numProj != null) { + opBuilder.setAttr("num_proj", opts.numProj); + } + } + } + return new CudnnRNNCanonicalToParamsV2(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param numProj + */ + public static Options numProj(Long numProj) { + return new Options().numProj(numProj); + } + + /** + */ + public Output params() { + return params; + } + + @Override + public Output asOutput() { + return params; + } + + private Output params; + + private CudnnRNNCanonicalToParamsV2(Operation operation) { + super(operation); + int outputIdx = 0; + params = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNParamsToCanonicalV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNParamsToCanonicalV2.java new file mode 100644 index 00000000000..e1386573c3a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNParamsToCanonicalV2.java @@ -0,0 +1,267 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Retrieves CudnnRNN params in canonical form. It supports the projection in LSTM. + *

+ * Retrieves a set of weights from the opaque params buffer that can be saved and + * restored in a way compatible with future runs. + *

+ * Note that the params buffer may not be compatible across different GPUs. So any + * save and restoration should be converted to and from the canonical weights and + * biases. + *

+ * num_layers: Specifies the number of layers in the RNN model. + * num_units: Specifies the size of the hidden state. + * input_size: Specifies the size of the input state. + * num_params_weigths: number of weight parameter matrix for all layers. + * num_params_biases: number of bias parameter vector for all layers. + * weights: the canonical form of weights that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * biases: the canonical form of biases that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicate whether there is a linear projection between the input and + * The actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. + * dir = (direction == bidirectional) ? 2 : 1 + * dropout: dropout probability. When set to 0., dropout is disabled. + * seed: the 1st part of a seed to initialize dropout. + * seed2: the 2nd part of a seed to initialize dropout. + * num_proj: The output dimensionality for the projection matrices. If None or 0, + * no projection is performed. + * + * @param data type for {@code weights()} output + */ +@Operator +public final class CudnnRNNParamsToCanonicalV2 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.CudnnRNNParamsToCanonicalV2} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param numProj + */ + public Options numProj(Long numProj) { + this.numProj = numProj; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + private Long numProj; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRNNParamsToCanonicalV2 operation. + * + * @param scope current scope + * @param numLayers + * @param numUnits + * @param inputSize + * @param params + * @param numParamsWeights + * @param numParamsBiases + * @param options carries optional attributes values + * @return a new instance of CudnnRNNParamsToCanonicalV2 + */ + public static CudnnRNNParamsToCanonicalV2 create(Scope scope, Operand numLayers, Operand numUnits, Operand inputSize, Operand params, Long numParamsWeights, Long numParamsBiases, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNParamsToCanonicalV2", scope.makeOpName("CudnnRNNParamsToCanonicalV2")); + opBuilder.addInput(numLayers.asOutput()); + opBuilder.addInput(numUnits.asOutput()); + opBuilder.addInput(inputSize.asOutput()); + opBuilder.addInput(params.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_params_weights", numParamsWeights); + opBuilder.setAttr("num_params_biases", numParamsBiases); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.numProj != null) { + opBuilder.setAttr("num_proj", opts.numProj); + } + } + } + return new CudnnRNNParamsToCanonicalV2(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param numProj + */ + public static Options numProj(Long numProj) { + return new Options().numProj(numProj); + } + + /** + */ + public List> weights() { + return weights; + } + + /** + */ + public List> biases() { + return biases; + } + + private List> weights; + private List> biases; + + @SuppressWarnings("unchecked") + private CudnnRNNParamsToCanonicalV2(Operation operation) { + super(operation); + int outputIdx = 0; + int weightsLength = operation.outputListLength("weights"); + weights = Arrays.asList((Output[])operation.outputList(outputIdx, weightsLength)); + outputIdx += weightsLength; + int biasesLength = operation.outputListLength("biases"); + biases = Arrays.asList((Output[])operation.outputList(outputIdx, biasesLength)); + outputIdx += biasesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNV3.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNV3.java new file mode 100644 index 00000000000..2786a410b16 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNV3.java @@ -0,0 +1,325 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A RNN backed by cuDNN. + *

+ * Computes the RNN from the input and initial states, with respect to the params + * buffer. Accepts one extra input "sequence_lengths" than CudnnRNN. + *

+ * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicates whether there is a linear projection between the input and + * the actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. Should be + * "unidirectional" or "bidirectional". + * dropout: Dropout probability. When set to 0., dropout is disabled. + * seed: The 1st part of a seed to initialize dropout. + * seed2: The 2nd part of a seed to initialize dropout. + * input: If time_major is true, this is a 3-D tensor with the shape of + * [seq_length, batch_size, input_size]. If time_major is false, the shape is + * [batch_size, seq_length, input_size]. + * input_h: If time_major is true, this is a 3-D tensor with the shape of + * [num_layer * dir, batch_size, num_units]. If time_major is false, the shape + * is [batch_size, num_layer * dir, num_units]. + * input_c: For LSTM, a 3-D tensor with the shape of + * [num_layer * dir, batch, num_units]. For other models, it is ignored. + * params: A 1-D tensor that contains the weights and biases in an opaque layout. + * The size must be created through CudnnRNNParamsSize, and initialized + * separately. Note that they might not be compatible across different + * generations. So it is a good idea to save and restore + * sequence_lengths: a vector of lengths of each input sequence. + * output: If time_major is true, this is a 3-D tensor with the shape of + * [seq_length, batch_size, dir * num_units]. If time_major is false, the + * shape is [batch_size, seq_length, dir * num_units]. + * output_h: The same shape has input_h. + * output_c: The same shape as input_c for LSTM. An empty tensor for other models. + * is_training: Indicates whether this operation is used for inferenece or + * training. + * time_major: Indicates whether the input/output format is time major or batch + * major. + * reserve_space: An opaque tensor that can be used in backprop calculation. It + * is only produced if is_training is true. + * + * @param data type for {@code output()} output + */ +public final class CudnnRNNV3 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.CudnnRNNV3} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param numProj + */ + public Options numProj(Long numProj) { + this.numProj = numProj; + return this; + } + + /** + * @param isTraining + */ + public Options isTraining(Boolean isTraining) { + this.isTraining = isTraining; + return this; + } + + /** + * @param timeMajor + */ + public Options timeMajor(Boolean timeMajor) { + this.timeMajor = timeMajor; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + private Long numProj; + private Boolean isTraining; + private Boolean timeMajor; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRNNV3 operation. + * + * @param scope current scope + * @param input + * @param inputH + * @param inputC + * @param params + * @param sequenceLengths + * @param options carries optional attributes values + * @return a new instance of CudnnRNNV3 + */ + public static CudnnRNNV3 create(Scope scope, Operand input, Operand inputH, Operand inputC, Operand params, Operand sequenceLengths, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNV3", scope.makeOpName("CudnnRNNV3")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputH.asOutput()); + opBuilder.addInput(inputC.asOutput()); + opBuilder.addInput(params.asOutput()); + opBuilder.addInput(sequenceLengths.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.numProj != null) { + opBuilder.setAttr("num_proj", opts.numProj); + } + if (opts.isTraining != null) { + opBuilder.setAttr("is_training", opts.isTraining); + } + if (opts.timeMajor != null) { + opBuilder.setAttr("time_major", opts.timeMajor); + } + } + } + return new CudnnRNNV3(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param numProj + */ + public static Options numProj(Long numProj) { + return new Options().numProj(numProj); + } + + /** + * @param isTraining + */ + public static Options isTraining(Boolean isTraining) { + return new Options().isTraining(isTraining); + } + + /** + * @param timeMajor + */ + public static Options timeMajor(Boolean timeMajor) { + return new Options().timeMajor(timeMajor); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output outputH() { + return outputH; + } + + /** + */ + public Output outputC() { + return outputC; + } + + /** + */ + public Output reserveSpace() { + return reserveSpace; + } + + /** + */ + public Output hostReserved() { + return hostReserved; + } + + private Output output; + private Output outputH; + private Output outputC; + private Output reserveSpace; + private Output hostReserved; + + private CudnnRNNV3(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputH = operation.output(outputIdx++); + outputC = operation.output(outputIdx++); + reserveSpace = operation.output(outputIdx++); + hostReserved = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CumulativeLogsumexp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CumulativeLogsumexp.java new file mode 100644 index 00000000000..4ac0ae657c0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CumulativeLogsumexp.java @@ -0,0 +1,140 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Compute the cumulative product of the tensor `x` along `axis`. + *

+ * By default, this op performs an inclusive cumulative log-sum-exp, + * which means that the first + * element of the input is identical to the first element of the output: + *

{@code
+ * tf.math.cumulative_logsumexp([a, b, c])  # => [a, log(exp(a) + exp(b)), log(exp(a) + exp(b) + exp(c))]
+ * }
+ * By setting the `exclusive` kwarg to `True`, an exclusive cumulative log-sum-exp is + * performed instead: + *
{@code
+ * tf.cumulative_logsumexp([a, b, c], exclusive=True)  # => [-inf, a, log(exp(a) * exp(b))]
+ * }
+ * Note that the neutral element of the log-sum-exp operation is `-inf`, + * however, for performance reasons, the minimal value representable by the + * floating point type is used instead. + *

+ * By setting the `reverse` kwarg to `True`, the cumulative log-sum-exp is performed in the + * opposite direction. + * + * @param data type for {@code out()} output + */ +public final class CumulativeLogsumexp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.CumulativeLogsumexp} + */ + public static class Options { + + /** + * @param exclusive If `True`, perform exclusive cumulative log-sum-exp. + */ + public Options exclusive(Boolean exclusive) { + this.exclusive = exclusive; + return this; + } + + /** + * @param reverse A `bool` (default: False). + */ + public Options reverse(Boolean reverse) { + this.reverse = reverse; + return this; + } + + private Boolean exclusive; + private Boolean reverse; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CumulativeLogsumexp operation. + * + * @param scope current scope + * @param x A `Tensor`. Must be one of the following types: `float16`, `float32`, `float64`. + * @param axis A `Tensor` of type `int32` (default: 0). Must be in the range + * `[-rank(x), rank(x))`. + * @param options carries optional attributes values + * @return a new instance of CumulativeLogsumexp + */ + public static CumulativeLogsumexp create(Scope scope, Operand x, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CumulativeLogsumexp", scope.makeOpName("CumulativeLogsumexp")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.exclusive != null) { + opBuilder.setAttr("exclusive", opts.exclusive); + } + if (opts.reverse != null) { + opBuilder.setAttr("reverse", opts.reverse); + } + } + } + return new CumulativeLogsumexp(opBuilder.build()); + } + + /** + * @param exclusive If `True`, perform exclusive cumulative log-sum-exp. + */ + public static Options exclusive(Boolean exclusive) { + return new Options().exclusive(exclusive); + } + + /** + * @param reverse A `bool` (default: False). + */ + public static Options reverse(Boolean reverse) { + return new Options().reverse(reverse); + } + + /** + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private CumulativeLogsumexp(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetCardinality.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetCardinality.java new file mode 100644 index 00000000000..26cc47eef2a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetCardinality.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns the cardinality of `input_dataset`. + *

+ * Returns the cardinality of `input_dataset`. + */ +public final class DatasetCardinality extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DatasetCardinality operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the dataset to return cardinality for. + * @return a new instance of DatasetCardinality + */ + public static DatasetCardinality create(Scope scope, Operand inputDataset) { + OperationBuilder opBuilder = scope.env().opBuilder("DatasetCardinality", scope.makeOpName("DatasetCardinality")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DatasetCardinality(opBuilder.build()); + } + + /** + * The cardinality of `input_dataset`. Named constants are used to represent + * infinite and unknown cardinality. + */ + public Output cardinality() { + return cardinality; + } + + @Override + public Output asOutput() { + return cardinality; + } + + private Output cardinality; + + private DatasetCardinality(Operation operation) { + super(operation); + int outputIdx = 0; + cardinality = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetFromGraph.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetFromGraph.java new file mode 100644 index 00000000000..100706ba1a8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetFromGraph.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset from the given `graph_def`. + *

+ * Creates a dataset from the provided `graph_def`. + */ +public final class DatasetFromGraph extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DatasetFromGraph operation. + * + * @param scope current scope + * @param graphDef The graph representation of the dataset (as serialized GraphDef). + * @return a new instance of DatasetFromGraph + */ + public static DatasetFromGraph create(Scope scope, Operand graphDef) { + OperationBuilder opBuilder = scope.env().opBuilder("DatasetFromGraph", scope.makeOpName("DatasetFromGraph")); + opBuilder.addInput(graphDef.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DatasetFromGraph(opBuilder.build()); + } + + /** + * A variant tensor representing the dataset. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private DatasetFromGraph(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientIdentity.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientIdentity.java new file mode 100644 index 00000000000..28fc1adbfbb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientIdentity.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Identity op for gradient debugging. + *

+ * This op is hidden from public in Python. It is used by TensorFlow Debugger to + * register gradient tensors for gradient debugging. + * This op operates on non-reference-type tensors. + * + * @param data type for {@code output()} output + */ +public final class DebugGradientIdentity extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DebugGradientIdentity operation. + * + * @param scope current scope + * @param input + * @return a new instance of DebugGradientIdentity + */ + public static DebugGradientIdentity create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("DebugGradientIdentity", scope.makeOpName("DebugGradientIdentity")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DebugGradientIdentity(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DebugGradientIdentity(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientRefIdentity.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientRefIdentity.java new file mode 100644 index 00000000000..2db65501cbf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientRefIdentity.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Identity op for gradient debugging. + *

+ * This op is hidden from public in Python. It is used by TensorFlow Debugger to + * register gradient tensors for gradient debugging. + * This op operates on reference-type tensors. + * + * @param data type for {@code output()} output + */ +public final class DebugGradientRefIdentity extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DebugGradientRefIdentity operation. + * + * @param scope current scope + * @param input + * @return a new instance of DebugGradientRefIdentity + */ + public static DebugGradientRefIdentity create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("DebugGradientRefIdentity", scope.makeOpName("DebugGradientRefIdentity")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DebugGradientRefIdentity(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DebugGradientRefIdentity(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DecodePaddedRaw.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DecodePaddedRaw.java new file mode 100644 index 00000000000..eb71ab6e692 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DecodePaddedRaw.java @@ -0,0 +1,113 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reinterpret the bytes of a string as a vector of numbers. + * + * @param data type for {@code output()} output + */ +@Operator +public final class DecodePaddedRaw extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.DecodePaddedRaw} + */ + public static class Options { + + /** + * @param littleEndian Whether the input `input_bytes` is in little-endian order. Ignored for + * `out_type` values that are stored in a single byte, like `uint8` + */ + public Options littleEndian(Boolean littleEndian) { + this.littleEndian = littleEndian; + return this; + } + + private Boolean littleEndian; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodePaddedRaw operation. + * + * @param scope current scope + * @param inputBytes Tensor of string to be decoded. + * @param fixedLength Length in bytes for each element of the decoded output. Must be a multiple + * of the size of the output type. + * @param outType + * @param options carries optional attributes values + * @return a new instance of DecodePaddedRaw + */ + public static DecodePaddedRaw create(Scope scope, Operand inputBytes, Operand fixedLength, Class outType, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodePaddedRaw", scope.makeOpName("DecodePaddedRaw")); + opBuilder.addInput(inputBytes.asOutput()); + opBuilder.addInput(fixedLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + if (options != null) { + for (Options opts : options) { + if (opts.littleEndian != null) { + opBuilder.setAttr("little_endian", opts.littleEndian); + } + } + } + return new DecodePaddedRaw(opBuilder.build()); + } + + /** + * @param littleEndian Whether the input `input_bytes` is in little-endian order. Ignored for + * `out_type` values that are stored in a single byte, like `uint8` + */ + public static Options littleEndian(Boolean littleEndian) { + return new Options().littleEndian(littleEndian); + } + + /** + * A Tensor with one more dimension than the input `bytes`. The added dimension + * will have size equal to the length of the elements of `bytes` divided by the + * number of bytes to represent `out_type`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DecodePaddedRaw(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DecodeProto.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DecodeProto.java new file mode 100644 index 00000000000..9f188ce008c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DecodeProto.java @@ -0,0 +1,215 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * The op extracts fields from a serialized protocol buffers message into tensors. + *

+ * The `decode_proto` op extracts fields from a serialized protocol buffers + * message into tensors. The fields in `field_names` are decoded and converted + * to the corresponding `output_types` if possible. + *

+ * A `message_type` name must be provided to give context for the field names. + * The actual message descriptor can be looked up either in the linked-in + * descriptor pool or a filename provided by the caller using the + * `descriptor_source` attribute. + *

+ * Each output tensor is a dense tensor. This means that it is padded to hold + * the largest number of repeated elements seen in the input minibatch. (The + * shape is also padded by one to prevent zero-sized dimensions). The actual + * repeat counts for each example in the minibatch can be found in the `sizes` + * output. In many cases the output of `decode_proto` is fed immediately into + * tf.squeeze if missing values are not a concern. When using tf.squeeze, always + * pass the squeeze dimension explicitly to avoid surprises. + *

+ * For the most part, the mapping between Proto field types and TensorFlow dtypes + * is straightforward. However, there are a few special cases: + *

+ * - A proto field that contains a submessage or group can only be converted + * to `DT_STRING` (the serialized submessage). This is to reduce the complexity + * of the API. The resulting string can be used as input to another instance of + * the decode_proto op. + *

+ * - TensorFlow lacks support for unsigned integers. The ops represent uint64 + * types as a `DT_INT64` with the same twos-complement bit pattern (the obvious + * way). Unsigned int32 values can be represented exactly by specifying type + * `DT_INT64`, or using twos-complement if the caller specifies `DT_INT32` in + * the `output_types` attribute. + *

+ * Both binary and text proto serializations are supported, and can be + * chosen using the `format` attribute. + *

+ * The `descriptor_source` attribute selects the source of protocol + * descriptors to consult when looking up `message_type`. This may be: + *

+ * - An empty string or "local://", in which case protocol descriptors are + * created for C++ (not Python) proto definitions linked to the binary. + *

+ * - A file, in which case protocol descriptors are created from the file, + * which is expected to contain a `FileDescriptorSet` serialized as a string. + * NOTE: You can build a `descriptor_source` file using the `--descriptor_set_out` + * and `--include_imports` options to the protocol compiler `protoc`. + *

+ * - A "bytes://", in which protocol descriptors are created from ``, + * which is expected to be a `FileDescriptorSet` serialized as a string. + */ +public final class DecodeProto extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.DecodeProto} + */ + public static class Options { + + /** + * @param descriptorSource Either the special value `local://` or a path to a file containing + * a serialized `FileDescriptorSet`. + */ + public Options descriptorSource(String descriptorSource) { + this.descriptorSource = descriptorSource; + return this; + } + + /** + * @param messageFormat Either `binary` or `text`. + */ + public Options messageFormat(String messageFormat) { + this.messageFormat = messageFormat; + return this; + } + + /** + * @param sanitize Whether to sanitize the result or not. + */ + public Options sanitize(Boolean sanitize) { + this.sanitize = sanitize; + return this; + } + + private String descriptorSource; + private String messageFormat; + private Boolean sanitize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeProto operation. + * + * @param scope current scope + * @param bytes Tensor of serialized protos with shape `batch_shape`. + * @param messageType Name of the proto message type to decode. + * @param fieldNames List of strings containing proto field names. An extension field can be decoded + * by using its full name, e.g. EXT_PACKAGE.EXT_FIELD_NAME. + * @param outputTypes List of TF types to use for the respective field in field_names. + * @param options carries optional attributes values + * @return a new instance of DecodeProto + */ + public static DecodeProto create(Scope scope, Operand bytes, String messageType, List fieldNames, List> outputTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeProtoV2", scope.makeOpName("DecodeProto")); + opBuilder.addInput(bytes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("message_type", messageType); + String[] fieldNamesArray = new String[fieldNames.size()]; + for (int i = 0; i < fieldNamesArray.length; ++i) { + fieldNamesArray[i] = fieldNames.get(i); + } + opBuilder.setAttr("field_names", fieldNamesArray); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.descriptorSource != null) { + opBuilder.setAttr("descriptor_source", opts.descriptorSource); + } + if (opts.messageFormat != null) { + opBuilder.setAttr("message_format", opts.messageFormat); + } + if (opts.sanitize != null) { + opBuilder.setAttr("sanitize", opts.sanitize); + } + } + } + return new DecodeProto(opBuilder.build()); + } + + /** + * @param descriptorSource Either the special value `local://` or a path to a file containing + * a serialized `FileDescriptorSet`. + */ + public static Options descriptorSource(String descriptorSource) { + return new Options().descriptorSource(descriptorSource); + } + + /** + * @param messageFormat Either `binary` or `text`. + */ + public static Options messageFormat(String messageFormat) { + return new Options().messageFormat(messageFormat); + } + + /** + * @param sanitize Whether to sanitize the result or not. + */ + public static Options sanitize(Boolean sanitize) { + return new Options().sanitize(sanitize); + } + + /** + * Tensor of int32 with shape `[batch_shape, len(field_names)]`. + * Each entry is the number of values found for the corresponding field. + * Optional fields may have 0 or 1 values. + */ + public Output sizes() { + return sizes; + } + + /** + * List of tensors containing values for the corresponding field. + * `values[i]` has datatype `output_types[i]` + * and shape `[batch_shape, max(sizes[...,i])]`. + */ + public List> values() { + return values; + } + + private Output sizes; + private List> values; + + private DecodeProto(Operation operation) { + super(operation); + int outputIdx = 0; + sizes = operation.output(outputIdx++); + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeepCopy.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeepCopy.java new file mode 100644 index 00000000000..d63c9d0c797 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeepCopy.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Makes a copy of `x`. + * + * @param data type for {@code y()} output + */ +@Operator +public final class DeepCopy extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DeepCopy operation. + * + * @param scope current scope + * @param x The source tensor of type `T`. + * @return a new instance of DeepCopy + */ + public static DeepCopy create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("DeepCopy", scope.makeOpName("DeepCopy")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DeepCopy(opBuilder.build()); + } + + /** + * y: A `Tensor` of type `T`. A copy of `x`. Guaranteed that `y` + * is not an alias of `x`. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private DeepCopy(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteIterator.java new file mode 100644 index 00000000000..c5110f028e3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteIterator.java @@ -0,0 +1,51 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A container for an iterator resource. + */ +public final class DeleteIterator extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeleteIterator operation. + * + * @param scope current scope + * @param handle A handle to the iterator to delete. + * @param deleter A variant deleter. + * @return a new instance of DeleteIterator + */ + public static DeleteIterator create(Scope scope, Operand handle, Operand deleter) { + OperationBuilder opBuilder = scope.env().opBuilder("DeleteIterator", scope.makeOpName("DeleteIterator")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(deleter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DeleteIterator(opBuilder.build()); + } + + + private DeleteIterator(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMemoryCache.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMemoryCache.java new file mode 100644 index 00000000000..93fb7a03beb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMemoryCache.java @@ -0,0 +1,50 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class DeleteMemoryCache extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeleteMemoryCache operation. + * + * @param scope current scope + * @param handle + * @param deleter + * @return a new instance of DeleteMemoryCache + */ + public static DeleteMemoryCache create(Scope scope, Operand handle, Operand deleter) { + OperationBuilder opBuilder = scope.env().opBuilder("DeleteMemoryCache", scope.makeOpName("DeleteMemoryCache")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(deleter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DeleteMemoryCache(opBuilder.build()); + } + + + private DeleteMemoryCache(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMultiDeviceIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMultiDeviceIterator.java new file mode 100644 index 00000000000..5de56ff7286 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMultiDeviceIterator.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A container for an iterator resource. + */ +public final class DeleteMultiDeviceIterator extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeleteMultiDeviceIterator operation. + * + * @param scope current scope + * @param multiDeviceIterator A handle to the multi device iterator to delete. + * @param iterators A list of iterator handles (unused). This is added so that automatic control dependencies get added during function tracing that ensure this op runs after all the dependent iterators are deleted. + * @param deleter A variant deleter. + * @return a new instance of DeleteMultiDeviceIterator + */ + public static DeleteMultiDeviceIterator create(Scope scope, Operand multiDeviceIterator, Iterable> iterators, Operand deleter) { + OperationBuilder opBuilder = scope.env().opBuilder("DeleteMultiDeviceIterator", scope.makeOpName("DeleteMultiDeviceIterator")); + opBuilder.addInput(multiDeviceIterator.asOutput()); + opBuilder.addInputList(Operands.asOutputs(iterators)); + opBuilder.addInput(deleter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DeleteMultiDeviceIterator(opBuilder.build()); + } + + + private DeleteMultiDeviceIterator(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteRandomSeedGenerator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteRandomSeedGenerator.java new file mode 100644 index 00000000000..8803d608ad3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteRandomSeedGenerator.java @@ -0,0 +1,50 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class DeleteRandomSeedGenerator extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeleteRandomSeedGenerator operation. + * + * @param scope current scope + * @param handle + * @param deleter + * @return a new instance of DeleteRandomSeedGenerator + */ + public static DeleteRandomSeedGenerator create(Scope scope, Operand handle, Operand deleter) { + OperationBuilder opBuilder = scope.env().opBuilder("DeleteRandomSeedGenerator", scope.makeOpName("DeleteRandomSeedGenerator")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(deleter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DeleteRandomSeedGenerator(opBuilder.build()); + } + + + private DeleteRandomSeedGenerator(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteSessionTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteSessionTensor.java new file mode 100644 index 00000000000..7024c12928e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteSessionTensor.java @@ -0,0 +1,51 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Delete the tensor specified by its handle in the session. + */ +@Operator +public final class DeleteSessionTensor extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeleteSessionTensor operation. + * + * @param scope current scope + * @param handle The handle for a tensor stored in the session state. + * @return a new instance of DeleteSessionTensor + */ + public static DeleteSessionTensor create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("DeleteSessionTensor", scope.makeOpName("DeleteSessionTensor")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DeleteSessionTensor(opBuilder.build()); + } + + + private DeleteSessionTensor(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DestroyResourceOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DestroyResourceOp.java new file mode 100644 index 00000000000..d4a93656172 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DestroyResourceOp.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Deletes the resource specified by the handle. + *

+ * All subsequent operations using the resource will result in a NotFound + * error status. + */ +@Operator +public final class DestroyResourceOp extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.DestroyResourceOp} + */ + public static class Options { + + /** + * @param ignoreLookupError whether to ignore the error when the resource + * doesn't exist. + */ + public Options ignoreLookupError(Boolean ignoreLookupError) { + this.ignoreLookupError = ignoreLookupError; + return this; + } + + private Boolean ignoreLookupError; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DestroyResourceOp operation. + * + * @param scope current scope + * @param resource handle to the resource to delete. + * @param options carries optional attributes values + * @return a new instance of DestroyResourceOp + */ + public static DestroyResourceOp create(Scope scope, Operand resource, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DestroyResourceOp", scope.makeOpName("DestroyResourceOp")); + opBuilder.addInput(resource.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.ignoreLookupError != null) { + opBuilder.setAttr("ignore_lookup_error", opts.ignoreLookupError); + } + } + } + return new DestroyResourceOp(opBuilder.build()); + } + + /** + * @param ignoreLookupError whether to ignore the error when the resource + * doesn't exist. + */ + public static Options ignoreLookupError(Boolean ignoreLookupError) { + return new Options().ignoreLookupError(ignoreLookupError); + } + + + private DestroyResourceOp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DestroyTemporaryVariable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DestroyTemporaryVariable.java new file mode 100644 index 00000000000..90d19979114 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DestroyTemporaryVariable.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Destroys the temporary variable and returns its final value. + *

+ * Sets output to the value of the Tensor pointed to by 'ref', then destroys + * the temporary variable called 'var_name'. + * All other uses of 'ref' must have executed before this op. + * This is typically achieved by chaining the ref through each assign op, or by + * using control dependencies. + *

+ * Outputs the final value of the tensor pointed to by 'ref'. + * + * @param data type for {@code value()} output + */ +@Operator +public final class DestroyTemporaryVariable extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DestroyTemporaryVariable operation. + * + * @param scope current scope + * @param ref A reference to the temporary variable tensor. + * @param varName Name of the temporary variable, usually the name of the matching + * 'TemporaryVariable' op. + * @return a new instance of DestroyTemporaryVariable + */ + public static DestroyTemporaryVariable create(Scope scope, Operand ref, String varName) { + OperationBuilder opBuilder = scope.env().opBuilder("DestroyTemporaryVariable", scope.makeOpName("DestroyTemporaryVariable")); + opBuilder.addInput(ref.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("var_name", varName); + return new DestroyTemporaryVariable(opBuilder.build()); + } + + /** + */ + public Output value() { + return value; + } + + @Override + public Output asOutput() { + return value; + } + + private Output value; + + private DestroyTemporaryVariable(Operation operation) { + super(operation); + int outputIdx = 0; + value = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DirectedInterleaveDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DirectedInterleaveDataset.java new file mode 100644 index 00000000000..7d15d488267 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DirectedInterleaveDataset.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A substitute for `InterleaveDataset` on a fixed list of `N` datasets. + */ +public final class DirectedInterleaveDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DirectedInterleaveDataset operation. + * + * @param scope current scope + * @param selectorInputDataset A dataset of scalar `DT_INT64` elements that determines which of the + * `N` data inputs should produce the next output element. + * @param dataInputDatasets `N` datasets with the same type that will be interleaved according to + * the values of `selector_input_dataset`. + * @param outputTypes + * @param outputShapes + * @return a new instance of DirectedInterleaveDataset + */ + public static DirectedInterleaveDataset create(Scope scope, Operand selectorInputDataset, Iterable> dataInputDatasets, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("DirectedInterleaveDataset", scope.makeOpName("DirectedInterleaveDataset")); + opBuilder.addInput(selectorInputDataset.asOutput()); + opBuilder.addInputList(Operands.asOutputs(dataInputDatasets)); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new DirectedInterleaveDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private DirectedInterleaveDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DrawBoundingBoxesV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DrawBoundingBoxesV2.java new file mode 100644 index 00000000000..dc344bcadf5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DrawBoundingBoxesV2.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Draw bounding boxes on a batch of images. + *

+ * Outputs a copy of `images` but draws on top of the pixels zero or more bounding + * boxes specified by the locations in `boxes`. The coordinates of the each + * bounding box in `boxes` are encoded as `[y_min, x_min, y_max, x_max]`. The + * bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and + * height of the underlying image. + *

+ * For example, if an image is 100 x 200 pixels (height x width) and the bounding + * box is `[0.1, 0.2, 0.5, 0.9]`, the upper-left and bottom-right coordinates of + * the bounding box will be `(40, 10)` to `(100, 50)` (in (x,y) coordinates). + *

+ * Parts of the bounding box may fall outside the image. + * + * @param data type for {@code output()} output + */ +@Operator +public final class DrawBoundingBoxesV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DrawBoundingBoxesV2 operation. + * + * @param scope current scope + * @param images 4-D with shape `[batch, height, width, depth]`. A batch of images. + * @param boxes 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding + * boxes. + * @param colors 2-D. A list of RGBA colors to cycle through for the boxes. + * @return a new instance of DrawBoundingBoxesV2 + */ + public static DrawBoundingBoxesV2 create(Scope scope, Operand images, Operand boxes, Operand colors) { + OperationBuilder opBuilder = scope.env().opBuilder("DrawBoundingBoxesV2", scope.makeOpName("DrawBoundingBoxesV2")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(boxes.asOutput()); + opBuilder.addInput(colors.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DrawBoundingBoxesV2(opBuilder.build()); + } + + /** + * 4-D with the same shape as `images`. The batch of input images with + * bounding boxes drawn on the images. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DrawBoundingBoxesV2(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DynamicPartition.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DynamicPartition.java new file mode 100644 index 00000000000..c06b8b156dd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DynamicPartition.java @@ -0,0 +1,113 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Partitions `data` into `num_partitions` tensors using indices from `partitions`. + *

+ * For each index tuple `js` of size `partitions.ndim`, the slice `data[js, ...]` + * becomes part of `outputs[partitions[js]]`. The slices with `partitions[js] = i` + * are placed in `outputs[i]` in lexicographic order of `js`, and the first + * dimension of `outputs[i]` is the number of entries in `partitions` equal to `i`. + * In detail, + *

{@code
+ *     outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:]
+ * 
+ *     outputs[i] = pack([data[js, ...] for js if partitions[js] == i])
+ * }
+ * `data.shape` must start with `partitions.shape`. + *

+ * For example: + *

{@code
+ *     # Scalar partitions.
+ *     partitions = 1
+ *     num_partitions = 2
+ *     data = [10, 20]
+ *     outputs[0] = []  # Empty with shape [0, 2]
+ *     outputs[1] = [[10, 20]]
+ * 
+ *     # Vector partitions.
+ *     partitions = [0, 0, 1, 1, 0]
+ *     num_partitions = 2
+ *     data = [10, 20, 30, 40, 50]
+ *     outputs[0] = [10, 20, 50]
+ *     outputs[1] = [30, 40]
+ * }
+ * See `dynamic_stitch` for an example on how to merge partitions back. + *

+ *

+ * + *
+ * + * @param data type for {@code outputs()} output + */ +@Operator +public final class DynamicPartition extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new DynamicPartition operation. + * + * @param scope current scope + * @param data + * @param partitions Any shape. Indices in the range `[0, num_partitions)`. + * @param numPartitions The number of partitions to output. + * @return a new instance of DynamicPartition + */ + public static DynamicPartition create(Scope scope, Operand data, Operand partitions, Long numPartitions) { + OperationBuilder opBuilder = scope.env().opBuilder("DynamicPartition", scope.makeOpName("DynamicPartition")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(partitions.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_partitions", numPartitions); + return new DynamicPartition(opBuilder.build()); + } + + /** + */ + public List> outputs() { + return outputs; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outputs.iterator(); + } + + private List> outputs; + + @SuppressWarnings("unchecked") + private DynamicPartition(Operation operation) { + super(operation); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList((Output[])operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DynamicStitch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DynamicStitch.java new file mode 100644 index 00000000000..864bc9631b0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DynamicStitch.java @@ -0,0 +1,126 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Interleave the values from the `data` tensors into a single tensor. + *

+ * Builds a merged tensor such that + *

{@code
+ *     merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
+ * }
+ * For example, if each `indices[m]` is scalar or vector, we have + *
{@code
+ *     # Scalar indices:
+ *     merged[indices[m], ...] = data[m][...]
+ * 
+ *     # Vector indices:
+ *     merged[indices[m][i], ...] = data[m][i, ...]
+ * }
+ * Each `data[i].shape` must start with the corresponding `indices[i].shape`, + * and the rest of `data[i].shape` must be constant w.r.t. `i`. That is, we + * must have `data[i].shape = indices[i].shape + constant`. In terms of this + * `constant`, the output shape is + *

+ * merged.shape = [max(indices)] + constant + *

+ * Values are merged in order, so if an index appears in both `indices[m][i]` and + * `indices[n][j]` for `(m,i) < (n,j)` the slice `data[n][j]` will appear in the + * merged result. If you do not need this guarantee, ParallelDynamicStitch might + * perform better on some devices. + *

+ * For example: + *

{@code
+ *     indices[0] = 6
+ *     indices[1] = [4, 1]
+ *     indices[2] = [[5, 2], [0, 3]]
+ *     data[0] = [61, 62]
+ *     data[1] = [[41, 42], [11, 12]]
+ *     data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
+ *     merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
+ *               [51, 52], [61, 62]]
+ * }
+ * This method can be used to merge partitions created by `dynamic_partition` + * as illustrated on the following example: + *
{@code
+ *     # Apply function (increments x_i) on elements for which a certain condition
+ *     # apply (x_i != -1 in this example).
+ *     x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
+ *     condition_mask=tf.not_equal(x,tf.constant(-1.))
+ *     partitioned_data = tf.dynamic_partition(
+ *         x, tf.cast(condition_mask, tf.int32) , 2)
+ *     partitioned_data[1] = partitioned_data[1] + 1.0
+ *     condition_indices = tf.dynamic_partition(
+ *         tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
+ *     x = tf.dynamic_stitch(condition_indices, partitioned_data)
+ *     # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
+ *     # unchanged.
+ * }
+ *
+ * + *
+ * + * @param data type for {@code merged()} output + */ +@Operator +public final class DynamicStitch extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DynamicStitch operation. + * + * @param scope current scope + * @param indices + * @param data + * @return a new instance of DynamicStitch + */ + public static DynamicStitch create(Scope scope, Iterable> indices, Iterable> data) { + OperationBuilder opBuilder = scope.env().opBuilder("DynamicStitch", scope.makeOpName("DynamicStitch")); + opBuilder.addInputList(Operands.asOutputs(indices)); + opBuilder.addInputList(Operands.asOutputs(data)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DynamicStitch(opBuilder.build()); + } + + /** + */ + public Output merged() { + return merged; + } + + @Override + public Output asOutput() { + return merged; + } + + private Output merged; + + private DynamicStitch(Operation operation) { + super(operation); + int outputIdx = 0; + merged = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EditDistance.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EditDistance.java new file mode 100644 index 00000000000..6cd854fcc3a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EditDistance.java @@ -0,0 +1,156 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the (possibly normalized) Levenshtein Edit Distance. + *

+ * The inputs are variable-length sequences provided by SparseTensors + * (hypothesis_indices, hypothesis_values, hypothesis_shape) + * and + * (truth_indices, truth_values, truth_shape). + *

+ * The inputs are: + */ +@Operator +public final class EditDistance extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.EditDistance} + */ + public static class Options { + + /** + * @param normalize boolean (if true, edit distances are normalized by length of truth). + *

+ * The output is: + */ + public Options normalize(Boolean normalize) { + this.normalize = normalize; + return this; + } + + private Boolean normalize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EditDistance operation. + * + * @param scope current scope + * @param hypothesisIndices The indices of the hypothesis list SparseTensor. + * This is an N x R int64 matrix. + * @param hypothesisValues The values of the hypothesis list SparseTensor. + * This is an N-length vector. + * @param hypothesisShape The shape of the hypothesis list SparseTensor. + * This is an R-length vector. + * @param truthIndices The indices of the truth list SparseTensor. + * This is an M x R int64 matrix. + * @param truthValues The values of the truth list SparseTensor. + * This is an M-length vector. + * @param truthShape truth indices, vector. + * @param options carries optional attributes values + * @return a new instance of EditDistance + */ + public static EditDistance create(Scope scope, Operand hypothesisIndices, Operand hypothesisValues, Operand hypothesisShape, Operand truthIndices, Operand truthValues, Operand truthShape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EditDistance", scope.makeOpName("EditDistance")); + opBuilder.addInput(hypothesisIndices.asOutput()); + opBuilder.addInput(hypothesisValues.asOutput()); + opBuilder.addInput(hypothesisShape.asOutput()); + opBuilder.addInput(truthIndices.asOutput()); + opBuilder.addInput(truthValues.asOutput()); + opBuilder.addInput(truthShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.normalize != null) { + opBuilder.setAttr("normalize", opts.normalize); + } + } + } + return new EditDistance(opBuilder.build()); + } + + /** + * @param normalize boolean (if true, edit distances are normalized by length of truth). + *

+ * The output is: + */ + public static Options normalize(Boolean normalize) { + return new Options().normalize(normalize); + } + + /** + * A dense float tensor with rank R - 1. + *

+ * For the example input: + *

+ * // hypothesis represents a 2x1 matrix with variable-length values: + * // (0,0) = ["a"] + * // (1,0) = ["b"] + * hypothesis_indices = [[0, 0, 0], + * [1, 0, 0]] + * hypothesis_values = ["a", "b"] + * hypothesis_shape = [2, 1, 1] + *

+ * // truth represents a 2x2 matrix with variable-length values: + * // (0,0) = [] + * // (0,1) = ["a"] + * // (1,0) = ["b", "c"] + * // (1,1) = ["a"] + * truth_indices = [[0, 1, 0], + * [1, 0, 0], + * [1, 0, 1], + * [1, 1, 0]] + * truth_values = ["a", "b", "c", "a"] + * truth_shape = [2, 2, 2] + * normalize = true + *

+ * The output will be: + *

+ * // output is a 2x2 matrix with edit distances normalized by truth lengths. + * output = [[inf, 1.0], // (0,0): no truth, (0,1): no hypothesis + * [0.5, 1.0]] // (1,0): addition, (1,1): no hypothesis + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private EditDistance(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Einsum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Einsum.java new file mode 100644 index 00000000000..7b1d8568389 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Einsum.java @@ -0,0 +1,149 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Tensor contraction according to Einstein summation convention. + *

+ * Implements generalized Tensor contraction and reduction. Each input Tensor must + * have a corresponding input subscript appearing in the comma-separated left-hand + * side of the equation. The right-hand side of the equation consists of the + * output subscript. The input subscripts and the output subscript should consist + * of zero or more named axis labels and at most one ellipsis (`...`). + *

+ * The named axis labels may be any single character other than those having + * special meaning, namely `,.->`. The behavior of this Op is undefined if it + * receives an ill-formatted equation; since the validation is done at + * graph-building time, we omit format validation checks at runtime. + *

+ * Note: This Op is not intended to be called by the user; instead users should + * call `tf.einsum` directly. It is a hidden Op used by `tf.einsum`. + *

+ * Operations are applied to the input(s) according to the following rules: + *

+ * (a) Generalized Diagonals: For input dimensions corresponding to axis labels + * appearing more than once in the same input subscript, we take the + * generalized (`k`-dimensional) diagonal. + * For example, in the equation `iii->i` with input shape `[3, 3, 3]`, the + * generalized diagonal would consist of `3` elements at indices `(0, 0, 0)`, + * `(1, 1, 1)` and `(2, 2, 2)` to create a Tensor of shape `[3]`. + *

+ * (b) Reduction: Axes corresponding to labels appearing only in one input + * subscript but not in the output subscript are summed over prior to Tensor + * contraction. + * For example, in the equation `ab,bc->b`, the axis labels `a` and `c` are + * the reduction axis labels. + *

+ * (c) Batch Dimensions: Axes corresponding to labels appearing in each of the + * input subscripts and also in the output subscript make up the batch + * dimensions in Tensor contraction. Unnamed axis labels corresponding to + * ellipsis (`...`) also correspond to batch dimensions. + * For example, for the equation denoting batch matrix multiplication, + * `bij,bjk->bik`, the axis label `b` corresponds to a batch dimension. + *

+ * (d) Contraction: In case of binary einsum, axes corresponding to labels + * appearing in two different inputs (and not in the output) are contracted + * against each other. + * Considering the batch matrix multiplication equation again + * (`bij,bjk->bik`), the contracted axis label is `j`. + *

+ * (e) Expand Diagonal: If the output subcripts contain repeated (explicit) axis + * labels, the opposite operation of (a) is applied. For example, in the + * equation `i->iii`, and input shape `[3]`, the output of shape `[3, 3, 3]` + * are all zeros, except for the (generalized) diagonal which is populated + * with values from the input. + * Note: This operation is not supported by `np.einsum` or `tf.einsum`; it is + * provided to enable computing the symbolic gradient of `tf.einsum`. + *

+ * The output subcripts must contain only labels appearing in at least one of the + * input subscripts. Furthermore, all dimensions mapping to the same axis label + * must be equal. + *

+ * Any of the input and output subscripts may contain at most a single ellipsis + * (`...`). These ellipsis are mapped against dimensions not corresponding to any + * named axis label. If two inputs contain ellipsis, then they are broadcasted + * according to standard NumPy broadcasting + * [rules](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html). + *

+ * The broadcasted dimensions are placed in the corresponding location of the + * ellipsis in the output subscript. If the broadcasted dimensions are non-empty + * and the output subcripts do not contain ellipsis, then an InvalidArgument error + * is raised. + *

+ * @compatibility(numpy) + * Similar to [`numpy.einsum`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.einsum.html). + *

+ * Comparison with `numpy.einsum`: + *

+ * * This Op only supports unary and binary forms of `numpy.einsum`. + * * This Op does not support implicit form. (i.e. equations without `->`). + * * This Op also supports repeated indices in the output subscript, which is not + * supported by `numpy.einsum`. + * @end_compatibility + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Einsum extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Einsum operation. + * + * @param scope current scope + * @param inputs List of 1 or 2 Tensors. + * @param equation String describing the Einstein Summation operation; in the format of np.einsum. + * @return a new instance of Einsum + */ + public static Einsum create(Scope scope, Iterable> inputs, String equation) { + OperationBuilder opBuilder = scope.env().opBuilder("Einsum", scope.makeOpName("Einsum")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("equation", equation); + return new Einsum(opBuilder.build()); + } + + /** + * Output Tensor with shape depending upon `equation`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Einsum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Empty.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Empty.java new file mode 100644 index 00000000000..1d15b16bb04 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Empty.java @@ -0,0 +1,108 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a tensor with the given shape. + *

+ * This operation creates a tensor of `shape` and `dtype`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Empty extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Empty} + */ + public static class Options { + + /** + * @param init If True, initialize the returned tensor with the default value of dtype. Otherwise, the implementation is free not to initializethe tensor's content. + */ + public Options init(Boolean init) { + this.init = init; + return this; + } + + private Boolean init; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Empty operation. + * + * @param scope current scope + * @param shape 1-D. Represents the shape of the output tensor. + * @param dtype + * @param options carries optional attributes values + * @return a new instance of Empty + */ + public static Empty create(Scope scope, Operand shape, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Empty", scope.makeOpName("Empty")); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.init != null) { + opBuilder.setAttr("init", opts.init); + } + } + } + return new Empty(opBuilder.build()); + } + + /** + * @param init If True, initialize the returned tensor with the default value of dtype. Otherwise, the implementation is free not to initializethe tensor's content. + */ + public static Options init(Boolean init) { + return new Options().init(init); + } + + /** + * A `Tensor` of type `T`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Empty(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorList.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorList.java new file mode 100644 index 00000000000..f933e1d3c34 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorList.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates and returns an empty tensor list. + *

+ * All list elements must be tensors of dtype element_dtype and shape compatible + * with element_shape. + *

+ * handle: an empty tensor list. + * element_dtype: the type of elements in the list. + * element_shape: a shape compatible with that of elements in the list. + */ +@Operator +public final class EmptyTensorList extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new EmptyTensorList operation. + * + * @param scope current scope + * @param elementShape + * @param maxNumElements + * @param elementDtype + * @return a new instance of EmptyTensorList + */ + public static EmptyTensorList create(Scope scope, Operand elementShape, Operand maxNumElements, Class elementDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("EmptyTensorList", scope.makeOpName("EmptyTensorList")); + opBuilder.addInput(elementShape.asOutput()); + opBuilder.addInput(maxNumElements.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + return new EmptyTensorList(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private EmptyTensorList(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EncodeProto.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EncodeProto.java new file mode 100644 index 00000000000..2bcaec9aa45 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EncodeProto.java @@ -0,0 +1,152 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * The op serializes protobuf messages provided in the input tensors. + *

+ * The types of the tensors in `values` must match the schema for the fields + * specified in `field_names`. All the tensors in `values` must have a common + * shape prefix, batch_shape. + *

+ * The `sizes` tensor specifies repeat counts for each field. The repeat count + * (last dimension) of a each tensor in `values` must be greater than or equal + * to corresponding repeat count in `sizes`. + *

+ * A `message_type` name must be provided to give context for the field names. + * The actual message descriptor can be looked up either in the linked-in + * descriptor pool or a filename provided by the caller using the + * `descriptor_source` attribute. + *

+ * For the most part, the mapping between Proto field types and TensorFlow dtypes + * is straightforward. However, there are a few special cases: + *

+ * - A proto field that contains a submessage or group can only be converted + * to `DT_STRING` (the serialized submessage). This is to reduce the complexity + * of the API. The resulting string can be used as input to another instance of + * the decode_proto op. + *

+ * - TensorFlow lacks support for unsigned integers. The ops represent uint64 + * types as a `DT_INT64` with the same twos-complement bit pattern (the obvious + * way). Unsigned int32 values can be represented exactly by specifying type + * `DT_INT64`, or using twos-complement if the caller specifies `DT_INT32` in + * the `output_types` attribute. + *

+ * The `descriptor_source` attribute selects the source of protocol + * descriptors to consult when looking up `message_type`. This may be: + *

+ * - An empty string or "local://", in which case protocol descriptors are + * created for C++ (not Python) proto definitions linked to the binary. + *

+ * - A file, in which case protocol descriptors are created from the file, + * which is expected to contain a `FileDescriptorSet` serialized as a string. + * NOTE: You can build a `descriptor_source` file using the `--descriptor_set_out` + * and `--include_imports` options to the protocol compiler `protoc`. + *

+ * - A "bytes://", in which protocol descriptors are created from ``, + * which is expected to be a `FileDescriptorSet` serialized as a string. + */ +public final class EncodeProto extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.EncodeProto} + */ + public static class Options { + + /** + * @param descriptorSource + */ + public Options descriptorSource(String descriptorSource) { + this.descriptorSource = descriptorSource; + return this; + } + + private String descriptorSource; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EncodeProto operation. + * + * @param scope current scope + * @param sizes Tensor of int32 with shape `[batch_shape, len(field_names)]`. + * @param values List of tensors containing values for the corresponding field. + * @param fieldNames List of strings containing proto field names. + * @param messageType Name of the proto message type to decode. + * @param options carries optional attributes values + * @return a new instance of EncodeProto + */ + public static EncodeProto create(Scope scope, Operand sizes, Iterable> values, List fieldNames, String messageType, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EncodeProto", scope.makeOpName("EncodeProto")); + opBuilder.addInput(sizes.asOutput()); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder = scope.applyControlDependencies(opBuilder); + String[] fieldNamesArray = new String[fieldNames.size()]; + for (int i = 0; i < fieldNamesArray.length; ++i) { + fieldNamesArray[i] = fieldNames.get(i); + } + opBuilder.setAttr("field_names", fieldNamesArray); + opBuilder.setAttr("message_type", messageType); + if (options != null) { + for (Options opts : options) { + if (opts.descriptorSource != null) { + opBuilder.setAttr("descriptor_source", opts.descriptorSource); + } + } + } + return new EncodeProto(opBuilder.build()); + } + + /** + * @param descriptorSource + */ + public static Options descriptorSource(String descriptorSource) { + return new Options().descriptorSource(descriptorSource); + } + + /** + * Tensor of serialized protos with shape `batch_shape`. + */ + public Output bytes() { + return bytes; + } + + @Override + public Output asOutput() { + return bytes; + } + + private Output bytes; + + private EncodeProto(Operation operation) { + super(operation); + int outputIdx = 0; + bytes = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingIntegerBatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingIntegerBatch.java new file mode 100644 index 00000000000..d17275aebb0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingIntegerBatch.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op that enqueues a list of input batch tensors to TPUEmbedding. + */ +public final class EnqueueTPUEmbeddingIntegerBatch extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.EnqueueTPUEmbeddingIntegerBatch} + */ + public static class Options { + + /** + * @param deviceOrdinal The TPU device to use. Should be >= 0 and less than the number + * of TPU cores in the task on which the node is placed. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + private Long deviceOrdinal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EnqueueTPUEmbeddingIntegerBatch operation. + * + * @param scope current scope + * @param batch A list of 1D tensors, one for each embedding table, containing the + * indices into the tables. + * @param modeOverride A string input that overrides the mode specified in the + * TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', + * 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set + * in TPUEmbeddingConfiguration is used, otherwise mode_override is used. + * @param options carries optional attributes values + * @return a new instance of EnqueueTPUEmbeddingIntegerBatch + */ + public static EnqueueTPUEmbeddingIntegerBatch create(Scope scope, Iterable> batch, Operand modeOverride, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EnqueueTPUEmbeddingIntegerBatch", scope.makeOpName("EnqueueTPUEmbeddingIntegerBatch")); + opBuilder.addInputList(Operands.asOutputs(batch)); + opBuilder.addInput(modeOverride.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + } + } + return new EnqueueTPUEmbeddingIntegerBatch(opBuilder.build()); + } + + /** + * @param deviceOrdinal The TPU device to use. Should be >= 0 and less than the number + * of TPU cores in the task on which the node is placed. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + + private EnqueueTPUEmbeddingIntegerBatch(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseBatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseBatch.java new file mode 100644 index 00000000000..489907b3137 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseBatch.java @@ -0,0 +1,144 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op that enqueues TPUEmbedding input indices from a SparseTensor. + *

+ * This Op eases the porting of code that uses embedding_lookup_sparse(), + * although some Python preprocessing of the SparseTensor arguments to + * embedding_lookup_sparse() is required to produce the arguments to this Op, + * since only a single EnqueueTPUEmbeddingSparseBatch Op is allowed per training + * step. + *

+ * The tensors at corresponding positions in the three input lists + * must have the same shape, i.e. rank 1 with dim_size() equal to the total + * number of lookups into the table described by the corresponding table_id. + */ +public final class EnqueueTPUEmbeddingSparseBatch extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.EnqueueTPUEmbeddingSparseBatch} + */ + public static class Options { + + /** + * @param deviceOrdinal The TPU device to use. Should be >= 0 and less than the number + * of TPU cores in the task on which the node is placed. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + /** + * @param combiners A list of string scalars, one for each embedding table that specify + * how to normalize the embedding activations after weighted summation. + * Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have + * the sum of the weights be 0 for 'mean' or the sum of the squared weights be + * 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for + * all tables. + */ + public Options combiners(List combiners) { + this.combiners = combiners; + return this; + } + + private Long deviceOrdinal; + private List combiners; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EnqueueTPUEmbeddingSparseBatch operation. + * + * @param scope current scope + * @param sampleIndices A list of rank 1 Tensors specifying the training example and + * feature to which the corresponding embedding_indices and aggregation_weights + * values belong. sample_indices[i] must equal b * nf + f, where nf is the + * number of features from the corresponding table, f is in [0, nf), and + * b is in [0, batch size). + * @param embeddingIndices A list of rank 1 Tensors, indices into the embedding tables. + * @param aggregationWeights A list of rank 1 Tensors containing per sample -- i.e. per + * (training example, feature) -- aggregation weights. + * @param modeOverride A string input that overrides the mode specified in the + * TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', + * 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set + * in TPUEmbeddingConfiguration is used, otherwise mode_override is used. + * @param options carries optional attributes values + * @return a new instance of EnqueueTPUEmbeddingSparseBatch + */ + public static EnqueueTPUEmbeddingSparseBatch create(Scope scope, Iterable> sampleIndices, Iterable> embeddingIndices, Iterable> aggregationWeights, Operand modeOverride, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EnqueueTPUEmbeddingSparseBatch", scope.makeOpName("EnqueueTPUEmbeddingSparseBatch")); + opBuilder.addInputList(Operands.asOutputs(sampleIndices)); + opBuilder.addInputList(Operands.asOutputs(embeddingIndices)); + opBuilder.addInputList(Operands.asOutputs(aggregationWeights)); + opBuilder.addInput(modeOverride.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + if (opts.combiners != null) { + String[] combinersArray = new String[opts.combiners.size()]; + for (int i = 0; i < combinersArray.length; ++i) { + combinersArray[i] = opts.combiners.get(i); + } + opBuilder.setAttr("combiners", combinersArray); + } + } + } + return new EnqueueTPUEmbeddingSparseBatch(opBuilder.build()); + } + + /** + * @param deviceOrdinal The TPU device to use. Should be >= 0 and less than the number + * of TPU cores in the task on which the node is placed. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + /** + * @param combiners A list of string scalars, one for each embedding table that specify + * how to normalize the embedding activations after weighted summation. + * Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have + * the sum of the weights be 0 for 'mean' or the sum of the squared weights be + * 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for + * all tables. + */ + public static Options combiners(List combiners) { + return new Options().combiners(combiners); + } + + + private EnqueueTPUEmbeddingSparseBatch(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseTensorBatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseTensorBatch.java new file mode 100644 index 00000000000..74418c46616 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseTensorBatch.java @@ -0,0 +1,176 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Eases the porting of code that uses tf.nn.embedding_lookup_sparse(). + *

+ * sample_indices[i], embedding_indices[i] and aggregation_weights[i] correspond + * to the ith feature. table_ids[i] indicates which embedding table to look up ith + * feature. + *

+ * The tensors at corresponding positions in the three input lists (sample_indices, + * embedding_indices and aggregation_weights) must have the same shape, i.e. rank 1 + * with dim_size() equal to the total number of lookups into the table described by + * the corresponding feature. + */ +public final class EnqueueTPUEmbeddingSparseTensorBatch extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.EnqueueTPUEmbeddingSparseTensorBatch} + */ + public static class Options { + + /** + * @param deviceOrdinal The TPU device to use. Should be >= 0 and less than the number + * of TPU cores in the task on which the node is placed. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + /** + * @param combiners A list of string scalars, one for each embedding table that specify + * how to normalize the embedding activations after weighted summation. + * Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have + * the sum of the weights be 0 for 'mean' or the sum of the squared weights be + * 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for + * all tables. + */ + public Options combiners(List combiners) { + this.combiners = combiners; + return this; + } + + /** + * @param maxSequenceLengths + */ + public Options maxSequenceLengths(List maxSequenceLengths) { + this.maxSequenceLengths = maxSequenceLengths; + return this; + } + + private Long deviceOrdinal; + private List combiners; + private List maxSequenceLengths; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EnqueueTPUEmbeddingSparseTensorBatch operation. + * + * @param scope current scope + * @param sampleIndices A list of rank 1 Tensors specifying the training example to + * which the corresponding embedding_indices and aggregation_weights values + * belong. It corresponds to sp_ids.indices[:,0] in embedding_lookup_sparse(). + * @param embeddingIndices A list of rank 1 Tensors, indices into the embedding tables. + * It corresponds to sp_ids.values in embedding_lookup_sparse(). + * @param aggregationWeights A list of rank 1 Tensors containing per training example + * aggregation weights. It corresponds to sp_weights.values in + * embedding_lookup_sparse(). + * @param modeOverride A string input that overrides the mode specified in the + * TPUEmbeddingConfiguration. Supported values are {'unspecified', 'inference', + * 'training', 'backward_pass_only'}. When set to 'unspecified', the mode set + * in TPUEmbeddingConfiguration is used, otherwise mode_override is used. + * @param tableIds A list of integers specifying the identifier of the embedding table + * (offset of TableDescriptor in the TPUEmbeddingConfiguration) to lookup the + * corresponding input. The ith input is looked up using table_ids[i]. The size + * of the table_ids list must be equal to that of sample_indices, + * embedding_indices and aggregation_weights. + * @param options carries optional attributes values + * @return a new instance of EnqueueTPUEmbeddingSparseTensorBatch + */ + public static EnqueueTPUEmbeddingSparseTensorBatch create(Scope scope, Iterable> sampleIndices, Iterable> embeddingIndices, Iterable> aggregationWeights, Operand modeOverride, List tableIds, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EnqueueTPUEmbeddingSparseTensorBatch", scope.makeOpName("EnqueueTPUEmbeddingSparseTensorBatch")); + opBuilder.addInputList(Operands.asOutputs(sampleIndices)); + opBuilder.addInputList(Operands.asOutputs(embeddingIndices)); + opBuilder.addInputList(Operands.asOutputs(aggregationWeights)); + opBuilder.addInput(modeOverride.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] tableIdsArray = new long[tableIds.size()]; + for (int i = 0; i < tableIdsArray.length; ++i) { + tableIdsArray[i] = tableIds.get(i); + } + opBuilder.setAttr("table_ids", tableIdsArray); + if (options != null) { + for (Options opts : options) { + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + if (opts.combiners != null) { + String[] combinersArray = new String[opts.combiners.size()]; + for (int i = 0; i < combinersArray.length; ++i) { + combinersArray[i] = opts.combiners.get(i); + } + opBuilder.setAttr("combiners", combinersArray); + } + if (opts.maxSequenceLengths != null) { + long[] maxSequenceLengthsArray = new long[opts.maxSequenceLengths.size()]; + for (int i = 0; i < maxSequenceLengthsArray.length; ++i) { + maxSequenceLengthsArray[i] = opts.maxSequenceLengths.get(i); + } + opBuilder.setAttr("max_sequence_lengths", maxSequenceLengthsArray); + } + } + } + return new EnqueueTPUEmbeddingSparseTensorBatch(opBuilder.build()); + } + + /** + * @param deviceOrdinal The TPU device to use. Should be >= 0 and less than the number + * of TPU cores in the task on which the node is placed. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + /** + * @param combiners A list of string scalars, one for each embedding table that specify + * how to normalize the embedding activations after weighted summation. + * Supported combiners are 'mean', 'sum', or 'sqrtn'. It is invalid to have + * the sum of the weights be 0 for 'mean' or the sum of the squared weights be + * 0 for 'sqrtn'. If combiners isn't passed, the default is to use 'sum' for + * all tables. + */ + public static Options combiners(List combiners) { + return new Options().combiners(combiners); + } + + /** + * @param maxSequenceLengths + */ + public static Options maxSequenceLengths(List maxSequenceLengths) { + return new Options().maxSequenceLengths(maxSequenceLengths); + } + + + private EnqueueTPUEmbeddingSparseTensorBatch(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnsureShape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnsureShape.java new file mode 100644 index 00000000000..8d808e65730 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnsureShape.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Ensures that the tensor's shape matches the expected shape. + *

+ * Raises an error if the input tensor's shape does not match the specified shape. + * Returns the input tensor otherwise. + * + * @param data type for {@code output()} output + */ +@Operator +public final class EnsureShape extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new EnsureShape operation. + * + * @param scope current scope + * @param input A tensor, whose shape is to be validated. + * @param shape The expected (possibly partially specified) shape of the input tensor. + * @return a new instance of EnsureShape + */ + public static EnsureShape create(Scope scope, Operand input, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("EnsureShape", scope.makeOpName("EnsureShape")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape", shape); + return new EnsureShape(opBuilder.build()); + } + + /** + * A tensor with the same shape and contents as the input tensor or value. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private EnsureShape(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Enter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Enter.java new file mode 100644 index 00000000000..da98b0b6cf4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Enter.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates or finds a child frame, and makes `data` available to the child frame. + *

+ * This op is used together with `Exit` to create loops in the graph. + * The unique `frame_name` is used by the `Executor` to identify frames. If + * `is_constant` is true, `output` is a constant in the child frame; otherwise + * it may be changed in the child frame. At most `parallel_iterations` iterations + * are run in parallel in the child frame. + * + * @param data type for {@code output()} output + */ +public final class Enter extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Enter} + */ + public static class Options { + + /** + * @param isConstant If true, the output is constant within the child frame. + */ + public Options isConstant(Boolean isConstant) { + this.isConstant = isConstant; + return this; + } + + /** + * @param parallelIterations The number of iterations allowed to run in parallel. + */ + public Options parallelIterations(Long parallelIterations) { + this.parallelIterations = parallelIterations; + return this; + } + + private Boolean isConstant; + private Long parallelIterations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Enter operation. + * + * @param scope current scope + * @param data The tensor to be made available to the child frame. + * @param frameName The name of the child frame. + * @param options carries optional attributes values + * @return a new instance of Enter + */ + public static Enter create(Scope scope, Operand data, String frameName, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Enter", scope.makeOpName("Enter")); + opBuilder.addInput(data.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("frame_name", frameName); + if (options != null) { + for (Options opts : options) { + if (opts.isConstant != null) { + opBuilder.setAttr("is_constant", opts.isConstant); + } + if (opts.parallelIterations != null) { + opBuilder.setAttr("parallel_iterations", opts.parallelIterations); + } + } + } + return new Enter(opBuilder.build()); + } + + /** + * @param isConstant If true, the output is constant within the child frame. + */ + public static Options isConstant(Boolean isConstant) { + return new Options().isConstant(isConstant); + } + + /** + * @param parallelIterations The number of iterations allowed to run in parallel. + */ + public static Options parallelIterations(Long parallelIterations) { + return new Options().parallelIterations(parallelIterations); + } + + /** + * The same tensor as `data`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Enter(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EuclideanNorm.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EuclideanNorm.java new file mode 100644 index 00000000000..d1fa6d0bd5c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EuclideanNorm.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the euclidean norm of elements across dimensions of a tensor. + *

+ * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class EuclideanNorm extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.EuclideanNorm} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EuclideanNorm operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of EuclideanNorm + */ + public static EuclideanNorm create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EuclideanNorm", scope.makeOpName("EuclideanNorm")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new EuclideanNorm(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private EuclideanNorm(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Exit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Exit.java new file mode 100644 index 00000000000..be052db219a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Exit.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Exits the current frame to its parent frame. + *

+ * Exit makes its input `data` available to the parent frame. + * + * @param data type for {@code output()} output + */ +public final class Exit extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Exit operation. + * + * @param scope current scope + * @param data The tensor to be made available to the parent frame. + * @return a new instance of Exit + */ + public static Exit create(Scope scope, Operand data) { + OperationBuilder opBuilder = scope.env().opBuilder("Exit", scope.makeOpName("Exit")); + opBuilder.addInput(data.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Exit(opBuilder.build()); + } + + /** + * The same tensor as `data`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Exit(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExpandDims.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExpandDims.java new file mode 100644 index 00000000000..192a86a4cbf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExpandDims.java @@ -0,0 +1,103 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Inserts a dimension of 1 into a tensor's shape. + *

+ * Given a tensor `input`, this operation inserts a dimension of 1 at the + * dimension index `axis` of `input`'s shape. The dimension index `axis` starts at + * zero; if you specify a negative number for `axis` it is counted backward from + * the end. + *

+ * This operation is useful if you want to add a batch dimension to a single + * element. For example, if you have a single image of shape `[height, width, + * channels]`, you can make it a batch of 1 image with `expand_dims(image, 0)`, + * which will make the shape `[1, height, width, channels]`. + *

+ * Other examples: + *

{@code
+ * # 't' is a tensor of shape [2]
+ * shape(expand_dims(t, 0)) ==> [1, 2]
+ * shape(expand_dims(t, 1)) ==> [2, 1]
+ * shape(expand_dims(t, -1)) ==> [2, 1]
+ * 
+ * # 't2' is a tensor of shape [2, 3, 5]
+ * shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
+ * shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
+ * shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]
+ * }
+ * This operation requires that: + *

+ * `-1-input.dims() <= dim <= input.dims()` + *

+ * This operation is related to `squeeze()`, which removes dimensions of + * size 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ExpandDims extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExpandDims operation. + * + * @param scope current scope + * @param input + * @param axis 0-D (scalar). Specifies the dimension index at which to + * expand the shape of `input`. Must be in the range + * `[-rank(input) - 1, rank(input)]`. + * @return a new instance of ExpandDims + */ + public static ExpandDims create(Scope scope, Operand input, Operand axis) { + OperationBuilder opBuilder = scope.env().opBuilder("ExpandDims", scope.makeOpName("ExpandDims")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ExpandDims(opBuilder.build()); + } + + /** + * Contains the same data as `input`, but its shape has an additional + * dimension of size 1 added. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ExpandDims(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalAutoShardDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalAutoShardDataset.java new file mode 100644 index 00000000000..9f8a0a3b8c1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalAutoShardDataset.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that shards the input dataset. + *

+ * Creates a dataset that shards the input dataset by num_workers, returning a + * sharded dataset for the index-th worker. This attempts to automatically shard + * a dataset by examining the Dataset graph and inserting a shard op before the + * inputs to a reader Dataset (e.g. CSVDataset, TFRecordDataset). + *

+ * This dataset will throw a NotFound error if we cannot shard the dataset + * automatically. + */ +public final class ExperimentalAutoShardDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalAutoShardDataset operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @param numWorkers A scalar representing the number of workers to distribute this dataset across. + * @param index A scalar representing the index of the current worker out of num_workers. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalAutoShardDataset + */ + public static ExperimentalAutoShardDataset create(Scope scope, Operand inputDataset, Operand numWorkers, Operand index, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalAutoShardDataset", scope.makeOpName("ExperimentalAutoShardDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numWorkers.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalAutoShardDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalAutoShardDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalBytesProducedStatsDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalBytesProducedStatsDataset.java new file mode 100644 index 00000000000..667105314ae --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalBytesProducedStatsDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Records the bytes size of each element of `input_dataset` in a StatsAggregator. + */ +public final class ExperimentalBytesProducedStatsDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalBytesProducedStatsDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param tag + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalBytesProducedStatsDataset + */ + public static ExperimentalBytesProducedStatsDataset create(Scope scope, Operand inputDataset, Operand tag, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalBytesProducedStatsDataset", scope.makeOpName("ExperimentalBytesProducedStatsDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalBytesProducedStatsDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalBytesProducedStatsDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalChooseFastestDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalChooseFastestDataset.java new file mode 100644 index 00000000000..402b1096985 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalChooseFastestDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalChooseFastestDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalChooseFastestDataset operation. + * + * @param scope current scope + * @param inputDatasets + * @param numExperiments + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalChooseFastestDataset + */ + public static ExperimentalChooseFastestDataset create(Scope scope, Iterable> inputDatasets, Long numExperiments, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalChooseFastestDataset", scope.makeOpName("ExperimentalChooseFastestDataset")); + opBuilder.addInputList(Operands.asOutputs(inputDatasets)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_experiments", numExperiments); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalChooseFastestDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalChooseFastestDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetCardinality.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetCardinality.java new file mode 100644 index 00000000000..4a81173ed9a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetCardinality.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns the cardinality of `input_dataset`. + *

+ * Returns the cardinality of `input_dataset`. + */ +public final class ExperimentalDatasetCardinality extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalDatasetCardinality operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the dataset to return cardinality for. + * @return a new instance of ExperimentalDatasetCardinality + */ + public static ExperimentalDatasetCardinality create(Scope scope, Operand inputDataset) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalDatasetCardinality", scope.makeOpName("ExperimentalDatasetCardinality")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ExperimentalDatasetCardinality(opBuilder.build()); + } + + /** + * The cardinality of `input_dataset`. Named constants are used to represent + * infinite and unknown cardinality. + */ + public Output cardinality() { + return cardinality; + } + + @Override + public Output asOutput() { + return cardinality; + } + + private Output cardinality; + + private ExperimentalDatasetCardinality(Operation operation) { + super(operation); + int outputIdx = 0; + cardinality = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetToTFRecord.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetToTFRecord.java new file mode 100644 index 00000000000..77f0a40e7fd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetToTFRecord.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Writes the given dataset to the given file using the TFRecord format. + */ +public final class ExperimentalDatasetToTFRecord extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ExperimentalDatasetToTFRecord operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the dataset to write. + * @param filename A scalar string tensor representing the filename to use. + * @param compressionType A scalar string tensor containing either (i) the empty string (no + * compression), (ii) "ZLIB", or (iii) "GZIP". + * @return a new instance of ExperimentalDatasetToTFRecord + */ + public static ExperimentalDatasetToTFRecord create(Scope scope, Operand inputDataset, Operand filename, Operand compressionType) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalDatasetToTFRecord", scope.makeOpName("ExperimentalDatasetToTFRecord")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(filename.asOutput()); + opBuilder.addInput(compressionType.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ExperimentalDatasetToTFRecord(opBuilder.build()); + } + + + private ExperimentalDatasetToTFRecord(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDenseToSparseBatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDenseToSparseBatchDataset.java new file mode 100644 index 00000000000..7a0095b0a05 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDenseToSparseBatchDataset.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that batches input elements into a SparseTensor. + */ +public final class ExperimentalDenseToSparseBatchDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalDenseToSparseBatchDataset operation. + * + * @param scope current scope + * @param inputDataset A handle to an input dataset. Must have a single component. + * @param batchSize A scalar representing the number of elements to accumulate in a + * batch. + * @param rowShape A vector representing the dense shape of each row in the produced + * SparseTensor. The shape may be partially specified, using `-1` to indicate + * that a particular dimension should use the maximum size of all batch elements. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalDenseToSparseBatchDataset + */ + public static ExperimentalDenseToSparseBatchDataset create(Scope scope, Operand inputDataset, Operand batchSize, Operand rowShape, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalDenseToSparseBatchDataset", scope.makeOpName("ExperimentalDenseToSparseBatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(batchSize.asOutput()); + opBuilder.addInput(rowShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalDenseToSparseBatchDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalDenseToSparseBatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalLatencyStatsDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalLatencyStatsDataset.java new file mode 100644 index 00000000000..787c91bb9e2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalLatencyStatsDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Records the latency of producing `input_dataset` elements in a StatsAggregator. + */ +public final class ExperimentalLatencyStatsDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalLatencyStatsDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param tag + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalLatencyStatsDataset + */ + public static ExperimentalLatencyStatsDataset create(Scope scope, Operand inputDataset, Operand tag, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalLatencyStatsDataset", scope.makeOpName("ExperimentalLatencyStatsDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalLatencyStatsDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalLatencyStatsDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMatchingFilesDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMatchingFilesDataset.java new file mode 100644 index 00000000000..0508f121e7b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMatchingFilesDataset.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalMatchingFilesDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalMatchingFilesDataset operation. + * + * @param scope current scope + * @param patterns + * @return a new instance of ExperimentalMatchingFilesDataset + */ + public static ExperimentalMatchingFilesDataset create(Scope scope, Operand patterns) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalMatchingFilesDataset", scope.makeOpName("ExperimentalMatchingFilesDataset")); + opBuilder.addInput(patterns.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ExperimentalMatchingFilesDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalMatchingFilesDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMaxIntraOpParallelismDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMaxIntraOpParallelismDataset.java new file mode 100644 index 00000000000..57c5b91add8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMaxIntraOpParallelismDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that overrides the maximum intra-op parallelism. + */ +public final class ExperimentalMaxIntraOpParallelismDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalMaxIntraOpParallelismDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param maxIntraOpParallelism Identifies the maximum intra-op parallelism to use. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalMaxIntraOpParallelismDataset + */ + public static ExperimentalMaxIntraOpParallelismDataset create(Scope scope, Operand inputDataset, Operand maxIntraOpParallelism, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalMaxIntraOpParallelismDataset", scope.makeOpName("ExperimentalMaxIntraOpParallelismDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(maxIntraOpParallelism.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalMaxIntraOpParallelismDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalMaxIntraOpParallelismDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalParseExampleDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalParseExampleDataset.java new file mode 100644 index 00000000000..eae72a12ee0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalParseExampleDataset.java @@ -0,0 +1,156 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Transforms `input_dataset` containing `Example` protos as vectors of DT_STRING into a dataset of `Tensor` or `SparseTensor` objects representing the parsed features. + */ +public final class ExperimentalParseExampleDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ExperimentalParseExampleDataset} + */ + public static class Options { + + /** + * @param sloppy + */ + public Options sloppy(Boolean sloppy) { + this.sloppy = sloppy; + return this; + } + + private Boolean sloppy; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ExperimentalParseExampleDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param numParallelCalls + * @param denseDefaults A dict mapping string keys to `Tensor`s. + * The keys of the dict must match the dense_keys of the feature. + * @param sparseKeys A list of string keys in the examples features. + * The results for these keys will be returned as `SparseTensor` objects. + * @param denseKeys A list of Ndense string Tensors (scalars). + * The keys expected in the Examples features associated with dense values. + * @param sparseTypes A list of `DTypes` of the same length as `sparse_keys`. + * Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), + * and `tf.string` (`BytesList`) are supported. + * @param denseShapes List of tuples with the same length as `dense_keys`. + * The shape of the data for each dense feature referenced by `dense_keys`. + * Required for any input tensors identified by `dense_keys`. Must be + * either fully defined, or may contain an unknown first dimension. + * An unknown first dimension means the feature is treated as having + * a variable number of blocks, and the output shape along this dimension + * is considered unknown at graph build time. Padding is applied for + * minibatch elements smaller than the maximum number of blocks for the + * given feature along this dimension. + * @param outputTypes The type list for the return values. + * @param outputShapes The list of shapes being produced. + * @param options carries optional attributes values + * @return a new instance of ExperimentalParseExampleDataset + */ + public static ExperimentalParseExampleDataset create(Scope scope, Operand inputDataset, Operand numParallelCalls, Iterable> denseDefaults, List sparseKeys, List denseKeys, List> sparseTypes, List denseShapes, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalParseExampleDataset", scope.makeOpName("ExperimentalParseExampleDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numParallelCalls.asOutput()); + opBuilder.addInputList(Operands.asOutputs(denseDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + String[] sparseKeysArray = new String[sparseKeys.size()]; + for (int i = 0; i < sparseKeysArray.length; ++i) { + sparseKeysArray[i] = sparseKeys.get(i); + } + opBuilder.setAttr("sparse_keys", sparseKeysArray); + String[] denseKeysArray = new String[denseKeys.size()]; + for (int i = 0; i < denseKeysArray.length; ++i) { + denseKeysArray[i] = denseKeys.get(i); + } + opBuilder.setAttr("dense_keys", denseKeysArray); + DataType[] sparseTypesArray = new DataType[sparseTypes.size()]; + for (int i = 0; i < sparseTypesArray.length; ++i) { + sparseTypesArray[i] = DataType.fromClass(sparseTypes.get(i)); + } + opBuilder.setAttr("sparse_types", sparseTypesArray); + Shape[] denseShapesArray = new Shape[denseShapes.size()]; + for (int i = 0; i < denseShapesArray.length; ++i) { + denseShapesArray[i] = denseShapes.get(i); + } + opBuilder.setAttr("dense_shapes", denseShapesArray); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.sloppy != null) { + opBuilder.setAttr("sloppy", opts.sloppy); + } + } + } + return new ExperimentalParseExampleDataset(opBuilder.build()); + } + + /** + * @param sloppy + */ + public static Options sloppy(Boolean sloppy) { + return new Options().sloppy(sloppy); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalParseExampleDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalPrivateThreadPoolDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalPrivateThreadPoolDataset.java new file mode 100644 index 00000000000..cea1ae5081e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalPrivateThreadPoolDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that uses a custom thread pool to compute `input_dataset`. + */ +public final class ExperimentalPrivateThreadPoolDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalPrivateThreadPoolDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param numThreads Identifies the number of threads to use for the private threadpool. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalPrivateThreadPoolDataset + */ + public static ExperimentalPrivateThreadPoolDataset create(Scope scope, Operand inputDataset, Operand numThreads, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalPrivateThreadPoolDataset", scope.makeOpName("ExperimentalPrivateThreadPoolDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numThreads.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalPrivateThreadPoolDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalPrivateThreadPoolDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRandomDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRandomDataset.java new file mode 100644 index 00000000000..7a524b3f46f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRandomDataset.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a Dataset that returns pseudorandom numbers. + */ +public final class ExperimentalRandomDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalRandomDataset operation. + * + * @param scope current scope + * @param seed A scalar seed for the random number generator. If either seed or + * seed2 is set to be non-zero, the random number generator is seeded + * by the given seed. Otherwise, a random seed is used. + * @param seed2 A second scalar seed to avoid seed collision. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalRandomDataset + */ + public static ExperimentalRandomDataset create(Scope scope, Operand seed, Operand seed2, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalRandomDataset", scope.makeOpName("ExperimentalRandomDataset")); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(seed2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalRandomDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalRandomDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRebatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRebatchDataset.java new file mode 100644 index 00000000000..1165d155e34 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRebatchDataset.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that changes the batch size. + *

+ * Creates a dataset that changes the batch size of the dataset to current batch + * size // num_replicas. + */ +public final class ExperimentalRebatchDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ExperimentalRebatchDataset} + */ + public static class Options { + + /** + * @param useFallback + */ + public Options useFallback(Boolean useFallback) { + this.useFallback = useFallback; + return this; + } + + private Boolean useFallback; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ExperimentalRebatchDataset operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @param numReplicas A scalar representing the number of replicas to distribute this batch across. As + * a result of this transformation the current batch size would end up being + * divided by this parameter. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of ExperimentalRebatchDataset + */ + public static ExperimentalRebatchDataset create(Scope scope, Operand inputDataset, Operand numReplicas, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalRebatchDataset", scope.makeOpName("ExperimentalRebatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numReplicas.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.useFallback != null) { + opBuilder.setAttr("use_fallback", opts.useFallback); + } + } + } + return new ExperimentalRebatchDataset(opBuilder.build()); + } + + /** + * @param useFallback + */ + public static Options useFallback(Boolean useFallback) { + return new Options().useFallback(useFallback); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalRebatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSetStatsAggregatorDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSetStatsAggregatorDataset.java new file mode 100644 index 00000000000..d29f82a6ee9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSetStatsAggregatorDataset.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalSetStatsAggregatorDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalSetStatsAggregatorDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param statsAggregator + * @param tag + * @param counterPrefix + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalSetStatsAggregatorDataset + */ + public static ExperimentalSetStatsAggregatorDataset create(Scope scope, Operand inputDataset, Operand statsAggregator, Operand tag, Operand counterPrefix, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalSetStatsAggregatorDataset", scope.makeOpName("ExperimentalSetStatsAggregatorDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(statsAggregator.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(counterPrefix.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalSetStatsAggregatorDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalSetStatsAggregatorDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSlidingWindowDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSlidingWindowDataset.java new file mode 100644 index 00000000000..77b38724316 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSlidingWindowDataset.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that passes a sliding window over `input_dataset`. + */ +public final class ExperimentalSlidingWindowDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalSlidingWindowDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param windowSize A scalar representing the number of elements in the + * sliding window. + * @param windowShift A scalar representing the steps moving the sliding window + * forward in one iteration. It must be positive. + * @param windowStride A scalar representing the stride of the input elements of the sliding window. + * It must be positive. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalSlidingWindowDataset + */ + public static ExperimentalSlidingWindowDataset create(Scope scope, Operand inputDataset, Operand windowSize, Operand windowShift, Operand windowStride, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalSlidingWindowDataset", scope.makeOpName("ExperimentalSlidingWindowDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(windowSize.asOutput()); + opBuilder.addInput(windowShift.asOutput()); + opBuilder.addInput(windowStride.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalSlidingWindowDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalSlidingWindowDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSqlDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSqlDataset.java new file mode 100644 index 00000000000..d576d457738 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSqlDataset.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that executes a SQL query and emits rows of the result set. + */ +public final class ExperimentalSqlDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalSqlDataset operation. + * + * @param scope current scope + * @param driverName The database type. Currently, the only supported type is 'sqlite'. + * @param dataSourceName A connection string to connect to the database. + * @param query A SQL query to execute. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalSqlDataset + */ + public static ExperimentalSqlDataset create(Scope scope, Operand driverName, Operand dataSourceName, Operand query, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalSqlDataset", scope.makeOpName("ExperimentalSqlDataset")); + opBuilder.addInput(driverName.asOutput()); + opBuilder.addInput(dataSourceName.asOutput()); + opBuilder.addInput(query.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalSqlDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalSqlDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorHandle.java new file mode 100644 index 00000000000..cf00b6039b6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorHandle.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a statistics manager resource. + */ +public final class ExperimentalStatsAggregatorHandle extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ExperimentalStatsAggregatorHandle} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ExperimentalStatsAggregatorHandle operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of ExperimentalStatsAggregatorHandle + */ + public static ExperimentalStatsAggregatorHandle create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalStatsAggregatorHandle", scope.makeOpName("ExperimentalStatsAggregatorHandle")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new ExperimentalStatsAggregatorHandle(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalStatsAggregatorHandle(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorSummary.java new file mode 100644 index 00000000000..39aedb8a8c2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorSummary.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Produces a summary of any statistics recorded by the given statistics manager. + */ +public final class ExperimentalStatsAggregatorSummary extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalStatsAggregatorSummary operation. + * + * @param scope current scope + * @param iterator + * @return a new instance of ExperimentalStatsAggregatorSummary + */ + public static ExperimentalStatsAggregatorSummary create(Scope scope, Operand iterator) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalStatsAggregatorSummary", scope.makeOpName("ExperimentalStatsAggregatorSummary")); + opBuilder.addInput(iterator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ExperimentalStatsAggregatorSummary(opBuilder.build()); + } + + /** + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private ExperimentalStatsAggregatorSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalUnbatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalUnbatchDataset.java new file mode 100644 index 00000000000..060cb11ccc0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalUnbatchDataset.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A dataset that splits the elements of its input into multiple elements. + */ +public final class ExperimentalUnbatchDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalUnbatchDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalUnbatchDataset + */ + public static ExperimentalUnbatchDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalUnbatchDataset", scope.makeOpName("ExperimentalUnbatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalUnbatchDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalUnbatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExtractVolumePatches.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExtractVolumePatches.java new file mode 100644 index 00000000000..526b749e8f2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExtractVolumePatches.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Extract `patches` from `input` and put them in the "depth" output dimension. 3D extension of `extract_image_patches`. + * + * @param data type for {@code patches()} output + */ +@Operator +public final class ExtractVolumePatches extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExtractVolumePatches operation. + * + * @param scope current scope + * @param input 5-D Tensor with shape `[batch, in_planes, in_rows, in_cols, depth]`. + * @param ksizes The size of the sliding window for each dimension of `input`. + * @param strides 1-D of length 5. How far the centers of two consecutive patches are in + * `input`. Must be: `[1, stride_planes, stride_rows, stride_cols, 1]`. + * @param padding The type of padding algorithm to use. + *

+ * We specify the size-related attributes as: + *

{@code
+   *       ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1]
+   *       strides = [1, stride_planes, strides_rows, strides_cols, 1]
+   * }
+ * + * @return a new instance of ExtractVolumePatches + */ + public static ExtractVolumePatches create(Scope scope, Operand input, List ksizes, List strides, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("ExtractVolumePatches", scope.makeOpName("ExtractVolumePatches")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizesArray = new long[ksizes.size()]; + for (int i = 0; i < ksizesArray.length; ++i) { + ksizesArray[i] = ksizes.get(i); + } + opBuilder.setAttr("ksizes", ksizesArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + return new ExtractVolumePatches(opBuilder.build()); + } + + /** + * 5-D Tensor with shape `[batch, out_planes, out_rows, out_cols, + * ksize_planes * ksize_rows * ksize_cols * depth]` containing patches + * with size `ksize_planes x ksize_rows x ksize_cols x depth` vectorized + * in the "depth" dimension. Note `out_planes`, `out_rows` and `out_cols` + * are the dimensions of the output patches. + */ + public Output patches() { + return patches; + } + + @Override + public Output asOutput() { + return patches; + } + + private Output patches; + + private ExtractVolumePatches(Operation operation) { + super(operation); + int outputIdx = 0; + patches = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fill.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fill.java new file mode 100644 index 00000000000..4bd71e2aa29 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fill.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a tensor filled with a scalar value. + *

+ * This operation creates a tensor of shape `dims` and fills it with `value`. + *

+ * For example: + *

{@code
+ * # Output tensor has shape [2, 3].
+ * fill([2, 3], 9) ==> [[9, 9, 9]
+ *                      [9, 9, 9]]
+ * }
+ * `tf.fill` differs from `tf.constant` in a few ways: + *
    + *
  • + * `tf.fill` only supports scalar contents, whereas `tf.constant` supports + * Tensor values. + *
  • + *
  • + * `tf.fill` creates an Op in the computation graph that constructs the actual + * Tensor value at runtime. This is in contrast to `tf.constant` which embeds + * the entire Tensor into the graph with a `Const` node. + *
  • + *
  • + * Because `tf.fill` evaluates at graph runtime, it supports dynamic shapes + * based on other runtime Tensors, unlike `tf.constant`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Fill extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Fill operation. + * + * @param scope current scope + * @param dims 1-D. Represents the shape of the output tensor. + * @param value 0-D (scalar). Value to fill the returned tensor. + *

    + * @compatibility(numpy) + * Equivalent to np.full + * @end_compatibility + * @return a new instance of Fill + */ + public static Fill create(Scope scope, Operand dims, Operand value) { + OperationBuilder opBuilder = scope.env().opBuilder("Fill", scope.makeOpName("Fill")); + opBuilder.addInput(dims.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Fill(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Fill(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fingerprint.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fingerprint.java new file mode 100644 index 00000000000..70fe53cb11b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fingerprint.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Generates fingerprint values. + *

    + * Generates fingerprint values of `data`. + *

    + * Fingerprint op considers the first dimension of `data` as the batch dimension, + * and `output[i]` contains the fingerprint value generated from contents in + * `data[i, ...]` for all `i`. + *

    + * Fingerprint op writes fingerprint values as byte arrays. For example, the + * default method `farmhash64` generates a 64-bit fingerprint value at a time. + * This 8-byte value is written out as an `uint8` array of size 8, in little-endian + * order. + *

    + * For example, suppose that `data` has data type `DT_INT32` and shape (2, 3, 4), + * and that the fingerprint method is `farmhash64`. In this case, the output shape + * is (2, 8), where 2 is the batch dimension size of `data`, and 8 is the size of + * each fingerprint value in bytes. `output[0, :]` is generated from 12 integers in + * `data[0, :, :]` and similarly `output[1, :]` is generated from other 12 integers + * in `data[1, :, :]`. + *

    + * Note that this op fingerprints the raw underlying buffer, and it does not + * fingerprint Tensor's metadata such as data type and/or shape. For example, the + * fingerprint values are invariant under reshapes and bitcasts as long as the + * batch dimension remain the same: + *

    {@code
    + * Fingerprint(data) == Fingerprint(Reshape(data, ...))
    + * Fingerprint(data) == Fingerprint(Bitcast(data, ...))
    + * }
    + * For string data, one should expect `Fingerprint(data) != + * Fingerprint(ReduceJoin(data))` in general. + */ +@Operator +public final class Fingerprint extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Fingerprint operation. + * + * @param scope current scope + * @param data Must have rank 1 or higher. + * @param method Fingerprint method used by this op. Currently available method is + * `farmhash::fingerprint64`. + * @return a new instance of Fingerprint + */ + public static Fingerprint create(Scope scope, Operand data, Operand method) { + OperationBuilder opBuilder = scope.env().opBuilder("Fingerprint", scope.makeOpName("Fingerprint")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(method.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Fingerprint(opBuilder.build()); + } + + /** + * A two-dimensional `Tensor` of type `tf.uint8`. The first dimension equals to + * `data`'s first dimension, and the second dimension size depends on the + * fingerprint algorithm. + */ + public Output fingerprint() { + return fingerprint; + } + + @Override + public Output asOutput() { + return fingerprint; + } + + private Output fingerprint; + + private Fingerprint(Operation operation) { + super(operation); + int outputIdx = 0; + fingerprint = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormGradV3.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormGradV3.java new file mode 100644 index 00000000000..9e9ab0f9b5d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormGradV3.java @@ -0,0 +1,200 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gradient for batch normalization. + *

    + * Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". + * The size of 1D Tensors matches the dimension C of the 4D Tensors. + * + * @param data type for {@code xBackprop()} output + * @param data type for {@code scaleBackprop()} output + */ +@Operator +public final class FusedBatchNormGradV3 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.FusedBatchNormGradV3} + */ + public static class Options { + + /** + * @param epsilon A small float number added to the variance of x. + */ + public Options epsilon(Float epsilon) { + this.epsilon = epsilon; + return this; + } + + /** + * @param dataFormat The data format for y_backprop, x, x_backprop. + * Either "NHWC" (default) or "NCHW". + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public Options isTraining(Boolean isTraining) { + this.isTraining = isTraining; + return this; + } + + private Float epsilon; + private String dataFormat; + private Boolean isTraining; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FusedBatchNormGradV3 operation. + * + * @param scope current scope + * @param yBackprop A 4D Tensor for the gradient with respect to y. + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param reserveSpace1 When is_training is True, a 1D Tensor for the computed batch + * mean to be reused in gradient computation. When is_training is + * False, a 1D Tensor for the population mean to be reused in both + * 1st and 2nd order gradient computation. + * @param reserveSpace2 When is_training is True, a 1D Tensor for the computed batch + * variance (inverted variance in the cuDNN case) to be reused in + * gradient computation. When is_training is False, a 1D Tensor + * for the population variance to be reused in both 1st and 2nd + * order gradient computation. + * @param reserveSpace3 When is_training is True, a 1D Tensor for some intermediate results to be reused + * in gradient computation. When is_training is False, a dummy empty Tensor will be + * created. + * @param options carries optional attributes values + * @return a new instance of FusedBatchNormGradV3 + */ + public static FusedBatchNormGradV3 create(Scope scope, Operand yBackprop, Operand x, Operand scale, Operand reserveSpace1, Operand reserveSpace2, Operand reserveSpace3, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FusedBatchNormGradV3", scope.makeOpName("FusedBatchNormGradV3")); + opBuilder.addInput(yBackprop.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(scale.asOutput()); + opBuilder.addInput(reserveSpace1.asOutput()); + opBuilder.addInput(reserveSpace2.asOutput()); + opBuilder.addInput(reserveSpace3.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.epsilon != null) { + opBuilder.setAttr("epsilon", opts.epsilon); + } + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.isTraining != null) { + opBuilder.setAttr("is_training", opts.isTraining); + } + } + } + return new FusedBatchNormGradV3(opBuilder.build()); + } + + /** + * @param epsilon A small float number added to the variance of x. + */ + public static Options epsilon(Float epsilon) { + return new Options().epsilon(epsilon); + } + + /** + * @param dataFormat The data format for y_backprop, x, x_backprop. + * Either "NHWC" (default) or "NCHW". + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public static Options isTraining(Boolean isTraining) { + return new Options().isTraining(isTraining); + } + + /** + * A 4D Tensor for the gradient with respect to x. + */ + public Output xBackprop() { + return xBackprop; + } + + /** + * A 1D Tensor for the gradient with respect to scale. + */ + public Output scaleBackprop() { + return scaleBackprop; + } + + /** + * A 1D Tensor for the gradient with respect to offset. + */ + public Output offsetBackprop() { + return offsetBackprop; + } + + /** + * Unused placeholder to match the mean input in FusedBatchNorm. + */ + public Output reserveSpace4() { + return reserveSpace4; + } + + /** + * Unused placeholder to match the variance input + * in FusedBatchNorm. + */ + public Output reserveSpace5() { + return reserveSpace5; + } + + private Output xBackprop; + private Output scaleBackprop; + private Output offsetBackprop; + private Output reserveSpace4; + private Output reserveSpace5; + + private FusedBatchNormGradV3(Operation operation) { + super(operation); + int outputIdx = 0; + xBackprop = operation.output(outputIdx++); + scaleBackprop = operation.output(outputIdx++); + offsetBackprop = operation.output(outputIdx++); + reserveSpace4 = operation.output(outputIdx++); + reserveSpace5 = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormV3.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormV3.java new file mode 100644 index 00000000000..1c3240c2e2a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormV3.java @@ -0,0 +1,202 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Batch normalization. + *

    + * Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". + * The size of 1D Tensors matches the dimension C of the 4D Tensors. + * + * @param data type for {@code y()} output + * @param data type for {@code batchMean()} output + */ +@Operator +public final class FusedBatchNormV3 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.FusedBatchNormV3} + */ + public static class Options { + + /** + * @param epsilon A small float number added to the variance of x. + */ + public Options epsilon(Float epsilon) { + this.epsilon = epsilon; + return this; + } + + /** + * @param dataFormat The data format for x and y. Either "NHWC" (default) or "NCHW". + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public Options isTraining(Boolean isTraining) { + this.isTraining = isTraining; + return this; + } + + private Float epsilon; + private String dataFormat; + private Boolean isTraining; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FusedBatchNormV3 operation. + * + * @param scope current scope + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param offset A 1D Tensor for offset, to shift to the normalized x. + * @param mean A 1D Tensor for population mean. Used for inference only; + * must be empty for training. + * @param variance A 1D Tensor for population variance. Used for inference only; + * must be empty for training. + * @param options carries optional attributes values + * @return a new instance of FusedBatchNormV3 + */ + public static FusedBatchNormV3 create(Scope scope, Operand x, Operand scale, Operand offset, Operand mean, Operand variance, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FusedBatchNormV3", scope.makeOpName("FusedBatchNormV3")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(scale.asOutput()); + opBuilder.addInput(offset.asOutput()); + opBuilder.addInput(mean.asOutput()); + opBuilder.addInput(variance.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.epsilon != null) { + opBuilder.setAttr("epsilon", opts.epsilon); + } + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.isTraining != null) { + opBuilder.setAttr("is_training", opts.isTraining); + } + } + } + return new FusedBatchNormV3(opBuilder.build()); + } + + /** + * @param epsilon A small float number added to the variance of x. + */ + public static Options epsilon(Float epsilon) { + return new Options().epsilon(epsilon); + } + + /** + * @param dataFormat The data format for x and y. Either "NHWC" (default) or "NCHW". + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public static Options isTraining(Boolean isTraining) { + return new Options().isTraining(isTraining); + } + + /** + * A 4D Tensor for output data. + */ + public Output y() { + return y; + } + + /** + * A 1D Tensor for the computed batch mean, to be used by TensorFlow + * to compute the running mean. + */ + public Output batchMean() { + return batchMean; + } + + /** + * A 1D Tensor for the computed batch variance, to be used by + * TensorFlow to compute the running variance. + */ + public Output batchVariance() { + return batchVariance; + } + + /** + * A 1D Tensor for the computed batch mean, to be reused + * in the gradient computation. + */ + public Output reserveSpace1() { + return reserveSpace1; + } + + /** + * A 1D Tensor for the computed batch variance (inverted variance + * in the cuDNN case), to be reused in the gradient computation. + */ + public Output reserveSpace2() { + return reserveSpace2; + } + + /** + * A 1D Tensor for some intermediate results, to be reused in the gradient + * computation for better efficiency. + */ + public Output reserveSpace3() { + return reserveSpace3; + } + + private Output y; + private Output batchMean; + private Output batchVariance; + private Output reserveSpace1; + private Output reserveSpace2; + private Output reserveSpace3; + + private FusedBatchNormV3(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + batchMean = operation.output(outputIdx++); + batchVariance = operation.output(outputIdx++); + reserveSpace1 = operation.output(outputIdx++); + reserveSpace2 = operation.output(outputIdx++); + reserveSpace3 = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCell.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCell.java new file mode 100644 index 00000000000..c7c83573a0f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCell.java @@ -0,0 +1,140 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the GRU cell forward propagation for 1 time step. + *

    + * Args + * x: Input to the GRU cell. + * h_prev: State input from the previous GRU cell. + * w_ru: Weight matrix for the reset and update gate. + * w_c: Weight matrix for the cell connection gate. + * b_ru: Bias vector for the reset and update gate. + * b_c: Bias vector for the cell connection gate. + *

    + * Returns + * r: Output of the reset gate. + * u: Output of the update gate. + * c: Output of the cell connection gate. + * h: Current state of the GRU cell. + *

    + * Note on notation of the variables: + *

    + * Concatenation of a and b is represented by a_b + * Element-wise dot product of a and b is represented by ab + * Element-wise dot product is represented by \circ + * Matrix multiplication is represented by * + *

    + * Biases are initialized with : + * `b_ru` - constant_initializer(1.0) + * `b_c` - constant_initializer(0.0) + *

    + * This kernel op implements the following mathematical equations: + *

    {@code
    + * x_h_prev = [x, h_prev]
    + * 
    + * [r_bar u_bar] = x_h_prev * w_ru + b_ru
    + * 
    + * r = sigmoid(r_bar)
    + * u = sigmoid(u_bar)
    + * 
    + * h_prevr = h_prev \circ r
    + * 
    + * x_h_prevr = [x h_prevr]
    + * 
    + * c_bar = x_h_prevr * w_c + b_c
    + * c = tanh(c_bar)
    + * 
    + * h = (1-u) \circ c + u \circ h_prev
    + * }
    + * + * + * @param data type for {@code r()} output + */ +public final class GRUBlockCell extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new GRUBlockCell operation. + * + * @param scope current scope + * @param x + * @param hPrev + * @param wRu + * @param wC + * @param bRu + * @param bC + * @return a new instance of GRUBlockCell + */ + public static GRUBlockCell create(Scope scope, Operand x, Operand hPrev, Operand wRu, Operand wC, Operand bRu, Operand bC) { + OperationBuilder opBuilder = scope.env().opBuilder("GRUBlockCell", scope.makeOpName("GRUBlockCell")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(hPrev.asOutput()); + opBuilder.addInput(wRu.asOutput()); + opBuilder.addInput(wC.asOutput()); + opBuilder.addInput(bRu.asOutput()); + opBuilder.addInput(bC.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new GRUBlockCell(opBuilder.build()); + } + + /** + */ + public Output r() { + return r; + } + + /** + */ + public Output u() { + return u; + } + + /** + */ + public Output c() { + return c; + } + + /** + */ + public Output h() { + return h; + } + + private Output r; + private Output u; + private Output c; + private Output h; + + private GRUBlockCell(Operation operation) { + super(operation); + int outputIdx = 0; + r = operation.output(outputIdx++); + u = operation.output(outputIdx++); + c = operation.output(outputIdx++); + h = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCellGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCellGrad.java new file mode 100644 index 00000000000..23b4a6cd51b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCellGrad.java @@ -0,0 +1,184 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the GRU cell back-propagation for 1 time step. + *

    + * Args + * x: Input to the GRU cell. + * h_prev: State input from the previous GRU cell. + * w_ru: Weight matrix for the reset and update gate. + * w_c: Weight matrix for the cell connection gate. + * b_ru: Bias vector for the reset and update gate. + * b_c: Bias vector for the cell connection gate. + * r: Output of the reset gate. + * u: Output of the update gate. + * c: Output of the cell connection gate. + * d_h: Gradients of the h_new wrt to objective function. + *

    + * Returns + * d_x: Gradients of the x wrt to objective function. + * d_h_prev: Gradients of the h wrt to objective function. + * d_c_bar Gradients of the c_bar wrt to objective function. + * d_r_bar_u_bar Gradients of the r_bar & u_bar wrt to objective function. + *

    + * This kernel op implements the following mathematical equations: + *

    + * Note on notation of the variables: + *

    + * Concatenation of a and b is represented by a_b + * Element-wise dot product of a and b is represented by ab + * Element-wise dot product is represented by \circ + * Matrix multiplication is represented by * + *

    + * Additional notes for clarity: + *

    + * `w_ru` can be segmented into 4 different matrices. + *

    {@code
    + * w_ru = [w_r_x w_u_x
    + *         w_r_h_prev w_u_h_prev]
    + * }
    + * Similarly, `w_c` can be segmented into 2 different matrices. + *
    {@code
    + * w_c = [w_c_x w_c_h_prevr]
    + * }
    + * Same goes for biases. + *
    {@code
    + * b_ru = [b_ru_x b_ru_h]
    + * b_c = [b_c_x b_c_h]
    + * }
    + * Another note on notation: + *
    {@code
    + * d_x = d_x_component_1 + d_x_component_2
    + * 
    + * where d_x_component_1 = d_r_bar * w_r_x^T + d_u_bar * w_r_x^T
    + * and d_x_component_2 = d_c_bar * w_c_x^T
    + * 
    + * d_h_prev = d_h_prev_component_1 + d_h_prevr \circ r + d_h \circ u
    + * where d_h_prev_componenet_1 = d_r_bar * w_r_h_prev^T + d_u_bar * w_r_h_prev^T
    + * }
    + * Mathematics behind the Gradients below: + *
    {@code
    + * d_c_bar = d_h \circ (1-u) \circ (1-c \circ c)
    + * d_u_bar = d_h \circ (h-c) \circ u \circ (1-u)
    + * 
    + * d_r_bar_u_bar = [d_r_bar d_u_bar]
    + * 
    + * [d_x_component_1 d_h_prev_component_1] = d_r_bar_u_bar * w_ru^T
    + * 
    + * [d_x_component_2 d_h_prevr] = d_c_bar * w_c^T
    + * 
    + * d_x = d_x_component_1 + d_x_component_2
    + * 
    + * d_h_prev = d_h_prev_component_1 + d_h_prevr \circ r + u
    + * }
    + * Below calculation is performed in the python wrapper for the Gradients + * (not in the gradient kernel.) + *
    {@code
    + * d_w_ru = x_h_prevr^T * d_c_bar
    + * 
    + * d_w_c = x_h_prev^T * d_r_bar_u_bar
    + * 
    + * d_b_ru = sum of d_r_bar_u_bar along axis = 0
    + * 
    + * d_b_c = sum of d_c_bar along axis = 0
    + * }
    + * + * + * @param data type for {@code dX()} output + */ +public final class GRUBlockCellGrad extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new GRUBlockCellGrad operation. + * + * @param scope current scope + * @param x + * @param hPrev + * @param wRu + * @param wC + * @param bRu + * @param bC + * @param r + * @param u + * @param c + * @param dH + * @return a new instance of GRUBlockCellGrad + */ + public static GRUBlockCellGrad create(Scope scope, Operand x, Operand hPrev, Operand wRu, Operand wC, Operand bRu, Operand bC, Operand r, Operand u, Operand c, Operand dH) { + OperationBuilder opBuilder = scope.env().opBuilder("GRUBlockCellGrad", scope.makeOpName("GRUBlockCellGrad")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(hPrev.asOutput()); + opBuilder.addInput(wRu.asOutput()); + opBuilder.addInput(wC.asOutput()); + opBuilder.addInput(bRu.asOutput()); + opBuilder.addInput(bC.asOutput()); + opBuilder.addInput(r.asOutput()); + opBuilder.addInput(u.asOutput()); + opBuilder.addInput(c.asOutput()); + opBuilder.addInput(dH.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new GRUBlockCellGrad(opBuilder.build()); + } + + /** + */ + public Output dX() { + return dX; + } + + /** + */ + public Output dHPrev() { + return dHPrev; + } + + /** + */ + public Output dCBar() { + return dCBar; + } + + /** + */ + public Output dRBarUBar() { + return dRBarUBar; + } + + private Output dX; + private Output dHPrev; + private Output dCBar; + private Output dRBarUBar; + + private GRUBlockCellGrad(Operation operation) { + super(operation); + int outputIdx = 0; + dX = operation.output(outputIdx++); + dHPrev = operation.output(outputIdx++); + dCBar = operation.output(outputIdx++); + dRBarUBar = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Gather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Gather.java new file mode 100644 index 00000000000..991c94ae988 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Gather.java @@ -0,0 +1,136 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gather slices from `params` axis `axis` according to `indices`. + *

    + * `indices` must be an integer tensor of any dimension (usually 0-D or 1-D). + * Produces an output tensor with shape `params.shape[:axis] + indices.shape + + * params.shape[axis + 1:]` where: + *

    {@code
    + *     # Scalar indices (output is rank(params) - 1).
    + *     output[a_0, ..., a_n, b_0, ..., b_n] =
    + *       params[a_0, ..., a_n, indices, b_0, ..., b_n]
    + * 
    + *     # Vector indices (output is rank(params)).
    + *     output[a_0, ..., a_n, i, b_0, ..., b_n] =
    + *       params[a_0, ..., a_n, indices[i], b_0, ..., b_n]
    + * 
    + *     # Higher rank indices (output is rank(params) + rank(indices) - 1).
    + *     output[a_0, ..., a_n, i, ..., j, b_0, ... b_n] =
    + *       params[a_0, ..., a_n, indices[i, ..., j], b_0, ..., b_n]
    + * }
    + *
    + * + *
    + *

    + * Note that on CPU, if an out of bound index is found, an error is returned. + * On GPU, if an out of bound index is found, a 0 is stored in the + * corresponding output value. + *

    + * See also `tf.batch_gather` and `tf.gather_nd`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Gather extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Gather} + */ + public static class Options { + + /** + * @param batchDims + */ + public Options batchDims(Long batchDims) { + this.batchDims = batchDims; + return this; + } + + private Long batchDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Gather operation. + * + * @param scope current scope + * @param params The tensor from which to gather values. Must be at least rank + * `axis + 1`. + * @param indices Index tensor. Must be in range `[0, params.shape[axis])`. + * @param axis The axis in `params` to gather `indices` from. Defaults to the first + * dimension. Supports negative indexes. + * @param options carries optional attributes values + * @return a new instance of Gather + */ + public static Gather create(Scope scope, Operand params, Operand indices, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("GatherV2", scope.makeOpName("Gather")); + opBuilder.addInput(params.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.batchDims != null) { + opBuilder.setAttr("batch_dims", opts.batchDims); + } + } + } + return new Gather(opBuilder.build()); + } + + /** + * @param batchDims + */ + public static Options batchDims(Long batchDims) { + return new Options().batchDims(batchDims); + } + + /** + * Values from `params` gathered from indices given by `indices`, with + * shape `params.shape[:axis] + indices.shape + params.shape[axis + 1:]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Gather(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GatherNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GatherNd.java new file mode 100644 index 00000000000..ea44591dc45 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GatherNd.java @@ -0,0 +1,165 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gather slices from `params` into a Tensor with shape specified by `indices`. + *

    + * `indices` is a K-dimensional integer tensor, best thought of as a + * (K-1)-dimensional tensor of indices into `params`, where each element defines a + * slice of `params`: + *

    + * output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]] + *

    + * Whereas in `tf.gather` `indices` defines slices into the first + * dimension of `params`, in `tf.gather_nd`, `indices` defines slices into the + * first `N` dimensions of `params`, where `N = indices.shape[-1]`. + *

    + * The last dimension of `indices` can be at most the rank of + * `params`: + *

    + * indices.shape[-1] <= params.rank + *

    + * The last dimension of `indices` corresponds to elements + * (if `indices.shape[-1] == params.rank`) or slices + * (if `indices.shape[-1] < params.rank`) along dimension `indices.shape[-1]` + * of `params`. The output tensor has shape + *

    + * indices.shape[:-1] + params.shape[indices.shape[-1]:] + *

    + * Note that on CPU, if an out of bound index is found, an error is returned. + * On GPU, if an out of bound index is found, a 0 is stored in the + * corresponding output value. + *

    + * Some examples below. + *

    + * Simple indexing into a matrix: + *

    {@code
    + *     indices = [[0, 0], [1, 1]]
    + *     params = [['a', 'b'], ['c', 'd']]
    + *     output = ['a', 'd']
    + * }
    + * Slice indexing into a matrix: + *
    {@code
    + *     indices = [[1], [0]]
    + *     params = [['a', 'b'], ['c', 'd']]
    + *     output = [['c', 'd'], ['a', 'b']]
    + * }
    + * Indexing into a 3-tensor: + *
    {@code
    + *     indices = [[1]]
    + *     params = [[['a0', 'b0'], ['c0', 'd0']],
    + *               [['a1', 'b1'], ['c1', 'd1']]]
    + *     output = [[['a1', 'b1'], ['c1', 'd1']]]
    + * 
    + * 
    + *     indices = [[0, 1], [1, 0]]
    + *     params = [[['a0', 'b0'], ['c0', 'd0']],
    + *               [['a1', 'b1'], ['c1', 'd1']]]
    + *     output = [['c0', 'd0'], ['a1', 'b1']]
    + * 
    + * 
    + *     indices = [[0, 0, 1], [1, 0, 1]]
    + *     params = [[['a0', 'b0'], ['c0', 'd0']],
    + *               [['a1', 'b1'], ['c1', 'd1']]]
    + *     output = ['b0', 'b1']
    + * }
    + * Batched indexing into a matrix: + *
    {@code
    + *     indices = [[[0, 0]], [[0, 1]]]
    + *     params = [['a', 'b'], ['c', 'd']]
    + *     output = [['a'], ['b']]
    + * }
    + * Batched slice indexing into a matrix: + *
    {@code
    + *     indices = [[[1]], [[0]]]
    + *     params = [['a', 'b'], ['c', 'd']]
    + *     output = [[['c', 'd']], [['a', 'b']]]
    + * }
    + * Batched indexing into a 3-tensor: + *
    {@code
    + *     indices = [[[1]], [[0]]]
    + *     params = [[['a0', 'b0'], ['c0', 'd0']],
    + *               [['a1', 'b1'], ['c1', 'd1']]]
    + *     output = [[[['a1', 'b1'], ['c1', 'd1']]],
    + *               [[['a0', 'b0'], ['c0', 'd0']]]]
    + * 
    + *     indices = [[[0, 1], [1, 0]], [[0, 0], [1, 1]]]
    + *     params = [[['a0', 'b0'], ['c0', 'd0']],
    + *               [['a1', 'b1'], ['c1', 'd1']]]
    + *     output = [[['c0', 'd0'], ['a1', 'b1']],
    + *               [['a0', 'b0'], ['c1', 'd1']]]
    + * 
    + * 
    + *     indices = [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]]
    + *     params = [[['a0', 'b0'], ['c0', 'd0']],
    + *               [['a1', 'b1'], ['c1', 'd1']]]
    + *     output = [['b0', 'b1'], ['d0', 'c1']]
    + * }
    + * See also `tf.gather` and `tf.batch_gather`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class GatherNd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new GatherNd operation. + * + * @param scope current scope + * @param params The tensor from which to gather values. + * @param indices Index tensor. + * @return a new instance of GatherNd + */ + public static GatherNd create(Scope scope, Operand params, Operand indices) { + OperationBuilder opBuilder = scope.env().opBuilder("GatherNd", scope.makeOpName("GatherNd")); + opBuilder.addInput(params.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new GatherNd(opBuilder.build()); + } + + /** + * Values from `params` gathered from indices given by `indices`, with + * shape `indices.shape[:-1] + params.shape[indices.shape[-1]:]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private GatherNd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionHandle.java new file mode 100644 index 00000000000..1e2978c813f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionHandle.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Store the input tensor in the state of the current session. + */ +@Operator +public final class GetSessionHandle extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new GetSessionHandle operation. + * + * @param scope current scope + * @param value The tensor to be stored. + * @return a new instance of GetSessionHandle + */ + public static GetSessionHandle create(Scope scope, Operand value) { + OperationBuilder opBuilder = scope.env().opBuilder("GetSessionHandleV2", scope.makeOpName("GetSessionHandle")); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new GetSessionHandle(opBuilder.build()); + } + + /** + * The handle for the tensor stored in the session state, represented + * as a ResourceHandle object. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private GetSessionHandle(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionTensor.java new file mode 100644 index 00000000000..c4cb100757d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionTensor.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Get the value of the tensor specified by its handle. + * + * @param data type for {@code value()} output + */ +@Operator +public final class GetSessionTensor extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new GetSessionTensor operation. + * + * @param scope current scope + * @param handle The handle for a tensor stored in the session state. + * @param dtype The type of the output value. + * @return a new instance of GetSessionTensor + */ + public static GetSessionTensor create(Scope scope, Operand handle, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("GetSessionTensor", scope.makeOpName("GetSessionTensor")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new GetSessionTensor(opBuilder.build()); + } + + /** + * The tensor for the given handle. + */ + public Output value() { + return value; + } + + @Override + public Output asOutput() { + return value; + } + + private Output value; + + private GetSessionTensor(Operation operation) { + super(operation); + int outputIdx = 0; + value = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GuaranteeConst.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GuaranteeConst.java new file mode 100644 index 00000000000..43d73d08810 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GuaranteeConst.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gives a guarantee to the TF runtime that the input tensor is a constant. + *

    + * The runtime is then free to make optimizations based on this. + *

    + * Only accepts value typed tensors as inputs and rejects resource variable handles + * as input. + *

    + * Returns the input tensor without modification. + * + * @param data type for {@code output()} output + */ +@Operator +public final class GuaranteeConst extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new GuaranteeConst operation. + * + * @param scope current scope + * @param input + * @return a new instance of GuaranteeConst + */ + public static GuaranteeConst create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("GuaranteeConst", scope.makeOpName("GuaranteeConst")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new GuaranteeConst(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private GuaranteeConst(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HashTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HashTable.java new file mode 100644 index 00000000000..cc9fae9b021 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HashTable.java @@ -0,0 +1,153 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a non-initialized hash table. + *

    + * This op creates a hash table, specifying the type of its keys and values. + * Before using the table you will have to initialize it. After initialization the + * table will be immutable. + */ +@Operator +public final class HashTable extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.HashTable} + */ + public static class Options { + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param useNodeNameSharing If true and shared_name is empty, the table is shared + * using the node name. + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + + private String container; + private String sharedName; + private Boolean useNodeNameSharing; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new HashTable operation. + * + * @param scope current scope + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of HashTable + */ + public static HashTable create(Scope scope, Class keyDtype, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("HashTableV2", scope.makeOpName("HashTable")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("key_dtype", DataType.fromClass(keyDtype)); + opBuilder.setAttr("value_dtype", DataType.fromClass(valueDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.useNodeNameSharing != null) { + opBuilder.setAttr("use_node_name_sharing", opts.useNodeNameSharing); + } + } + } + return new HashTable(opBuilder.build()); + } + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param useNodeNameSharing If true and shared_name is empty, the table is shared + * using the node name. + */ + public static Options useNodeNameSharing(Boolean useNodeNameSharing) { + return new Options().useNodeNameSharing(useNodeNameSharing); + } + + /** + * Handle to a table. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + private Output tableHandle; + + private HashTable(Operation operation) { + super(operation); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HistogramFixedWidth.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HistogramFixedWidth.java new file mode 100644 index 00000000000..2d87208ea3d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HistogramFixedWidth.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Return histogram of values. + *

    + * Given the tensor `values`, this operation returns a rank 1 histogram counting + * the number of entries in `values` that fall into every bin. The bins are + * equal width and determined by the arguments `value_range` and `nbins`. + *

    {@code
    + * # Bins will be:  (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
    + * nbins = 5
    + * value_range = [0.0, 5.0]
    + * new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
    + * 
    + * with tf.get_default_session() as sess:
    + *   hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
    + *   variables.global_variables_initializer().run()
    + *   sess.run(hist) => [2, 1, 1, 0, 2]
    + * }
    + * + * + * @param data type for {@code out()} output + */ +@Operator +public final class HistogramFixedWidth extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new HistogramFixedWidth operation. + * + * @param scope current scope + * @param values Numeric `Tensor`. + * @param valueRange Shape [2] `Tensor` of same `dtype` as `values`. + * values <= value_range[0] will be mapped to hist[0], + * values >= value_range[1] will be mapped to hist[-1]. + * @param nbins Scalar `int32 Tensor`. Number of histogram bins. + * @param dtype + * @return a new instance of HistogramFixedWidth + */ + public static HistogramFixedWidth create(Scope scope, Operand values, Operand valueRange, Operand nbins, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("HistogramFixedWidth", scope.makeOpName("HistogramFixedWidth")); + opBuilder.addInput(values.asOutput()); + opBuilder.addInput(valueRange.asOutput()); + opBuilder.addInput(nbins.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new HistogramFixedWidth(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new HistogramFixedWidth operation using default output types. + * + * @param scope current scope + * @param values Numeric `Tensor`. + * @param valueRange Shape [2] `Tensor` of same `dtype` as `values`. + * values <= value_range[0] will be mapped to hist[0], + * values >= value_range[1] will be mapped to hist[-1]. + * @param nbins Scalar `int32 Tensor`. Number of histogram bins. + * @return a new instance of HistogramFixedWidth + */ + public static HistogramFixedWidth create(Scope scope, Operand values, Operand valueRange, Operand nbins) { + return create(scope, values, valueRange, nbins, Integer.class); + } + + /** + * A 1-D `Tensor` holding histogram of values. + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private HistogramFixedWidth(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Identity.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Identity.java new file mode 100644 index 00000000000..efda54a91fb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Identity.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Return a tensor with the same shape and contents as the input tensor or value. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Identity extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Identity operation. + * + * @param scope current scope + * @param input + * @return a new instance of Identity + */ + public static Identity create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("Identity", scope.makeOpName("Identity")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Identity(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Identity(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IdentityN.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IdentityN.java new file mode 100644 index 00000000000..0dc057878e9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IdentityN.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a list of tensors with the same shapes and contents as the input + *

    + * tensors. + *

    + * This op can be used to override the gradient for complicated functions. For + * example, suppose y = f(x) and we wish to apply a custom function g for backprop + * such that dx = g(dy). In Python, + *

    {@code
    + * with tf.get_default_graph().gradient_override_map(
    + *     {'IdentityN': 'OverrideGradientWithG'}):
    + *   y, _ = identity_n([f(x), x])
    + * 
    + * @tf.RegisterGradient('OverrideGradientWithG')
    + * def ApplyG(op, dy, _):
    + *   return [None, g(dy)]  # Do not backprop to f(x).
    + * }
    + * + */ +@Operator +public final class IdentityN extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new IdentityN operation. + * + * @param scope current scope + * @param input + * @return a new instance of IdentityN + */ + public static IdentityN create(Scope scope, Iterable> input) { + OperationBuilder opBuilder = scope.env().opBuilder("IdentityN", scope.makeOpName("IdentityN")); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IdentityN(opBuilder.build()); + } + + /** + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + private List> output; + + private IdentityN(Operation operation) { + super(operation); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IgnoreErrorsDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IgnoreErrorsDataset.java new file mode 100644 index 00000000000..0af926e3717 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IgnoreErrorsDataset.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that contains the elements of `input_dataset` ignoring errors. + */ +public final class IgnoreErrorsDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IgnoreErrorsDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of IgnoreErrorsDataset + */ + public static IgnoreErrorsDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("IgnoreErrorsDataset", scope.makeOpName("IgnoreErrorsDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new IgnoreErrorsDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private IgnoreErrorsDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ImmutableConst.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ImmutableConst.java new file mode 100644 index 00000000000..aa8e8b3e664 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ImmutableConst.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns immutable tensor from memory region. + *

    + * The current implementation memmaps the tensor from a file. + * + * @param data type for {@code tensor()} output + */ +@Operator +public final class ImmutableConst extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ImmutableConst operation. + * + * @param scope current scope + * @param dtype Type of the returned tensor. + * @param shape Shape of the returned tensor. + * @param memoryRegionName Name of readonly memory region used by the tensor, see + * NewReadOnlyMemoryRegionFromFile in tensorflow::Env. + * @return a new instance of ImmutableConst + */ + public static ImmutableConst create(Scope scope, Class dtype, Shape shape, String memoryRegionName) { + OperationBuilder opBuilder = scope.env().opBuilder("ImmutableConst", scope.makeOpName("ImmutableConst")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + opBuilder.setAttr("shape", shape); + opBuilder.setAttr("memory_region_name", memoryRegionName); + return new ImmutableConst(opBuilder.build()); + } + + /** + */ + public Output tensor() { + return tensor; + } + + @Override + public Output asOutput() { + return tensor; + } + + private Output tensor; + + private ImmutableConst(Operation operation) { + super(operation); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeue.java new file mode 100644 index 00000000000..1e8474c966e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeue.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A placeholder op for a value that will be fed into the computation. + * + * @param data type for {@code output()} output + */ +public final class InfeedDequeue extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new InfeedDequeue operation. + * + * @param scope current scope + * @param dtype The type of elements in the tensor. + * @param shape The shape of the tensor. + * @return a new instance of InfeedDequeue + */ + public static InfeedDequeue create(Scope scope, Class dtype, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("InfeedDequeue", scope.makeOpName("InfeedDequeue")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + opBuilder.setAttr("shape", shape); + return new InfeedDequeue(opBuilder.build()); + } + + /** + * A tensor that will be provided using the infeed mechanism. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private InfeedDequeue(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeueTuple.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeueTuple.java new file mode 100644 index 00000000000..207bd126831 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeueTuple.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Fetches multiple values from infeed as an XLA tuple. + */ +public final class InfeedDequeueTuple extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new InfeedDequeueTuple operation. + * + * @param scope current scope + * @param dtypes The element types of each element in `outputs`. + * @param shapes The shapes of each tensor in `outputs`. + * @return a new instance of InfeedDequeueTuple + */ + public static InfeedDequeueTuple create(Scope scope, List> dtypes, List shapes) { + OperationBuilder opBuilder = scope.env().opBuilder("InfeedDequeueTuple", scope.makeOpName("InfeedDequeueTuple")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + Shape[] shapesArray = new Shape[shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + return new InfeedDequeueTuple(opBuilder.build()); + } + + /** + * A list of tensors that will be provided using the infeed mechanism. + */ + public List> outputs() { + return outputs; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outputs.iterator(); + } + + private List> outputs; + + private InfeedDequeueTuple(Operation operation) { + super(operation); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList(operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueue.java new file mode 100644 index 00000000000..74251f1d1d6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueue.java @@ -0,0 +1,135 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op which feeds a single Tensor value into the computation. + */ +public final class InfeedEnqueue extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.InfeedEnqueue} + */ + public static class Options { + + /** + * @param shape The shape of the tensor. + */ + public Options shape(Shape shape) { + this.shape = shape; + return this; + } + + /** + * @param layout A vector holding the requested layout in minor-to-major sequence. + * If a layout attribute is passed, but its values are all -1, the layout will + * be computed by the infeed operation. + */ + public Options layout(List layout) { + this.layout = layout; + return this; + } + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + private Shape shape; + private List layout; + private Long deviceOrdinal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new InfeedEnqueue operation. + * + * @param scope current scope + * @param input A tensor that will be provided using the infeed mechanism. + * @param options carries optional attributes values + * @return a new instance of InfeedEnqueue + */ + public static InfeedEnqueue create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("InfeedEnqueue", scope.makeOpName("InfeedEnqueue")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.shape != null) { + opBuilder.setAttr("shape", opts.shape); + } + if (opts.layout != null) { + long[] layoutArray = new long[opts.layout.size()]; + for (int i = 0; i < layoutArray.length; ++i) { + layoutArray[i] = opts.layout.get(i); + } + opBuilder.setAttr("layout", layoutArray); + } + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + } + } + return new InfeedEnqueue(opBuilder.build()); + } + + /** + * @param shape The shape of the tensor. + */ + public static Options shape(Shape shape) { + return new Options().shape(shape); + } + + /** + * @param layout A vector holding the requested layout in minor-to-major sequence. + * If a layout attribute is passed, but its values are all -1, the layout will + * be computed by the infeed operation. + */ + public static Options layout(List layout) { + return new Options().layout(layout); + } + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + + private InfeedEnqueue(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueuePrelinearizedBuffer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueuePrelinearizedBuffer.java new file mode 100644 index 00000000000..1ad68de268e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueuePrelinearizedBuffer.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op which enqueues prelinearized buffer into TPU infeed. + */ +public final class InfeedEnqueuePrelinearizedBuffer extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.InfeedEnqueuePrelinearizedBuffer} + */ + public static class Options { + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op is running on a TPU device + * and = 0 when the Op is running on the CPU device. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + private Long deviceOrdinal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new InfeedEnqueuePrelinearizedBuffer operation. + * + * @param scope current scope + * @param input A variant tensor representing linearized output. + * @param options carries optional attributes values + * @return a new instance of InfeedEnqueuePrelinearizedBuffer + */ + public static InfeedEnqueuePrelinearizedBuffer create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("InfeedEnqueuePrelinearizedBuffer", scope.makeOpName("InfeedEnqueuePrelinearizedBuffer")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + } + } + return new InfeedEnqueuePrelinearizedBuffer(opBuilder.build()); + } + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op is running on a TPU device + * and = 0 when the Op is running on the CPU device. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + + private InfeedEnqueuePrelinearizedBuffer(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueueTuple.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueueTuple.java new file mode 100644 index 00000000000..1dec27d3a40 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueueTuple.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Feeds multiple Tensor values into the computation as an XLA tuple. + */ +public final class InfeedEnqueueTuple extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.InfeedEnqueueTuple} + */ + public static class Options { + + /** + * @param layouts A vector holding the requested layout in minor-to-major sequence for + * all the tuple shapes, in the order the shapes appear in the "shapes" input. + * The layout elements for a sub-shape can be set to -1, in which case the + * corresponding layout will be computed by the infeed operation. + */ + public Options layouts(List layouts) { + this.layouts = layouts; + return this; + } + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + private List layouts; + private Long deviceOrdinal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new InfeedEnqueueTuple operation. + * + * @param scope current scope + * @param inputs A list of tensors that will be provided using the infeed mechanism. + * @param shapes The shapes of each tensor in `inputs`. + * @param options carries optional attributes values + * @return a new instance of InfeedEnqueueTuple + */ + public static InfeedEnqueueTuple create(Scope scope, Iterable> inputs, List shapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("InfeedEnqueueTuple", scope.makeOpName("InfeedEnqueueTuple")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + Shape[] shapesArray = new Shape[shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.layouts != null) { + long[] layoutsArray = new long[opts.layouts.size()]; + for (int i = 0; i < layoutsArray.length; ++i) { + layoutsArray[i] = opts.layouts.get(i); + } + opBuilder.setAttr("layouts", layoutsArray); + } + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + } + } + return new InfeedEnqueueTuple(opBuilder.build()); + } + + /** + * @param layouts A vector holding the requested layout in minor-to-major sequence for + * all the tuple shapes, in the order the shapes appear in the "shapes" input. + * The layout elements for a sub-shape can be set to -1, in which case the + * corresponding layout will be computed by the infeed operation. + */ + public static Options layouts(List layouts) { + return new Options().layouts(layouts); + } + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + + private InfeedEnqueueTuple(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTable.java new file mode 100644 index 00000000000..5878ce2ec89 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTable.java @@ -0,0 +1,55 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Table initializer that takes two tensors for keys and values respectively. + */ +@Operator +public final class InitializeTable extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new InitializeTable operation. + * + * @param scope current scope + * @param tableHandle Handle to a table which will be initialized. + * @param keys Keys of type Tkey. + * @param values Values of type Tval. + * @return a new instance of InitializeTable + */ + public static InitializeTable create(Scope scope, Operand tableHandle, Operand keys, Operand values) { + OperationBuilder opBuilder = scope.env().opBuilder("InitializeTableV2", scope.makeOpName("InitializeTable")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder.addInput(keys.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new InitializeTable(opBuilder.build()); + } + + + private InitializeTable(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTableFromTextFile.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTableFromTextFile.java new file mode 100644 index 00000000000..f28b98709c2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTableFromTextFile.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Initializes a table from a text file. + *

    + * It inserts one key-value pair into the table for each line of the file. + * The key and value is extracted from the whole line content, elements from the + * split line based on `delimiter` or the line number (starting from zero). + * Where to extract the key and value from a line is specified by `key_index` and + * `value_index`. + *

    + * - A value of -1 means use the line number(starting from zero), expects `int64`. + * - A value of -2 means use the whole line content, expects `string`. + * - A value >= 0 means use the index (starting at zero) of the split line based + * on `delimiter`. + */ +@Operator +public final class InitializeTableFromTextFile extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.InitializeTableFromTextFile} + */ + public static class Options { + + /** + * @param vocabSize Number of elements of the file, use -1 if unknown. + */ + public Options vocabSize(Long vocabSize) { + this.vocabSize = vocabSize; + return this; + } + + /** + * @param delimiter Delimiter to separate fields in a line. + */ + public Options delimiter(String delimiter) { + this.delimiter = delimiter; + return this; + } + + private Long vocabSize; + private String delimiter; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new InitializeTableFromTextFile operation. + * + * @param scope current scope + * @param tableHandle Handle to a table which will be initialized. + * @param filename Filename of a vocabulary text file. + * @param keyIndex Column index in a line to get the table `key` values from. + * @param valueIndex Column index that represents information of a line to get the table + * `value` values from. + * @param options carries optional attributes values + * @return a new instance of InitializeTableFromTextFile + */ + public static InitializeTableFromTextFile create(Scope scope, Operand tableHandle, Operand filename, Long keyIndex, Long valueIndex, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("InitializeTableFromTextFileV2", scope.makeOpName("InitializeTableFromTextFile")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder.addInput(filename.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("key_index", keyIndex); + opBuilder.setAttr("value_index", valueIndex); + if (options != null) { + for (Options opts : options) { + if (opts.vocabSize != null) { + opBuilder.setAttr("vocab_size", opts.vocabSize); + } + if (opts.delimiter != null) { + opBuilder.setAttr("delimiter", opts.delimiter); + } + } + } + return new InitializeTableFromTextFile(opBuilder.build()); + } + + /** + * @param vocabSize Number of elements of the file, use -1 if unknown. + */ + public static Options vocabSize(Long vocabSize) { + return new Options().vocabSize(vocabSize); + } + + /** + * @param delimiter Delimiter to separate fields in a line. + */ + public static Options delimiter(String delimiter) { + return new Options().delimiter(delimiter); + } + + + private InitializeTableFromTextFile(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceAdd.java new file mode 100644 index 00000000000..5bc86ea6a6c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceAdd.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds v into specified rows of x. + *

    + * Computes y = x; y[i, :] += v; return y. + * + * @param data type for {@code y()} output + */ +@Operator +public final class InplaceAdd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new InplaceAdd operation. + * + * @param scope current scope + * @param x A `Tensor` of type T. + * @param i A vector. Indices into the left-most dimension of `x`. + * @param v A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @return a new instance of InplaceAdd + */ + public static InplaceAdd create(Scope scope, Operand x, Operand i, Operand v) { + OperationBuilder opBuilder = scope.env().opBuilder("InplaceAdd", scope.makeOpName("InplaceAdd")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(i.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new InplaceAdd(opBuilder.build()); + } + + /** + * A `Tensor` of type T. An alias of `x`. The content of `y` is undefined if there are duplicates in `i`. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private InplaceAdd(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceSub.java new file mode 100644 index 00000000000..81e027b52a8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceSub.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Subtracts `v` into specified rows of `x`. + *

    + * Computes y = x; y[i, :] -= v; return y. + * + * @param data type for {@code y()} output + */ +@Operator +public final class InplaceSub extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new InplaceSub operation. + * + * @param scope current scope + * @param x A `Tensor` of type T. + * @param i A vector. Indices into the left-most dimension of `x`. + * @param v A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @return a new instance of InplaceSub + */ + public static InplaceSub create(Scope scope, Operand x, Operand i, Operand v) { + OperationBuilder opBuilder = scope.env().opBuilder("InplaceSub", scope.makeOpName("InplaceSub")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(i.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new InplaceSub(opBuilder.build()); + } + + /** + * A `Tensor` of type T. An alias of `x`. The content of `y` is undefined if there are duplicates in `i`. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private InplaceSub(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceUpdate.java new file mode 100644 index 00000000000..3ba6530eed3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InplaceUpdate.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Updates specified rows with values in `v`. + *

    + * Computes `x[i, :] = v; return x`. + * + * @param data type for {@code y()} output + */ +@Operator +public final class InplaceUpdate extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new InplaceUpdate operation. + * + * @param scope current scope + * @param x A tensor of type `T`. + * @param i A vector. Indices into the left-most dimension of `x`. + * @param v A `Tensor` of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @return a new instance of InplaceUpdate + */ + public static InplaceUpdate create(Scope scope, Operand x, Operand i, Operand v) { + OperationBuilder opBuilder = scope.env().opBuilder("InplaceUpdate", scope.makeOpName("InplaceUpdate")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(i.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new InplaceUpdate(opBuilder.build()); + } + + /** + * A `Tensor` of type T. An alias of `x`. The content of `y` is undefined if there are duplicates in `i`. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private InplaceUpdate(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesEnsembleInitialized.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesEnsembleInitialized.java new file mode 100644 index 00000000000..cbe3b016340 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesEnsembleInitialized.java @@ -0,0 +1,65 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Checks whether a tree ensemble has been initialized. + */ +public final class IsBoostedTreesEnsembleInitialized extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IsBoostedTreesEnsembleInitialized operation. + * + * @param scope current scope + * @param treeEnsembleHandle Handle to the tree ensemble resouce. + * @return a new instance of IsBoostedTreesEnsembleInitialized + */ + public static IsBoostedTreesEnsembleInitialized create(Scope scope, Operand treeEnsembleHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("IsBoostedTreesEnsembleInitialized", scope.makeOpName("IsBoostedTreesEnsembleInitialized")); + opBuilder.addInput(treeEnsembleHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IsBoostedTreesEnsembleInitialized(opBuilder.build()); + } + + /** + * output boolean on whether it is initialized or not. + */ + public Output isInitialized() { + return isInitialized; + } + + @Override + public Output asOutput() { + return isInitialized; + } + + private Output isInitialized; + + private IsBoostedTreesEnsembleInitialized(Operation operation) { + super(operation); + int outputIdx = 0; + isInitialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesQuantileStreamResourceInitialized.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesQuantileStreamResourceInitialized.java new file mode 100644 index 00000000000..26855e129fb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesQuantileStreamResourceInitialized.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Checks whether a quantile stream has been initialized. + *

    + * An Op that checks if quantile stream resource is initialized. + */ +public final class IsBoostedTreesQuantileStreamResourceInitialized extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IsBoostedTreesQuantileStreamResourceInitialized operation. + * + * @param scope current scope + * @param quantileStreamResourceHandle resource; The reference to quantile stream resource handle. + * @return a new instance of IsBoostedTreesQuantileStreamResourceInitialized + */ + public static IsBoostedTreesQuantileStreamResourceInitialized create(Scope scope, Operand quantileStreamResourceHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("IsBoostedTreesQuantileStreamResourceInitialized", scope.makeOpName("IsBoostedTreesQuantileStreamResourceInitialized")); + opBuilder.addInput(quantileStreamResourceHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IsBoostedTreesQuantileStreamResourceInitialized(opBuilder.build()); + } + + /** + * bool; True if the resource is initialized, False otherwise. + */ + public Output isInitialized() { + return isInitialized; + } + + @Override + public Output asOutput() { + return isInitialized; + } + + private Output isInitialized; + + private IsBoostedTreesQuantileStreamResourceInitialized(Operation operation) { + super(operation); + int outputIdx = 0; + isInitialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsVariableInitialized.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsVariableInitialized.java new file mode 100644 index 00000000000..6c4b9a691b7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsVariableInitialized.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Checks whether a tensor has been initialized. + *

    + * Outputs boolean scalar indicating whether the tensor has been initialized. + */ +@Operator +public final class IsVariableInitialized extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IsVariableInitialized operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. May be uninitialized. + * @return a new instance of IsVariableInitialized + */ + public static IsVariableInitialized create(Scope scope, Operand ref) { + OperationBuilder opBuilder = scope.env().opBuilder("IsVariableInitialized", scope.makeOpName("IsVariableInitialized")); + opBuilder.addInput(ref.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IsVariableInitialized(opBuilder.build()); + } + + /** + */ + public Output isInitialized() { + return isInitialized; + } + + @Override + public Output asOutput() { + return isInitialized; + } + + private Output isInitialized; + + private IsVariableInitialized(Operation operation) { + super(operation); + int outputIdx = 0; + isInitialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IteratorGetDevice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IteratorGetDevice.java new file mode 100644 index 00000000000..73fd7065fbc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IteratorGetDevice.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns the name of the device on which `resource` has been placed. + */ +public final class IteratorGetDevice extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IteratorGetDevice operation. + * + * @param scope current scope + * @param resource + * @return a new instance of IteratorGetDevice + */ + public static IteratorGetDevice create(Scope scope, Operand resource) { + OperationBuilder opBuilder = scope.env().opBuilder("IteratorGetDevice", scope.makeOpName("IteratorGetDevice")); + opBuilder.addInput(resource.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IteratorGetDevice(opBuilder.build()); + } + + /** + */ + public Output device() { + return device; + } + + @Override + public Output asOutput() { + return device; + } + + private Output device; + + private IteratorGetDevice(Operation operation) { + super(operation); + int outputIdx = 0; + device = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KMC2ChainInitialization.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KMC2ChainInitialization.java new file mode 100644 index 00000000000..288c9c82caf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KMC2ChainInitialization.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns the index of a data point that should be added to the seed set. + *

    + * Entries in distances are assumed to be squared distances of candidate points to + * the already sampled centers in the seed set. The op constructs one Markov chain + * of the k-MC^2 algorithm and returns the index of one candidate point to be added + * as an additional cluster center. + */ +public final class KMC2ChainInitialization extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new KMC2ChainInitialization operation. + * + * @param scope current scope + * @param distances Vector with squared distances to the closest previously sampled cluster center + * for each candidate point. + * @param seed Scalar. Seed for initializing the random number generator. + * @return a new instance of KMC2ChainInitialization + */ + public static KMC2ChainInitialization create(Scope scope, Operand distances, Operand seed) { + OperationBuilder opBuilder = scope.env().opBuilder("KMC2ChainInitialization", scope.makeOpName("KMC2ChainInitialization")); + opBuilder.addInput(distances.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new KMC2ChainInitialization(opBuilder.build()); + } + + /** + * Scalar with the index of the sampled point. + */ + public Output index() { + return index; + } + + @Override + public Output asOutput() { + return index; + } + + private Output index; + + private KMC2ChainInitialization(Operation operation) { + super(operation); + int outputIdx = 0; + index = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KmeansPlusPlusInitialization.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KmeansPlusPlusInitialization.java new file mode 100644 index 00000000000..6e85daf6fef --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KmeansPlusPlusInitialization.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Selects num_to_sample rows of input using the KMeans++ criterion. + *

    + * Rows of points are assumed to be input points. One row is selected at random. + * Subsequent rows are sampled with probability proportional to the squared L2 + * distance from the nearest row selected thus far till num_to_sample rows have + * been sampled. + */ +public final class KmeansPlusPlusInitialization extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new KmeansPlusPlusInitialization operation. + * + * @param scope current scope + * @param points Matrix of shape (n, d). Rows are assumed to be input points. + * @param numToSample Scalar. The number of rows to sample. This value must not be larger than n. + * @param seed Scalar. Seed for initializing the random number generator. + * @param numRetriesPerSample Scalar. For each row that is sampled, this parameter + * specifies the number of additional points to draw from the current + * distribution before selecting the best. If a negative value is specified, a + * heuristic is used to sample O(log(num_to_sample)) additional points. + * @return a new instance of KmeansPlusPlusInitialization + */ + public static KmeansPlusPlusInitialization create(Scope scope, Operand points, Operand numToSample, Operand seed, Operand numRetriesPerSample) { + OperationBuilder opBuilder = scope.env().opBuilder("KmeansPlusPlusInitialization", scope.makeOpName("KmeansPlusPlusInitialization")); + opBuilder.addInput(points.asOutput()); + opBuilder.addInput(numToSample.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(numRetriesPerSample.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new KmeansPlusPlusInitialization(opBuilder.build()); + } + + /** + * Matrix of shape (num_to_sample, d). The sampled rows. + */ + public Output samples() { + return samples; + } + + @Override + public Output asOutput() { + return samples; + } + + private Output samples; + + private KmeansPlusPlusInitialization(Operation operation) { + super(operation); + int outputIdx = 0; + samples = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LMDBDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LMDBDataset.java new file mode 100644 index 00000000000..4c709d74aeb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LMDBDataset.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class LMDBDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LMDBDataset operation. + * + * @param scope current scope + * @param filenames + * @param outputTypes + * @param outputShapes + * @return a new instance of LMDBDataset + */ + public static LMDBDataset create(Scope scope, Operand filenames, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("LMDBDataset", scope.makeOpName("LMDBDataset")); + opBuilder.addInput(filenames.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new LMDBDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private LMDBDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCell.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCell.java new file mode 100644 index 00000000000..ef7ef171c14 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCell.java @@ -0,0 +1,227 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the LSTM cell forward propagation for 1 time step. + *

    + * This implementation uses 1 weight matrix and 1 bias vector, and there's an + * optional peephole connection. + *

    + * This kernel op implements the following mathematical equations: + *

    {@code
    + * xh = [x, h_prev]
    + * [i, f, ci, o] = xh * w + b
    + * f = f + forget_bias
    + * 
    + * if not use_peephole:
    + *   wci = wcf = wco = 0
    + * 
    + * i = sigmoid(cs_prev * wci + i)
    + * f = sigmoid(cs_prev * wcf + f)
    + * ci = tanh(ci)
    + * 
    + * cs = ci .* i + cs_prev .* f
    + * cs = clip(cs, cell_clip)
    + * 
    + * o = sigmoid(cs * wco + o)
    + * co = tanh(cs)
    + * h = co .* o
    + * }
    + * + * + * @param data type for {@code i()} output + */ +public final class LSTMBlockCell extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LSTMBlockCell} + */ + public static class Options { + + /** + * @param forgetBias The forget gate bias. + */ + public Options forgetBias(Float forgetBias) { + this.forgetBias = forgetBias; + return this; + } + + /** + * @param cellClip Value to clip the 'cs' value to. + */ + public Options cellClip(Float cellClip) { + this.cellClip = cellClip; + return this; + } + + /** + * @param usePeephole Whether to use peephole weights. + */ + public Options usePeephole(Boolean usePeephole) { + this.usePeephole = usePeephole; + return this; + } + + private Float forgetBias; + private Float cellClip; + private Boolean usePeephole; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LSTMBlockCell operation. + * + * @param scope current scope + * @param x The input to the LSTM cell, shape (batch_size, num_inputs). + * @param csPrev Value of the cell state at previous time step. + * @param hPrev Output of the previous cell at previous time step. + * @param w The weight matrix. + * @param wci The weight matrix for input gate peephole connection. + * @param wcf The weight matrix for forget gate peephole connection. + * @param wco The weight matrix for output gate peephole connection. + * @param b The bias vector. + * @param options carries optional attributes values + * @return a new instance of LSTMBlockCell + */ + public static LSTMBlockCell create(Scope scope, Operand x, Operand csPrev, Operand hPrev, Operand w, Operand wci, Operand wcf, Operand wco, Operand b, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LSTMBlockCell", scope.makeOpName("LSTMBlockCell")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(csPrev.asOutput()); + opBuilder.addInput(hPrev.asOutput()); + opBuilder.addInput(w.asOutput()); + opBuilder.addInput(wci.asOutput()); + opBuilder.addInput(wcf.asOutput()); + opBuilder.addInput(wco.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.forgetBias != null) { + opBuilder.setAttr("forget_bias", opts.forgetBias); + } + if (opts.cellClip != null) { + opBuilder.setAttr("cell_clip", opts.cellClip); + } + if (opts.usePeephole != null) { + opBuilder.setAttr("use_peephole", opts.usePeephole); + } + } + } + return new LSTMBlockCell(opBuilder.build()); + } + + /** + * @param forgetBias The forget gate bias. + */ + public static Options forgetBias(Float forgetBias) { + return new Options().forgetBias(forgetBias); + } + + /** + * @param cellClip Value to clip the 'cs' value to. + */ + public static Options cellClip(Float cellClip) { + return new Options().cellClip(cellClip); + } + + /** + * @param usePeephole Whether to use peephole weights. + */ + public static Options usePeephole(Boolean usePeephole) { + return new Options().usePeephole(usePeephole); + } + + /** + * The input gate. + */ + public Output i() { + return i; + } + + /** + * The cell state before the tanh. + */ + public Output cs() { + return cs; + } + + /** + * The forget gate. + */ + public Output f() { + return f; + } + + /** + * The output gate. + */ + public Output o() { + return o; + } + + /** + * The cell input. + */ + public Output ci() { + return ci; + } + + /** + * The cell after the tanh. + */ + public Output co() { + return co; + } + + /** + * The output h vector. + */ + public Output h() { + return h; + } + + private Output i; + private Output cs; + private Output f; + private Output o; + private Output ci; + private Output co; + private Output h; + + private LSTMBlockCell(Operation operation) { + super(operation); + int outputIdx = 0; + i = operation.output(outputIdx++); + cs = operation.output(outputIdx++); + f = operation.output(outputIdx++); + o = operation.output(outputIdx++); + ci = operation.output(outputIdx++); + co = operation.output(outputIdx++); + h = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCellGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCellGrad.java new file mode 100644 index 00000000000..25da21a31e9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCellGrad.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the LSTM cell backward propagation for 1 timestep. + *

    + * This implementation is to be used in conjunction of LSTMBlockCell. + * + * @param data type for {@code csPrevGrad()} output + */ +public final class LSTMBlockCellGrad extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new LSTMBlockCellGrad operation. + * + * @param scope current scope + * @param x The input to the LSTM cell, shape (batch_size, num_inputs). + * @param csPrev The previous cell state. + * @param hPrev The previous h state. + * @param w The weight matrix. + * @param wci The weight matrix for input gate peephole connection. + * @param wcf The weight matrix for forget gate peephole connection. + * @param wco The weight matrix for output gate peephole connection. + * @param b The bias vector. + * @param i The input gate. + * @param cs The cell state before the tanh. + * @param f The forget gate. + * @param o The output gate. + * @param ci The cell input. + * @param co The cell after the tanh. + * @param csGrad The current gradient of cs. + * @param hGrad The gradient of h vector. + * @param usePeephole Whether the cell uses peephole connections. + * @return a new instance of LSTMBlockCellGrad + */ + public static LSTMBlockCellGrad create(Scope scope, Operand x, Operand csPrev, Operand hPrev, Operand w, Operand wci, Operand wcf, Operand wco, Operand b, Operand i, Operand cs, Operand f, Operand o, Operand ci, Operand co, Operand csGrad, Operand hGrad, Boolean usePeephole) { + OperationBuilder opBuilder = scope.env().opBuilder("LSTMBlockCellGrad", scope.makeOpName("LSTMBlockCellGrad")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(csPrev.asOutput()); + opBuilder.addInput(hPrev.asOutput()); + opBuilder.addInput(w.asOutput()); + opBuilder.addInput(wci.asOutput()); + opBuilder.addInput(wcf.asOutput()); + opBuilder.addInput(wco.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder.addInput(i.asOutput()); + opBuilder.addInput(cs.asOutput()); + opBuilder.addInput(f.asOutput()); + opBuilder.addInput(o.asOutput()); + opBuilder.addInput(ci.asOutput()); + opBuilder.addInput(co.asOutput()); + opBuilder.addInput(csGrad.asOutput()); + opBuilder.addInput(hGrad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("use_peephole", usePeephole); + return new LSTMBlockCellGrad(opBuilder.build()); + } + + /** + * The gradient of cs to be back-propped. + */ + public Output csPrevGrad() { + return csPrevGrad; + } + + /** + * The derivative wrt to [i, cs, f, o]. + */ + public Output dicfo() { + return dicfo; + } + + /** + * The gradient for wci to be back-propped. + */ + public Output wciGrad() { + return wciGrad; + } + + /** + * The gradient for wcf to be back-propped. + */ + public Output wcfGrad() { + return wcfGrad; + } + + /** + * The gradient for wco to be back-propped. + */ + public Output wcoGrad() { + return wcoGrad; + } + + private Output csPrevGrad; + private Output dicfo; + private Output wciGrad; + private Output wcfGrad; + private Output wcoGrad; + + private LSTMBlockCellGrad(Operation operation) { + super(operation); + int outputIdx = 0; + csPrevGrad = operation.output(outputIdx++); + dicfo = operation.output(outputIdx++); + wciGrad = operation.output(outputIdx++); + wcfGrad = operation.output(outputIdx++); + wcoGrad = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LinSpace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LinSpace.java new file mode 100644 index 00000000000..faae8c19de3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LinSpace.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generates values in an interval. + *

    + * A sequence of `num` evenly-spaced values are generated beginning at `start`. + * If `num > 1`, the values in the sequence increase by `stop - start / num - 1`, + * so that the last one is exactly `stop`. + *

    + * For example: + *

    {@code
    + * tf.linspace(10.0, 12.0, 3, name="linspace") => [ 10.0  11.0  12.0]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class LinSpace extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LinSpace operation. + * + * @param scope current scope + * @param start 0-D tensor. First entry in the range. + * @param stop 0-D tensor. Last entry in the range. + * @param num 0-D tensor. Number of values to generate. + * @return a new instance of LinSpace + */ + public static LinSpace create(Scope scope, Operand start, Operand stop, Operand num) { + OperationBuilder opBuilder = scope.env().opBuilder("LinSpace", scope.makeOpName("LinSpace")); + opBuilder.addInput(start.asOutput()); + opBuilder.addInput(stop.asOutput()); + opBuilder.addInput(num.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LinSpace(opBuilder.build()); + } + + /** + * 1-D. The generated values. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private LinSpace(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParameters.java new file mode 100644 index 00000000000..a0953b8c570 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParameters.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load ADAM embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingADAMParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingADAMParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingADAMParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the ADAM optimization algorithm. + * @param momenta Value of momenta used in the ADAM optimization algorithm. + * @param velocities Value of velocities used in the ADAM optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingADAMParameters + */ + public static LoadTPUEmbeddingADAMParameters create(Scope scope, Operand parameters, Operand momenta, Operand velocities, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingADAMParameters", scope.makeOpName("LoadTPUEmbeddingADAMParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(momenta.asOutput()); + opBuilder.addInput(velocities.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingADAMParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingADAMParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParametersGradAccumDebug.java new file mode 100644 index 00000000000..d6f48806bb9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParametersGradAccumDebug.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load ADAM embedding parameters with debug support. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingADAMParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingADAMParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingADAMParametersGradAccumDebug operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the ADAM optimization algorithm. + * @param momenta Value of momenta used in the ADAM optimization algorithm. + * @param velocities Value of velocities used in the ADAM optimization algorithm. + * @param gradientAccumulators Value of gradient_accumulators used in the ADAM optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingADAMParametersGradAccumDebug + */ + public static LoadTPUEmbeddingADAMParametersGradAccumDebug create(Scope scope, Operand parameters, Operand momenta, Operand velocities, Operand gradientAccumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingADAMParametersGradAccumDebug", scope.makeOpName("LoadTPUEmbeddingADAMParametersGradAccumDebug")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(momenta.asOutput()); + opBuilder.addInput(velocities.asOutput()); + opBuilder.addInput(gradientAccumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingADAMParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingADAMParametersGradAccumDebug(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParameters.java new file mode 100644 index 00000000000..231e74b0b4f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParameters.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load Adadelta embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingAdadeltaParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingAdadeltaParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingAdadeltaParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the Adadelta optimization algorithm. + * @param accumulators Value of accumulators used in the Adadelta optimization algorithm. + * @param updates Value of updates used in the Adadelta optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingAdadeltaParameters + */ + public static LoadTPUEmbeddingAdadeltaParameters create(Scope scope, Operand parameters, Operand accumulators, Operand updates, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingAdadeltaParameters", scope.makeOpName("LoadTPUEmbeddingAdadeltaParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingAdadeltaParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingAdadeltaParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParametersGradAccumDebug.java new file mode 100644 index 00000000000..f77aaa25199 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParametersGradAccumDebug.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load Adadelta parameters with debug support. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingAdadeltaParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingAdadeltaParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingAdadeltaParametersGradAccumDebug operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the Adadelta optimization algorithm. + * @param accumulators Value of accumulators used in the Adadelta optimization algorithm. + * @param updates Value of updates used in the Adadelta optimization algorithm. + * @param gradientAccumulators Value of gradient_accumulators used in the Adadelta optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingAdadeltaParametersGradAccumDebug + */ + public static LoadTPUEmbeddingAdadeltaParametersGradAccumDebug create(Scope scope, Operand parameters, Operand accumulators, Operand updates, Operand gradientAccumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingAdadeltaParametersGradAccumDebug", scope.makeOpName("LoadTPUEmbeddingAdadeltaParametersGradAccumDebug")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder.addInput(gradientAccumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingAdadeltaParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingAdadeltaParametersGradAccumDebug(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParameters.java new file mode 100644 index 00000000000..c88e1ae8aef --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParameters.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load Adagrad embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingAdagradParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingAdagradParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingAdagradParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the Adagrad optimization algorithm. + * @param accumulators Value of accumulators used in the Adagrad optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingAdagradParameters + */ + public static LoadTPUEmbeddingAdagradParameters create(Scope scope, Operand parameters, Operand accumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingAdagradParameters", scope.makeOpName("LoadTPUEmbeddingAdagradParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingAdagradParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingAdagradParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParametersGradAccumDebug.java new file mode 100644 index 00000000000..3964656c45c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParametersGradAccumDebug.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load Adagrad embedding parameters with debug support. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingAdagradParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingAdagradParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingAdagradParametersGradAccumDebug operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the Adagrad optimization algorithm. + * @param accumulators Value of accumulators used in the Adagrad optimization algorithm. + * @param gradientAccumulators Value of gradient_accumulators used in the Adagrad optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingAdagradParametersGradAccumDebug + */ + public static LoadTPUEmbeddingAdagradParametersGradAccumDebug create(Scope scope, Operand parameters, Operand accumulators, Operand gradientAccumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingAdagradParametersGradAccumDebug", scope.makeOpName("LoadTPUEmbeddingAdagradParametersGradAccumDebug")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder.addInput(gradientAccumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingAdagradParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingAdagradParametersGradAccumDebug(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingCenteredRMSPropParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingCenteredRMSPropParameters.java new file mode 100644 index 00000000000..f975ebb4b39 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingCenteredRMSPropParameters.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load centered RMSProp embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingCenteredRMSPropParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingCenteredRMSPropParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingCenteredRMSPropParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the centered RMSProp optimization algorithm. + * @param ms Value of ms used in the centered RMSProp optimization algorithm. + * @param mom Value of mom used in the centered RMSProp optimization algorithm. + * @param mg Value of mg used in the centered RMSProp optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingCenteredRMSPropParameters + */ + public static LoadTPUEmbeddingCenteredRMSPropParameters create(Scope scope, Operand parameters, Operand ms, Operand mom, Operand mg, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingCenteredRMSPropParameters", scope.makeOpName("LoadTPUEmbeddingCenteredRMSPropParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(mg.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingCenteredRMSPropParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingCenteredRMSPropParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParameters.java new file mode 100644 index 00000000000..f8d95d7a950 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParameters.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load FTRL embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingFTRLParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingFTRLParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingFTRLParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the FTRL optimization algorithm. + * @param accumulators Value of accumulators used in the FTRL optimization algorithm. + * @param linears Value of linears used in the FTRL optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingFTRLParameters + */ + public static LoadTPUEmbeddingFTRLParameters create(Scope scope, Operand parameters, Operand accumulators, Operand linears, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingFTRLParameters", scope.makeOpName("LoadTPUEmbeddingFTRLParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder.addInput(linears.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingFTRLParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingFTRLParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParametersGradAccumDebug.java new file mode 100644 index 00000000000..9d3768d0b80 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParametersGradAccumDebug.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load FTRL embedding parameters with debug support. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingFTRLParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingFTRLParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingFTRLParametersGradAccumDebug operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the FTRL optimization algorithm. + * @param accumulators Value of accumulators used in the FTRL optimization algorithm. + * @param linears Value of linears used in the FTRL optimization algorithm. + * @param gradientAccumulators Value of gradient_accumulators used in the FTRL optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingFTRLParametersGradAccumDebug + */ + public static LoadTPUEmbeddingFTRLParametersGradAccumDebug create(Scope scope, Operand parameters, Operand accumulators, Operand linears, Operand gradientAccumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingFTRLParametersGradAccumDebug", scope.makeOpName("LoadTPUEmbeddingFTRLParametersGradAccumDebug")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder.addInput(linears.asOutput()); + opBuilder.addInput(gradientAccumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingFTRLParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingFTRLParametersGradAccumDebug(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMDLAdagradLightParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMDLAdagradLightParameters.java new file mode 100644 index 00000000000..7cc48270b2f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMDLAdagradLightParameters.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load MDL Adagrad Light embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingMDLAdagradLightParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingMDLAdagradLightParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingMDLAdagradLightParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the MDL Adagrad Light optimization algorithm. + * @param accumulators Value of accumulators used in the MDL Adagrad Light optimization algorithm. + * @param weights Value of weights used in the MDL Adagrad Light optimization algorithm. + * @param benefits Value of benefits used in the MDL Adagrad Light optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingMDLAdagradLightParameters + */ + public static LoadTPUEmbeddingMDLAdagradLightParameters create(Scope scope, Operand parameters, Operand accumulators, Operand weights, Operand benefits, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingMDLAdagradLightParameters", scope.makeOpName("LoadTPUEmbeddingMDLAdagradLightParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder.addInput(weights.asOutput()); + opBuilder.addInput(benefits.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingMDLAdagradLightParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingMDLAdagradLightParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParameters.java new file mode 100644 index 00000000000..88db883b9e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParameters.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load Momentum embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingMomentumParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingMomentumParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingMomentumParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the Momentum optimization algorithm. + * @param momenta Value of momenta used in the Momentum optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingMomentumParameters + */ + public static LoadTPUEmbeddingMomentumParameters create(Scope scope, Operand parameters, Operand momenta, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingMomentumParameters", scope.makeOpName("LoadTPUEmbeddingMomentumParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(momenta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingMomentumParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingMomentumParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParametersGradAccumDebug.java new file mode 100644 index 00000000000..5dfedf47805 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParametersGradAccumDebug.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load Momentum embedding parameters with debug support. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingMomentumParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingMomentumParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingMomentumParametersGradAccumDebug operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the Momentum optimization algorithm. + * @param momenta Value of momenta used in the Momentum optimization algorithm. + * @param gradientAccumulators Value of gradient_accumulators used in the Momentum optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingMomentumParametersGradAccumDebug + */ + public static LoadTPUEmbeddingMomentumParametersGradAccumDebug create(Scope scope, Operand parameters, Operand momenta, Operand gradientAccumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingMomentumParametersGradAccumDebug", scope.makeOpName("LoadTPUEmbeddingMomentumParametersGradAccumDebug")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(momenta.asOutput()); + opBuilder.addInput(gradientAccumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingMomentumParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingMomentumParametersGradAccumDebug(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParameters.java new file mode 100644 index 00000000000..c60005b7095 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParameters.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load proximal Adagrad embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingProximalAdagradParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingProximalAdagradParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingProximalAdagradParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the proximal Adagrad optimization algorithm. + * @param accumulators Value of accumulators used in the proximal Adagrad optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingProximalAdagradParameters + */ + public static LoadTPUEmbeddingProximalAdagradParameters create(Scope scope, Operand parameters, Operand accumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingProximalAdagradParameters", scope.makeOpName("LoadTPUEmbeddingProximalAdagradParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingProximalAdagradParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingProximalAdagradParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug.java new file mode 100644 index 00000000000..10f10fdb7df --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load proximal Adagrad embedding parameters with debug support. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the proximal Adagrad optimization algorithm. + * @param accumulators Value of accumulators used in the proximal Adagrad optimization algorithm. + * @param gradientAccumulators Value of gradient_accumulators used in the proximal Adagrad optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug + */ + public static LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug create(Scope scope, Operand parameters, Operand accumulators, Operand gradientAccumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug", scope.makeOpName("LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(accumulators.asOutput()); + opBuilder.addInput(gradientAccumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParameters.java new file mode 100644 index 00000000000..9ec503b9234 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParameters.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load RMSProp embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingRMSPropParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingRMSPropParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingRMSPropParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the RMSProp optimization algorithm. + * @param ms Value of ms used in the RMSProp optimization algorithm. + * @param mom Value of mom used in the RMSProp optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingRMSPropParameters + */ + public static LoadTPUEmbeddingRMSPropParameters create(Scope scope, Operand parameters, Operand ms, Operand mom, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingRMSPropParameters", scope.makeOpName("LoadTPUEmbeddingRMSPropParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingRMSPropParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingRMSPropParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParametersGradAccumDebug.java new file mode 100644 index 00000000000..ba1e8b49334 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParametersGradAccumDebug.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load RMSProp embedding parameters with debug support. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingRMSPropParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingRMSPropParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingRMSPropParametersGradAccumDebug operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the RMSProp optimization algorithm. + * @param ms Value of ms used in the RMSProp optimization algorithm. + * @param mom Value of mom used in the RMSProp optimization algorithm. + * @param gradientAccumulators Value of gradient_accumulators used in the RMSProp optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingRMSPropParametersGradAccumDebug + */ + public static LoadTPUEmbeddingRMSPropParametersGradAccumDebug create(Scope scope, Operand parameters, Operand ms, Operand mom, Operand gradientAccumulators, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingRMSPropParametersGradAccumDebug", scope.makeOpName("LoadTPUEmbeddingRMSPropParametersGradAccumDebug")); + opBuilder.addInput(parameters.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(gradientAccumulators.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingRMSPropParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingRMSPropParametersGradAccumDebug(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingStochasticGradientDescentParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingStochasticGradientDescentParameters.java new file mode 100644 index 00000000000..cf9c2d8c503 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingStochasticGradientDescentParameters.java @@ -0,0 +1,112 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Load SGD embedding parameters. + *

    + * An op that loads optimization parameters into HBM for embedding. Must be + * preceded by a ConfigureTPUEmbeddingHost op that sets up the correct + * embedding table configuration. For example, this op is used to install + * parameters that are loaded from a checkpoint before a training loop is + * executed. + */ +public final class LoadTPUEmbeddingStochasticGradientDescentParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.LoadTPUEmbeddingStochasticGradientDescentParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadTPUEmbeddingStochasticGradientDescentParameters operation. + * + * @param scope current scope + * @param parameters Value of parameters used in the stochastic gradient descent optimization algorithm. + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of LoadTPUEmbeddingStochasticGradientDescentParameters + */ + public static LoadTPUEmbeddingStochasticGradientDescentParameters create(Scope scope, Operand parameters, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadTPUEmbeddingStochasticGradientDescentParameters", scope.makeOpName("LoadTPUEmbeddingStochasticGradientDescentParameters")); + opBuilder.addInput(parameters.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new LoadTPUEmbeddingStochasticGradientDescentParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + + private LoadTPUEmbeddingStochasticGradientDescentParameters(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableExport.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableExport.java new file mode 100644 index 00000000000..b3c82d2778e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableExport.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs all keys and values in the table. + * + * @param data type for {@code keys()} output + * @param data type for {@code values()} output + */ +@Operator +public final class LookupTableExport extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new LookupTableExport operation. + * + * @param scope current scope + * @param tableHandle Handle to the table. + * @param Tkeys + * @param Tvalues + * @return a new instance of LookupTableExport + */ + public static LookupTableExport create(Scope scope, Operand tableHandle, Class Tkeys, Class Tvalues) { + OperationBuilder opBuilder = scope.env().opBuilder("LookupTableExportV2", scope.makeOpName("LookupTableExport")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Tkeys", DataType.fromClass(Tkeys)); + opBuilder.setAttr("Tvalues", DataType.fromClass(Tvalues)); + return new LookupTableExport(opBuilder.build()); + } + + /** + * Vector of all keys present in the table. + */ + public Output keys() { + return keys; + } + + /** + * Tensor of all values in the table. Indexed in parallel with `keys`. + */ + public Output values() { + return values; + } + + private Output keys; + private Output values; + + private LookupTableExport(Operation operation) { + super(operation); + int outputIdx = 0; + keys = operation.output(outputIdx++); + values = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableFind.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableFind.java new file mode 100644 index 00000000000..63b836bb2c5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableFind.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Looks up keys in a table, outputs the corresponding values. + *

    + * The tensor `keys` must of the same type as the keys of the table. + * The output `values` is of the type of the table values. + *

    + * The scalar `default_value` is the value output for keys not present in the + * table. It must also be of the same type as the table values. + * + * @param data type for {@code values()} output + */ +@Operator +public final class LookupTableFind extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LookupTableFind operation. + * + * @param scope current scope + * @param tableHandle Handle to the table. + * @param keys Any shape. Keys to look up. + * @param defaultValue + * @return a new instance of LookupTableFind + */ + public static LookupTableFind create(Scope scope, Operand tableHandle, Operand keys, Operand defaultValue) { + OperationBuilder opBuilder = scope.env().opBuilder("LookupTableFindV2", scope.makeOpName("LookupTableFind")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder.addInput(keys.asOutput()); + opBuilder.addInput(defaultValue.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LookupTableFind(opBuilder.build()); + } + + /** + * Same shape as `keys`. Values found in the table, or `default_values` + * for missing keys. + */ + public Output values() { + return values; + } + + @Override + public Output asOutput() { + return values; + } + + private Output values; + + private LookupTableFind(Operation operation) { + super(operation); + int outputIdx = 0; + values = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableImport.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableImport.java new file mode 100644 index 00000000000..2204682eddf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableImport.java @@ -0,0 +1,58 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Replaces the contents of the table with the specified keys and values. + *

    + * The tensor `keys` must be of the same type as the keys of the table. + * The tensor `values` must be of the type of the table values. + */ +@Operator +public final class LookupTableImport extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new LookupTableImport operation. + * + * @param scope current scope + * @param tableHandle Handle to the table. + * @param keys Any shape. Keys to look up. + * @param values Values to associate with keys. + * @return a new instance of LookupTableImport + */ + public static LookupTableImport create(Scope scope, Operand tableHandle, Operand keys, Operand values) { + OperationBuilder opBuilder = scope.env().opBuilder("LookupTableImportV2", scope.makeOpName("LookupTableImport")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder.addInput(keys.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LookupTableImport(opBuilder.build()); + } + + + private LookupTableImport(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableInsert.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableInsert.java new file mode 100644 index 00000000000..6882211528e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableInsert.java @@ -0,0 +1,58 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Updates the table to associates keys with values. + *

    + * The tensor `keys` must be of the same type as the keys of the table. + * The tensor `values` must be of the type of the table values. + */ +@Operator +public final class LookupTableInsert extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new LookupTableInsert operation. + * + * @param scope current scope + * @param tableHandle Handle to the table. + * @param keys Any shape. Keys to look up. + * @param values Values to associate with keys. + * @return a new instance of LookupTableInsert + */ + public static LookupTableInsert create(Scope scope, Operand tableHandle, Operand keys, Operand values) { + OperationBuilder opBuilder = scope.env().opBuilder("LookupTableInsertV2", scope.makeOpName("LookupTableInsert")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder.addInput(keys.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LookupTableInsert(opBuilder.build()); + } + + + private LookupTableInsert(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableRemove.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableRemove.java new file mode 100644 index 00000000000..4c911c471f9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableRemove.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Removes keys and its associated values from a table. + *

    + * The tensor `keys` must of the same type as the keys of the table. Keys not + * already in the table are silently ignored. + */ +public final class LookupTableRemove extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new LookupTableRemove operation. + * + * @param scope current scope + * @param tableHandle Handle to the table. + * @param keys Any shape. Keys of the elements to remove. + * @return a new instance of LookupTableRemove + */ + public static LookupTableRemove create(Scope scope, Operand tableHandle, Operand keys) { + OperationBuilder opBuilder = scope.env().opBuilder("LookupTableRemoveV2", scope.makeOpName("LookupTableRemove")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder.addInput(keys.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LookupTableRemove(opBuilder.build()); + } + + + private LookupTableRemove(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableSize.java new file mode 100644 index 00000000000..70c26a789fb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableSize.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the number of elements in the given table. + */ +@Operator +public final class LookupTableSize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LookupTableSize operation. + * + * @param scope current scope + * @param tableHandle Handle to the table. + * @return a new instance of LookupTableSize + */ + public static LookupTableSize create(Scope scope, Operand tableHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("LookupTableSizeV2", scope.makeOpName("LookupTableSize")); + opBuilder.addInput(tableHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LookupTableSize(opBuilder.build()); + } + + /** + * Scalar that contains number of elements in the table. + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private LookupTableSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoopCond.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoopCond.java new file mode 100644 index 00000000000..e92f4d96123 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoopCond.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Forwards the input to the output. + *

    + * This operator represents the loop termination condition used by the + * "pivot" switches of a loop. + */ +@Operator +public final class LoopCond extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LoopCond operation. + * + * @param scope current scope + * @param input A boolean scalar, representing the branch predicate of the Switch op. + * @return a new instance of LoopCond + */ + public static LoopCond create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("LoopCond", scope.makeOpName("LoopCond")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LoopCond(opBuilder.build()); + } + + /** + * The same tensor as `input`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private LoopCond(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LowerBound.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LowerBound.java new file mode 100644 index 00000000000..e53704e3fa1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LowerBound.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Applies lower_bound(sorted_search_values, values) along each row. + *

    + * Each set of rows with the same index in (sorted_inputs, values) is treated + * independently. The resulting row is the equivalent of calling + * `np.searchsorted(sorted_inputs, values, side='left')`. + *

    + * The result is not a global index to the entire + * `Tensor`, but rather just the index in the last dimension. + *

    + * A 2-D example: + * sorted_sequence = [[0, 3, 9, 9, 10], + * [1, 2, 3, 4, 5]] + * values = [[2, 4, 9], + * [0, 2, 6]] + *

    + * result = LowerBound(sorted_sequence, values) + *

    + * result == [[1, 2, 2], + * [0, 1, 5]] + * + * @param data type for {@code output()} output + */ +public final class LowerBound extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LowerBound operation. + * + * @param scope current scope + * @param sortedInputs 2-D Tensor where each row is ordered. + * @param values 2-D Tensor with the same numbers of rows as `sorted_search_values`. Contains + * the values that will be searched for in `sorted_search_values`. + * @param outType + * @return a new instance of LowerBound + */ + public static LowerBound create(Scope scope, Operand sortedInputs, Operand values, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("LowerBound", scope.makeOpName("LowerBound")); + opBuilder.addInput(sortedInputs.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new LowerBound(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new LowerBound operation using default output types. + * + * @param scope current scope + * @param sortedInputs 2-D Tensor where each row is ordered. + * @param values 2-D Tensor with the same numbers of rows as `sorted_search_values`. Contains + * the values that will be searched for in `sorted_search_values`. + * @return a new instance of LowerBound + */ + public static LowerBound create(Scope scope, Operand sortedInputs, Operand values) { + return create(scope, sortedInputs, values, Integer.class); + } + + /** + * A `Tensor` with the same shape as `values`. It contains the first scalar index + * into the last dimension where values can be inserted without changing the + * ordered property. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private LowerBound(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Lu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Lu.java new file mode 100644 index 00000000000..d26a2ee3d5e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Lu.java @@ -0,0 +1,117 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the LU decomposition of one or more square matrices. + *

    + * The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions + * form square matrices. + *

    + * The input has to be invertible. + *

    + * The output consists of two tensors LU and P containing the LU decomposition + * of all input submatrices `[..., :, :]`. LU encodes the lower triangular and + * upper triangular factors. + *

    + * For each input submatrix of shape `[M, M]`, L is a lower triangular matrix of + * shape `[M, M]` with unit diagonal whose entries correspond to the strictly lower + * triangular part of LU. U is a upper triangular matrix of shape `[M, M]` whose + * entries correspond to the upper triangular part, including the diagonal, of LU. + *

    + * P represents a permutation matrix encoded as a list of indices each between `0` + * and `M-1`, inclusive. If P_mat denotes the permutation matrix corresponding to + * P, then the L, U and P satisfies P_mat * input = L * U. + * + * @param data type for {@code lu()} output + * @param data type for {@code p()} output + */ +@Operator +public final class Lu extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new Lu operation. + * + * @param scope current scope + * @param input A tensor of shape `[..., M, M]` whose inner-most 2 dimensions form matrices of + * size `[M, M]`. + * @param outputIdxType + * @return a new instance of Lu + */ + public static Lu create(Scope scope, Operand input, Class outputIdxType) { + OperationBuilder opBuilder = scope.env().opBuilder("Lu", scope.makeOpName("Lu")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("output_idx_type", DataType.fromClass(outputIdxType)); + return new Lu(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Lu operation using default output types. + * + * @param scope current scope + * @param input A tensor of shape `[..., M, M]` whose inner-most 2 dimensions form matrices of + * size `[M, M]`. + * @return a new instance of Lu + */ + public static Lu create(Scope scope, Operand input) { + return create(scope, input, Integer.class); + } + + /** + * A tensor of shape `[..., M, M]` whose strictly lower triangular part denotes the + * lower triangular factor `L` with unit diagonal, and whose upper triangular part + * denotes the upper triangular factor `U`. + */ + public Output lu() { + return lu; + } + + /** + * Permutation of the rows encoded as a list of indices in `0..M-1`. Shape is + * `[..., M]`. + * @compatibility(scipy) + * Similar to `scipy.linalg.lu`, except the triangular factors `L` and `U` are + * packed into a single tensor, the permutation is applied to `input` instead of + * the right hand side and the permutation `P` is returned as a list of indices + * instead of a permutation matrix. + * @end_compatibility + */ + public Output p() { + return p; + } + + private Output lu; + private Output p; + + private Lu(Operation operation) { + super(operation); + int outputIdx = 0; + lu = operation.output(outputIdx++); + p = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapClear.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapClear.java new file mode 100644 index 00000000000..88bddc291ea --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapClear.java @@ -0,0 +1,147 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op removes all elements in the underlying container. + */ +@Operator +public final class MapClear extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapClear} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MapClear operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapClear + */ + public static MapClear create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MapClear", scope.makeOpName("MapClear")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new MapClear(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + + private MapClear(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapIncompleteSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapIncompleteSize.java new file mode 100644 index 00000000000..16f0173e649 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapIncompleteSize.java @@ -0,0 +1,163 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op returns the number of incomplete elements in the underlying container. + */ +@Operator +public final class MapIncompleteSize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapIncompleteSize} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MapIncompleteSize operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapIncompleteSize + */ + public static MapIncompleteSize create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MapIncompleteSize", scope.makeOpName("MapIncompleteSize")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new MapIncompleteSize(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private MapIncompleteSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapPeek.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapPeek.java new file mode 100644 index 00000000000..64ce0f02e53 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapPeek.java @@ -0,0 +1,175 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op peeks at the values at the specified key. If the + *

    + * underlying container does not contain this key + * this op will block until it does. + */ +@Operator +public final class MapPeek extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapPeek} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MapPeek operation. + * + * @param scope current scope + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapPeek + */ + public static MapPeek create(Scope scope, Operand key, Operand indices, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MapPeek", scope.makeOpName("MapPeek")); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new MapPeek(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public List> values() { + return values; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) values.iterator(); + } + + private List> values; + + private MapPeek(Operation operation) { + super(operation); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapSize.java new file mode 100644 index 00000000000..3e9be2a9586 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapSize.java @@ -0,0 +1,163 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op returns the number of elements in the underlying container. + */ +@Operator +public final class MapSize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapSize} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MapSize operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapSize + */ + public static MapSize create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MapSize", scope.makeOpName("MapSize")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new MapSize(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private MapSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapStage.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapStage.java new file mode 100644 index 00000000000..5ef7f865654 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapStage.java @@ -0,0 +1,160 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Stage (key, values) in the underlying container which behaves like a hashtable. + */ +@Operator +public final class MapStage extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapStage} + */ + public static class Options { + + /** + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName It is necessary to match this name to the matching Unstage Op. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MapStage operation. + * + * @param scope current scope + * @param key int64 + * @param indices + * @param values a list of tensors + * dtypes A list of data types that inserted values should adhere to. + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapStage + */ + public static MapStage create(Scope scope, Operand key, Operand indices, Iterable> values, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MapStage", scope.makeOpName("MapStage")); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new MapStage(opBuilder.build()); + } + + /** + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName It is necessary to match this name to the matching Unstage Op. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + + private MapStage(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapUnstage.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapUnstage.java new file mode 100644 index 00000000000..ddca39c3c20 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapUnstage.java @@ -0,0 +1,175 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op removes and returns the values associated with the key + *

    + * from the underlying container. If the underlying container + * does not contain this key, the op will block until it does. + */ +@Operator +public final class MapUnstage extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapUnstage} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MapUnstage operation. + * + * @param scope current scope + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapUnstage + */ + public static MapUnstage create(Scope scope, Operand key, Operand indices, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MapUnstage", scope.makeOpName("MapUnstage")); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new MapUnstage(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public List> values() { + return values; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) values.iterator(); + } + + private List> values; + + private MapUnstage(Operation operation) { + super(operation); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapUnstageNoKey.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapUnstageNoKey.java new file mode 100644 index 00000000000..eeca07c036b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapUnstageNoKey.java @@ -0,0 +1,174 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op removes and returns a random (key, value) + *

    + * from the underlying container. If the underlying container + * does not contain elements, the op will block until it does. + */ +@Operator +public final class MapUnstageNoKey extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapUnstageNoKey} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MapUnstageNoKey operation. + * + * @param scope current scope + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of MapUnstageNoKey + */ + public static MapUnstageNoKey create(Scope scope, Operand indices, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MapUnstageNoKey", scope.makeOpName("MapUnstageNoKey")); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new MapUnstageNoKey(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output key() { + return key; + } + + /** + */ + public List> values() { + return values; + } + + private Output key; + private List> values; + + private MapUnstageNoKey(Operation operation) { + super(operation); + int outputIdx = 0; + key = operation.output(outputIdx++); + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagPartV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagPartV2.java new file mode 100644 index 00000000000..b1c87b73d25 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagPartV2.java @@ -0,0 +1,144 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the batched diagonal part of a batched tensor. + *

    + * Returns a tensor with the `k[0]`-th to `k[1]`-th diagonals of the batched + * `input`. + *

    + * Assume `input` has `r` dimensions `[I, J, ..., L, M, N]`. + * Let `max_diag_len` be the maximum length among all diagonals to be extracted, + * `max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))` + * Let `num_diags` be the number of diagonals to extract, + * `num_diags = k[1] - k[0] + 1`. + *

    + * If `num_diags == 1`, the output tensor is of rank `r - 1` with shape + * `[I, J, ..., L, max_diag_len]` and values: + *

    {@code
    + * diagonal[i, j, ..., l, n]
    + *   = input[i, j, ..., l, n+y, n+x] ; when 0 <= n-y < M and 0 <= n-x < N,
    + *     0                             ; otherwise.
    + * }
    + * where `y = max(-k[1], 0)`, `x = max(k[1], 0)`. + *

    + * Otherwise, the output tensor has rank `r` with dimensions + * `[I, J, ..., L, num_diags, max_diag_len]` with values: + *

    {@code
    + * diagonal[i, j, ..., l, m, n]
    + *   = input[i, j, ..., l, n+y, n+x] ; when 0 <= n-y < M and 0 <= n-x < N,
    + *     0                             ; otherwise.
    + * }
    + * where `d = k[1] - m`, `y = max(-d, 0)`, and `x = max(d, 0)`. + *

    + * The input must be at least a matrix. + *

    + * For example: + *

    {@code
    + * input = np.array([[[1, 2, 3, 4],  # Input shape: (2, 3, 4)
    + *                    [5, 6, 7, 8],
    + *                    [9, 8, 7, 6]],
    + *                   [[5, 4, 3, 2],
    + *                    [1, 2, 3, 4],
    + *                    [5, 6, 7, 8]]])
    + * 
    + * # A main diagonal from each batch.
    + * tf.matrix_diag_part(input) ==> [[1, 6, 7],  # Output shape: (2, 3)
    + *                                 [5, 2, 7]]
    + * 
    + * # A superdiagonal from each batch.
    + * tf.matrix_diag_part(input, k = 1)
    + *   ==> [[2, 7, 6],  # Output shape: (2, 3)
    + *        [4, 3, 8]]
    + * 
    + * # A tridiagonal band from each batch.
    + * tf.matrix_diag_part(input, k = (-1, 1))
    + *   ==> [[[2, 7, 6],  # Output shape: (2, 3, 3)
    + *         [1, 6, 7],
    + *         [5, 8, 0]],
    + *        [[4, 3, 8],
    + *         [5, 2, 7],
    + *         [1, 6, 0]]]
    + * 
    + * # Padding = 9
    + * tf.matrix_diag_part(input, k = (1, 3), padding = 9)
    + *   ==> [[[4, 9, 9],  # Output shape: (2, 3, 3)
    + *         [3, 8, 9],
    + *         [2, 7, 6]],
    + *        [[2, 9, 9],
    + *         [3, 4, 9],
    + *         [4, 3, 8]]]
    + * }
    + * + * + * @param data type for {@code diagonal()} output + */ +@Operator +public final class MatrixDiagPartV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MatrixDiagPartV2 operation. + * + * @param scope current scope + * @param input Rank `r` tensor where `r >= 2`. + * @param k Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + * diagonal, and negative value means subdiagonals. `k` can be a single integer + * (for a single diagonal) or a pair of integers specifying the low and high ends + * of a matrix band. `k[0]` must not be larger than `k[1]`. + * @param paddingValue The value to fill the area outside the specified diagonal band with. + * Default is 0. + * @return a new instance of MatrixDiagPartV2 + */ + public static MatrixDiagPartV2 create(Scope scope, Operand input, Operand k, Operand paddingValue) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixDiagPartV2", scope.makeOpName("MatrixDiagPartV2")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(k.asOutput()); + opBuilder.addInput(paddingValue.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MatrixDiagPartV2(opBuilder.build()); + } + + /** + * The extracted diagonal(s). + */ + public Output diagonal() { + return diagonal; + } + + @Override + public Output asOutput() { + return diagonal; + } + + private Output diagonal; + + private MatrixDiagPartV2(Operation operation) { + super(operation); + int outputIdx = 0; + diagonal = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagV2.java new file mode 100644 index 00000000000..2e2c0f93385 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagV2.java @@ -0,0 +1,170 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a batched diagonal tensor with given batched diagonal values. + *

    + * Returns a tensor with the contents in `diagonal` as `k[0]`-th to `k[1]`-th + * diagonals of a matrix, with everything else padded with `padding`. `num_rows` + * and `num_cols` specify the dimension of the innermost matrix of the output. If + * both are not specified, the op assumes the innermost matrix is square and infers + * its size from `k` and the innermost dimension of `diagonal`. If only one of them + * is specified, the op assumes the unspecified value is the smallest possible + * based on other criteria. + *

    + * Let `diagonal` have `r` dimensions `[I, J, ..., L, M, N]`. The output tensor has + * rank `r+1` with shape `[I, J, ..., L, M, num_rows, num_cols]` when only one + * diagonal is given (`k` is an integer or `k[0] == k[1]`). Otherwise, it has rank + * `r` with shape `[I, J, ..., L, num_rows, num_cols]`. + *

    + * The second innermost dimension of `diagonal` has double meaning. + * When `k` is scalar or `k[0] == k[1]`, `M` is part of the batch size + * [I, J, ..., M], and the output tensor is: + *

    {@code
    + * output[i, j, ..., l, m, n]
    + *   = diagonal[i, j, ..., l, n-max(d_upper, 0)] ; if n - m == d_upper
    + *     output[i, j, ..., l, m, n]                ; otherwise
    + * }
    + * Otherwise, `M` is treated as the number of diagonals for the matrix in the + * same batch (`M = k[1]-k[0]+1`), and the output tensor is: + *
    {@code
    + * output[i, j, ..., l, m, n]
    + *   = diagonal[i, j, ..., l, k[1]-d, n-max(d, 0)] ; if d_lower <= d <= d_upper
    + *     input[i, j, ..., l, m, n]                   ; otherwise
    + * }
    + * where `d = n - m` + *

    + * For example: + *

    {@code
    + * # The main diagonal.
    + * diagonal = np.array([[1, 2, 3, 4],            # Input shape: (2, 4)
    + *                      [5, 6, 7, 8]])
    + * tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0],  # Output shape: (2, 4, 4)
    + *                                [0, 2, 0, 0],
    + *                                [0, 0, 3, 0],
    + *                                [0, 0, 0, 4]],
    + *                               [[5, 0, 0, 0],
    + *                                [0, 6, 0, 0],
    + *                                [0, 0, 7, 0],
    + *                                [0, 0, 0, 8]]]
    + * 
    + * # A superdiagonal (per batch).
    + * diagonal = np.array([[1, 2, 3],  # Input shape: (2, 3)
    + *                      [4, 5, 6]])
    + * tf.matrix_diag(diagonal, k = 1)
    + *   ==> [[[0, 1, 0, 0],  # Output shape: (2, 4, 4)
    + *         [0, 0, 2, 0],
    + *         [0, 0, 0, 3],
    + *         [0, 0, 0, 0]],
    + *        [[0, 4, 0, 0],
    + *         [0, 0, 5, 0],
    + *         [0, 0, 0, 6],
    + *         [0, 0, 0, 0]]]
    + * 
    + * # A band of diagonals.
    + * diagonals = np.array([[[1, 2, 3],  # Input shape: (2, 2, 3)
    + *                        [4, 5, 0]],
    + *                       [[6, 7, 9],
    + *                        [9, 1, 0]]])
    + * tf.matrix_diag(diagonals, k = (-1, 0))
    + *   ==> [[[1, 0, 0],  # Output shape: (2, 3, 3)
    + *         [4, 2, 0],
    + *         [0, 5, 3]],
    + *        [[6, 0, 0],
    + *         [9, 7, 0],
    + *         [0, 1, 9]]]
    + * 
    + * # Rectangular matrix.
    + * diagonal = np.array([1, 2])  # Input shape: (2)
    + * tf.matrix_diag(diagonal, k = -1, num_rows = 3, num_cols = 4)
    + *   ==> [[0, 0, 0, 0],  # Output shape: (3, 4)
    + *        [1, 0, 0, 0],
    + *        [0, 2, 0, 0]]
    + * 
    + * # Rectangular matrix with inferred num_cols and padding = 9.
    + * tf.matrix_diag(diagonal, k = -1, num_rows = 3, padding = 9)
    + *   ==> [[9, 9],  # Output shape: (3, 2)
    + *        [1, 9],
    + *        [9, 2]]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class MatrixDiagV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MatrixDiagV2 operation. + * + * @param scope current scope + * @param diagonal Rank `r`, where `r >= 1` + * @param k Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + * diagonal, and negative value means subdiagonals. `k` can be a single integer + * (for a single diagonal) or a pair of integers specifying the low and high ends + * of a matrix band. `k[0]` must not be larger than `k[1]`. + * @param numRows The number of rows of the output matrix. If it is not provided, the op assumes + * the output matrix is a square matrix and infers the matrix size from k and the + * innermost dimension of `diagonal`. + * @param numCols The number of columns of the output matrix. If it is not provided, the op + * assumes the output matrix is a square matrix and infers the matrix size from + * k and the innermost dimension of `diagonal`. + * @param paddingValue The number to fill the area outside the specified diagonal band with. + * Default is 0. + * @return a new instance of MatrixDiagV2 + */ + public static MatrixDiagV2 create(Scope scope, Operand diagonal, Operand k, Operand numRows, Operand numCols, Operand paddingValue) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixDiagV2", scope.makeOpName("MatrixDiagV2")); + opBuilder.addInput(diagonal.asOutput()); + opBuilder.addInput(k.asOutput()); + opBuilder.addInput(numRows.asOutput()); + opBuilder.addInput(numCols.asOutput()); + opBuilder.addInput(paddingValue.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MatrixDiagV2(opBuilder.build()); + } + + /** + * Has rank `r+1` when `k` is an integer or `k[0] == k[1]`, rank `r` otherwise. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MatrixDiagV2(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixSetDiagV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixSetDiagV2.java new file mode 100644 index 00000000000..74f5edadc7c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixSetDiagV2.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a batched matrix tensor with new batched diagonal values. + *

    + * Given `input` and `diagonal`, this operation returns a tensor with the + * same shape and values as `input`, except for the specified diagonals of the + * innermost matrices. These will be overwritten by the values in `diagonal`. + *

    + * `input` has `r+1` dimensions `[I, J, ..., L, M, N]`. When `k` is scalar or + * `k[0] == k[1]`, `diagonal` has `r` dimensions `[I, J, ..., L, max_diag_len]`. + * Otherwise, it has `r+1` dimensions `[I, J, ..., L, num_diags, max_diag_len]`. + * `num_diags` is the number of diagonals, `num_diags = k[1] - k[0] + 1`. + * `max_diag_len` is the longest diagonal in the range `[k[0], k[1]]`, + * `max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))` + *

    + * The output is a tensor of rank `k+1` with dimensions `[I, J, ..., L, M, N]`. + * If `k` is scalar or `k[0] == k[1]`: + *

    {@code
    + * output[i, j, ..., l, m, n]
    + *   = diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1]
    + *     output[i, j, ..., l, m, n]             ; otherwise
    + * }
    + * Otherwise, + *
    {@code
    + * output[i, j, ..., l, m, n]
    + *   = diagonal[i, j, ..., l, k[1]-d, n-max(d, 0)] ; if d_lower <= d <= d_upper
    + *     input[i, j, ..., l, m, n]                   ; otherwise
    + * }
    + * where `d = n - m` + *

    + * For example: + *

    {@code
    + * # The main diagonal.
    + * input = np.array([[[7, 7, 7, 7],              # Input shape: (2, 3, 4)
    + *                    [7, 7, 7, 7],
    + *                    [7, 7, 7, 7]],
    + *                   [[7, 7, 7, 7],
    + *                    [7, 7, 7, 7],
    + *                    [7, 7, 7, 7]]])
    + * diagonal = np.array([[1, 2, 3],               # Diagonal shape: (2, 3)
    + *                      [4, 5, 6]])
    + * tf.matrix_diag(diagonal) ==> [[[1, 7, 7, 7],  # Output shape: (2, 3, 4)
    + *                                [7, 2, 7, 7],
    + *                                [7, 7, 3, 7]],
    + *                               [[4, 7, 7, 7],
    + *                                [7, 5, 7, 7],
    + *                                [7, 7, 6, 7]]]
    + * 
    + * # A superdiagonal (per batch).
    + * tf.matrix_diag(diagonal, k = 1)
    + *   ==> [[[7, 1, 7, 7],  # Output shape: (2, 3, 4)
    + *         [7, 7, 2, 7],
    + *         [7, 7, 7, 3]],
    + *        [[7, 4, 7, 7],
    + *         [7, 7, 5, 7],
    + *         [7, 7, 7, 6]]]
    + * 
    + * # A band of diagonals.
    + * diagonals = np.array([[[1, 2, 3],  # Diagonal shape: (2, 2, 3)
    + *                        [4, 5, 0]],
    + *                       [[6, 1, 2],
    + *                        [3, 4, 0]]])
    + * tf.matrix_diag(diagonals, k = (-1, 0))
    + *   ==> [[[1, 7, 7, 7],  # Output shape: (2, 3, 4)
    + *         [4, 2, 7, 7],
    + *         [0, 5, 3, 7]],
    + *        [[6, 7, 7, 7],
    + *         [3, 1, 7, 7],
    + *         [7, 4, 2, 7]]]
    + * 
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class MatrixSetDiagV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MatrixSetDiagV2 operation. + * + * @param scope current scope + * @param input Rank `r+1`, where `r >= 1`. + * @param diagonal Rank `r` when `k` is an integer or `k[0] == k[1]`. Otherwise, it has rank `r+1`. + * `k >= 1`. + * @param k Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main + * diagonal, and negative value means subdiagonals. `k` can be a single integer + * (for a single diagonal) or a pair of integers specifying the low and high ends + * of a matrix band. `k[0]` must not be larger than `k[1]`. + * @return a new instance of MatrixSetDiagV2 + */ + public static MatrixSetDiagV2 create(Scope scope, Operand input, Operand diagonal, Operand k) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixSetDiagV2", scope.makeOpName("MatrixSetDiagV2")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(diagonal.asOutput()); + opBuilder.addInput(k.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MatrixSetDiagV2(opBuilder.build()); + } + + /** + * Rank `r+1`, with `output.shape = input.shape`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MatrixSetDiagV2(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Max.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Max.java new file mode 100644 index 00000000000..972e8e142e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Max.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the maximum of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Max extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Max} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Max operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of Max + */ + public static Max create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Max", scope.makeOpName("Max")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new Max(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Max(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MaxIntraOpParallelismDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MaxIntraOpParallelismDataset.java new file mode 100644 index 00000000000..e442fbf7f4a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MaxIntraOpParallelismDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that overrides the maximum intra-op parallelism. + */ +public final class MaxIntraOpParallelismDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MaxIntraOpParallelismDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param maxIntraOpParallelism Identifies the maximum intra-op parallelism to use. + * @param outputTypes + * @param outputShapes + * @return a new instance of MaxIntraOpParallelismDataset + */ + public static MaxIntraOpParallelismDataset create(Scope scope, Operand inputDataset, Operand maxIntraOpParallelism, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxIntraOpParallelismDataset", scope.makeOpName("MaxIntraOpParallelismDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(maxIntraOpParallelism.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new MaxIntraOpParallelismDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private MaxIntraOpParallelismDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Merge.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Merge.java new file mode 100644 index 00000000000..2961b1cfcd5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Merge.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Forwards the value of an available tensor from `inputs` to `output`. + *

    + * `Merge` waits for at least one of the tensors in `inputs` to become available. + * It is usually combined with `Switch` to implement branching. + *

    + * `Merge` forwards the first tensor to become available to `output`, and sets + * `value_index` to its index in `inputs`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Merge extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new Merge operation. + * + * @param scope current scope + * @param inputs The input tensors, exactly one of which will become available. + * @return a new instance of Merge + */ + public static Merge create(Scope scope, Iterable> inputs) { + OperationBuilder opBuilder = scope.env().opBuilder("Merge", scope.makeOpName("Merge")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Merge(opBuilder.build()); + } + + /** + * Will be set to the available input tensor. + */ + public Output output() { + return output; + } + + /** + * The index of the chosen input tensor in `inputs`. + */ + public Output valueIndex() { + return valueIndex; + } + + private Output output; + private Output valueIndex; + + private Merge(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + valueIndex = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Min.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Min.java new file mode 100644 index 00000000000..cb8f427ac36 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Min.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the minimum of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Min extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Min} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Min operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of Min + */ + public static Min create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Min", scope.makeOpName("Min")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new Min(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Min(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPad.java new file mode 100644 index 00000000000..99953ee05c4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPad.java @@ -0,0 +1,104 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Pads a tensor with mirrored values. + *

    + * This operation pads a `input` with mirrored values according to the `paddings` + * you specify. `paddings` is an integer tensor with shape `[n, 2]`, where n is + * the rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates + * how many values to add before the contents of `input` in that dimension, and + * `paddings[D, 1]` indicates how many values to add after the contents of `input` + * in that dimension. Both `paddings[D, 0]` and `paddings[D, 1]` must be no greater + * than `input.dim_size(D)` (or `input.dim_size(D) - 1`) if `copy_border` is true + * (if false, respectively). + *

    + * The padded size of each dimension D of the output is: + *

    + * `paddings(D, 0) + input.dim_size(D) + paddings(D, 1)` + *

    + * For example: + *

    {@code
    + * # 't' is [[1, 2, 3], [4, 5, 6]].
    + * # 'paddings' is [[1, 1]], [2, 2]].
    + * # 'mode' is SYMMETRIC.
    + * # rank of 't' is 2.
    + * pad(t, paddings) ==> [[2, 1, 1, 2, 3, 3, 2]
    + *                       [2, 1, 1, 2, 3, 3, 2]
    + *                       [5, 4, 4, 5, 6, 6, 5]
    + *                       [5, 4, 4, 5, 6, 6, 5]]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class MirrorPad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MirrorPad operation. + * + * @param scope current scope + * @param input The input tensor to be padded. + * @param paddings A two-column matrix specifying the padding sizes. The number of + * rows must be the same as the rank of `input`. + * @param mode Either `REFLECT` or `SYMMETRIC`. In reflect mode the padded regions + * do not include the borders, while in symmetric mode the padded regions + * do include the borders. For example, if `input` is `[1, 2, 3]` and `paddings` + * is `[0, 2]`, then the output is `[1, 2, 3, 2, 1]` in reflect mode, and + * it is `[1, 2, 3, 3, 2]` in symmetric mode. + * @return a new instance of MirrorPad + */ + public static MirrorPad create(Scope scope, Operand input, Operand paddings, String mode) { + OperationBuilder opBuilder = scope.env().opBuilder("MirrorPad", scope.makeOpName("MirrorPad")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(paddings.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("mode", mode); + return new MirrorPad(opBuilder.build()); + } + + /** + * The padded tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MirrorPad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPadGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPadGrad.java new file mode 100644 index 00000000000..fcf5d332647 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPadGrad.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Gradient op for `MirrorPad` op. This op folds a mirror-padded tensor. + *

    + * This operation folds the padded areas of `input` by `MirrorPad` according to the + * `paddings` you specify. `paddings` must be the same as `paddings` argument + * given to the corresponding `MirrorPad` op. + *

    + * The folded size of each dimension D of the output is: + *

    + * `input.dim_size(D) - paddings(D, 0) - paddings(D, 1)` + *

    + * For example: + *

    {@code
    + * # 't' is [[1, 2, 3], [4, 5, 6], [7, 8, 9]].
    + * # 'paddings' is [[0, 1]], [0, 1]].
    + * # 'mode' is SYMMETRIC.
    + * # rank of 't' is 2.
    + * pad(t, paddings) ==> [[ 1,  5]
    + *                       [11, 28]]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +public final class MirrorPadGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MirrorPadGrad operation. + * + * @param scope current scope + * @param input The input tensor to be folded. + * @param paddings A two-column matrix specifying the padding sizes. The number of + * rows must be the same as the rank of `input`. + * @param mode The mode used in the `MirrorPad` op. + * @return a new instance of MirrorPadGrad + */ + public static MirrorPadGrad create(Scope scope, Operand input, Operand paddings, String mode) { + OperationBuilder opBuilder = scope.env().opBuilder("MirrorPadGrad", scope.makeOpName("MirrorPadGrad")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(paddings.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("mode", mode); + return new MirrorPadGrad(opBuilder.build()); + } + + /** + * The folded tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MirrorPadGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MulNoNan.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MulNoNan.java new file mode 100644 index 00000000000..6d547179c44 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MulNoNan.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x * y element-wise. Returns zero if y is zero, even if x if infinite or NaN. + *

    + * NOTE: `MulNoNan` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator +public final class MulNoNan extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MulNoNan operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of MulNoNan + */ + public static MulNoNan create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("MulNoNan", scope.makeOpName("MulNoNan")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MulNoNan(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private MulNoNan(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableDenseHashTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableDenseHashTable.java new file mode 100644 index 00000000000..68e1d135043 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableDenseHashTable.java @@ -0,0 +1,219 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates an empty hash table that uses tensors as the backing store. + *

    + * It uses "open addressing" with quadratic reprobing to resolve + * collisions. + *

    + * This op creates a mutable hash table, specifying the type of its keys and + * values. Each value must be a scalar. Data can be inserted into the table using + * the insert operations. It does not support the initialization operation. + */ +@Operator +public final class MutableDenseHashTable extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MutableDenseHashTable} + */ + public static class Options { + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param useNodeNameSharing + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + + /** + * @param valueShape The shape of each value. + */ + public Options valueShape(Shape valueShape) { + this.valueShape = valueShape; + return this; + } + + /** + * @param initialNumBuckets The initial number of hash table buckets. Must be a power + * to 2. + */ + public Options initialNumBuckets(Long initialNumBuckets) { + this.initialNumBuckets = initialNumBuckets; + return this; + } + + /** + * @param maxLoadFactor The maximum ratio between number of entries and number of + * buckets before growing the table. Must be between 0 and 1. + */ + public Options maxLoadFactor(Float maxLoadFactor) { + this.maxLoadFactor = maxLoadFactor; + return this; + } + + private String container; + private String sharedName; + private Boolean useNodeNameSharing; + private Shape valueShape; + private Long initialNumBuckets; + private Float maxLoadFactor; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MutableDenseHashTable operation. + * + * @param scope current scope + * @param emptyKey The key used to represent empty key buckets internally. Must not + * be used in insert or lookup operations. + * @param deletedKey + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of MutableDenseHashTable + */ + public static MutableDenseHashTable create(Scope scope, Operand emptyKey, Operand deletedKey, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MutableDenseHashTableV2", scope.makeOpName("MutableDenseHashTable")); + opBuilder.addInput(emptyKey.asOutput()); + opBuilder.addInput(deletedKey.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("value_dtype", DataType.fromClass(valueDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.useNodeNameSharing != null) { + opBuilder.setAttr("use_node_name_sharing", opts.useNodeNameSharing); + } + if (opts.valueShape != null) { + opBuilder.setAttr("value_shape", opts.valueShape); + } + if (opts.initialNumBuckets != null) { + opBuilder.setAttr("initial_num_buckets", opts.initialNumBuckets); + } + if (opts.maxLoadFactor != null) { + opBuilder.setAttr("max_load_factor", opts.maxLoadFactor); + } + } + } + return new MutableDenseHashTable(opBuilder.build()); + } + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param useNodeNameSharing + */ + public static Options useNodeNameSharing(Boolean useNodeNameSharing) { + return new Options().useNodeNameSharing(useNodeNameSharing); + } + + /** + * @param valueShape The shape of each value. + */ + public static Options valueShape(Shape valueShape) { + return new Options().valueShape(valueShape); + } + + /** + * @param initialNumBuckets The initial number of hash table buckets. Must be a power + * to 2. + */ + public static Options initialNumBuckets(Long initialNumBuckets) { + return new Options().initialNumBuckets(initialNumBuckets); + } + + /** + * @param maxLoadFactor The maximum ratio between number of entries and number of + * buckets before growing the table. Must be between 0 and 1. + */ + public static Options maxLoadFactor(Float maxLoadFactor) { + return new Options().maxLoadFactor(maxLoadFactor); + } + + /** + * Handle to a table. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + private Output tableHandle; + + private MutableDenseHashTable(Operation operation) { + super(operation); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableHashTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableHashTable.java new file mode 100644 index 00000000000..cba8c552089 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableHashTable.java @@ -0,0 +1,153 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates an empty hash table. + *

    + * This op creates a mutable hash table, specifying the type of its keys and + * values. Each value must be a scalar. Data can be inserted into the table using + * the insert operations. It does not support the initialization operation. + */ +@Operator +public final class MutableHashTable extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MutableHashTable} + */ + public static class Options { + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param useNodeNameSharing If true and shared_name is empty, the table is shared + * using the node name. + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + + private String container; + private String sharedName; + private Boolean useNodeNameSharing; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MutableHashTable operation. + * + * @param scope current scope + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of MutableHashTable + */ + public static MutableHashTable create(Scope scope, Class keyDtype, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MutableHashTableV2", scope.makeOpName("MutableHashTable")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("key_dtype", DataType.fromClass(keyDtype)); + opBuilder.setAttr("value_dtype", DataType.fromClass(valueDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.useNodeNameSharing != null) { + opBuilder.setAttr("use_node_name_sharing", opts.useNodeNameSharing); + } + } + } + return new MutableHashTable(opBuilder.build()); + } + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param useNodeNameSharing If true and shared_name is empty, the table is shared + * using the node name. + */ + public static Options useNodeNameSharing(Boolean useNodeNameSharing) { + return new Options().useNodeNameSharing(useNodeNameSharing); + } + + /** + * Handle to a table. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + private Output tableHandle; + + private MutableHashTable(Operation operation) { + super(operation); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableHashTableOfTensors.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableHashTableOfTensors.java new file mode 100644 index 00000000000..8c8ee00ad51 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutableHashTableOfTensors.java @@ -0,0 +1,171 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates an empty hash table. + *

    + * This op creates a mutable hash table, specifying the type of its keys and + * values. Each value must be a vector. Data can be inserted into the table using + * the insert operations. It does not support the initialization operation. + */ +@Operator +public final class MutableHashTableOfTensors extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.MutableHashTableOfTensors} + */ + public static class Options { + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param useNodeNameSharing + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + + /** + * @param valueShape + */ + public Options valueShape(Shape valueShape) { + this.valueShape = valueShape; + return this; + } + + private String container; + private String sharedName; + private Boolean useNodeNameSharing; + private Shape valueShape; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MutableHashTableOfTensors operation. + * + * @param scope current scope + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param options carries optional attributes values + * @return a new instance of MutableHashTableOfTensors + */ + public static MutableHashTableOfTensors create(Scope scope, Class keyDtype, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MutableHashTableOfTensorsV2", scope.makeOpName("MutableHashTableOfTensors")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("key_dtype", DataType.fromClass(keyDtype)); + opBuilder.setAttr("value_dtype", DataType.fromClass(valueDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.useNodeNameSharing != null) { + opBuilder.setAttr("use_node_name_sharing", opts.useNodeNameSharing); + } + if (opts.valueShape != null) { + opBuilder.setAttr("value_shape", opts.valueShape); + } + } + } + return new MutableHashTableOfTensors(opBuilder.build()); + } + + /** + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param useNodeNameSharing + */ + public static Options useNodeNameSharing(Boolean useNodeNameSharing) { + return new Options().useNodeNameSharing(useNodeNameSharing); + } + + /** + * @param valueShape + */ + public static Options valueShape(Shape valueShape) { + return new Options().valueShape(valueShape); + } + + /** + * Handle to a table. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + private Output tableHandle; + + private MutableHashTableOfTensors(Operation operation) { + super(operation); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Mutex.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Mutex.java new file mode 100644 index 00000000000..9a16ae81c56 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Mutex.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a Mutex resource that can be locked by `MutexLock`. + */ +@Operator +public final class Mutex extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Mutex} + */ + public static class Options { + + /** + * @param container If non-empty, this variable is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this variable is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Mutex operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of Mutex + */ + public static Mutex create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MutexV2", scope.makeOpName("Mutex")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new Mutex(opBuilder.build()); + } + + /** + * @param container If non-empty, this variable is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this variable is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The mutex resource. + */ + public Output resource() { + return resource; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) resource; + } + + private Output resource; + + private Mutex(Operation operation) { + super(operation); + int outputIdx = 0; + resource = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutexLock.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutexLock.java new file mode 100644 index 00000000000..191ca0e0580 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MutexLock.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Locks a mutex resource. The output is the lock. So long as the lock tensor + *

    + * is alive, any other request to use `MutexLock` with this mutex will wait. + *

    + * This is particularly useful for creating a critical section when used in + * conjunction with `MutexLockIdentity`: + *

    {@code
    + * mutex = mutex_v2(
    + *   shared_name=handle_name, container=container, name=name)
    + * 
    + * def execute_in_critical_section(fn, *args, **kwargs):
    + *   lock = gen_resource_variable_ops.mutex_lock(mutex)
    + * 
    + *   with ops.control_dependencies([lock]):
    + *     r = fn(*args, **kwargs)
    + * 
    + *   with ops.control_dependencies(nest.flatten(r)):
    + *     with ops.colocate_with(mutex):
    + *       ensure_lock_exists = mutex_lock_identity(lock)
    + * 
    + *     # Make sure that if any element of r is accessed, all of
    + *     # them are executed together.
    + *     r = nest.map_structure(tf.identity, r)
    + * 
    + *   with ops.control_dependencies([ensure_lock_exists]):
    + *     return nest.map_structure(tf.identity, r)
    + * }
    + * While `fn` is running in the critical section, no other functions which wish to + * use this critical section may run. + *

    + * Often the use case is that two executions of the same graph, in parallel, + * wish to run `fn`; and we wish to ensure that only one of them executes + * at a time. This is especially important if `fn` modifies one or more + * variables at a time. + *

    + * It is also useful if two separate functions must share a resource, but we + * wish to ensure the usage is exclusive. + */ +@Operator +public final class MutexLock extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MutexLock operation. + * + * @param scope current scope + * @param mutex The mutex resource to lock. + * @return a new instance of MutexLock + */ + public static MutexLock create(Scope scope, Operand mutex) { + OperationBuilder opBuilder = scope.env().opBuilder("MutexLock", scope.makeOpName("MutexLock")); + opBuilder.addInput(mutex.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MutexLock(opBuilder.build()); + } + + /** + * A tensor that keeps a shared pointer to a lock on the mutex; + * when the Tensor is destroyed, the use count on the shared pointer is decreased + * by 1. When it reaches 0, the lock is released. + */ + public Output mutexLock() { + return mutexLock; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) mutexLock; + } + + private Output mutexLock; + + private MutexLock(Operation operation) { + super(operation); + int outputIdx = 0; + mutexLock = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclAllReduce.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclAllReduce.java new file mode 100644 index 00000000000..5e4b0906308 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclAllReduce.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Outputs a tensor containing the reduction across all input tensors. + *

    + * Outputs a tensor containing the reduction across all input tensors passed to ops + * within the same `shared_name. + *

    + * The graph should be constructed so if one op runs with shared_name value `c`, + * then `num_devices` ops will run with shared_name value `c`. Failure to do so + * will cause the graph execution to fail to complete. + *

    + * input: the input to the reduction + * data: the value of the reduction across all `num_devices` devices. + * reduction: the reduction operation to perform. + * num_devices: The number of devices participating in this reduction. + * shared_name: Identifier that shared between ops of the same reduction. + * + * @param data type for {@code data()} output + */ +public final class NcclAllReduce extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NcclAllReduce operation. + * + * @param scope current scope + * @param input + * @param reduction + * @param numDevices + * @param sharedName + * @return a new instance of NcclAllReduce + */ + public static NcclAllReduce create(Scope scope, Operand input, String reduction, Long numDevices, String sharedName) { + OperationBuilder opBuilder = scope.env().opBuilder("NcclAllReduce", scope.makeOpName("NcclAllReduce")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("reduction", reduction); + opBuilder.setAttr("num_devices", numDevices); + opBuilder.setAttr("shared_name", sharedName); + return new NcclAllReduce(opBuilder.build()); + } + + /** + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + private Output data; + + private NcclAllReduce(Operation operation) { + super(operation); + int outputIdx = 0; + data = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclBroadcast.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclBroadcast.java new file mode 100644 index 00000000000..0432ae7ae02 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclBroadcast.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Sends `input` to all devices that are connected to the output. + *

    + * Sends `input` to all devices that are connected to the output. + *

    + * The graph should be constructed so that all ops connected to the output have a + * valid device assignment, and the op itself is assigned one of these devices. + *

    + * input: The input to the broadcast. + * output: The same as input. + * shape: The shape of the input tensor. + * + * + * @param data type for {@code output()} output + */ +public final class NcclBroadcast extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NcclBroadcast operation. + * + * @param scope current scope + * @param input + * @param shape + * @return a new instance of NcclBroadcast + */ + public static NcclBroadcast create(Scope scope, Operand input, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("NcclBroadcast", scope.makeOpName("NcclBroadcast")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape", shape); + return new NcclBroadcast(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private NcclBroadcast(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclReduce.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclReduce.java new file mode 100644 index 00000000000..b8049a21dc1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NcclReduce.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Reduces `input` from `num_devices` using `reduction` to a single device. + *

    + * Reduces `input` from `num_devices` using `reduction` to a single device. + *

    + * The graph should be constructed so that all inputs have a valid device + * assignment, and the op itself is assigned one of these devices. + *

    + * input: The input to the reduction. + * data: the value of the reduction across all `num_devices` devices. + * reduction: the reduction operation to perform. + * + * @param data type for {@code data()} output + */ +public final class NcclReduce extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NcclReduce operation. + * + * @param scope current scope + * @param input + * @param reduction + * @return a new instance of NcclReduce + */ + public static NcclReduce create(Scope scope, Iterable> input, String reduction) { + OperationBuilder opBuilder = scope.env().opBuilder("NcclReduce", scope.makeOpName("NcclReduce")); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("reduction", reduction); + return new NcclReduce(opBuilder.build()); + } + + /** + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + private Output data; + + private NcclReduce(Operation operation) { + super(operation); + int outputIdx = 0; + data = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NearestNeighbors.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NearestNeighbors.java new file mode 100644 index 00000000000..b6ed3c1721c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NearestNeighbors.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Selects the k nearest centers for each point. + *

    + * Rows of points are assumed to be input points. Rows of centers are assumed to be + * the list of candidate centers. For each point, the k centers that have least L2 + * distance to it are computed. + */ +public final class NearestNeighbors extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new NearestNeighbors operation. + * + * @param scope current scope + * @param points Matrix of shape (n, d). Rows are assumed to be input points. + * @param centers Matrix of shape (m, d). Rows are assumed to be centers. + * @param k Number of nearest centers to return for each point. If k is larger than m, then + * only m centers are returned. + * @return a new instance of NearestNeighbors + */ + public static NearestNeighbors create(Scope scope, Operand points, Operand centers, Operand k) { + OperationBuilder opBuilder = scope.env().opBuilder("NearestNeighbors", scope.makeOpName("NearestNeighbors")); + opBuilder.addInput(points.asOutput()); + opBuilder.addInput(centers.asOutput()); + opBuilder.addInput(k.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new NearestNeighbors(opBuilder.build()); + } + + /** + * Matrix of shape (n, min(m, k)). Each row contains the indices of the centers + * closest to the corresponding point, ordered by increasing distance. + */ + public Output nearestCenterIndices() { + return nearestCenterIndices; + } + + /** + * Matrix of shape (n, min(m, k)). Each row contains the squared L2 distance to the + * corresponding center in nearest_center_indices. + */ + public Output nearestCenterDistances() { + return nearestCenterDistances; + } + + private Output nearestCenterIndices; + private Output nearestCenterDistances; + + private NearestNeighbors(Operation operation) { + super(operation); + int outputIdx = 0; + nearestCenterIndices = operation.output(outputIdx++); + nearestCenterDistances = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NextAfter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NextAfter.java new file mode 100644 index 00000000000..a4b8b296274 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NextAfter.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the next representable value of `x1` in the direction of `x2`, element-wise. + *

    + * This operation returns the same result as the C++ std::nextafter function. + *

    + * It can also return a subnormal number. + *

    + * @compatibility(cpp) + * Equivalent to C++ std::nextafter function. + * @end_compatibility + * + * @param data type for {@code output()} output + */ +@Operator +public final class NextAfter extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NextAfter operation. + * + * @param scope current scope + * @param x1 + * @param x2 + * @return a new instance of NextAfter + */ + public static NextAfter create(Scope scope, Operand x1, Operand x2) { + OperationBuilder opBuilder = scope.env().opBuilder("NextAfter", scope.makeOpName("NextAfter")); + opBuilder.addInput(x1.asOutput()); + opBuilder.addInput(x2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new NextAfter(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private NextAfter(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NextIteration.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NextIteration.java new file mode 100644 index 00000000000..0b598a3b374 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NextIteration.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Makes its input available to the next iteration. + * + * @param data type for {@code output()} output + */ +@Operator +public final class NextIteration extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NextIteration operation. + * + * @param scope current scope + * @param data The tensor to be made available to the next iteration. + * @return a new instance of NextIteration + */ + public static NextIteration create(Scope scope, Operand data) { + OperationBuilder opBuilder = scope.env().opBuilder("NextIteration", scope.makeOpName("NextIteration")); + opBuilder.addInput(data.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new NextIteration(opBuilder.build()); + } + + /** + * The same tensor as `data`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private NextIteration(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NoOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NoOp.java new file mode 100644 index 00000000000..7b95dd4f421 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NoOp.java @@ -0,0 +1,48 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Does nothing. Only useful as a placeholder for control edges. + */ +@Operator +public final class NoOp extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new NoOp operation. + * + * @param scope current scope + * @return a new instance of NoOp + */ + public static NoOp create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("NoOp", scope.makeOpName("NoOp")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new NoOp(opBuilder.build()); + } + + + private NoOp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonDeterministicInts.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonDeterministicInts.java new file mode 100644 index 00000000000..5879a315640 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonDeterministicInts.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Non-deterministically generates some integers. + *

    + * This op may use some OS-provided source of non-determinism (e.g. an RNG), so each execution will give different results. + * + * @param data type for {@code output()} output + */ +public final class NonDeterministicInts extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NonDeterministicInts operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of NonDeterministicInts + */ + public static NonDeterministicInts create(Scope scope, Operand shape, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("NonDeterministicInts", scope.makeOpName("NonDeterministicInts")); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new NonDeterministicInts(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new NonDeterministicInts operation using default output types. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @return a new instance of NonDeterministicInts + */ + public static NonDeterministicInts create(Scope scope, Operand shape) { + return create(scope, shape, Long.class); + } + + /** + * Non-deterministic integer values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private NonDeterministicInts(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonMaxSuppressionV5.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonMaxSuppressionV5.java new file mode 100644 index 00000000000..11dbb4bc35c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonMaxSuppressionV5.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Greedily selects a subset of bounding boxes in descending order of score, + *

    + * pruning away boxes that have high intersection-over-union (IOU) overlap + * with previously selected boxes. Bounding boxes with score less than + * `score_threshold` are removed. Bounding boxes are supplied as + * [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any + * diagonal pair of box corners and the coordinates can be provided as normalized + * (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm + * is agnostic to where the origin is in the coordinate system and more + * generally is invariant to orthogonal transformations and translations + * of the coordinate system; thus translating or reflections of the coordinate + * system result in the same boxes being selected by the algorithm. + * The output of this operation is a set of integers indexing into the input + * collection of bounding boxes representing the selected boxes. The bounding + * box coordinates corresponding to the selected indices can then be obtained + * using the `tf.gather operation`. For example: + * selected_indices = tf.image.non_max_suppression_v2( + * boxes, scores, max_output_size, iou_threshold, score_threshold) + * selected_boxes = tf.gather(boxes, selected_indices) + * This op also supports a Soft-NMS (with Gaussian weighting) mode (c.f. + * Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score + * of other overlapping boxes instead of directly causing them to be pruned. + * To enable this Soft-NMS mode, set the `soft_nms_sigma` parameter to be + * larger than 0. + * + * @param data type for {@code selectedScores()} output + */ +@Operator +public final class NonMaxSuppressionV5 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.NonMaxSuppressionV5} + */ + public static class Options { + + /** + * @param padToMaxOutputSize If true, the output `selected_indices` is padded to be of length + * `max_output_size`. Defaults to false. + */ + public Options padToMaxOutputSize(Boolean padToMaxOutputSize) { + this.padToMaxOutputSize = padToMaxOutputSize; + return this; + } + + private Boolean padToMaxOutputSize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new NonMaxSuppressionV5 operation. + * + * @param scope current scope + * @param boxes A 2-D float tensor of shape `[num_boxes, 4]`. + * @param scores A 1-D float tensor of shape `[num_boxes]` representing a single + * score corresponding to each box (each row of boxes). + * @param maxOutputSize A scalar integer tensor representing the maximum number of + * boxes to be selected by non max suppression. + * @param iouThreshold A 0-D float tensor representing the threshold for deciding whether + * boxes overlap too much with respect to IOU. + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * boxes based on score. + * @param softNmsSigma A 0-D float tensor representing the sigma parameter for Soft NMS; see Bodla et + * al (c.f. https://arxiv.org/abs/1704.04503). When `soft_nms_sigma=0.0` (which + * is default), we fall back to standard (hard) NMS. + * @param options carries optional attributes values + * @return a new instance of NonMaxSuppressionV5 + */ + public static NonMaxSuppressionV5 create(Scope scope, Operand boxes, Operand scores, Operand maxOutputSize, Operand iouThreshold, Operand scoreThreshold, Operand softNmsSigma, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("NonMaxSuppressionV5", scope.makeOpName("NonMaxSuppressionV5")); + opBuilder.addInput(boxes.asOutput()); + opBuilder.addInput(scores.asOutput()); + opBuilder.addInput(maxOutputSize.asOutput()); + opBuilder.addInput(iouThreshold.asOutput()); + opBuilder.addInput(scoreThreshold.asOutput()); + opBuilder.addInput(softNmsSigma.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.padToMaxOutputSize != null) { + opBuilder.setAttr("pad_to_max_output_size", opts.padToMaxOutputSize); + } + } + } + return new NonMaxSuppressionV5(opBuilder.build()); + } + + /** + * @param padToMaxOutputSize If true, the output `selected_indices` is padded to be of length + * `max_output_size`. Defaults to false. + */ + public static Options padToMaxOutputSize(Boolean padToMaxOutputSize) { + return new Options().padToMaxOutputSize(padToMaxOutputSize); + } + + /** + * A 1-D integer tensor of shape `[M]` representing the selected + * indices from the boxes tensor, where `M <= max_output_size`. + */ + public Output selectedIndices() { + return selectedIndices; + } + + /** + * A 1-D float tensor of shape `[M]` representing the corresponding + * scores for each selected box, where `M <= max_output_size`. Scores only differ + * from corresponding input scores when using Soft NMS (i.e. when + * `soft_nms_sigma>0`) + */ + public Output selectedScores() { + return selectedScores; + } + + /** + * A 0-D integer tensor representing the number of valid elements in + * `selected_indices`, with the valid elements appearing first. + */ + public Output validOutputs() { + return validOutputs; + } + + private Output selectedIndices; + private Output selectedScores; + private Output validOutputs; + + private NonMaxSuppressionV5(Operation operation) { + super(operation); + int outputIdx = 0; + selectedIndices = operation.output(outputIdx++); + selectedScores = operation.output(outputIdx++); + validOutputs = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonSerializableDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonSerializableDataset.java new file mode 100644 index 00000000000..957f9117696 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonSerializableDataset.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class NonSerializableDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NonSerializableDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of NonSerializableDataset + */ + public static NonSerializableDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("NonSerializableDataset", scope.makeOpName("NonSerializableDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new NonSerializableDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private NonSerializableDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OneHot.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OneHot.java new file mode 100644 index 00000000000..52699a4e758 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OneHot.java @@ -0,0 +1,190 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a one-hot tensor. + *

    + * The locations represented by indices in `indices` take value `on_value`, + * while all other locations take value `off_value`. + *

    + * If the input `indices` is rank `N`, the output will have rank `N+1`, + * The new axis is created at dimension `axis` (default: the new axis is + * appended at the end). + *

    + * If `indices` is a scalar the output shape will be a vector of length `depth`. + *

    + * If `indices` is a vector of length `features`, the output shape will be: + *

    {@code
    + *   features x depth if axis == -1
    + *   depth x features if axis == 0
    + * }
    + * If `indices` is a matrix (batch) with shape `[batch, features]`, + * the output shape will be: + *
    {@code
    + *   batch x features x depth if axis == -1
    + *   batch x depth x features if axis == 1
    + *   depth x batch x features if axis == 0
    + * }
    + * Examples + * ========= + *

    + * Suppose that + *

    {@code
    + *   indices = [0, 2, -1, 1]
    + *   depth = 3
    + *   on_value = 5.0
    + *   off_value = 0.0
    + *   axis = -1
    + * }
    + * Then output is `[4 x 3]`: + *
    {@code
    + * output =
    + *   [5.0 0.0 0.0]  // one_hot(0)
    + *   [0.0 0.0 5.0]  // one_hot(2)
    + *   [0.0 0.0 0.0]  // one_hot(-1)
    + *   [0.0 5.0 0.0]  // one_hot(1)
    + * }
    + * Suppose that + *
    {@code
    + *   indices = [0, 2, -1, 1]
    + *   depth = 3
    + *   on_value = 0.0
    + *   off_value = 3.0
    + *   axis = 0
    + * }
    + * Then output is `[3 x 4]`: + *
    {@code
    + * output =
    + *   [0.0 3.0 3.0 3.0]
    + *   [3.0 3.0 3.0 0.0]
    + *   [3.0 3.0 3.0 3.0]
    + *   [3.0 0.0 3.0 3.0]
    + * //  ^                one_hot(0)
    + * //      ^            one_hot(2)
    + * //          ^        one_hot(-1)
    + * //              ^    one_hot(1)
    + * }
    + * Suppose that + *
    {@code
    + *   indices = [[0, 2], [1, -1]]
    + *   depth = 3
    + *   on_value = 1.0
    + *   off_value = 0.0
    + *   axis = -1
    + * }
    + * Then output is `[2 x 2 x 3]`: + *
    {@code
    + * output =
    + *   [
    + *     [1.0, 0.0, 0.0]  // one_hot(0)
    + *     [0.0, 0.0, 1.0]  // one_hot(2)
    + *   ][
    + *     [0.0, 1.0, 0.0]  // one_hot(1)
    + *     [0.0, 0.0, 0.0]  // one_hot(-1)
    + *   ]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class OneHot extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OneHot} + */ + public static class Options { + + /** + * @param axis The axis to fill (default: -1, a new inner-most axis). + */ + public Options axis(Long axis) { + this.axis = axis; + return this; + } + + private Long axis; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OneHot operation. + * + * @param scope current scope + * @param indices A tensor of indices. + * @param depth A scalar defining the depth of the one hot dimension. + * @param onValue A scalar defining the value to fill in output when `indices[j] = i`. + * @param offValue A scalar defining the value to fill in output when `indices[j] != i`. + * @param options carries optional attributes values + * @return a new instance of OneHot + */ + public static OneHot create(Scope scope, Operand indices, Operand depth, Operand onValue, Operand offValue, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OneHot", scope.makeOpName("OneHot")); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(depth.asOutput()); + opBuilder.addInput(onValue.asOutput()); + opBuilder.addInput(offValue.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.axis != null) { + opBuilder.setAttr("axis", opts.axis); + } + } + } + return new OneHot(opBuilder.build()); + } + + /** + * @param axis The axis to fill (default: -1, a new inner-most axis). + */ + public static Options axis(Long axis) { + return new Options().axis(axis); + } + + /** + * The one-hot tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private OneHot(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OnesLike.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OnesLike.java new file mode 100644 index 00000000000..aacad8b4fb5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OnesLike.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a tensor of ones with the same shape and type as x. + * + * @param data type for {@code y()} output + */ +@Operator +public final class OnesLike extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new OnesLike operation. + * + * @param scope current scope + * @param x a tensor of type T. + * @return a new instance of OnesLike + */ + public static OnesLike create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("OnesLike", scope.makeOpName("OnesLike")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new OnesLike(opBuilder.build()); + } + + /** + * a tensor of the same shape and type as x but filled with ones. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private OnesLike(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapClear.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapClear.java new file mode 100644 index 00000000000..dff8119bfec --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapClear.java @@ -0,0 +1,147 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op removes all elements in the underlying container. + */ +@Operator +public final class OrderedMapClear extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapClear} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OrderedMapClear operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapClear + */ + public static OrderedMapClear create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OrderedMapClear", scope.makeOpName("OrderedMapClear")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new OrderedMapClear(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + + private OrderedMapClear(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapIncompleteSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapIncompleteSize.java new file mode 100644 index 00000000000..63cca530ab3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapIncompleteSize.java @@ -0,0 +1,163 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op returns the number of incomplete elements in the underlying container. + */ +@Operator +public final class OrderedMapIncompleteSize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapIncompleteSize} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OrderedMapIncompleteSize operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapIncompleteSize + */ + public static OrderedMapIncompleteSize create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OrderedMapIncompleteSize", scope.makeOpName("OrderedMapIncompleteSize")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new OrderedMapIncompleteSize(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private OrderedMapIncompleteSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapPeek.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapPeek.java new file mode 100644 index 00000000000..6c6a80c7663 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapPeek.java @@ -0,0 +1,176 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op peeks at the values at the specified key. If the + *

    + * underlying container does not contain this key + * this op will block until it does. This Op is optimized for + * performance. + */ +@Operator +public final class OrderedMapPeek extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapPeek} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OrderedMapPeek operation. + * + * @param scope current scope + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapPeek + */ + public static OrderedMapPeek create(Scope scope, Operand key, Operand indices, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OrderedMapPeek", scope.makeOpName("OrderedMapPeek")); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new OrderedMapPeek(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public List> values() { + return values; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) values.iterator(); + } + + private List> values; + + private OrderedMapPeek(Operation operation) { + super(operation); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapSize.java new file mode 100644 index 00000000000..ffbaf307d8d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapSize.java @@ -0,0 +1,163 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op returns the number of elements in the underlying container. + */ +@Operator +public final class OrderedMapSize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapSize} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OrderedMapSize operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapSize + */ + public static OrderedMapSize create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OrderedMapSize", scope.makeOpName("OrderedMapSize")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new OrderedMapSize(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private OrderedMapSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapStage.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapStage.java new file mode 100644 index 00000000000..0c34ed4f0ce --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapStage.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Stage (key, values) in the underlying container which behaves like a ordered + *

    + * associative container. Elements are ordered by key. + */ +@Operator +public final class OrderedMapStage extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapStage} + */ + public static class Options { + + /** + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName It is necessary to match this name to the matching Unstage Op. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OrderedMapStage operation. + * + * @param scope current scope + * @param key int64 + * @param indices + * @param values a list of tensors + * dtypes A list of data types that inserted values should adhere to. + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapStage + */ + public static OrderedMapStage create(Scope scope, Operand key, Operand indices, Iterable> values, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OrderedMapStage", scope.makeOpName("OrderedMapStage")); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new OrderedMapStage(opBuilder.build()); + } + + /** + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName It is necessary to match this name to the matching Unstage Op. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + + private OrderedMapStage(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapUnstage.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapUnstage.java new file mode 100644 index 00000000000..66fda9ddbc1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapUnstage.java @@ -0,0 +1,175 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op removes and returns the values associated with the key + *

    + * from the underlying container. If the underlying container + * does not contain this key, the op will block until it does. + */ +@Operator +public final class OrderedMapUnstage extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapUnstage} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OrderedMapUnstage operation. + * + * @param scope current scope + * @param key + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapUnstage + */ + public static OrderedMapUnstage create(Scope scope, Operand key, Operand indices, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OrderedMapUnstage", scope.makeOpName("OrderedMapUnstage")); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new OrderedMapUnstage(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public List> values() { + return values; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) values.iterator(); + } + + private List> values; + + private OrderedMapUnstage(Operation operation) { + super(operation); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapUnstageNoKey.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapUnstageNoKey.java new file mode 100644 index 00000000000..d63d6fe1d7c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OrderedMapUnstageNoKey.java @@ -0,0 +1,174 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op removes and returns the (key, value) element with the smallest + *

    + * key from the underlying container. If the underlying container + * does not contain elements, the op will block until it does. + */ +@Operator +public final class OrderedMapUnstageNoKey extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapUnstageNoKey} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OrderedMapUnstageNoKey operation. + * + * @param scope current scope + * @param indices + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of OrderedMapUnstageNoKey + */ + public static OrderedMapUnstageNoKey create(Scope scope, Operand indices, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OrderedMapUnstageNoKey", scope.makeOpName("OrderedMapUnstageNoKey")); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new OrderedMapUnstageNoKey(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output key() { + return key; + } + + /** + */ + public List> values() { + return values; + } + + private Output key; + private List> values; + + private OrderedMapUnstageNoKey(Operation operation) { + super(operation); + int outputIdx = 0; + key = operation.output(outputIdx++); + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeue.java new file mode 100644 index 00000000000..ac446dc9ee2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeue.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieves a single tensor from the computation outfeed. + *

    + * This operation will block indefinitely until data is available. + * + * @param data type for {@code output()} output + */ +public final class OutfeedDequeue extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OutfeedDequeue} + */ + public static class Options { + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + private Long deviceOrdinal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OutfeedDequeue operation. + * + * @param scope current scope + * @param dtype The type of elements in the tensor. + * @param shape The shape of the tensor. + * @param options carries optional attributes values + * @return a new instance of OutfeedDequeue + */ + public static OutfeedDequeue create(Scope scope, Class dtype, Shape shape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OutfeedDequeue", scope.makeOpName("OutfeedDequeue")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + opBuilder.setAttr("shape", shape); + if (options != null) { + for (Options opts : options) { + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + } + } + return new OutfeedDequeue(opBuilder.build()); + } + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + /** + * A tensor that will be read from the device outfeed. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private OutfeedDequeue(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeueTuple.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeueTuple.java new file mode 100644 index 00000000000..72d7f3b5ca1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeueTuple.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve multiple values from the computation outfeed. + *

    + * This operation will block indefinitely until data is available. Output `i` + * corresponds to XLA tuple element `i`. + */ +public final class OutfeedDequeueTuple extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.OutfeedDequeueTuple} + */ + public static class Options { + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public Options deviceOrdinal(Long deviceOrdinal) { + this.deviceOrdinal = deviceOrdinal; + return this; + } + + private Long deviceOrdinal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OutfeedDequeueTuple operation. + * + * @param scope current scope + * @param dtypes The element types of each element in `outputs`. + * @param shapes The shapes of each tensor in `outputs`. + * @param options carries optional attributes values + * @return a new instance of OutfeedDequeueTuple + */ + public static OutfeedDequeueTuple create(Scope scope, List> dtypes, List shapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OutfeedDequeueTuple", scope.makeOpName("OutfeedDequeueTuple")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + Shape[] shapesArray = new Shape[shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.deviceOrdinal != null) { + opBuilder.setAttr("device_ordinal", opts.deviceOrdinal); + } + } + } + return new OutfeedDequeueTuple(opBuilder.build()); + } + + /** + * @param deviceOrdinal The TPU device to use. This should be -1 when the Op + * is running on a TPU device, and >= 0 when the Op is running on the CPU + * device. + */ + public static Options deviceOrdinal(Long deviceOrdinal) { + return new Options().deviceOrdinal(deviceOrdinal); + } + + /** + * A list of tensors that will be read from the outfeed. + */ + public List> outputs() { + return outputs; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outputs.iterator(); + } + + private List> outputs; + + private OutfeedDequeueTuple(Operation operation) { + super(operation); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList(operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueue.java new file mode 100644 index 00000000000..1641c3a65e4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueue.java @@ -0,0 +1,49 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Enqueue a Tensor on the computation outfeed. + */ +public final class OutfeedEnqueue extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new OutfeedEnqueue operation. + * + * @param scope current scope + * @param input A tensor that will be inserted into the outfeed queue. + * @return a new instance of OutfeedEnqueue + */ + public static OutfeedEnqueue create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("OutfeedEnqueue", scope.makeOpName("OutfeedEnqueue")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new OutfeedEnqueue(opBuilder.build()); + } + + + private OutfeedEnqueue(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueueTuple.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueueTuple.java new file mode 100644 index 00000000000..53093469d5c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueueTuple.java @@ -0,0 +1,51 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Enqueue multiple Tensor values on the computation outfeed. + */ +public final class OutfeedEnqueueTuple extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new OutfeedEnqueueTuple operation. + * + * @param scope current scope + * @param inputs A list of tensors that will be inserted into the outfeed queue as an + * XLA tuple. + * @return a new instance of OutfeedEnqueueTuple + */ + public static OutfeedEnqueueTuple create(Scope scope, Iterable> inputs) { + OperationBuilder opBuilder = scope.env().opBuilder("OutfeedEnqueueTuple", scope.makeOpName("OutfeedEnqueueTuple")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new OutfeedEnqueueTuple(opBuilder.build()); + } + + + private OutfeedEnqueueTuple(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Pad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Pad.java new file mode 100644 index 00000000000..60352327c31 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Pad.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Pads a tensor. + *

    + * This operation pads `input` according to the `paddings` and `constant_values` + * you specify. `paddings` is an integer tensor with shape `[Dn, 2]`, where n is + * the rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates + * how many padding values to add before the contents of `input` in that dimension, + * and `paddings[D, 1]` indicates how many padding values to add after the contents + * of `input` in that dimension. `constant_values` is a scalar tensor of the same + * type as `input` that indicates the value to use for padding `input`. + *

    + * The padded size of each dimension D of the output is: + *

    + * `paddings(D, 0) + input.dim_size(D) + paddings(D, 1)` + *

    + * For example: + *

    {@code
    + * # 't' is [[1, 1], [2, 2]]
    + * # 'paddings' is [[1, 1], [2, 2]]
    + * # 'constant_values' is 0
    + * # rank of 't' is 2
    + * pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0]
    + *                       [0, 0, 1, 1, 0, 0]
    + *                       [0, 0, 2, 2, 0, 0]
    + *                       [0, 0, 0, 0, 0, 0]]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Pad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Pad operation. + * + * @param scope current scope + * @param input + * @param paddings + * @param constantValues + * @return a new instance of Pad + */ + public static Pad create(Scope scope, Operand input, Operand paddings, Operand constantValues) { + OperationBuilder opBuilder = scope.env().opBuilder("PadV2", scope.makeOpName("Pad")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(paddings.asOutput()); + opBuilder.addInput(constantValues.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Pad(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Pad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ParallelConcat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ParallelConcat.java new file mode 100644 index 00000000000..8928b8b2748 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ParallelConcat.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Concatenates a list of `N` tensors along the first dimension. + *

    + * The input tensors are all required to have size 1 in the first dimension. + *

    + * For example: + *

    {@code
    + * # 'x' is [[1, 4]]
    + * # 'y' is [[2, 5]]
    + * # 'z' is [[3, 6]]
    + * parallel_concat([x, y, z]) => [[1, 4], [2, 5], [3, 6]]  # Pack along first dim.
    + * }
    + * The difference between concat and parallel_concat is that concat requires all + * of the inputs be computed before the operation will begin but doesn't require + * that the input shapes be known during graph construction. Parallel concat + * will copy pieces of the input into the output as they become available, in + * some situations this can provide a performance benefit. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ParallelConcat extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ParallelConcat operation. + * + * @param scope current scope + * @param values Tensors to be concatenated. All must have size 1 in the first dimension + * and same shape. + * @param shape the final shape of the result; should be equal to the shapes of any input + * but with the number of input values in the first dimension. + * @return a new instance of ParallelConcat + */ + public static ParallelConcat create(Scope scope, Iterable> values, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("ParallelConcat", scope.makeOpName("ParallelConcat")); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape", shape); + return new ParallelConcat(opBuilder.build()); + } + + /** + * The concatenated tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ParallelConcat(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ParallelDynamicStitch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ParallelDynamicStitch.java new file mode 100644 index 00000000000..020810e0544 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ParallelDynamicStitch.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Interleave the values from the `data` tensors into a single tensor. + *

    + * Builds a merged tensor such that + *

    {@code
    + *     merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
    + * }
    + * For example, if each `indices[m]` is scalar or vector, we have + *
    {@code
    + *     # Scalar indices:
    + *     merged[indices[m], ...] = data[m][...]
    + * 
    + *     # Vector indices:
    + *     merged[indices[m][i], ...] = data[m][i, ...]
    + * }
    + * Each `data[i].shape` must start with the corresponding `indices[i].shape`, + * and the rest of `data[i].shape` must be constant w.r.t. `i`. That is, we + * must have `data[i].shape = indices[i].shape + constant`. In terms of this + * `constant`, the output shape is + *

    + * merged.shape = [max(indices)] + constant + *

    + * Values may be merged in parallel, so if an index appears in both `indices[m][i]` + * and `indices[n][j]`, the result may be invalid. This differs from the normal + * DynamicStitch operator that defines the behavior in that case. + *

    + * For example: + *

    {@code
    + *     indices[0] = 6
    + *     indices[1] = [4, 1]
    + *     indices[2] = [[5, 2], [0, 3]]
    + *     data[0] = [61, 62]
    + *     data[1] = [[41, 42], [11, 12]]
    + *     data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
    + *     merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
    + *               [51, 52], [61, 62]]
    + * }
    + * This method can be used to merge partitions created by `dynamic_partition` + * as illustrated on the following example: + *
    {@code
    + *     # Apply function (increments x_i) on elements for which a certain condition
    + *     # apply (x_i != -1 in this example).
    + *     x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
    + *     condition_mask=tf.not_equal(x,tf.constant(-1.))
    + *     partitioned_data = tf.dynamic_partition(
    + *         x, tf.cast(condition_mask, tf.int32) , 2)
    + *     partitioned_data[1] = partitioned_data[1] + 1.0
    + *     condition_indices = tf.dynamic_partition(
    + *         tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
    + *     x = tf.dynamic_stitch(condition_indices, partitioned_data)
    + *     # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
    + *     # unchanged.
    + * }
    + *
    + * + *
    + * + * @param data type for {@code merged()} output + */ +@Operator +public final class ParallelDynamicStitch extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ParallelDynamicStitch operation. + * + * @param scope current scope + * @param indices + * @param data + * @return a new instance of ParallelDynamicStitch + */ + public static ParallelDynamicStitch create(Scope scope, Iterable> indices, Iterable> data) { + OperationBuilder opBuilder = scope.env().opBuilder("ParallelDynamicStitch", scope.makeOpName("ParallelDynamicStitch")); + opBuilder.addInputList(Operands.asOutputs(indices)); + opBuilder.addInputList(Operands.asOutputs(data)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ParallelDynamicStitch(opBuilder.build()); + } + + /** + */ + public Output merged() { + return merged; + } + + @Override + public Output asOutput() { + return merged; + } + + private Output merged; + + private ParallelDynamicStitch(Operation operation) { + super(operation); + int outputIdx = 0; + merged = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Placeholder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Placeholder.java new file mode 100644 index 00000000000..153670ce63c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Placeholder.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A placeholder op for a value that will be fed into the computation. + *

    + * N.B. This operation will fail with an error if it is executed. It is + * intended as a way to represent a value that will always be fed, and to + * provide attrs that enable the fed value to be checked at runtime. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Placeholder extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Placeholder} + */ + public static class Options { + + /** + * @param shape (Optional) The shape of the tensor. If the shape has 0 dimensions, the + * shape is unconstrained. + */ + public Options shape(Shape shape) { + this.shape = shape; + return this; + } + + private Shape shape; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Placeholder operation. + * + * @param scope current scope + * @param dtype The type of elements in the tensor. + * @param options carries optional attributes values + * @return a new instance of Placeholder + */ + public static Placeholder create(Scope scope, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Placeholder", scope.makeOpName("Placeholder")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.shape != null) { + opBuilder.setAttr("shape", opts.shape); + } + } + } + return new Placeholder(opBuilder.build()); + } + + /** + * @param shape (Optional) The shape of the tensor. If the shape has 0 dimensions, the + * shape is unconstrained. + */ + public static Options shape(Shape shape) { + return new Options().shape(shape); + } + + /** + * A placeholder tensor that must be replaced using the feed mechanism. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Placeholder(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PlaceholderWithDefault.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PlaceholderWithDefault.java new file mode 100644 index 00000000000..9790ec20136 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PlaceholderWithDefault.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A placeholder op that passes through `input` when its output is not fed. + * + * @param data type for {@code output()} output + */ +@Operator +public final class PlaceholderWithDefault extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new PlaceholderWithDefault operation. + * + * @param scope current scope + * @param input The default value to produce when `output` is not fed. + * @param shape The (possibly partial) shape of the tensor. + * @return a new instance of PlaceholderWithDefault + */ + public static PlaceholderWithDefault create(Scope scope, Operand input, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("PlaceholderWithDefault", scope.makeOpName("PlaceholderWithDefault")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape", shape); + return new PlaceholderWithDefault(opBuilder.build()); + } + + /** + * A placeholder tensor that defaults to `input` if it is not fed. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private PlaceholderWithDefault(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prelinearize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prelinearize.java new file mode 100644 index 00000000000..6c641999b5b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prelinearize.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op which linearizes one Tensor value to an opaque variant tensor. + */ +public final class Prelinearize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Prelinearize} + */ + public static class Options { + + /** + * @param shape The shape of the tensor. + */ + public Options shape(Shape shape) { + this.shape = shape; + return this; + } + + /** + * @param layout A vector holding the requested layout in minor-to-major sequence. If a layout + * attribute is passed but its values are all -1 the layout will be computed by + * the infeed operation. + */ + public Options layout(List layout) { + this.layout = layout; + return this; + } + + private Shape shape; + private List layout; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Prelinearize operation. + * + * @param scope current scope + * @param input A tensor that will be linearized. + * @param options carries optional attributes values + * @return a new instance of Prelinearize + */ + public static Prelinearize create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Prelinearize", scope.makeOpName("Prelinearize")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.shape != null) { + opBuilder.setAttr("shape", opts.shape); + } + if (opts.layout != null) { + long[] layoutArray = new long[opts.layout.size()]; + for (int i = 0; i < layoutArray.length; ++i) { + layoutArray[i] = opts.layout.get(i); + } + opBuilder.setAttr("layout", layoutArray); + } + } + } + return new Prelinearize(opBuilder.build()); + } + + /** + * @param shape The shape of the tensor. + */ + public static Options shape(Shape shape) { + return new Options().shape(shape); + } + + /** + * @param layout A vector holding the requested layout in minor-to-major sequence. If a layout + * attribute is passed but its values are all -1 the layout will be computed by + * the infeed operation. + */ + public static Options layout(List layout) { + return new Options().layout(layout); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private Prelinearize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrelinearizeTuple.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrelinearizeTuple.java new file mode 100644 index 00000000000..bf99fa5f7f7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrelinearizeTuple.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op which linearizes multiple Tensor values to an opaque variant tensor. + */ +public final class PrelinearizeTuple extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.PrelinearizeTuple} + */ + public static class Options { + + /** + * @param layouts A vector holding the requested layout in minor-to-major sequence for all the + * tuple shapes in the order the shapes appear in the "shapes" input. The layout + * elements for a sub-shape can be set to -1 in which case the corresponding layout + * will be computed by the infeed operation. + */ + public Options layouts(List layouts) { + this.layouts = layouts; + return this; + } + + private List layouts; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new PrelinearizeTuple operation. + * + * @param scope current scope + * @param inputs A list of tensors that will be provided using the infeed mechanism. + * @param shapes The shapes of each tensor in `inputs`. + * @param options carries optional attributes values + * @return a new instance of PrelinearizeTuple + */ + public static PrelinearizeTuple create(Scope scope, Iterable> inputs, List shapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("PrelinearizeTuple", scope.makeOpName("PrelinearizeTuple")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + Shape[] shapesArray = new Shape[shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.layouts != null) { + long[] layoutsArray = new long[opts.layouts.size()]; + for (int i = 0; i < layoutsArray.length; ++i) { + layoutsArray[i] = opts.layouts.get(i); + } + opBuilder.setAttr("layouts", layoutsArray); + } + } + } + return new PrelinearizeTuple(opBuilder.build()); + } + + /** + * @param layouts A vector holding the requested layout in minor-to-major sequence for all the + * tuple shapes in the order the shapes appear in the "shapes" input. The layout + * elements for a sub-shape can be set to -1 in which case the corresponding layout + * will be computed by the infeed operation. + */ + public static Options layouts(List layouts) { + return new Options().layouts(layouts); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private PrelinearizeTuple(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Print.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Print.java new file mode 100644 index 00000000000..50fb5aae36c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Print.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Prints a string scalar. + *

    + * Prints a string scalar to the desired output_stream. + */ +@Operator +public final class Print extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Print} + */ + public static class Options { + + /** + * @param outputStream A string specifying the output stream or logging level to print to. + */ + public Options outputStream(String outputStream) { + this.outputStream = outputStream; + return this; + } + + /** + * @param end + */ + public Options end(String end) { + this.end = end; + return this; + } + + private String outputStream; + private String end; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Print operation. + * + * @param scope current scope + * @param input The string scalar to print. + * @param options carries optional attributes values + * @return a new instance of Print + */ + public static Print create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("PrintV2", scope.makeOpName("Print")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.outputStream != null) { + opBuilder.setAttr("output_stream", opts.outputStream); + } + if (opts.end != null) { + opBuilder.setAttr("end", opts.end); + } + } + } + return new Print(opBuilder.build()); + } + + /** + * @param outputStream A string specifying the output stream or logging level to print to. + */ + public static Options outputStream(String outputStream) { + return new Options().outputStream(outputStream); + } + + /** + * @param end + */ + public static Options end(String end) { + return new Options().end(end); + } + + + private Print(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrivateThreadPoolDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrivateThreadPoolDataset.java new file mode 100644 index 00000000000..fce679d83e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrivateThreadPoolDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that uses a custom thread pool to compute `input_dataset`. + */ +public final class PrivateThreadPoolDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new PrivateThreadPoolDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param numThreads Identifies the number of threads to use for the private threadpool. + * @param outputTypes + * @param outputShapes + * @return a new instance of PrivateThreadPoolDataset + */ + public static PrivateThreadPoolDataset create(Scope scope, Operand inputDataset, Operand numThreads, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("PrivateThreadPoolDataset", scope.makeOpName("PrivateThreadPoolDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numThreads.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new PrivateThreadPoolDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private PrivateThreadPoolDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prod.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prod.java new file mode 100644 index 00000000000..e3051043a2c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prod.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the product of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Prod extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Prod} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Prod operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of Prod + */ + public static Prod create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Prod", scope.makeOpName("Prod")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new Prod(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Prod(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcat.java new file mode 100644 index 00000000000..1b3b2217dfb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcat.java @@ -0,0 +1,93 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Concatenates quantized tensors along one dimension. + * + * @param data type for {@code output()} output + */ +@Operator +public final class QuantizedConcat extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedConcat operation. + * + * @param scope current scope + * @param concatDim 0-D. The dimension along which to concatenate. Must be in the + * range [0, rank(values)). + * @param values The `N` Tensors to concatenate. Their ranks and types must match, + * and their sizes must match in all dimensions except `concat_dim`. + * @param inputMins The minimum scalar values for each of the input tensors. + * @param inputMaxes The maximum scalar values for each of the input tensors. + * @return a new instance of QuantizedConcat + */ + public static QuantizedConcat create(Scope scope, Operand concatDim, Iterable> values, Iterable> inputMins, Iterable> inputMaxes) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConcat", scope.makeOpName("QuantizedConcat")); + opBuilder.addInput(concatDim.asOutput()); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder.addInputList(Operands.asOutputs(inputMins)); + opBuilder.addInputList(Operands.asOutputs(inputMaxes)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new QuantizedConcat(opBuilder.build()); + } + + /** + * A `Tensor` with the concatenation of values stacked along the + * `concat_dim` dimension. This tensor's shape matches that of `values` except + * in `concat_dim` where it has the sum of the sizes. + */ + public Output output() { + return output; + } + + /** + * The float value that the minimum quantized output value represents. + */ + public Output outputMin() { + return outputMin; + } + + /** + * The float value that the maximum quantized output value represents. + */ + public Output outputMax() { + return outputMax; + } + + private Output output; + private Output outputMin; + private Output outputMax; + + private QuantizedConcat(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcatV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcatV2.java new file mode 100644 index 00000000000..f96ca92943e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcatV2.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator +public final class QuantizedConcatV2 extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedConcatV2 operation. + * + * @param scope current scope + * @param values + * @param axis + * @param inputMins + * @param inputMaxes + * @return a new instance of QuantizedConcatV2 + */ + public static QuantizedConcatV2 create(Scope scope, Iterable> values, Operand axis, Iterable> inputMins, Iterable> inputMaxes) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConcatV2", scope.makeOpName("QuantizedConcatV2")); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder.addInput(axis.asOutput()); + opBuilder.addInputList(Operands.asOutputs(inputMins)); + opBuilder.addInputList(Operands.asOutputs(inputMaxes)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new QuantizedConcatV2(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output outputMin() { + return outputMin; + } + + /** + */ + public Output outputMax() { + return outputMax; + } + + private Output output; + private Output outputMin; + private Output outputMax; + + private QuantizedConcatV2(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRelu.java new file mode 100644 index 00000000000..9edd60a2ea4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRelu.java @@ -0,0 +1,158 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DAndRelu extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DAndRelu} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DAndRelu operation. + * + * @param scope current scope + * @param input + * @param filter + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DAndRelu + */ + public static QuantizedConv2DAndRelu create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DAndRelu", scope.makeOpName("QuantizedConv2DAndRelu")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DAndRelu(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DAndRelu(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndReluAndRequantize.java new file mode 100644 index 00000000000..7fc5911a5b4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndReluAndRequantize.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DAndReluAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DAndReluAndRequantize} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DAndReluAndRequantize operation. + * + * @param scope current scope + * @param input + * @param filter + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param minFreezedOutput + * @param maxFreezedOutput + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DAndReluAndRequantize + */ + public static QuantizedConv2DAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DAndReluAndRequantize", scope.makeOpName("QuantizedConv2DAndReluAndRequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DAndReluAndRequantize(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DAndReluAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRequantize.java new file mode 100644 index 00000000000..2cc2367cfb2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRequantize.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DAndRequantize} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DAndRequantize operation. + * + * @param scope current scope + * @param input + * @param filter + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param minFreezedOutput + * @param maxFreezedOutput + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DAndRequantize + */ + public static QuantizedConv2DAndRequantize create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DAndRequantize", scope.makeOpName("QuantizedConv2DAndRequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DAndRequantize(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DPerChannel.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DPerChannel.java new file mode 100644 index 00000000000..476a1edc0ac --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DPerChannel.java @@ -0,0 +1,140 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes QuantizedConv2D per channel. + * + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DPerChannel extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DPerChannel} + */ + public static class Options { + + /** + * @param dilations list of dilation values. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DPerChannel operation. + * + * @param scope current scope + * @param input The original input tensor. + * @param filter The original filter tensor. + * @param minInput The minimum value of the input tensor + * @param maxInput The maximum value of the input tensor. + * @param minFilter The minimum value of the filter tensor. + * @param maxFilter The maximum value of the filter tensor. + * @param outType The quantized type of output tensor that needs to be converted. + * @param strides list of stride values. + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DPerChannel + */ + public static QuantizedConv2DPerChannel create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DPerChannel", scope.makeOpName("QuantizedConv2DPerChannel")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new QuantizedConv2DPerChannel(opBuilder.build()); + } + + /** + * @param dilations list of dilation values. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * The output tensor. + */ + public Output output() { + return output; + } + + /** + * The minimum value of the final output tensor. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The maximum value of the final output tensor. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DPerChannel(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBias.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBias.java new file mode 100644 index 00000000000..1f668d2ee70 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBias.java @@ -0,0 +1,160 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DWithBias extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DWithBias} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DWithBias operation. + * + * @param scope current scope + * @param input + * @param filter + * @param bias + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DWithBias + */ + public static QuantizedConv2DWithBias create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBias", scope.makeOpName("QuantizedConv2DWithBias")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DWithBias(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DWithBias(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRelu.java new file mode 100644 index 00000000000..10b1f56fdfa --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRelu.java @@ -0,0 +1,160 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DWithBiasAndRelu extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DWithBiasAndRelu} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DWithBiasAndRelu operation. + * + * @param scope current scope + * @param input + * @param filter + * @param bias + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DWithBiasAndRelu + */ + public static QuantizedConv2DWithBiasAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasAndRelu", scope.makeOpName("QuantizedConv2DWithBiasAndRelu")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DWithBiasAndRelu(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DWithBiasAndRelu(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndReluAndRequantize.java new file mode 100644 index 00000000000..c8bbdc3ecb1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndReluAndRequantize.java @@ -0,0 +1,164 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DWithBiasAndReluAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DWithBiasAndReluAndRequantize} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DWithBiasAndReluAndRequantize operation. + * + * @param scope current scope + * @param input + * @param filter + * @param bias + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param minFreezedOutput + * @param maxFreezedOutput + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DWithBiasAndReluAndRequantize + */ + public static QuantizedConv2DWithBiasAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasAndReluAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasAndReluAndRequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DWithBiasAndReluAndRequantize(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DWithBiasAndReluAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRequantize.java new file mode 100644 index 00000000000..17c11264934 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRequantize.java @@ -0,0 +1,164 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DWithBiasAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DWithBiasAndRequantize} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DWithBiasAndRequantize operation. + * + * @param scope current scope + * @param input + * @param filter + * @param bias + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param minFreezedOutput + * @param maxFreezedOutput + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DWithBiasAndRequantize + */ + public static QuantizedConv2DWithBiasAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasAndRequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DWithBiasAndRequantize(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DWithBiasAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java new file mode 100644 index 00000000000..818d6f539b0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java @@ -0,0 +1,170 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DWithBiasSignedSumAndReluAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DWithBiasSignedSumAndReluAndRequantize} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DWithBiasSignedSumAndReluAndRequantize operation. + * + * @param scope current scope + * @param input + * @param filter + * @param bias + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param minFreezedOutput + * @param maxFreezedOutput + * @param summand + * @param minSummand + * @param maxSummand + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DWithBiasSignedSumAndReluAndRequantize + */ + public static QuantizedConv2DWithBiasSignedSumAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Operand summand, Operand minSummand, Operand maxSummand, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasSignedSumAndReluAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasSignedSumAndReluAndRequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder.addInput(summand.asOutput()); + opBuilder.addInput(minSummand.asOutput()); + opBuilder.addInput(maxSummand.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DWithBiasSignedSumAndReluAndRequantize(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DWithBiasSignedSumAndReluAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndRelu.java new file mode 100644 index 00000000000..f9434882938 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndRelu.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DWithBiasSumAndRelu extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DWithBiasSumAndRelu} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DWithBiasSumAndRelu operation. + * + * @param scope current scope + * @param input + * @param filter + * @param bias + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param summand + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DWithBiasSumAndRelu + */ + public static QuantizedConv2DWithBiasSumAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand summand, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasSumAndRelu", scope.makeOpName("QuantizedConv2DWithBiasSumAndRelu")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(summand.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DWithBiasSumAndRelu(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DWithBiasSumAndRelu(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndReluAndRequantize.java new file mode 100644 index 00000000000..abbd0f2742d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndReluAndRequantize.java @@ -0,0 +1,170 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class QuantizedConv2DWithBiasSumAndReluAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedConv2DWithBiasSumAndReluAndRequantize} + */ + public static class Options { + + /** + * @param dilations + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + /** + * @param paddingList + */ + public Options paddingList(List paddingList) { + this.paddingList = paddingList; + return this; + } + + private List dilations; + private List paddingList; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2DWithBiasSumAndReluAndRequantize operation. + * + * @param scope current scope + * @param input + * @param filter + * @param bias + * @param minInput + * @param maxInput + * @param minFilter + * @param maxFilter + * @param minFreezedOutput + * @param maxFreezedOutput + * @param summand + * @param minSummand + * @param maxSummand + * @param outType + * @param strides + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2DWithBiasSumAndReluAndRequantize + */ + public static QuantizedConv2DWithBiasSumAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Operand summand, Operand minSummand, Operand maxSummand, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasSumAndReluAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasSumAndReluAndRequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder.addInput(summand.asOutput()); + opBuilder.addInput(minSummand.asOutput()); + opBuilder.addInput(maxSummand.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + if (opts.paddingList != null) { + long[] paddingListArray = new long[opts.paddingList.size()]; + for (int i = 0; i < paddingListArray.length; ++i) { + paddingListArray[i] = opts.paddingList.get(i); + } + opBuilder.setAttr("padding_list", paddingListArray); + } + } + } + return new QuantizedConv2DWithBiasSumAndReluAndRequantize(opBuilder.build()); + } + + /** + * @param dilations + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * @param paddingList + */ + public static Options paddingList(List paddingList) { + return new Options().paddingList(paddingList); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output minOutput() { + return minOutput; + } + + /** + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2DWithBiasSumAndReluAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2D.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2D.java new file mode 100644 index 00000000000..f578ea30f5a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2D.java @@ -0,0 +1,140 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes quantized depthwise Conv2D. + * + * @param data type for {@code output()} output + */ +public final class QuantizedDepthwiseConv2D extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedDepthwiseConv2D} + */ + public static class Options { + + /** + * @param dilations List of dilation values. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedDepthwiseConv2D operation. + * + * @param scope current scope + * @param input The original input tensor. + * @param filter The original filter tensor. + * @param minInput The float value that the minimum quantized input value represents. + * @param maxInput The float value that the maximum quantized input value represents. + * @param minFilter The float value that the minimum quantized filter value represents. + * @param maxFilter The float value that the maximum quantized filter value represents. + * @param outType The type of the output. + * @param strides List of stride values. + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedDepthwiseConv2D + */ + public static QuantizedDepthwiseConv2D create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2D", scope.makeOpName("QuantizedDepthwiseConv2D")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new QuantizedDepthwiseConv2D(opBuilder.build()); + } + + /** + * @param dilations List of dilation values. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * The output tensor. + */ + public Output output() { + return output; + } + + /** + * The float value that the minimum quantized output value represents. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The float value that the maximum quantized output value represents. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedDepthwiseConv2D(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBias.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBias.java new file mode 100644 index 00000000000..7ef96750fbd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBias.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes quantized depthwise Conv2D with Bias. + * + * @param data type for {@code output()} output + */ +public final class QuantizedDepthwiseConv2DWithBias extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedDepthwiseConv2DWithBias} + */ + public static class Options { + + /** + * @param dilations List of dilation values. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedDepthwiseConv2DWithBias operation. + * + * @param scope current scope + * @param input The original input tensor. + * @param filter The original filter tensor. + * @param bias The original bias tensor. + * @param minInput The float value that the minimum quantized input value represents. + * @param maxInput The float value that the maximum quantized input value represents. + * @param minFilter The float value that the minimum quantized filter value represents. + * @param maxFilter The float value that the maximum quantized filter value represents. + * @param outType The type of the output. + * @param strides List of stride values. + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedDepthwiseConv2DWithBias + */ + public static QuantizedDepthwiseConv2DWithBias create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2DWithBias", scope.makeOpName("QuantizedDepthwiseConv2DWithBias")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new QuantizedDepthwiseConv2DWithBias(opBuilder.build()); + } + + /** + * @param dilations List of dilation values. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * The output tensor. + */ + public Output output() { + return output; + } + + /** + * The float value that the minimum quantized output value represents. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The float value that the maximum quantized output value represents. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedDepthwiseConv2DWithBias(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndRelu.java new file mode 100644 index 00000000000..8609f9b0a6c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndRelu.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes quantized depthwise Conv2D with Bias and Relu. + * + * @param data type for {@code output()} output + */ +public final class QuantizedDepthwiseConv2DWithBiasAndRelu extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedDepthwiseConv2DWithBiasAndRelu} + */ + public static class Options { + + /** + * @param dilations List of dilation values. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedDepthwiseConv2DWithBiasAndRelu operation. + * + * @param scope current scope + * @param input The original input tensor. + * @param filter The original filter tensor. + * @param bias The original bias tensor. + * @param minInput The float value that the minimum quantized input value represents. + * @param maxInput The float value that the maximum quantized input value represents. + * @param minFilter The float value that the minimum quantized filter value represents. + * @param maxFilter The float value that the maximum quantized filter value represents. + * @param outType The type of the output. + * @param strides List of stride values. + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedDepthwiseConv2DWithBiasAndRelu + */ + public static QuantizedDepthwiseConv2DWithBiasAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2DWithBiasAndRelu", scope.makeOpName("QuantizedDepthwiseConv2DWithBiasAndRelu")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new QuantizedDepthwiseConv2DWithBiasAndRelu(opBuilder.build()); + } + + /** + * @param dilations List of dilation values. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * The output tensor. + */ + public Output output() { + return output; + } + + /** + * The float value that the minimum quantized output value represents. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The float value that the maximum quantized output value represents. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedDepthwiseConv2DWithBiasAndRelu(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java new file mode 100644 index 00000000000..ac46d0f12f1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes quantized depthwise Conv2D with Bias, Relu and Requantize. + * + * @param data type for {@code output()} output + */ +public final class QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize} + */ + public static class Options { + + /** + * @param dilations List of dilation values. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize operation. + * + * @param scope current scope + * @param input The original input tensor. + * @param filter The original filter tensor. + * @param bias The original bias tensor. + * @param minInput The float value that the minimum quantized input value represents. + * @param maxInput The float value that the maximum quantized input value represents. + * @param minFilter The float value that the minimum quantized filter value represents. + * @param maxFilter The float value that the maximum quantized filter value represents. + * @param minFreezedOutput The minimum float value of the output tensor. + * @param maxFreezedOutput The maximum float value of the output tensor. + * @param outType The type of the output. + * @param strides List of stride values. + * @param padding + * @param options carries optional attributes values + * @return a new instance of QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize + */ + public static QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize", scope.makeOpName("QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize(opBuilder.build()); + } + + /** + * @param dilations List of dilation values. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * The output tensor. + */ + public Output output() { + return output; + } + + /** + * The float value that the minimum quantized output value represents. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The float value that the maximum quantized output value represents. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBias.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBias.java new file mode 100644 index 00000000000..ab2a5e9f58d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBias.java @@ -0,0 +1,174 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Performs a quantized matrix multiplication of `a` by the matrix `b` with bias + * add. + *

    + * The inputs must be two-dimensional matrices and 1D bias vector. And the inner + * dimension of `a` (after being transposed if `transpose_a` is non-zero) must + * match the outer dimension of `b` (after being transposed if `transposed_b` is + * non-zero). Then do broadcast add operation with bias values on the matrix + * mulplication result. The bias size must match inner dimension of `b`. + * + * @param data type for {@code out()} output + */ +public final class QuantizedMatMulWithBias extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedMatMulWithBias} + */ + public static class Options { + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public Options transposeA(Boolean transposeA) { + this.transposeA = transposeA; + return this; + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public Options transposeB(Boolean transposeB) { + this.transposeB = transposeB; + return this; + } + + /** + * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. + */ + public Options inputQuantMode(String inputQuantMode) { + this.inputQuantMode = inputQuantMode; + return this; + } + + private Boolean transposeA; + private Boolean transposeB; + private String inputQuantMode; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedMatMulWithBias operation. + * + * @param scope current scope + * @param a A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`. + * @param b A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`. + * @param bias A 1D bias tensor with size matching inner dimension of `b` (after being + * transposed if `transposed_b` is non-zero). + * @param minA The float value that the lowest quantized `a` value represents. + * @param maxA The float value that the highest quantized `a` value represents. + * @param minB The float value that the lowest quantized `b` value represents. + * @param maxB The float value that the highest quantized `b` value represents. + * @param Toutput + * @param options carries optional attributes values + * @return a new instance of QuantizedMatMulWithBias + */ + public static QuantizedMatMulWithBias create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBias", scope.makeOpName("QuantizedMatMulWithBias")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minA.asOutput()); + opBuilder.addInput(maxA.asOutput()); + opBuilder.addInput(minB.asOutput()); + opBuilder.addInput(maxB.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Toutput", DataType.fromClass(Toutput)); + if (options != null) { + for (Options opts : options) { + if (opts.transposeA != null) { + opBuilder.setAttr("transpose_a", opts.transposeA); + } + if (opts.transposeB != null) { + opBuilder.setAttr("transpose_b", opts.transposeB); + } + if (opts.inputQuantMode != null) { + opBuilder.setAttr("input_quant_mode", opts.inputQuantMode); + } + } + } + return new QuantizedMatMulWithBias(opBuilder.build()); + } + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public static Options transposeA(Boolean transposeA) { + return new Options().transposeA(transposeA); + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public static Options transposeB(Boolean transposeB) { + return new Options().transposeB(transposeB); + } + + /** + * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. + */ + public static Options inputQuantMode(String inputQuantMode) { + return new Options().inputQuantMode(inputQuantMode); + } + + /** + */ + public Output out() { + return out; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOut() { + return minOut; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOut() { + return maxOut; + } + + private Output out; + private Output minOut; + private Output maxOut; + + private QuantizedMatMulWithBias(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + minOut = operation.output(outputIdx++); + maxOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndRelu.java new file mode 100644 index 00000000000..ae3c8fc7782 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndRelu.java @@ -0,0 +1,175 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Perform a quantized matrix multiplication of `a` by the matrix `b` with bias + * add and relu fusion. + *

    + * The inputs must be two-dimensional matrices and 1D bias vector. And the inner + * dimension of `a` (after being transposed if `transpose_a` is non-zero) must + * match the outer dimension of `b` (after being transposed if `transposed_b` is + * non-zero). Then do broadcast add operation with bias values on the matrix + * mulplication result. The bias size must match inner dimension of `b`. Then do + * relu activation to get non-negative result. + * + * @param data type for {@code out()} output + */ +public final class QuantizedMatMulWithBiasAndRelu extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedMatMulWithBiasAndRelu} + */ + public static class Options { + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public Options transposeA(Boolean transposeA) { + this.transposeA = transposeA; + return this; + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public Options transposeB(Boolean transposeB) { + this.transposeB = transposeB; + return this; + } + + /** + * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. + */ + public Options inputQuantMode(String inputQuantMode) { + this.inputQuantMode = inputQuantMode; + return this; + } + + private Boolean transposeA; + private Boolean transposeB; + private String inputQuantMode; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedMatMulWithBiasAndRelu operation. + * + * @param scope current scope + * @param a A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`. + * @param b A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`. + * @param bias A 1D bias tensor with size matching with inner dimension of `b` (after being + * transposed if `transposed_b` is non-zero). + * @param minA The float value that the lowest quantized `a` value represents. + * @param maxA The float value that the highest quantized `a` value represents. + * @param minB The float value that the lowest quantized `b` value represents. + * @param maxB The float value that the highest quantized `b` value represents. + * @param Toutput + * @param options carries optional attributes values + * @return a new instance of QuantizedMatMulWithBiasAndRelu + */ + public static QuantizedMatMulWithBiasAndRelu create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBiasAndRelu", scope.makeOpName("QuantizedMatMulWithBiasAndRelu")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minA.asOutput()); + opBuilder.addInput(maxA.asOutput()); + opBuilder.addInput(minB.asOutput()); + opBuilder.addInput(maxB.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Toutput", DataType.fromClass(Toutput)); + if (options != null) { + for (Options opts : options) { + if (opts.transposeA != null) { + opBuilder.setAttr("transpose_a", opts.transposeA); + } + if (opts.transposeB != null) { + opBuilder.setAttr("transpose_b", opts.transposeB); + } + if (opts.inputQuantMode != null) { + opBuilder.setAttr("input_quant_mode", opts.inputQuantMode); + } + } + } + return new QuantizedMatMulWithBiasAndRelu(opBuilder.build()); + } + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public static Options transposeA(Boolean transposeA) { + return new Options().transposeA(transposeA); + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public static Options transposeB(Boolean transposeB) { + return new Options().transposeB(transposeB); + } + + /** + * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. + */ + public static Options inputQuantMode(String inputQuantMode) { + return new Options().inputQuantMode(inputQuantMode); + } + + /** + */ + public Output out() { + return out; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOut() { + return minOut; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOut() { + return maxOut; + } + + private Output out; + private Output minOut; + private Output maxOut; + + private QuantizedMatMulWithBiasAndRelu(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + minOut = operation.output(outputIdx++); + maxOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndReluAndRequantize.java new file mode 100644 index 00000000000..b279bf5212b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndReluAndRequantize.java @@ -0,0 +1,180 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Perform a quantized matrix multiplication of `a` by the matrix `b` with bias + * add and relu and requantize fusion. + *

    + * The inputs must be two-dimensional matrices and 1D bias vector. And the inner + * dimension of `a` (after being transposed if `transpose_a` is non-zero) must + * match the outer dimension of `b` (after being transposed if `transposed_b` is + * non-zero). Then do broadcast add operation with bias values on the matrix + * mulplication result. The bias size must match inner dimension of `b`. Then do + * relu activation to get non-negative result. Then do requantize operation to get + * final uint8 result. + * + * @param data type for {@code out()} output + */ +public final class QuantizedMatMulWithBiasAndReluAndRequantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.QuantizedMatMulWithBiasAndReluAndRequantize} + */ + public static class Options { + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public Options transposeA(Boolean transposeA) { + this.transposeA = transposeA; + return this; + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public Options transposeB(Boolean transposeB) { + this.transposeB = transposeB; + return this; + } + + /** + * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. + */ + public Options inputQuantMode(String inputQuantMode) { + this.inputQuantMode = inputQuantMode; + return this; + } + + private Boolean transposeA; + private Boolean transposeB; + private String inputQuantMode; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedMatMulWithBiasAndReluAndRequantize operation. + * + * @param scope current scope + * @param a A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`. + * @param b A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`. + * @param bias A 1D bias tensor with size matching with inner dimension of `b` (after being + * transposed if `transposed_b` is non-zero). + * @param minA The float value that the lowest quantized `a` value represents. + * @param maxA The float value that the highest quantized `a` value represents. + * @param minB The float value that the lowest quantized `b` value represents. + * @param maxB The float value that the highest quantized `b` value represents. + * @param minFreezedOutput The float value that the highest quantized output value after requantize. + * @param maxFreezedOutput + * @param Toutput + * @param options carries optional attributes values + * @return a new instance of QuantizedMatMulWithBiasAndReluAndRequantize + */ + public static QuantizedMatMulWithBiasAndReluAndRequantize create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Operand minFreezedOutput, Operand maxFreezedOutput, Class Toutput, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBiasAndReluAndRequantize", scope.makeOpName("QuantizedMatMulWithBiasAndReluAndRequantize")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minA.asOutput()); + opBuilder.addInput(maxA.asOutput()); + opBuilder.addInput(minB.asOutput()); + opBuilder.addInput(maxB.asOutput()); + opBuilder.addInput(minFreezedOutput.asOutput()); + opBuilder.addInput(maxFreezedOutput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Toutput", DataType.fromClass(Toutput)); + if (options != null) { + for (Options opts : options) { + if (opts.transposeA != null) { + opBuilder.setAttr("transpose_a", opts.transposeA); + } + if (opts.transposeB != null) { + opBuilder.setAttr("transpose_b", opts.transposeB); + } + if (opts.inputQuantMode != null) { + opBuilder.setAttr("input_quant_mode", opts.inputQuantMode); + } + } + } + return new QuantizedMatMulWithBiasAndReluAndRequantize(opBuilder.build()); + } + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public static Options transposeA(Boolean transposeA) { + return new Options().transposeA(transposeA); + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public static Options transposeB(Boolean transposeB) { + return new Options().transposeB(transposeB); + } + + /** + * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. + */ + public static Options inputQuantMode(String inputQuantMode) { + return new Options().inputQuantMode(inputQuantMode); + } + + /** + */ + public Output out() { + return out; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOut() { + return minOut; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOut() { + return maxOut; + } + + private Output out; + private Output minOut; + private Output maxOut; + + private QuantizedMatMulWithBiasAndReluAndRequantize(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + minOut = operation.output(outputIdx++); + maxOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedReshape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedReshape.java new file mode 100644 index 00000000000..30690c85754 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedReshape.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reshapes a quantized tensor as per the Reshape op. + *

    + * ``` + * + * @param data type for {@code output()} output + */ +@Operator +public final class QuantizedReshape extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedReshape operation. + * + * @param scope current scope + * @param tensor + * @param shape Defines the shape of the output tensor. + * @param inputMin The minimum value of the input. + * @param inputMax The maximum value of the input. + * @return a new instance of QuantizedReshape + */ + public static QuantizedReshape create(Scope scope, Operand tensor, Operand shape, Operand inputMin, Operand inputMax) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedReshape", scope.makeOpName("QuantizedReshape")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(inputMin.asOutput()); + opBuilder.addInput(inputMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new QuantizedReshape(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + /** + * This value is copied from input_min. + */ + public Output outputMin() { + return outputMin; + } + + /** + * This value is copied from input_max. + */ + public Output outputMax() { + return outputMax; + } + + private Output output; + private Output outputMin; + private Output outputMax; + + private QuantizedReshape(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedGather.java new file mode 100644 index 00000000000..67f9a822f07 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedGather.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Gather ragged slices from `params` axis `0` according to `indices`. + *

    + * Outputs a `RaggedTensor` output composed from `output_dense_values` and + * `output_nested_splits`, such that: + *

    {@code
    + * output.shape = indices.shape + params.shape[1:]
    + * output.ragged_rank = indices.shape.ndims + params.ragged_rank
    + * output[i...j, d0...dn] = params[indices[i...j], d0...dn]
    + * }
    + * where + *
      + *
    • + * `params = + * ragged.from_nested_row_splits(params_dense_values, params_nested_splits)` + * provides the values that should be gathered. + *
    • + *
    • + * `indices` ia a dense tensor with dtype `int32` or `int64`, indicating which + * values should be gathered. + *
    • + *
    • + * `output = + * ragged.from_nested_row_splits(output_dense_values, output_nested_splits)` + * is the output tensor. + *
    • + *
    + * (Note: This c++ op is used to implement the higher-level python + * `tf.ragged.gather` op, which also supports ragged indices.) + * + * + * @param data type for {@code outputNestedSplits()} output + * @param data type for {@code outputDenseValues()} output + */ +public final class RaggedGather extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RaggedGather operation. + * + * @param scope current scope + * @param paramsNestedSplits The `nested_row_splits` tensors that define the row-partitioning for the + * `params` RaggedTensor input. + * @param paramsDenseValues The `flat_values` for the `params` RaggedTensor. There was a terminology change + * at the python level from dense_values to flat_values, so dense_values is the + * deprecated name. + * @param indices Indices in the outermost dimension of `params` of the values that should be + * gathered. + * @param OUTPUTRAGGEDRANK The ragged rank of the output RaggedTensor. `output_nested_splits` will contain + * this number of `row_splits` tensors. This value should equal + * `indices.shape.ndims + params.ragged_rank - 1`. + * @return a new instance of RaggedGather + */ + public static RaggedGather create(Scope scope, Iterable> paramsNestedSplits, Operand paramsDenseValues, Operand indices, Long OUTPUTRAGGEDRANK) { + OperationBuilder opBuilder = scope.env().opBuilder("RaggedGather", scope.makeOpName("RaggedGather")); + opBuilder.addInputList(Operands.asOutputs(paramsNestedSplits)); + opBuilder.addInput(paramsDenseValues.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("OUTPUT_RAGGED_RANK", OUTPUTRAGGEDRANK); + return new RaggedGather(opBuilder.build()); + } + + /** + * The `nested_row_splits` tensors that define the row-partitioning for the + * returned RaggedTensor. + */ + public List> outputNestedSplits() { + return outputNestedSplits; + } + + /** + * The `flat_values` for the returned RaggedTensor. + */ + public Output outputDenseValues() { + return outputDenseValues; + } + + private List> outputNestedSplits; + private Output outputDenseValues; + + @SuppressWarnings("unchecked") + private RaggedGather(Operation operation) { + super(operation); + int outputIdx = 0; + int outputNestedSplitsLength = operation.outputListLength("output_nested_splits"); + outputNestedSplits = Arrays.asList((Output[])operation.outputList(outputIdx, outputNestedSplitsLength)); + outputIdx += outputNestedSplitsLength; + outputDenseValues = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedRange.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedRange.java new file mode 100644 index 00000000000..dc892365e41 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedRange.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns a `RaggedTensor` containing the specified sequences of numbers. + *

    + * + * Returns a `RaggedTensor` `result` composed from `rt_dense_values` and + * `rt_nested_splits`, such that + * `result[i] = range(starts[i], limits[i], deltas[i])`. + *

    {@code
    + * >>> (rt_nested_splits, rt_dense_values) = gen_ragged_ops.ragged_range(
    + * ...     starts=[2, 5, 8], limits=[3, 5, 12], deltas=1)
    + * >>> result = ragged.from_nested_row_splits(rt_dense_values, rt_nested_splits)
    + * >>> print result.eval().tolist()
    + * [[2],               # result[0] = range(2, 3)
    + *  [],                # result[1] = range(5, 5)
    + *  [8, 9, 10, 11]]    # result[2] = range(8, 12)
    + * }
    + * The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors. + * The vector inputs must all have the same size. Scalar inputs are broadcast + * to match the size of the vector inputs. + * + * @param data type for {@code rtNestedSplits()} output + * @param data type for {@code rtDenseValues()} output + */ +public final class RaggedRange extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RaggedRange operation. + * + * @param scope current scope + * @param starts The starts of each range. + * @param limits The limits of each range. + * @param deltas The deltas of each range. + * @param Tsplits + * @return a new instance of RaggedRange + */ + public static RaggedRange create(Scope scope, Operand starts, Operand limits, Operand deltas, Class Tsplits) { + OperationBuilder opBuilder = scope.env().opBuilder("RaggedRange", scope.makeOpName("RaggedRange")); + opBuilder.addInput(starts.asOutput()); + opBuilder.addInput(limits.asOutput()); + opBuilder.addInput(deltas.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Tsplits", DataType.fromClass(Tsplits)); + return new RaggedRange(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new RaggedRange operation using default output types. + * + * @param scope current scope + * @param starts The starts of each range. + * @param limits The limits of each range. + * @param deltas The deltas of each range. + * @return a new instance of RaggedRange + */ + public static RaggedRange create(Scope scope, Operand starts, Operand limits, Operand deltas) { + return create(scope, starts, limits, deltas, Long.class); + } + + /** + * The `row_splits` for the returned `RaggedTensor`. + */ + public Output rtNestedSplits() { + return rtNestedSplits; + } + + /** + * The `flat_values` for the returned `RaggedTensor`. + */ + public Output rtDenseValues() { + return rtDenseValues; + } + + private Output rtNestedSplits; + private Output rtDenseValues; + + private RaggedRange(Operation operation) { + super(operation); + int outputIdx = 0; + rtNestedSplits = operation.output(outputIdx++); + rtDenseValues = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorFromVariant.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorFromVariant.java new file mode 100644 index 00000000000..11872cfec53 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorFromVariant.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Decodes a `variant` Tensor into a `RaggedTensor`. + *

    + * Decodes the given `variant` Tensor and returns a `RaggedTensor`. The input + * could be a scalar, meaning it encodes a single `RaggedTensor` with ragged_rank + * `output_ragged_rank`. It could also have an arbitrary rank, in which case each + * element is decoded into a `RaggedTensor` with ragged_rank `input_ragged_rank` + * and these are then stacked according to the input shape to output a single + * `RaggedTensor` with ragged_rank `output_ragged_rank`. Each `variant` element in + * the input Tensor is decoded by retrieving from the element a 1-D `variant` + * Tensor with `input_ragged_rank + 1` Tensors, corresponding to the splits and + * values of the decoded `RaggedTensor`. If `input_ragged_rank` is -1, then it is + * inferred as `output_ragged_rank` - `rank(encoded_ragged)`. See + * `RaggedTensorToVariant` for the corresponding encoding logic. + * + * + * @param data type for {@code outputNestedSplits()} output + * @param data type for {@code outputDenseValues()} output + */ +public final class RaggedTensorFromVariant extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RaggedTensorFromVariant operation. + * + * @param scope current scope + * @param encodedRagged A `variant` Tensor containing encoded `RaggedTensor`s. + * @param inputRaggedRank The ragged rank of each encoded `RaggedTensor` component in the input. If set to + * -1, this is inferred as `output_ragged_rank` - `rank(encoded_ragged)` + * @param outputRaggedRank The expected ragged rank of the output `RaggedTensor`. The following must hold: + * `output_ragged_rank = rank(encoded_ragged) + input_ragged_rank`. + * @param Tvalues + * @param Tsplits + * @return a new instance of RaggedTensorFromVariant + */ + public static RaggedTensorFromVariant create(Scope scope, Operand encodedRagged, Long inputRaggedRank, Long outputRaggedRank, Class Tvalues, Class Tsplits) { + OperationBuilder opBuilder = scope.env().opBuilder("RaggedTensorFromVariant", scope.makeOpName("RaggedTensorFromVariant")); + opBuilder.addInput(encodedRagged.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("input_ragged_rank", inputRaggedRank); + opBuilder.setAttr("output_ragged_rank", outputRaggedRank); + opBuilder.setAttr("Tvalues", DataType.fromClass(Tvalues)); + opBuilder.setAttr("Tsplits", DataType.fromClass(Tsplits)); + return new RaggedTensorFromVariant(opBuilder.build()); + } + + /** + * A list of one or more Tensors representing the splits of the output + * `RaggedTensor`. + */ + public List> outputNestedSplits() { + return outputNestedSplits; + } + + /** + * A Tensor representing the values of the output `RaggedTensor`. + */ + public Output outputDenseValues() { + return outputDenseValues; + } + + private List> outputNestedSplits; + private Output outputDenseValues; + + @SuppressWarnings("unchecked") + private RaggedTensorFromVariant(Operation operation) { + super(operation); + int outputIdx = 0; + int outputNestedSplitsLength = operation.outputListLength("output_nested_splits"); + outputNestedSplits = Arrays.asList((Output[])operation.outputList(outputIdx, outputNestedSplitsLength)); + outputIdx += outputNestedSplitsLength; + outputDenseValues = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToSparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToSparse.java new file mode 100644 index 00000000000..d537d03c812 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToSparse.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Converts a `RaggedTensor` into a `SparseTensor` with the same values. + *

    + * input=ragged.from_nested_row_splits(rt_dense_values, rt_nested_splits) + * output=SparseTensor(indices=sparse_indices, values=sparse_values, + * dense_shape=sparse_dense_shape) + * + * @param data type for {@code sparseValues()} output + */ +public final class RaggedTensorToSparse extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RaggedTensorToSparse operation. + * + * @param scope current scope + * @param rtNestedSplits The `row_splits` for the `RaggedTensor`. + * @param rtDenseValues The `flat_values` for the `RaggedTensor`. + * @return a new instance of RaggedTensorToSparse + */ + public static RaggedTensorToSparse create(Scope scope, Iterable> rtNestedSplits, Operand rtDenseValues) { + OperationBuilder opBuilder = scope.env().opBuilder("RaggedTensorToSparse", scope.makeOpName("RaggedTensorToSparse")); + opBuilder.addInputList(Operands.asOutputs(rtNestedSplits)); + opBuilder.addInput(rtDenseValues.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RaggedTensorToSparse(opBuilder.build()); + } + + /** + * The indices for the `SparseTensor`. + */ + public Output sparseIndices() { + return sparseIndices; + } + + /** + * The values of the `SparseTensor`. + */ + public Output sparseValues() { + return sparseValues; + } + + /** + * `sparse_dense_shape` is a tight bounding box of the input `RaggedTensor`. + */ + public Output sparseDenseShape() { + return sparseDenseShape; + } + + private Output sparseIndices; + private Output sparseValues; + private Output sparseDenseShape; + + private RaggedTensorToSparse(Operation operation) { + super(operation); + int outputIdx = 0; + sparseIndices = operation.output(outputIdx++); + sparseValues = operation.output(outputIdx++); + sparseDenseShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToVariant.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToVariant.java new file mode 100644 index 00000000000..2abde17cfb8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToVariant.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Encodes a `RaggedTensor` into a `variant` Tensor. + *

    + * + * Encodes the given `RaggedTensor` and returns a `variant` Tensor. If + * `batched_input` is True, then input `RaggedTensor` is unbatched along the + * zero-th dimension, each component `RaggedTensor` is encoded into a scalar + * `variant` Tensor, and these are stacked to return a 1-D `variant` Tensor. + * If `batched_input` is False, then the input `RaggedTensor` is encoded as is and + * a scalar `variant` Tensor is returned. A `RaggedTensor` is encoded by first + * creating a 1-D `variant` Tensor with `ragged_rank + 1` elements, containing the + * splits and values Tensors of the `RaggedTensor`. Then the 1-D `variant` Tensor + * is wrapped in a scalar `variant` Tensor. See `RaggedTensorFromVariant` for the + * corresponding decoding logic. + * + */ +public final class RaggedTensorToVariant extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RaggedTensorToVariant operation. + * + * @param scope current scope + * @param rtNestedSplits A list of one or more Tensors representing the splits of the input + * `RaggedTensor`. + * @param rtDenseValues A Tensor representing the values of the input `RaggedTensor`. + * @param batchedInput A `bool` denoting whether the input is a batched `RaggedTensor`. + * @return a new instance of RaggedTensorToVariant + */ + public static RaggedTensorToVariant create(Scope scope, Iterable> rtNestedSplits, Operand rtDenseValues, Boolean batchedInput) { + OperationBuilder opBuilder = scope.env().opBuilder("RaggedTensorToVariant", scope.makeOpName("RaggedTensorToVariant")); + opBuilder.addInputList(Operands.asOutputs(rtNestedSplits)); + opBuilder.addInput(rtDenseValues.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("batched_input", batchedInput); + return new RaggedTensorToVariant(opBuilder.build()); + } + + /** + * A `variant` Tensor that containing encoded `RaggedTensor`. + */ + public Output encodedRagged() { + return encodedRagged; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) encodedRagged; + } + + private Output encodedRagged; + + private RaggedTensorToVariant(Operation operation) { + super(operation); + int outputIdx = 0; + encodedRagged = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Range.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Range.java new file mode 100644 index 00000000000..2c30b5449c3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Range.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a sequence of numbers. + *

    + * This operation creates a sequence of numbers that begins at `start` and + * extends by increments of `delta` up to but not including `limit`. + *

    + * For example: + *

    {@code
    + * # 'start' is 3
    + * # 'limit' is 18
    + * # 'delta' is 3
    + * tf.range(start, limit, delta) ==> [3, 6, 9, 12, 15]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Range extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Range operation. + * + * @param scope current scope + * @param start 0-D (scalar). First entry in the sequence. + * @param limit 0-D (scalar). Upper limit of sequence, exclusive. + * @param delta 0-D (scalar). Optional. Default is 1. Number that increments `start`. + * @return a new instance of Range + */ + public static Range create(Scope scope, Operand start, Operand limit, Operand delta) { + OperationBuilder opBuilder = scope.env().opBuilder("Range", scope.makeOpName("Range")); + opBuilder.addInput(start.asOutput()); + opBuilder.addInput(limit.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Range(opBuilder.build()); + } + + /** + * 1-D. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Range(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rank.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rank.java new file mode 100644 index 00000000000..49d3ebc13fc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rank.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the rank of a tensor. + *

    + * This operation returns an integer representing the rank of `input`. + *

    + * For example: + *

    {@code
    + * # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]
    + * # shape of tensor 't' is [2, 2, 3]
    + * rank(t) ==> 3
    + * }
    + * Note: The rank of a tensor is not the same as the rank of a matrix. The rank + * of a tensor is the number of indices required to uniquely select each element + * of the tensor. Rank is also known as "order", "degree", or "ndims." + */ +@Operator +public final class Rank extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Rank operation. + * + * @param scope current scope + * @param input + * @return a new instance of Rank + */ + public static Rank create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("Rank", scope.makeOpName("Rank")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Rank(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Rank(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReadVariableOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReadVariableOp.java new file mode 100644 index 00000000000..1a3370eda14 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReadVariableOp.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reads the value of a variable. + *

    + * The tensor returned by this operation is immutable. + *

    + * The value returned by this operation is guaranteed to be influenced by all the + * writes on which this operation depends directly or indirectly, and to not be + * influenced by any of the writes which depend directly or indirectly on this + * operation. + * + * @param data type for {@code value()} output + */ +@Operator +public final class ReadVariableOp extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ReadVariableOp operation. + * + * @param scope current scope + * @param resource handle to the resource in which to store the variable. + * @param dtype the dtype of the value. + * @return a new instance of ReadVariableOp + */ + public static ReadVariableOp create(Scope scope, Operand resource, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("ReadVariableOp", scope.makeOpName("ReadVariableOp")); + opBuilder.addInput(resource.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new ReadVariableOp(opBuilder.build()); + } + + /** + */ + public Output value() { + return value; + } + + @Override + public Output asOutput() { + return value; + } + + private Output value; + + private ReadVariableOp(Operation operation) { + super(operation); + int outputIdx = 0; + value = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RebatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RebatchDataset.java new file mode 100644 index 00000000000..afd9cdd3008 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RebatchDataset.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that changes the batch size. + *

    + * Creates a dataset that changes the batch size of the dataset to current batch + * size // num_workers. + */ +public final class RebatchDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RebatchDataset} + */ + public static class Options { + + /** + * @param useFallback + */ + public Options useFallback(Boolean useFallback) { + this.useFallback = useFallback; + return this; + } + + private Boolean useFallback; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RebatchDataset operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @param numReplicas A scalar representing the number of replicas to distribute this batch across. As + * a result of this transformation the current batch size would end up being + * divided by this parameter. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of RebatchDataset + */ + public static RebatchDataset create(Scope scope, Operand inputDataset, Operand numReplicas, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RebatchDataset", scope.makeOpName("RebatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numReplicas.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.useFallback != null) { + opBuilder.setAttr("use_fallback", opts.useFallback); + } + } + } + return new RebatchDataset(opBuilder.build()); + } + + /** + * @param useFallback + */ + public static Options useFallback(Boolean useFallback) { + return new Options().useFallback(useFallback); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private RebatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RecvTPUEmbeddingActivations.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RecvTPUEmbeddingActivations.java new file mode 100644 index 00000000000..88ca08f3eca --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RecvTPUEmbeddingActivations.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op that receives embedding activations on the TPU. + *

    + * The TPU system performs the embedding lookups and aggregations specified by + * the arguments to TPUEmbeddingEnqueue(Integer/Sparse/SparseTensor)Batch. The + * results of these aggregations are visible to the Tensorflow Graph as the + * outputs of a RecvTPUEmbeddingActivations op. This op returns a list containing + * one Tensor of activations per table specified in the model. There can be at + * most one RecvTPUEmbeddingActivations op in the TPU graph. + */ +public final class RecvTPUEmbeddingActivations extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new RecvTPUEmbeddingActivations operation. + * + * @param scope current scope + * @param numOutputs The number of output activation tensors, equal to the number of + * embedding tables in the model. + * @param config Serialized TPUEmbeddingConfiguration proto. + * @return a new instance of RecvTPUEmbeddingActivations + */ + public static RecvTPUEmbeddingActivations create(Scope scope, Long numOutputs, String config) { + OperationBuilder opBuilder = scope.env().opBuilder("RecvTPUEmbeddingActivations", scope.makeOpName("RecvTPUEmbeddingActivations")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_outputs", numOutputs); + opBuilder.setAttr("config", config); + return new RecvTPUEmbeddingActivations(opBuilder.build()); + } + + /** + * A TensorList of embedding activations containing one Tensor per + * embedding table in the model. + */ + public List> outputs() { + return outputs; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outputs.iterator(); + } + + private List> outputs; + + @SuppressWarnings("unchecked") + private RecvTPUEmbeddingActivations(Operation operation) { + super(operation); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList((Output[])operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAll.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAll.java new file mode 100644 index 00000000000..d4a76da4258 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAll.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the "logical and" of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + */ +@Operator +public final class ReduceAll extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceAll} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReduceAll operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of ReduceAll + */ + public static ReduceAll create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("All", scope.makeOpName("ReduceAll")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new ReduceAll(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReduceAll(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAny.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAny.java new file mode 100644 index 00000000000..4157226c067 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAny.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the "logical or" of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + */ +@Operator +public final class ReduceAny extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceAny} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReduceAny operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of ReduceAny + */ + public static ReduceAny create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Any", scope.makeOpName("ReduceAny")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new ReduceAny(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReduceAny(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMax.java new file mode 100644 index 00000000000..95f3672a434 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMax.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the maximum of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ReduceMax extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceMax} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReduceMax operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of ReduceMax + */ + public static ReduceMax create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Max", scope.makeOpName("ReduceMax")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new ReduceMax(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReduceMax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMin.java new file mode 100644 index 00000000000..81d2a4d913e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMin.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the minimum of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ReduceMin extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceMin} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReduceMin operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of ReduceMin + */ + public static ReduceMin create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Min", scope.makeOpName("ReduceMin")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new ReduceMin(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReduceMin(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceProd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceProd.java new file mode 100644 index 00000000000..981758183be --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceProd.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the product of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ReduceProd extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceProd} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReduceProd operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of ReduceProd + */ + public static ReduceProd create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Prod", scope.makeOpName("ReduceProd")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new ReduceProd(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReduceProd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceSum.java new file mode 100644 index 00000000000..013432ca778 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceSum.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum of elements across dimensions of a tensor. + *

    + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ReduceSum extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceSum} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReduceSum operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of ReduceSum + */ + public static ReduceSum create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Sum", scope.makeOpName("ReduceSum")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new ReduceSum(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReduceSum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefEnter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefEnter.java new file mode 100644 index 00000000000..3c293640791 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefEnter.java @@ -0,0 +1,127 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates or finds a child frame, and makes `data` available to the child frame. + *

    + * The unique `frame_name` is used by the `Executor` to identify frames. If + * `is_constant` is true, `output` is a constant in the child frame; otherwise + * it may be changed in the child frame. At most `parallel_iterations` iterations + * are run in parallel in the child frame. + * + * @param data type for {@code output()} output + */ +public final class RefEnter extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RefEnter} + */ + public static class Options { + + /** + * @param isConstant If true, the output is constant within the child frame. + */ + public Options isConstant(Boolean isConstant) { + this.isConstant = isConstant; + return this; + } + + /** + * @param parallelIterations The number of iterations allowed to run in parallel. + */ + public Options parallelIterations(Long parallelIterations) { + this.parallelIterations = parallelIterations; + return this; + } + + private Boolean isConstant; + private Long parallelIterations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RefEnter operation. + * + * @param scope current scope + * @param data The tensor to be made available to the child frame. + * @param frameName The name of the child frame. + * @param options carries optional attributes values + * @return a new instance of RefEnter + */ + public static RefEnter create(Scope scope, Operand data, String frameName, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RefEnter", scope.makeOpName("RefEnter")); + opBuilder.addInput(data.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("frame_name", frameName); + if (options != null) { + for (Options opts : options) { + if (opts.isConstant != null) { + opBuilder.setAttr("is_constant", opts.isConstant); + } + if (opts.parallelIterations != null) { + opBuilder.setAttr("parallel_iterations", opts.parallelIterations); + } + } + } + return new RefEnter(opBuilder.build()); + } + + /** + * @param isConstant If true, the output is constant within the child frame. + */ + public static Options isConstant(Boolean isConstant) { + return new Options().isConstant(isConstant); + } + + /** + * @param parallelIterations The number of iterations allowed to run in parallel. + */ + public static Options parallelIterations(Long parallelIterations) { + return new Options().parallelIterations(parallelIterations); + } + + /** + * The same tensor as `data`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RefEnter(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefExit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefExit.java new file mode 100644 index 00000000000..754a9aeab37 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefExit.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Exits the current frame to its parent frame. + *

    + * Exit makes its input `data` available to the parent frame. + * + * @param data type for {@code output()} output + */ +public final class RefExit extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RefExit operation. + * + * @param scope current scope + * @param data The tensor to be made available to the parent frame. + * @return a new instance of RefExit + */ + public static RefExit create(Scope scope, Operand data) { + OperationBuilder opBuilder = scope.env().opBuilder("RefExit", scope.makeOpName("RefExit")); + opBuilder.addInput(data.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RefExit(opBuilder.build()); + } + + /** + * The same tensor as `data`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RefExit(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefIdentity.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefIdentity.java new file mode 100644 index 00000000000..dd139e39101 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefIdentity.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Return the same ref tensor as the input ref tensor. + * + * @param data type for {@code output()} output + */ +public final class RefIdentity extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RefIdentity operation. + * + * @param scope current scope + * @param input + * @return a new instance of RefIdentity + */ + public static RefIdentity create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("RefIdentity", scope.makeOpName("RefIdentity")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RefIdentity(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RefIdentity(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefMerge.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefMerge.java new file mode 100644 index 00000000000..5a30ee939c1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefMerge.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Forwards the value of an available tensor from `inputs` to `output`. + *

    + * `Merge` waits for at least one of the tensors in `inputs` to become available. + * It is usually combined with `Switch` to implement branching. + *

    + * `Merge` forwards the first tensor for become available to `output`, and sets + * `value_index` to its index in `inputs`. + * + * @param data type for {@code output()} output + */ +public final class RefMerge extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RefMerge operation. + * + * @param scope current scope + * @param inputs The input tensors, exactly one of which will become available. + * @return a new instance of RefMerge + */ + public static RefMerge create(Scope scope, Iterable> inputs) { + OperationBuilder opBuilder = scope.env().opBuilder("RefMerge", scope.makeOpName("RefMerge")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RefMerge(opBuilder.build()); + } + + /** + * Will be set to the available input tensor. + */ + public Output output() { + return output; + } + + /** + * The index of the chosen input tensor in `inputs`. + */ + public Output valueIndex() { + return valueIndex; + } + + private Output output; + private Output valueIndex; + + private RefMerge(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + valueIndex = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefNextIteration.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefNextIteration.java new file mode 100644 index 00000000000..0cd46893693 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefNextIteration.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Makes its input available to the next iteration. + * + * @param data type for {@code output()} output + */ +@Operator +public final class RefNextIteration extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RefNextIteration operation. + * + * @param scope current scope + * @param data The tensor to be made available to the next iteration. + * @return a new instance of RefNextIteration + */ + public static RefNextIteration create(Scope scope, Operand data) { + OperationBuilder opBuilder = scope.env().opBuilder("RefNextIteration", scope.makeOpName("RefNextIteration")); + opBuilder.addInput(data.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RefNextIteration(opBuilder.build()); + } + + /** + * The same tensor as `data`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RefNextIteration(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefSelect.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefSelect.java new file mode 100644 index 00000000000..712b82fa40d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefSelect.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Forwards the `index`th element of `inputs` to `output`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class RefSelect extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RefSelect operation. + * + * @param scope current scope + * @param index A scalar that determines the input that gets selected. + * @param inputs A list of ref tensors, one of which will be forwarded to `output`. + * @return a new instance of RefSelect + */ + public static RefSelect create(Scope scope, Operand index, Iterable> inputs) { + OperationBuilder opBuilder = scope.env().opBuilder("RefSelect", scope.makeOpName("RefSelect")); + opBuilder.addInput(index.asOutput()); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RefSelect(opBuilder.build()); + } + + /** + * The forwarded tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RefSelect(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefSwitch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefSwitch.java new file mode 100644 index 00000000000..3017e9de59a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RefSwitch.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Forwards the ref tensor `data` to the output port determined by `pred`. + *

    + * If `pred` is true, the `data` input is forwarded to `output_true`. Otherwise, + * the data goes to `output_false`. + *

    + * See also `Switch` and `Merge`. + * + * @param data type for {@code outputFalse()} output + */ +@Operator +public final class RefSwitch extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RefSwitch operation. + * + * @param scope current scope + * @param data The ref tensor to be forwarded to the appropriate output. + * @param pred A scalar that specifies which output port will receive data. + * @return a new instance of RefSwitch + */ + public static RefSwitch create(Scope scope, Operand data, Operand pred) { + OperationBuilder opBuilder = scope.env().opBuilder("RefSwitch", scope.makeOpName("RefSwitch")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(pred.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RefSwitch(opBuilder.build()); + } + + /** + * If `pred` is false, data will be forwarded to this output. + */ + public Output outputFalse() { + return outputFalse; + } + + /** + * If `pred` is true, data will be forwarded to this output. + */ + public Output outputTrue() { + return outputTrue; + } + + private Output outputFalse; + private Output outputTrue; + + private RefSwitch(Operation operation) { + super(operation); + int outputIdx = 0; + outputFalse = operation.output(outputIdx++); + outputTrue = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RemoteFusedGraphExecute.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RemoteFusedGraphExecute.java new file mode 100644 index 00000000000..a9593b1272a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RemoteFusedGraphExecute.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Execute a sub graph on a remote processor. + *

    + * The graph specifications(such as graph itself, input tensors and output names) + * are stored as a serialized protocol buffer of RemoteFusedGraphExecuteInfo + * as serialized_remote_fused_graph_execute_info. + * The specifications will be passed to a dedicated registered + * remote fused graph executor. The executor will send the graph specifications + * to a remote processor and execute that graph. The execution results + * will be passed to consumer nodes as outputs of this node. + */ +@Operator +public final class RemoteFusedGraphExecute extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new RemoteFusedGraphExecute operation. + * + * @param scope current scope + * @param inputs Arbitrary number of tensors with arbitrary data types + * @param Toutputs + * @param serializedRemoteFusedGraphExecuteInfo Serialized protocol buffer + * of RemoteFusedGraphExecuteInfo which contains graph specifications. + * @return a new instance of RemoteFusedGraphExecute + */ + public static RemoteFusedGraphExecute create(Scope scope, Iterable> inputs, List> Toutputs, String serializedRemoteFusedGraphExecuteInfo) { + OperationBuilder opBuilder = scope.env().opBuilder("RemoteFusedGraphExecute", scope.makeOpName("RemoteFusedGraphExecute")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] ToutputsArray = new DataType[Toutputs.size()]; + for (int i = 0; i < ToutputsArray.length; ++i) { + ToutputsArray[i] = DataType.fromClass(Toutputs.get(i)); + } + opBuilder.setAttr("Toutputs", ToutputsArray); + opBuilder.setAttr("serialized_remote_fused_graph_execute_info", serializedRemoteFusedGraphExecuteInfo); + return new RemoteFusedGraphExecute(opBuilder.build()); + } + + /** + * Arbitrary number of tensors with arbitrary data types + */ + public List> outputs() { + return outputs; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outputs.iterator(); + } + + private List> outputs; + + private RemoteFusedGraphExecute(Operation operation) { + super(operation); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList(operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizationRangePerChannel.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizationRangePerChannel.java new file mode 100644 index 00000000000..e2d507496de --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizationRangePerChannel.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes requantization range per channel. + */ +public final class RequantizationRangePerChannel extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RequantizationRangePerChannel operation. + * + * @param scope current scope + * @param input The original input tensor. + * @param inputMin The minimum value of the input tensor + * @param inputMax The maximum value of the input tensor. + * @param clipValueMax The maximum value of the output that needs to be clipped. + * Example: set this to 6 for Relu6. + * @return a new instance of RequantizationRangePerChannel + */ + public static RequantizationRangePerChannel create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Float clipValueMax) { + OperationBuilder opBuilder = scope.env().opBuilder("RequantizationRangePerChannel", scope.makeOpName("RequantizationRangePerChannel")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputMin.asOutput()); + opBuilder.addInput(inputMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("clip_value_max", clipValueMax); + return new RequantizationRangePerChannel(opBuilder.build()); + } + + /** + * The minimum value of the final output tensor + */ + public Output outputMin() { + return outputMin; + } + + /** + * The maximum value of the final output tensor. + */ + public Output outputMax() { + return outputMax; + } + + private Output outputMin; + private Output outputMax; + + private RequantizationRangePerChannel(Operation operation) { + super(operation); + int outputIdx = 0; + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizePerChannel.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizePerChannel.java new file mode 100644 index 00000000000..67aed0b4cfb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizePerChannel.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Requantizes input with min and max values known per channel. + * + * @param data type for {@code output()} output + */ +public final class RequantizePerChannel extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RequantizePerChannel operation. + * + * @param scope current scope + * @param input The original input tensor. + * @param inputMin The minimum value of the input tensor + * @param inputMax The maximum value of the input tensor. + * @param requestedOutputMin The minimum value of the output tensor requested. + * @param requestedOutputMax The maximum value of the output tensor requested. + * @param outType The quantized type of output tensor that needs to be converted. + * @return a new instance of RequantizePerChannel + */ + public static RequantizePerChannel create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("RequantizePerChannel", scope.makeOpName("RequantizePerChannel")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputMin.asOutput()); + opBuilder.addInput(inputMax.asOutput()); + opBuilder.addInput(requestedOutputMin.asOutput()); + opBuilder.addInput(requestedOutputMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new RequantizePerChannel(opBuilder.build()); + } + + /** + * Output tensor. + */ + public Output output() { + return output; + } + + /** + * The minimum value of the final output tensor + */ + public Output outputMin() { + return outputMin; + } + + /** + * The maximum value of the final output tensor. + */ + public Output outputMax() { + return outputMax; + } + + private Output output; + private Output outputMin; + private Output outputMax; + + private RequantizePerChannel(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reshape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reshape.java new file mode 100644 index 00000000000..0fa6e78cdb0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reshape.java @@ -0,0 +1,127 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reshapes a tensor. + *

    + * Given `tensor`, this operation returns a tensor that has the same values + * as `tensor` with shape `shape`. + *

    + * If one component of `shape` is the special value -1, the size of that dimension + * is computed so that the total size remains constant. In particular, a `shape` + * of `[-1]` flattens into 1-D. At most one component of `shape` can be -1. + *

    + * If `shape` is 1-D or higher, then the operation returns a tensor with shape + * `shape` filled with the values of `tensor`. In this case, the number of elements + * implied by `shape` must be the same as the number of elements in `tensor`. + *

    + * For example: + *

    {@code
    + * # tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9]
    + * # tensor 't' has shape [9]
    + * reshape(t, [3, 3]) ==> [[1, 2, 3],
    + *                         [4, 5, 6],
    + *                         [7, 8, 9]]
    + * 
    + * # tensor 't' is [[[1, 1], [2, 2]],
    + * #                [[3, 3], [4, 4]]]
    + * # tensor 't' has shape [2, 2, 2]
    + * reshape(t, [2, 4]) ==> [[1, 1, 2, 2],
    + *                         [3, 3, 4, 4]]
    + * 
    + * # tensor 't' is [[[1, 1, 1],
    + * #                 [2, 2, 2]],
    + * #                [[3, 3, 3],
    + * #                 [4, 4, 4]],
    + * #                [[5, 5, 5],
    + * #                 [6, 6, 6]]]
    + * # tensor 't' has shape [3, 2, 3]
    + * # pass '[-1]' to flatten 't'
    + * reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]
    + * 
    + * # -1 can also be used to infer the shape
    + * 
    + * # -1 is inferred to be 9:
    + * reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3],
    + *                          [4, 4, 4, 5, 5, 5, 6, 6, 6]]
    + * # -1 is inferred to be 2:
    + * reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3],
    + *                          [4, 4, 4, 5, 5, 5, 6, 6, 6]]
    + * # -1 is inferred to be 3:
    + * reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1],
    + *                               [2, 2, 2],
    + *                               [3, 3, 3]],
    + *                              [[4, 4, 4],
    + *                               [5, 5, 5],
    + *                               [6, 6, 6]]]
    + * 
    + * # tensor 't' is [7]
    + * # shape `[]` reshapes to a scalar
    + * reshape(t, []) ==> 7
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Reshape extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Reshape operation. + * + * @param scope current scope + * @param tensor + * @param shape Defines the shape of the output tensor. + * @return a new instance of Reshape + */ + public static Reshape create(Scope scope, Operand tensor, Operand shape) { + OperationBuilder opBuilder = scope.env().opBuilder("Reshape", scope.makeOpName("Reshape")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Reshape(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Reshape(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorApplyGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorApplyGradient.java new file mode 100644 index 00000000000..ef5e8796149 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorApplyGradient.java @@ -0,0 +1,55 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Applies a gradient to a given accumulator. + *

    + * Does not add if local_step is lesser than the accumulator's global_step. + */ +public final class ResourceAccumulatorApplyGradient extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceAccumulatorApplyGradient operation. + * + * @param scope current scope + * @param handle The handle to a accumulator. + * @param localStep The local_step value at which the gradient was computed. + * @param gradient A tensor of the gradient to be accumulated. + * @return a new instance of ResourceAccumulatorApplyGradient + */ + public static ResourceAccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradient) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceAccumulatorApplyGradient", scope.makeOpName("ResourceAccumulatorApplyGradient")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(localStep.asOutput()); + opBuilder.addInput(gradient.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceAccumulatorApplyGradient(opBuilder.build()); + } + + + private ResourceAccumulatorApplyGradient(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorNumAccumulated.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorNumAccumulated.java new file mode 100644 index 00000000000..da40320c80b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorNumAccumulated.java @@ -0,0 +1,65 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns the number of gradients aggregated in the given accumulators. + */ +public final class ResourceAccumulatorNumAccumulated extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ResourceAccumulatorNumAccumulated operation. + * + * @param scope current scope + * @param handle The handle to an accumulator. + * @return a new instance of ResourceAccumulatorNumAccumulated + */ + public static ResourceAccumulatorNumAccumulated create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceAccumulatorNumAccumulated", scope.makeOpName("ResourceAccumulatorNumAccumulated")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceAccumulatorNumAccumulated(opBuilder.build()); + } + + /** + * The number of gradients aggregated in the given accumulator. + */ + public Output numAccumulated() { + return numAccumulated; + } + + @Override + public Output asOutput() { + return numAccumulated; + } + + private Output numAccumulated; + + private ResourceAccumulatorNumAccumulated(Operation operation) { + super(operation); + int outputIdx = 0; + numAccumulated = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorSetGlobalStep.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorSetGlobalStep.java new file mode 100644 index 00000000000..1ff57263c61 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorSetGlobalStep.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Updates the accumulator with a new value for global_step. + *

    + * Logs warning if the accumulator's value is already higher than + * new_global_step. + */ +public final class ResourceAccumulatorSetGlobalStep extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceAccumulatorSetGlobalStep operation. + * + * @param scope current scope + * @param handle The handle to an accumulator. + * @param newGlobalStep The new global_step value to set. + * @return a new instance of ResourceAccumulatorSetGlobalStep + */ + public static ResourceAccumulatorSetGlobalStep create(Scope scope, Operand handle, Operand newGlobalStep) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceAccumulatorSetGlobalStep", scope.makeOpName("ResourceAccumulatorSetGlobalStep")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(newGlobalStep.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceAccumulatorSetGlobalStep(opBuilder.build()); + } + + + private ResourceAccumulatorSetGlobalStep(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorTakeGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorTakeGradient.java new file mode 100644 index 00000000000..9d5b66ceb24 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorTakeGradient.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Extracts the average gradient in the given ConditionalAccumulator. + *

    + * The op blocks until sufficient (i.e., more than num_required) + * gradients have been accumulated. If the accumulator has already + * aggregated more than num_required gradients, it returns the average of + * the accumulated gradients. Also automatically increments the recorded + * global_step in the accumulator by 1, and resets the aggregate to 0. + * + * @param data type for {@code average()} output + */ +public final class ResourceAccumulatorTakeGradient extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ResourceAccumulatorTakeGradient operation. + * + * @param scope current scope + * @param handle The handle to an accumulator. + * @param numRequired Number of gradients required before we return an aggregate. + * @param dtype The data type of accumulated gradients. Needs to correspond to the type + * of the accumulator. + * @return a new instance of ResourceAccumulatorTakeGradient + */ + public static ResourceAccumulatorTakeGradient create(Scope scope, Operand handle, Operand numRequired, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceAccumulatorTakeGradient", scope.makeOpName("ResourceAccumulatorTakeGradient")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(numRequired.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new ResourceAccumulatorTakeGradient(opBuilder.build()); + } + + /** + * The average of the accumulated gradients. + */ + public Output average() { + return average; + } + + @Override + public Output asOutput() { + return average; + } + + private Output average; + + private ResourceAccumulatorTakeGradient(Operation operation) { + super(operation); + int outputIdx = 0; + average = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdagradV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdagradV2.java new file mode 100644 index 00000000000..195a5af8ecd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdagradV2.java @@ -0,0 +1,117 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Update '*var' according to the adagrad scheme. + *

    + * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) + */ +public final class ResourceApplyAdagradV2 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceApplyAdagradV2} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAdagradV2 operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdagradV2 + */ + public static ResourceApplyAdagradV2 create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAdagradV2", scope.makeOpName("ResourceApplyAdagradV2")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new ResourceApplyAdagradV2(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + + private ResourceApplyAdagradV2(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdamWithAmsgrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdamWithAmsgrad.java new file mode 100644 index 00000000000..db354f7ae94 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdamWithAmsgrad.java @@ -0,0 +1,115 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the Adam algorithm. + *

    + * $$lr_t := \text{learning\_rate} * \sqrt{1 - beta_2^t} / (1 - beta_1^t)$$ + * $$m_t := beta_1 * m_{t-1} + (1 - beta_1) * g$$ + * $$v_t := beta_2 * v_{t-1} + (1 - beta_2) * g * g$$ + * $$vhat_t := max{vhat_{t-1}, v_t}$$ + * $$variable := variable - lr_t * m_t / (\sqrt{vhat_t} + \epsilon)$$ + */ +@Operator +public final class ResourceApplyAdamWithAmsgrad extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceApplyAdamWithAmsgrad} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAdamWithAmsgrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param vhat Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param beta2Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdamWithAmsgrad + */ + public static ResourceApplyAdamWithAmsgrad create(Scope scope, Operand var, Operand m, Operand v, Operand vhat, Operand beta1Power, Operand beta2Power, Operand lr, Operand beta1, Operand beta2, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAdamWithAmsgrad", scope.makeOpName("ResourceApplyAdamWithAmsgrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(vhat.asOutput()); + opBuilder.addInput(beta1Power.asOutput()); + opBuilder.addInput(beta2Power.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(beta1.asOutput()); + opBuilder.addInput(beta2.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyAdamWithAmsgrad(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyAdamWithAmsgrad(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyKerasMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyKerasMomentum.java new file mode 100644 index 00000000000..5e49211289b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyKerasMomentum.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the momentum scheme. Set use_nesterov = True if you + *

    + * want to use Nesterov momentum. + *

    + * accum = accum * momentum - lr * grad + * var += accum + */ +@Operator +public final class ResourceApplyKerasMomentum extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceApplyKerasMomentum} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var + momentum * accum, so in the end, the var you get is actually + * var + momentum * accum. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyKerasMomentum operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyKerasMomentum + */ + public static ResourceApplyKerasMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand momentum, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyKerasMomentum", scope.makeOpName("ResourceApplyKerasMomentum")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new ResourceApplyKerasMomentum(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var + momentum * accum, so in the end, the var you get is actually + * var + momentum * accum. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + + private ResourceApplyKerasMomentum(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceConditionalAccumulator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceConditionalAccumulator.java new file mode 100644 index 00000000000..de60fa0a487 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceConditionalAccumulator.java @@ -0,0 +1,155 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A conditional accumulator for aggregating gradients. + *

    + * The accumulator accepts gradients marked with local_step greater or + * equal to the most recent global_step known to the accumulator. The + * average can be extracted from the accumulator, provided sufficient + * gradients have been accumulated. Extracting the average automatically + * resets the aggregate to 0, and increments the global_step recorded by + * the accumulator. + * This is a resource version of ConditionalAccumulator that will work in TF2.0 + * with tf.cond version 2. + */ +public final class ResourceConditionalAccumulator extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceConditionalAccumulator} + */ + public static class Options { + + /** + * @param container If non-empty, this accumulator is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this accumulator will be shared under the + * given name across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param reductionType + */ + public Options reductionType(String reductionType) { + this.reductionType = reductionType; + return this; + } + + private String container; + private String sharedName; + private String reductionType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceConditionalAccumulator operation. + * + * @param scope current scope + * @param dtype The type of the value being accumulated. + * @param shape The shape of the values, can be [], in which case shape is unknown. + * @param options carries optional attributes values + * @return a new instance of ResourceConditionalAccumulator + */ + public static ResourceConditionalAccumulator create(Scope scope, Class dtype, Shape shape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceConditionalAccumulator", scope.makeOpName("ResourceConditionalAccumulator")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + opBuilder.setAttr("shape", shape); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.reductionType != null) { + opBuilder.setAttr("reduction_type", opts.reductionType); + } + } + } + return new ResourceConditionalAccumulator(opBuilder.build()); + } + + /** + * @param container If non-empty, this accumulator is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this accumulator will be shared under the + * given name across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param reductionType + */ + public static Options reductionType(String reductionType) { + return new Options().reductionType(reductionType); + } + + /** + * The handle to the accumulator. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ResourceConditionalAccumulator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceCountUpTo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceCountUpTo.java new file mode 100644 index 00000000000..fe7c6337e4b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceCountUpTo.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Increments variable pointed to by 'resource' until it reaches 'limit'. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ResourceCountUpTo extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ResourceCountUpTo operation. + * + * @param scope current scope + * @param resource Should be from a scalar `Variable` node. + * @param limit If incrementing ref would bring it above limit, instead generates an + * 'OutOfRange' error. + * @param T + * @return a new instance of ResourceCountUpTo + */ + public static ResourceCountUpTo create(Scope scope, Operand resource, Long limit, Class T) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceCountUpTo", scope.makeOpName("ResourceCountUpTo")); + opBuilder.addInput(resource.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("limit", limit); + opBuilder.setAttr("T", DataType.fromClass(T)); + return new ResourceCountUpTo(opBuilder.build()); + } + + /** + * A copy of the input before increment. If nothing else modifies the + * input, the values produced will all be distinct. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ResourceCountUpTo(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGather.java new file mode 100644 index 00000000000..a3a2f7a2288 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGather.java @@ -0,0 +1,140 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gather slices from the variable pointed to by `resource` according to `indices`. + *

    + * `indices` must be an integer tensor of any dimension (usually 0-D or 1-D). + * Produces an output tensor with shape `indices.shape + params.shape[1:]` where: + *

    {@code
    + *     # Scalar indices
    + *     output[:, ..., :] = params[indices, :, ... :]
    + * 
    + *     # Vector indices
    + *     output[i, :, ..., :] = params[indices[i], :, ... :]
    + * 
    + *     # Higher rank indices
    + *     output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class ResourceGather extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceGather} + */ + public static class Options { + + /** + * @param batchDims + */ + public Options batchDims(Long batchDims) { + this.batchDims = batchDims; + return this; + } + + /** + * @param validateIndices + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + + private Long batchDims; + private Boolean validateIndices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceGather operation. + * + * @param scope current scope + * @param resource + * @param indices + * @param dtype + * @param options carries optional attributes values + * @return a new instance of ResourceGather + */ + public static ResourceGather create(Scope scope, Operand resource, Operand indices, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceGather", scope.makeOpName("ResourceGather")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.batchDims != null) { + opBuilder.setAttr("batch_dims", opts.batchDims); + } + if (opts.validateIndices != null) { + opBuilder.setAttr("validate_indices", opts.validateIndices); + } + } + } + return new ResourceGather(opBuilder.build()); + } + + /** + * @param batchDims + */ + public static Options batchDims(Long batchDims) { + return new Options().batchDims(batchDims); + } + + /** + * @param validateIndices + */ + public static Options validateIndices(Boolean validateIndices) { + return new Options().validateIndices(validateIndices); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ResourceGather(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGatherNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGatherNd.java new file mode 100644 index 00000000000..8adcf5c55c5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGatherNd.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator +public final class ResourceGatherNd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ResourceGatherNd operation. + * + * @param scope current scope + * @param resource + * @param indices + * @param dtype + * @return a new instance of ResourceGatherNd + */ + public static ResourceGatherNd create(Scope scope, Operand resource, Operand indices, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceGatherNd", scope.makeOpName("ResourceGatherNd")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new ResourceGatherNd(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ResourceGatherNd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterAdd.java new file mode 100644 index 00000000000..6613f3138d3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterAdd.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds sparse updates to the variable referenced by `resource`. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] += updates[...] + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] += updates[i, ...] + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] += updates[i, ..., j, ...] + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions add. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + */ +@Operator +public final class ResourceScatterAdd extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceScatterAdd operation. + * + * @param scope current scope + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterAdd + */ + public static ResourceScatterAdd create(Scope scope, Operand resource, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterAdd", scope.makeOpName("ResourceScatterAdd")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceScatterAdd(opBuilder.build()); + } + + + private ResourceScatterAdd(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterDiv.java new file mode 100644 index 00000000000..1f70e2a874b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterDiv.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Divides sparse updates into the variable referenced by `resource`. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] /= updates[...] + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] /= updates[i, ...] + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...] + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions multiply. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + */ +@Operator +public final class ResourceScatterDiv extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceScatterDiv operation. + * + * @param scope current scope + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterDiv + */ + public static ResourceScatterDiv create(Scope scope, Operand resource, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterDiv", scope.makeOpName("ResourceScatterDiv")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceScatterDiv(opBuilder.build()); + } + + + private ResourceScatterDiv(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMax.java new file mode 100644 index 00000000000..69e9850cb37 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMax.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reduces sparse updates into the variable referenced by `resource` using the `max` operation. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] = max(ref[indices, ...], updates[...]) + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] = max(ref[indices[i], ...], updates[i, ...]) + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] = max(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions are combined. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + */ +@Operator +public final class ResourceScatterMax extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceScatterMax operation. + * + * @param scope current scope + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterMax + */ + public static ResourceScatterMax create(Scope scope, Operand resource, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterMax", scope.makeOpName("ResourceScatterMax")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceScatterMax(opBuilder.build()); + } + + + private ResourceScatterMax(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMin.java new file mode 100644 index 00000000000..c472a12b382 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMin.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reduces sparse updates into the variable referenced by `resource` using the `min` operation. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] = min(ref[indices, ...], updates[...]) + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] = min(ref[indices[i], ...], updates[i, ...]) + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] = min(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions are combined. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + */ +@Operator +public final class ResourceScatterMin extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceScatterMin operation. + * + * @param scope current scope + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterMin + */ + public static ResourceScatterMin create(Scope scope, Operand resource, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterMin", scope.makeOpName("ResourceScatterMin")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceScatterMin(opBuilder.build()); + } + + + private ResourceScatterMin(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMul.java new file mode 100644 index 00000000000..46d7fd5bfe1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMul.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Multiplies sparse updates into the variable referenced by `resource`. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] *= updates[...] + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] *= updates[i, ...] + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...] + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions multiply. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + */ +@Operator +public final class ResourceScatterMul extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceScatterMul operation. + * + * @param scope current scope + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterMul + */ + public static ResourceScatterMul create(Scope scope, Operand resource, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterMul", scope.makeOpName("ResourceScatterMul")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceScatterMul(opBuilder.build()); + } + + + private ResourceScatterMul(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdAdd.java new file mode 100644 index 00000000000..ec2462b03ad --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdAdd.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse addition to individual values or slices in a Variable. + *

    + * `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. + *

    + * `indices` must be integer tensor, containing indices into `ref`. + * It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. + *

    + * The innermost dimension of `indices` (with length `K`) corresponds to + * indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th + * dimension of `ref`. + *

    + * `updates` is `Tensor` of rank `Q-1+P-K` with shape: + *

    {@code
    + * [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]
    + * }
    + * For example, say we want to add 4 scattered elements to a rank-1 tensor to + * 8 elements. In Python, that addition would look like this: + *
    {@code
    + * ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8], use_resource=True)
    + * indices = tf.constant([[4], [3], [1], [7]])
    + * updates = tf.constant([9, 10, 11, 12])
    + * add = tf.scatter_nd_add(ref, indices, updates)
    + * with tf.Session() as sess:
    + *   print sess.run(add)
    + * }
    + * The resulting update to ref would look like this: + *

    + * [1, 13, 3, 14, 14, 6, 7, 20] + *

    + * See `tf.scatter_nd` for more details about how to make updates to + * slices. + */ +@Operator +public final class ResourceScatterNdAdd extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdAdd} + */ + public static class Options { + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceScatterNdAdd operation. + * + * @param scope current scope + * @param ref A resource handle. Must be from a VarHandleOp. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + * @param updates A Tensor. Must have the same type as ref. A tensor of + * values to add to ref. + * @param options carries optional attributes values + * @return a new instance of ResourceScatterNdAdd + */ + public static ResourceScatterNdAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdAdd", scope.makeOpName("ResourceScatterNdAdd")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceScatterNdAdd(opBuilder.build()); + } + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceScatterNdAdd(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdSub.java new file mode 100644 index 00000000000..2c0ba2ac5b5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdSub.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse subtraction to individual values or slices in a Variable. + *

    + * `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. + *

    + * `indices` must be integer tensor, containing indices into `ref`. + * It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. + *

    + * The innermost dimension of `indices` (with length `K`) corresponds to + * indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th + * dimension of `ref`. + *

    + * `updates` is `Tensor` of rank `Q-1+P-K` with shape: + *

    {@code
    + * [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]
    + * }
    + * For example, say we want to subtract 4 scattered elements from a rank-1 tensor + * with 8 elements. In Python, that subtraction would look like this: + *
    {@code
    + * ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8], use_resource=True)
    + * indices = tf.constant([[4], [3], [1], [7]])
    + * updates = tf.constant([9, 10, 11, 12])
    + * sub = tf.scatter_nd_sub(ref, indices, updates)
    + * with tf.Session() as sess:
    + *   print sess.run(sub)
    + * }
    + * The resulting update to ref would look like this: + *

    + * [1, -9, 3, -6, -4, 6, 7, -4] + *

    + * See `tf.scatter_nd` for more details about how to make updates to + * slices. + */ +@Operator +public final class ResourceScatterNdSub extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdSub} + */ + public static class Options { + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceScatterNdSub operation. + * + * @param scope current scope + * @param ref A resource handle. Must be from a VarHandleOp. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + * @param updates A Tensor. Must have the same type as ref. A tensor of + * values to add to ref. + * @param options carries optional attributes values + * @return a new instance of ResourceScatterNdSub + */ + public static ResourceScatterNdSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdSub", scope.makeOpName("ResourceScatterNdSub")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceScatterNdSub(opBuilder.build()); + } + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceScatterNdSub(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdUpdate.java new file mode 100644 index 00000000000..167fa47d22d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdUpdate.java @@ -0,0 +1,127 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse `updates` to individual values or slices within a given + *

    + * variable according to `indices`. + *

    + * `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. + *

    + * `indices` must be integer tensor, containing indices into `ref`. + * It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. + *

    + * The innermost dimension of `indices` (with length `K`) corresponds to + * indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th + * dimension of `ref`. + *

    + * `updates` is `Tensor` of rank `Q-1+P-K` with shape: + *

    {@code
    + * [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]].
    + * }
    + * For example, say we want to update 4 scattered elements to a rank-1 tensor to + * 8 elements. In Python, that update would look like this: + *
    {@code
    + *     ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8])
    + *     indices = tf.constant([[4], [3], [1] ,[7]])
    + *     updates = tf.constant([9, 10, 11, 12])
    + *     update = tf.scatter_nd_update(ref, indices, updates)
    + *     with tf.Session() as sess:
    + *       print sess.run(update)
    + * }
    + * The resulting update to ref would look like this: + *

    + * [1, 11, 3, 10, 9, 6, 7, 12] + *

    + * See `tf.scatter_nd` for more details about how to make updates to + * slices. + */ +@Operator +public final class ResourceScatterNdUpdate extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdUpdate} + */ + public static class Options { + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceScatterNdUpdate operation. + * + * @param scope current scope + * @param ref A resource handle. Must be from a VarHandleOp. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated + * values to add to ref. + * @param options carries optional attributes values + * @return a new instance of ResourceScatterNdUpdate + */ + public static ResourceScatterNdUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdUpdate", scope.makeOpName("ResourceScatterNdUpdate")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceScatterNdUpdate(opBuilder.build()); + } + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceScatterNdUpdate(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterSub.java new file mode 100644 index 00000000000..ec8ab22718a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterSub.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Subtracts sparse updates from the variable referenced by `resource`. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] -= updates[...] + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] -= updates[i, ...] + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...] + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions add. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + */ +@Operator +public final class ResourceScatterSub extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceScatterSub operation. + * + * @param scope current scope + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterSub + */ + public static ResourceScatterSub create(Scope scope, Operand resource, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterSub", scope.makeOpName("ResourceScatterSub")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceScatterSub(opBuilder.build()); + } + + + private ResourceScatterSub(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterUpdate.java new file mode 100644 index 00000000000..e97d9551725 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterUpdate.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Assigns sparse updates to the variable referenced by `resource`. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] = updates[...] + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] = updates[i, ...] + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] = updates[i, ..., j, ...] + */ +@Operator +public final class ResourceScatterUpdate extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ResourceScatterUpdate operation. + * + * @param scope current scope + * @param resource Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @return a new instance of ResourceScatterUpdate + */ + public static ResourceScatterUpdate create(Scope scope, Operand resource, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterUpdate", scope.makeOpName("ResourceScatterUpdate")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ResourceScatterUpdate(opBuilder.build()); + } + + + private ResourceScatterUpdate(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyAdagradV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyAdagradV2.java new file mode 100644 index 00000000000..b794f208966 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyAdagradV2.java @@ -0,0 +1,120 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Update relevant entries in '*var' and '*accum' according to the adagrad scheme. + *

    + * That is for rows we have grad for, we update var and accum as follows: + * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) + */ +public final class ResourceSparseApplyAdagradV2 extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceSparseApplyAdagradV2} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyAdagradV2 operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyAdagradV2 + */ + public static ResourceSparseApplyAdagradV2 create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdagradV2", scope.makeOpName("ResourceSparseApplyAdagradV2")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new ResourceSparseApplyAdagradV2(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + + private ResourceSparseApplyAdagradV2(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyKerasMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyKerasMomentum.java new file mode 100644 index 00000000000..6c70febbb1f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyKerasMomentum.java @@ -0,0 +1,129 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update relevant entries in '*var' and '*accum' according to the momentum scheme. + *

    + * Set use_nesterov = True if you want to use Nesterov momentum. + *

    + * That is for rows we have grad for, we update var and accum as follows: + *

    + * accum = accum * momentum - lr * grad + * var += accum + */ +@Operator +public final class ResourceSparseApplyKerasMomentum extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceSparseApplyKerasMomentum} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var + momentum * accum, so in the end, the var you get is actually + * var + momentum * accum. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyKerasMomentum operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyKerasMomentum + */ + public static ResourceSparseApplyKerasMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyKerasMomentum", scope.makeOpName("ResourceSparseApplyKerasMomentum")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new ResourceSparseApplyKerasMomentum(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var + momentum * accum, so in the end, the var you get is actually + * var + momentum * accum. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + + private ResourceSparseApplyKerasMomentum(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceStridedSliceAssign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceStridedSliceAssign.java new file mode 100644 index 00000000000..020b03db452 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceStridedSliceAssign.java @@ -0,0 +1,176 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Assign `value` to the sliced l-value reference of `ref`. + *

    + * The values of `value` are assigned to the positions in the variable + * `ref` that are selected by the slice parameters. The slice parameters + * `begin, `end`, `strides`, etc. work exactly as in `StridedSlice`. + *

    + * NOTE this op currently does not support broadcasting and so `value`'s + * shape must be exactly the shape produced by the slice of `ref`. + */ +@Operator +public final class ResourceStridedSliceAssign extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceStridedSliceAssign} + */ + public static class Options { + + /** + * @param beginMask + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * @param endMask + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * @param ellipsisMask + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * @param newAxisMask + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * @param shrinkAxisMask + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + + private Long beginMask; + private Long endMask; + private Long ellipsisMask; + private Long newAxisMask; + private Long shrinkAxisMask; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceStridedSliceAssign operation. + * + * @param scope current scope + * @param ref + * @param begin + * @param end + * @param strides + * @param value + * @param options carries optional attributes values + * @return a new instance of ResourceStridedSliceAssign + */ + public static ResourceStridedSliceAssign create(Scope scope, Operand ref, Operand begin, Operand end, Operand strides, Operand value, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceStridedSliceAssign", scope.makeOpName("ResourceStridedSliceAssign")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(begin.asOutput()); + opBuilder.addInput(end.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.beginMask != null) { + opBuilder.setAttr("begin_mask", opts.beginMask); + } + if (opts.endMask != null) { + opBuilder.setAttr("end_mask", opts.endMask); + } + if (opts.ellipsisMask != null) { + opBuilder.setAttr("ellipsis_mask", opts.ellipsisMask); + } + if (opts.newAxisMask != null) { + opBuilder.setAttr("new_axis_mask", opts.newAxisMask); + } + if (opts.shrinkAxisMask != null) { + opBuilder.setAttr("shrink_axis_mask", opts.shrinkAxisMask); + } + } + } + return new ResourceStridedSliceAssign(opBuilder.build()); + } + + /** + * @param beginMask + */ + public static Options beginMask(Long beginMask) { + return new Options().beginMask(beginMask); + } + + /** + * @param endMask + */ + public static Options endMask(Long endMask) { + return new Options().endMask(endMask); + } + + /** + * @param ellipsisMask + */ + public static Options ellipsisMask(Long ellipsisMask) { + return new Options().ellipsisMask(ellipsisMask); + } + + /** + * @param newAxisMask + */ + public static Options newAxisMask(Long newAxisMask) { + return new Options().newAxisMask(newAxisMask); + } + + /** + * @param shrinkAxisMask + */ + public static Options shrinkAxisMask(Long shrinkAxisMask) { + return new Options().shrinkAxisMask(shrinkAxisMask); + } + + + private ResourceStridedSliceAssign(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParameters.java new file mode 100644 index 00000000000..1a60282c2c1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParameters.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve ADAM embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingADAMParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingADAMParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingADAMParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingADAMParameters + */ + public static RetrieveTPUEmbeddingADAMParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingADAMParameters", scope.makeOpName("RetrieveTPUEmbeddingADAMParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingADAMParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the ADAM optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter momenta updated by the ADAM optimization algorithm. + */ + public Output momenta() { + return momenta; + } + + /** + * Parameter velocities updated by the ADAM optimization algorithm. + */ + public Output velocities() { + return velocities; + } + + private Output parameters; + private Output momenta; + private Output velocities; + + private RetrieveTPUEmbeddingADAMParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + momenta = operation.output(outputIdx++); + velocities = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParametersGradAccumDebug.java new file mode 100644 index 00000000000..f88660ce979 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParametersGradAccumDebug.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve ADAM embedding parameters with debug support. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingADAMParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingADAMParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingADAMParametersGradAccumDebug operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingADAMParametersGradAccumDebug + */ + public static RetrieveTPUEmbeddingADAMParametersGradAccumDebug create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingADAMParametersGradAccumDebug", scope.makeOpName("RetrieveTPUEmbeddingADAMParametersGradAccumDebug")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingADAMParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the ADAM optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter momenta updated by the ADAM optimization algorithm. + */ + public Output momenta() { + return momenta; + } + + /** + * Parameter velocities updated by the ADAM optimization algorithm. + */ + public Output velocities() { + return velocities; + } + + /** + * Parameter gradient_accumulators updated by the ADAM optimization algorithm. + */ + public Output gradientAccumulators() { + return gradientAccumulators; + } + + private Output parameters; + private Output momenta; + private Output velocities; + private Output gradientAccumulators; + + private RetrieveTPUEmbeddingADAMParametersGradAccumDebug(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + momenta = operation.output(outputIdx++); + velocities = operation.output(outputIdx++); + gradientAccumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParameters.java new file mode 100644 index 00000000000..9a8eabbf2d8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParameters.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve Adadelta embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingAdadeltaParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingAdadeltaParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingAdadeltaParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingAdadeltaParameters + */ + public static RetrieveTPUEmbeddingAdadeltaParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingAdadeltaParameters", scope.makeOpName("RetrieveTPUEmbeddingAdadeltaParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingAdadeltaParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the Adadelta optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the Adadelta optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + /** + * Parameter updates updated by the Adadelta optimization algorithm. + */ + public Output updates() { + return updates; + } + + private Output parameters; + private Output accumulators; + private Output updates; + + private RetrieveTPUEmbeddingAdadeltaParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + updates = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug.java new file mode 100644 index 00000000000..ab5776d7159 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve Adadelta embedding parameters with debug support. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug + */ + public static RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug", scope.makeOpName("RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the Adadelta optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the Adadelta optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + /** + * Parameter updates updated by the Adadelta optimization algorithm. + */ + public Output updates() { + return updates; + } + + /** + * Parameter gradient_accumulators updated by the Adadelta optimization algorithm. + */ + public Output gradientAccumulators() { + return gradientAccumulators; + } + + private Output parameters; + private Output accumulators; + private Output updates; + private Output gradientAccumulators; + + private RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + updates = operation.output(outputIdx++); + gradientAccumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParameters.java new file mode 100644 index 00000000000..8e2e3bb6ab6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParameters.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve Adagrad embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingAdagradParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingAdagradParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingAdagradParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingAdagradParameters + */ + public static RetrieveTPUEmbeddingAdagradParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingAdagradParameters", scope.makeOpName("RetrieveTPUEmbeddingAdagradParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingAdagradParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the Adagrad optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the Adagrad optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + private Output parameters; + private Output accumulators; + + private RetrieveTPUEmbeddingAdagradParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParametersGradAccumDebug.java new file mode 100644 index 00000000000..16f10db96fe --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParametersGradAccumDebug.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve Adagrad embedding parameters with debug support. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingAdagradParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingAdagradParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingAdagradParametersGradAccumDebug operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingAdagradParametersGradAccumDebug + */ + public static RetrieveTPUEmbeddingAdagradParametersGradAccumDebug create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingAdagradParametersGradAccumDebug", scope.makeOpName("RetrieveTPUEmbeddingAdagradParametersGradAccumDebug")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingAdagradParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the Adagrad optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the Adagrad optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + /** + * Parameter gradient_accumulators updated by the Adagrad optimization algorithm. + */ + public Output gradientAccumulators() { + return gradientAccumulators; + } + + private Output parameters; + private Output accumulators; + private Output gradientAccumulators; + + private RetrieveTPUEmbeddingAdagradParametersGradAccumDebug(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + gradientAccumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingCenteredRMSPropParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingCenteredRMSPropParameters.java new file mode 100644 index 00000000000..079c968978d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingCenteredRMSPropParameters.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve centered RMSProp embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingCenteredRMSPropParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingCenteredRMSPropParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingCenteredRMSPropParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingCenteredRMSPropParameters + */ + public static RetrieveTPUEmbeddingCenteredRMSPropParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingCenteredRMSPropParameters", scope.makeOpName("RetrieveTPUEmbeddingCenteredRMSPropParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingCenteredRMSPropParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the centered RMSProp optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter ms updated by the centered RMSProp optimization algorithm. + */ + public Output ms() { + return ms; + } + + /** + * Parameter mom updated by the centered RMSProp optimization algorithm. + */ + public Output mom() { + return mom; + } + + /** + * Parameter mg updated by the centered RMSProp optimization algorithm. + */ + public Output mg() { + return mg; + } + + private Output parameters; + private Output ms; + private Output mom; + private Output mg; + + private RetrieveTPUEmbeddingCenteredRMSPropParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + ms = operation.output(outputIdx++); + mom = operation.output(outputIdx++); + mg = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParameters.java new file mode 100644 index 00000000000..0de5292c378 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParameters.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve FTRL embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingFTRLParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingFTRLParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingFTRLParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingFTRLParameters + */ + public static RetrieveTPUEmbeddingFTRLParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingFTRLParameters", scope.makeOpName("RetrieveTPUEmbeddingFTRLParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingFTRLParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the FTRL optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the FTRL optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + /** + * Parameter linears updated by the FTRL optimization algorithm. + */ + public Output linears() { + return linears; + } + + private Output parameters; + private Output accumulators; + private Output linears; + + private RetrieveTPUEmbeddingFTRLParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + linears = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParametersGradAccumDebug.java new file mode 100644 index 00000000000..32c61428018 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParametersGradAccumDebug.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve FTRL embedding parameters with debug support. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingFTRLParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingFTRLParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingFTRLParametersGradAccumDebug operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingFTRLParametersGradAccumDebug + */ + public static RetrieveTPUEmbeddingFTRLParametersGradAccumDebug create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingFTRLParametersGradAccumDebug", scope.makeOpName("RetrieveTPUEmbeddingFTRLParametersGradAccumDebug")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingFTRLParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the FTRL optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the FTRL optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + /** + * Parameter linears updated by the FTRL optimization algorithm. + */ + public Output linears() { + return linears; + } + + /** + * Parameter gradient_accumulators updated by the FTRL optimization algorithm. + */ + public Output gradientAccumulators() { + return gradientAccumulators; + } + + private Output parameters; + private Output accumulators; + private Output linears; + private Output gradientAccumulators; + + private RetrieveTPUEmbeddingFTRLParametersGradAccumDebug(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + linears = operation.output(outputIdx++); + gradientAccumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMDLAdagradLightParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMDLAdagradLightParameters.java new file mode 100644 index 00000000000..5436bcfcedf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMDLAdagradLightParameters.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve MDL Adagrad Light embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingMDLAdagradLightParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingMDLAdagradLightParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingMDLAdagradLightParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingMDLAdagradLightParameters + */ + public static RetrieveTPUEmbeddingMDLAdagradLightParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingMDLAdagradLightParameters", scope.makeOpName("RetrieveTPUEmbeddingMDLAdagradLightParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingMDLAdagradLightParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the MDL Adagrad Light optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the MDL Adagrad Light optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + /** + * Parameter weights updated by the MDL Adagrad Light optimization algorithm. + */ + public Output weights() { + return weights; + } + + /** + * Parameter benefits updated by the MDL Adagrad Light optimization algorithm. + */ + public Output benefits() { + return benefits; + } + + private Output parameters; + private Output accumulators; + private Output weights; + private Output benefits; + + private RetrieveTPUEmbeddingMDLAdagradLightParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + weights = operation.output(outputIdx++); + benefits = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParameters.java new file mode 100644 index 00000000000..d086985a7a1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParameters.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve Momentum embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingMomentumParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingMomentumParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingMomentumParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingMomentumParameters + */ + public static RetrieveTPUEmbeddingMomentumParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingMomentumParameters", scope.makeOpName("RetrieveTPUEmbeddingMomentumParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingMomentumParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the Momentum optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter momenta updated by the Momentum optimization algorithm. + */ + public Output momenta() { + return momenta; + } + + private Output parameters; + private Output momenta; + + private RetrieveTPUEmbeddingMomentumParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + momenta = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParametersGradAccumDebug.java new file mode 100644 index 00000000000..ed7cde14464 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParametersGradAccumDebug.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve Momentum embedding parameters with debug support. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingMomentumParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingMomentumParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingMomentumParametersGradAccumDebug operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingMomentumParametersGradAccumDebug + */ + public static RetrieveTPUEmbeddingMomentumParametersGradAccumDebug create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingMomentumParametersGradAccumDebug", scope.makeOpName("RetrieveTPUEmbeddingMomentumParametersGradAccumDebug")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingMomentumParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the Momentum optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter momenta updated by the Momentum optimization algorithm. + */ + public Output momenta() { + return momenta; + } + + /** + * Parameter gradient_accumulators updated by the Momentum optimization algorithm. + */ + public Output gradientAccumulators() { + return gradientAccumulators; + } + + private Output parameters; + private Output momenta; + private Output gradientAccumulators; + + private RetrieveTPUEmbeddingMomentumParametersGradAccumDebug(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + momenta = operation.output(outputIdx++); + gradientAccumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParameters.java new file mode 100644 index 00000000000..16332f64e84 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParameters.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve proximal Adagrad embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingProximalAdagradParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingProximalAdagradParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingProximalAdagradParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingProximalAdagradParameters + */ + public static RetrieveTPUEmbeddingProximalAdagradParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingProximalAdagradParameters", scope.makeOpName("RetrieveTPUEmbeddingProximalAdagradParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingProximalAdagradParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the proximal Adagrad optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the proximal Adagrad optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + private Output parameters; + private Output accumulators; + + private RetrieveTPUEmbeddingProximalAdagradParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug.java new file mode 100644 index 00000000000..e02ecc04d40 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve proximal Adagrad embedding parameters with debug support. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug + */ + public static RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug", scope.makeOpName("RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the proximal Adagrad optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter accumulators updated by the proximal Adagrad optimization algorithm. + */ + public Output accumulators() { + return accumulators; + } + + /** + * Parameter gradient_accumulators updated by the proximal Adagrad optimization algorithm. + */ + public Output gradientAccumulators() { + return gradientAccumulators; + } + + private Output parameters; + private Output accumulators; + private Output gradientAccumulators; + + private RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + accumulators = operation.output(outputIdx++); + gradientAccumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParameters.java new file mode 100644 index 00000000000..ae84f309a9c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParameters.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve RMSProp embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingRMSPropParameters extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingRMSPropParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingRMSPropParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingRMSPropParameters + */ + public static RetrieveTPUEmbeddingRMSPropParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingRMSPropParameters", scope.makeOpName("RetrieveTPUEmbeddingRMSPropParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingRMSPropParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the RMSProp optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter ms updated by the RMSProp optimization algorithm. + */ + public Output ms() { + return ms; + } + + /** + * Parameter mom updated by the RMSProp optimization algorithm. + */ + public Output mom() { + return mom; + } + + private Output parameters; + private Output ms; + private Output mom; + + private RetrieveTPUEmbeddingRMSPropParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + ms = operation.output(outputIdx++); + mom = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug.java new file mode 100644 index 00000000000..606e5724937 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve RMSProp embedding parameters with debug support. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug + */ + public static RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug", scope.makeOpName("RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the RMSProp optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + /** + * Parameter ms updated by the RMSProp optimization algorithm. + */ + public Output ms() { + return ms; + } + + /** + * Parameter mom updated by the RMSProp optimization algorithm. + */ + public Output mom() { + return mom; + } + + /** + * Parameter gradient_accumulators updated by the RMSProp optimization algorithm. + */ + public Output gradientAccumulators() { + return gradientAccumulators; + } + + private Output parameters; + private Output ms; + private Output mom; + private Output gradientAccumulators; + + private RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + ms = operation.output(outputIdx++); + mom = operation.output(outputIdx++); + gradientAccumulators = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingStochasticGradientDescentParameters.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingStochasticGradientDescentParameters.java new file mode 100644 index 00000000000..6d6fdb253eb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingStochasticGradientDescentParameters.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Retrieve SGD embedding parameters. + *

    + * An op that retrieves optimization parameters from embedding to host + * memory. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up + * the correct embedding table configuration. For example, this op is + * used to retrieve updated parameters before saving a checkpoint. + */ +public final class RetrieveTPUEmbeddingStochasticGradientDescentParameters extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.RetrieveTPUEmbeddingStochasticGradientDescentParameters} + */ + public static class Options { + + /** + * @param tableId + */ + public Options tableId(Long tableId) { + this.tableId = tableId; + return this; + } + + /** + * @param tableName + */ + public Options tableName(String tableName) { + this.tableName = tableName; + return this; + } + + private Long tableId; + private String tableName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RetrieveTPUEmbeddingStochasticGradientDescentParameters operation. + * + * @param scope current scope + * @param numShards + * @param shardId + * @param options carries optional attributes values + * @return a new instance of RetrieveTPUEmbeddingStochasticGradientDescentParameters + */ + public static RetrieveTPUEmbeddingStochasticGradientDescentParameters create(Scope scope, Long numShards, Long shardId, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RetrieveTPUEmbeddingStochasticGradientDescentParameters", scope.makeOpName("RetrieveTPUEmbeddingStochasticGradientDescentParameters")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_shards", numShards); + opBuilder.setAttr("shard_id", shardId); + if (options != null) { + for (Options opts : options) { + if (opts.tableId != null) { + opBuilder.setAttr("table_id", opts.tableId); + } + if (opts.tableName != null) { + opBuilder.setAttr("table_name", opts.tableName); + } + } + } + return new RetrieveTPUEmbeddingStochasticGradientDescentParameters(opBuilder.build()); + } + + /** + * @param tableId + */ + public static Options tableId(Long tableId) { + return new Options().tableId(tableId); + } + + /** + * @param tableName + */ + public static Options tableName(String tableName) { + return new Options().tableName(tableName); + } + + /** + * Parameter parameters updated by the stochastic gradient descent optimization algorithm. + */ + public Output parameters() { + return parameters; + } + + @Override + public Output asOutput() { + return parameters; + } + + private Output parameters; + + private RetrieveTPUEmbeddingStochasticGradientDescentParameters(Operation operation) { + super(operation); + int outputIdx = 0; + parameters = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reverse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reverse.java new file mode 100644 index 00000000000..750ba20f0b6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reverse.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reverses specific dimensions of a tensor. + *

    + * NOTE `tf.reverse` has now changed behavior in preparation for 1.0. + * `tf.reverse_v2` is currently an alias that will be deprecated before TF 1.0. + *

    + * Given a `tensor`, and a `int32` tensor `axis` representing the set of + * dimensions of `tensor` to reverse. This operation reverses each dimension + * `i` for which there exists `j` s.t. `axis[j] == i`. + *

    + * `tensor` can have up to 8 dimensions. The number of dimensions specified + * in `axis` may be 0 or more entries. If an index is specified more than + * once, a InvalidArgument error is raised. + *

    + * For example: + *

    {@code
    + * # tensor 't' is [[[[ 0,  1,  2,  3],
    + * #                  [ 4,  5,  6,  7],
    + * #                  [ 8,  9, 10, 11]],
    + * #                 [[12, 13, 14, 15],
    + * #                  [16, 17, 18, 19],
    + * #                  [20, 21, 22, 23]]]]
    + * # tensor 't' shape is [1, 2, 3, 4]
    + * 
    + * # 'dims' is [3] or 'dims' is [-1]
    + * reverse(t, dims) ==> [[[[ 3,  2,  1,  0],
    + *                         [ 7,  6,  5,  4],
    + *                         [ 11, 10, 9, 8]],
    + *                        [[15, 14, 13, 12],
    + *                         [19, 18, 17, 16],
    + *                         [23, 22, 21, 20]]]]
    + * 
    + * # 'dims' is '[1]' (or 'dims' is '[-3]')
    + * reverse(t, dims) ==> [[[[12, 13, 14, 15],
    + *                         [16, 17, 18, 19],
    + *                         [20, 21, 22, 23]
    + *                        [[ 0,  1,  2,  3],
    + *                         [ 4,  5,  6,  7],
    + *                         [ 8,  9, 10, 11]]]]
    + * 
    + * # 'dims' is '[2]' (or 'dims' is '[-2]')
    + * reverse(t, dims) ==> [[[[8, 9, 10, 11],
    + *                         [4, 5, 6, 7],
    + *                         [0, 1, 2, 3]]
    + *                        [[20, 21, 22, 23],
    + *                         [16, 17, 18, 19],
    + *                         [12, 13, 14, 15]]]]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Reverse extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Reverse operation. + * + * @param scope current scope + * @param tensor Up to 8-D. + * @param axis 1-D. The indices of the dimensions to reverse. Must be in the range + * `[-rank(tensor), rank(tensor))`. + * @return a new instance of Reverse + */ + public static Reverse create(Scope scope, Operand tensor, Operand axis) { + OperationBuilder opBuilder = scope.env().opBuilder("ReverseV2", scope.makeOpName("Reverse")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Reverse(opBuilder.build()); + } + + /** + * The same shape as `tensor`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Reverse(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReverseSequence.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReverseSequence.java new file mode 100644 index 00000000000..27e60dd41fe --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReverseSequence.java @@ -0,0 +1,161 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reverses variable length slices. + *

    + * This op first slices `input` along the dimension `batch_dim`, and for each + * slice `i`, reverses the first `seq_lengths[i]` elements along + * the dimension `seq_dim`. + *

    + * The elements of `seq_lengths` must obey `seq_lengths[i] <= input.dims[seq_dim]`, + * and `seq_lengths` must be a vector of length `input.dims[batch_dim]`. + *

    + * The output slice `i` along dimension `batch_dim` is then given by input + * slice `i`, with the first `seq_lengths[i]` slices along dimension + * `seq_dim` reversed. + *

    + * For example: + *

    {@code
    + * # Given this:
    + * batch_dim = 0
    + * seq_dim = 1
    + * input.dims = (4, 8, ...)
    + * seq_lengths = [7, 2, 3, 5]
    + * 
    + * # then slices of input are reversed on seq_dim, but only up to seq_lengths:
    + * output[0, 0:7, :, ...] = input[0, 7:0:-1, :, ...]
    + * output[1, 0:2, :, ...] = input[1, 2:0:-1, :, ...]
    + * output[2, 0:3, :, ...] = input[2, 3:0:-1, :, ...]
    + * output[3, 0:5, :, ...] = input[3, 5:0:-1, :, ...]
    + * 
    + * # while entries past seq_lens are copied through:
    + * output[0, 7:, :, ...] = input[0, 7:, :, ...]
    + * output[1, 2:, :, ...] = input[1, 2:, :, ...]
    + * output[2, 3:, :, ...] = input[2, 3:, :, ...]
    + * output[3, 2:, :, ...] = input[3, 2:, :, ...]
    + * }
    + * In contrast, if: + *
    {@code
    + * # Given this:
    + * batch_dim = 2
    + * seq_dim = 0
    + * input.dims = (8, ?, 4, ...)
    + * seq_lengths = [7, 2, 3, 5]
    + * 
    + * # then slices of input are reversed on seq_dim, but only up to seq_lengths:
    + * output[0:7, :, 0, :, ...] = input[7:0:-1, :, 0, :, ...]
    + * output[0:2, :, 1, :, ...] = input[2:0:-1, :, 1, :, ...]
    + * output[0:3, :, 2, :, ...] = input[3:0:-1, :, 2, :, ...]
    + * output[0:5, :, 3, :, ...] = input[5:0:-1, :, 3, :, ...]
    + * 
    + * # while entries past seq_lens are copied through:
    + * output[7:, :, 0, :, ...] = input[7:, :, 0, :, ...]
    + * output[2:, :, 1, :, ...] = input[2:, :, 1, :, ...]
    + * output[3:, :, 2, :, ...] = input[3:, :, 2, :, ...]
    + * output[2:, :, 3, :, ...] = input[2:, :, 3, :, ...]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class ReverseSequence extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReverseSequence} + */ + public static class Options { + + /** + * @param batchDim The dimension along which reversal is performed. + */ + public Options batchDim(Long batchDim) { + this.batchDim = batchDim; + return this; + } + + private Long batchDim; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReverseSequence operation. + * + * @param scope current scope + * @param input The input to reverse. + * @param seqLengths 1-D with length `input.dims(batch_dim)` and + * `max(seq_lengths) <= input.dims(seq_dim)` + * @param seqDim The dimension which is partially reversed. + * @param options carries optional attributes values + * @return a new instance of ReverseSequence + */ + public static ReverseSequence create(Scope scope, Operand input, Operand seqLengths, Long seqDim, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ReverseSequence", scope.makeOpName("ReverseSequence")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(seqLengths.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("seq_dim", seqDim); + if (options != null) { + for (Options opts : options) { + if (opts.batchDim != null) { + opBuilder.setAttr("batch_dim", opts.batchDim); + } + } + } + return new ReverseSequence(opBuilder.build()); + } + + /** + * @param batchDim The dimension along which reversal is performed. + */ + public static Options batchDim(Long batchDim) { + return new Options().batchDim(batchDim); + } + + /** + * The partially reversed input. It has the same shape as `input`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReverseSequence(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RngSkip.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RngSkip.java new file mode 100644 index 00000000000..048deecbc7e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RngSkip.java @@ -0,0 +1,58 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Advance the counter of a counter-based RNG. + *

    + * The state of the RNG after + * `rng_skip(n)` will be the same as that after `stateful_uniform([n])` + * (or any other distribution). The actual increment added to the + * counter is an unspecified implementation detail. + */ +public final class RngSkip extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RngSkip operation. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param delta The amount of advancement. + * @return a new instance of RngSkip + */ + public static RngSkip create(Scope scope, Operand resource, Operand algorithm, Operand delta) { + OperationBuilder opBuilder = scope.env().opBuilder("RngSkip", scope.makeOpName("RngSkip")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(algorithm.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RngSkip(opBuilder.build()); + } + + + private RngSkip(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Roll.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Roll.java new file mode 100644 index 00000000000..25b0c1582ca --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Roll.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Rolls the elements of a tensor along an axis. + *

    + * The elements are shifted positively (towards larger indices) by the offset of + * `shift` along the dimension of `axis`. Negative `shift` values will shift + * elements in the opposite direction. Elements that roll passed the last position + * will wrap around to the first and vice versa. Multiple shifts along multiple + * axes may be specified. + *

    + * For example: + *

    {@code
    + * # 't' is [0, 1, 2, 3, 4]
    + * roll(t, shift=2, axis=0) ==> [3, 4, 0, 1, 2]
    + * 
    + * # shifting along multiple dimensions
    + * # 't' is [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
    + * roll(t, shift=[1, -2], axis=[0, 1]) ==> [[7, 8, 9, 5, 6], [2, 3, 4, 0, 1]]
    + * 
    + * # shifting along the same axis multiple times
    + * # 't' is [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
    + * roll(t, shift=[2, -3], axis=[1, 1]) ==> [[1, 2, 3, 4, 0], [6, 7, 8, 9, 5]]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Roll extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Roll operation. + * + * @param scope current scope + * @param input + * @param shift Dimension must be 0-D or 1-D. `shift[i]` specifies the number of places by which + * elements are shifted positively (towards larger indices) along the dimension + * specified by `axis[i]`. Negative shifts will roll the elements in the opposite + * direction. + * @param axis Dimension must be 0-D or 1-D. `axis[i]` specifies the dimension that the shift + * `shift[i]` should occur. If the same axis is referenced more than once, the + * total shift for that axis will be the sum of all the shifts that belong to that + * axis. + * @return a new instance of Roll + */ + public static Roll create(Scope scope, Operand input, Operand shift, Operand axis) { + OperationBuilder opBuilder = scope.env().opBuilder("Roll", scope.makeOpName("Roll")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(shift.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Roll(opBuilder.build()); + } + + /** + * Has the same shape and size as the input. The elements are shifted + * positively (towards larger indices) by the offsets of `shift` along the + * dimensions of `axis`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Roll(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rpc.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rpc.java new file mode 100644 index 00000000000..1d5552c4728 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rpc.java @@ -0,0 +1,203 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Perform batches of RPC requests. + *

    + * This op asynchronously performs either a single RPC request, or a batch + * of requests. RPC requests are defined by three main parameters: + *

    + * - `address` (the host+port or BNS address of the request) + * - `method` (the RPC method name for the request) + * - `request` (the serialized proto string, or vector of strings, + * of the RPC request argument). + *

    + * For example, if you have an RPC service running on port localhost:2345, + * and its interface is configured with the following proto declaration: + *

    {@code
    + * service MyService {
    + *   rpc MyMethod(MyRequestProto) returns (MyResponseProto) {
    + *   }
    + * };
    + * }
    + * then call this op with arguments: + *
    {@code
    + * address = "localhost:2345"
    + * method = "MyService/MyMethod"
    + * }
    + * The `request` tensor is a string tensor representing serialized `MyRequestProto` + * strings; and the output string tensor `response` will have the same shape + * and contain (upon successful completion) corresponding serialized + * `MyResponseProto` strings. + *

    + * For example, to send a single, empty, `MyRequestProto`, call + * this op with `request = ""`. To send 5 parallel empty requests, + * call this op with `request = ["", "", "", "", ""]`. + *

    + * More generally, one can create a batch of `MyRequestProto` serialized protos + * from regular batched tensors using the `encode_proto` op, and convert + * the response `MyResponseProto` serialized protos to batched tensors + * using the `decode_proto` op. + *

    + * NOTE Working with serialized proto strings is faster than instantiating + * actual proto objects in memory, so no performance degradation is expected + * compared to writing custom kernels for this workflow. + *

    + * If the connection fails or the remote worker returns an error + * status, the op reraises this exception locally. + *

    + * See the `TryRpc` op if you prefer to handle RPC failures manually in the graph. + */ +@Operator +public final class Rpc extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Rpc} + */ + public static class Options { + + /** + * @param protocol RPC protocol to use. Empty string means use the default protocol. + * Options include 'grpc'. + */ + public Options protocol(String protocol) { + this.protocol = protocol; + return this; + } + + /** + * @param failFast `boolean`. If `true` (default), then failures to connect + * (i.e., the server does not immediately respond) cause an RPC failure. + */ + public Options failFast(Boolean failFast) { + this.failFast = failFast; + return this; + } + + /** + * @param timeoutInMs `int`. If `0` (default), then the kernel will run the RPC + * request and only time out if the RPC deadline passes or the session times out. + * If this value is greater than `0`, then the op will raise an exception if + * the RPC takes longer than `timeout_in_ms`. + */ + public Options timeoutInMs(Long timeoutInMs) { + this.timeoutInMs = timeoutInMs; + return this; + } + + private String protocol; + private Boolean failFast; + private Long timeoutInMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Rpc operation. + * + * @param scope current scope + * @param address `0-D` or `1-D`. The address (i.e. host_name:port) of the RPC server. + * If this tensor has more than 1 element, then multiple parallel rpc requests + * are sent. This argument broadcasts with `method` and `request`. + * @param method `0-D` or `1-D`. The method address on the RPC server. + * If this tensor has more than 1 element, then multiple parallel rpc requests + * are sent. This argument broadcasts with `address` and `request`. + * @param request `0-D` or `1-D`. Serialized proto strings: the rpc request argument. + * If this tensor has more than 1 element, then multiple parallel rpc requests + * are sent. This argument broadcasts with `address` and `method`. + * @param options carries optional attributes values + * @return a new instance of Rpc + */ + public static Rpc create(Scope scope, Operand address, Operand method, Operand request, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Rpc", scope.makeOpName("Rpc")); + opBuilder.addInput(address.asOutput()); + opBuilder.addInput(method.asOutput()); + opBuilder.addInput(request.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.protocol != null) { + opBuilder.setAttr("protocol", opts.protocol); + } + if (opts.failFast != null) { + opBuilder.setAttr("fail_fast", opts.failFast); + } + if (opts.timeoutInMs != null) { + opBuilder.setAttr("timeout_in_ms", opts.timeoutInMs); + } + } + } + return new Rpc(opBuilder.build()); + } + + /** + * @param protocol RPC protocol to use. Empty string means use the default protocol. + * Options include 'grpc'. + */ + public static Options protocol(String protocol) { + return new Options().protocol(protocol); + } + + /** + * @param failFast `boolean`. If `true` (default), then failures to connect + * (i.e., the server does not immediately respond) cause an RPC failure. + */ + public static Options failFast(Boolean failFast) { + return new Options().failFast(failFast); + } + + /** + * @param timeoutInMs `int`. If `0` (default), then the kernel will run the RPC + * request and only time out if the RPC deadline passes or the session times out. + * If this value is greater than `0`, then the op will raise an exception if + * the RPC takes longer than `timeout_in_ms`. + */ + public static Options timeoutInMs(Long timeoutInMs) { + return new Options().timeoutInMs(timeoutInMs); + } + + /** + * Same shape as `request`. Serialized proto strings: the rpc responses. + */ + public Output response() { + return response; + } + + @Override + public Output asOutput() { + return response; + } + + private Output response; + + private Rpc(Operation operation) { + super(operation); + int outputIdx = 0; + response = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SamplingDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SamplingDataset.java new file mode 100644 index 00000000000..86db550e242 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SamplingDataset.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that contains `rate` elements from the `input_dataset`. + */ +public final class SamplingDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SamplingDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param rate A scalar representing the sample rate of elements from the `input_dataset` + * that should be taken. + * @param seed A scalar representing seed of random number generator. + * @param seed2 A scalar representing seed2 of random number generator. + * @param outputTypes + * @param outputShapes + * @return a new instance of SamplingDataset + */ + public static SamplingDataset create(Scope scope, Operand inputDataset, Operand rate, Operand seed, Operand seed2, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("SamplingDataset", scope.makeOpName("SamplingDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(rate.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(seed2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new SamplingDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SamplingDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslate.java new file mode 100644 index 00000000000..e5012bbb32d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslate.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator +public final class ScaleAndTranslate extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScaleAndTranslate} + */ + public static class Options { + + /** + * @param kernelType + */ + public Options kernelType(String kernelType) { + this.kernelType = kernelType; + return this; + } + + /** + * @param antialias + */ + public Options antialias(Boolean antialias) { + this.antialias = antialias; + return this; + } + + private String kernelType; + private Boolean antialias; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScaleAndTranslate operation. + * + * @param scope current scope + * @param images + * @param size + * @param scale + * @param translation + * @param options carries optional attributes values + * @return a new instance of ScaleAndTranslate + */ + public static ScaleAndTranslate create(Scope scope, Operand images, Operand size, Operand scale, Operand translation, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScaleAndTranslate", scope.makeOpName("ScaleAndTranslate")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder.addInput(scale.asOutput()); + opBuilder.addInput(translation.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.kernelType != null) { + opBuilder.setAttr("kernel_type", opts.kernelType); + } + if (opts.antialias != null) { + opBuilder.setAttr("antialias", opts.antialias); + } + } + } + return new ScaleAndTranslate(opBuilder.build()); + } + + /** + * @param kernelType + */ + public static Options kernelType(String kernelType) { + return new Options().kernelType(kernelType); + } + + /** + * @param antialias + */ + public static Options antialias(Boolean antialias) { + return new Options().antialias(antialias); + } + + /** + */ + public Output resizedImages() { + return resizedImages; + } + + @Override + public Output asOutput() { + return resizedImages; + } + + private Output resizedImages; + + private ScaleAndTranslate(Operation operation) { + super(operation); + int outputIdx = 0; + resizedImages = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslateGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslateGrad.java new file mode 100644 index 00000000000..f61d3e7d91c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslateGrad.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * @param data type for {@code output()} output + */ +public final class ScaleAndTranslateGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScaleAndTranslateGrad} + */ + public static class Options { + + /** + * @param kernelType + */ + public Options kernelType(String kernelType) { + this.kernelType = kernelType; + return this; + } + + /** + * @param antialias + */ + public Options antialias(Boolean antialias) { + this.antialias = antialias; + return this; + } + + private String kernelType; + private Boolean antialias; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScaleAndTranslateGrad operation. + * + * @param scope current scope + * @param grads + * @param originalImage + * @param scale + * @param translation + * @param options carries optional attributes values + * @return a new instance of ScaleAndTranslateGrad + */ + public static ScaleAndTranslateGrad create(Scope scope, Operand grads, Operand originalImage, Operand scale, Operand translation, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScaleAndTranslateGrad", scope.makeOpName("ScaleAndTranslateGrad")); + opBuilder.addInput(grads.asOutput()); + opBuilder.addInput(originalImage.asOutput()); + opBuilder.addInput(scale.asOutput()); + opBuilder.addInput(translation.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.kernelType != null) { + opBuilder.setAttr("kernel_type", opts.kernelType); + } + if (opts.antialias != null) { + opBuilder.setAttr("antialias", opts.antialias); + } + } + } + return new ScaleAndTranslateGrad(opBuilder.build()); + } + + /** + * @param kernelType + */ + public static Options kernelType(String kernelType) { + return new Options().kernelType(kernelType); + } + + /** + * @param antialias + */ + public static Options antialias(Boolean antialias) { + return new Options().antialias(antialias); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ScaleAndTranslateGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterAdd.java new file mode 100644 index 00000000000..5ef403ff99b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterAdd.java @@ -0,0 +1,133 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds sparse updates to a variable reference. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] += updates[...] + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] += updates[i, ...] + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] += updates[i, ..., j, ...] + *

    + * This operation outputs `ref` after the update is done. + * This makes it easier to chain operations that need to use the reset value. + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions add. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterAdd extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterAdd} + */ + public static class Options { + + /** + * @param useLocking If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterAdd operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to add to `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterAdd + */ + public static ScatterAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterAdd", scope.makeOpName("ScatterAdd")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterAdd(opBuilder.build()); + } + + /** + * @param useLocking If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as `ref`. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterAdd(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterDiv.java new file mode 100644 index 00000000000..f11f7d27bf9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterDiv.java @@ -0,0 +1,129 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Divides a variable reference by sparse updates. + *

    + * This operation computes + *

    {@code
    + *     # Scalar indices
    + *     ref[indices, ...] /= updates[...]
    + * 
    + *     # Vector indices (for each i)
    + *     ref[indices[i], ...] /= updates[i, ...]
    + * 
    + *     # High rank indices (for each i, ..., j)
    + *     ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...]
    + * }
    + * This operation outputs `ref` after the update is done. + * This makes it easier to chain operations that need to use the reset value. + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions divide. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterDiv extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterDiv} + */ + public static class Options { + + /** + * @param useLocking If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterDiv operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of values that `ref` is divided by. + * @param options carries optional attributes values + * @return a new instance of ScatterDiv + */ + public static ScatterDiv create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterDiv", scope.makeOpName("ScatterDiv")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterDiv(opBuilder.build()); + } + + /** + * @param useLocking If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as `ref`. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterDiv(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMax.java new file mode 100644 index 00000000000..6e9e717f0dd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMax.java @@ -0,0 +1,133 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reduces sparse updates into a variable reference using the `max` operation. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] = max(ref[indices, ...], updates[...]) + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] = max(ref[indices[i], ...], updates[i, ...]) + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] = max(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) + *

    + * This operation outputs `ref` after the update is done. + * This makes it easier to chain operations that need to use the reset value. + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions combine. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterMax extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterMax} + */ + public static class Options { + + /** + * @param useLocking If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterMax operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to reduce into `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterMax + */ + public static ScatterMax create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterMax", scope.makeOpName("ScatterMax")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterMax(opBuilder.build()); + } + + /** + * @param useLocking If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as `ref`. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterMax(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMin.java new file mode 100644 index 00000000000..ac026b21ceb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMin.java @@ -0,0 +1,133 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reduces sparse updates into a variable reference using the `min` operation. + *

    + * This operation computes + *

    + * # Scalar indices + * ref[indices, ...] = min(ref[indices, ...], updates[...]) + *

    + * # Vector indices (for each i) + * ref[indices[i], ...] = min(ref[indices[i], ...], updates[i, ...]) + *

    + * # High rank indices (for each i, ..., j) + * ref[indices[i, ..., j], ...] = min(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) + *

    + * This operation outputs `ref` after the update is done. + * This makes it easier to chain operations that need to use the reset value. + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions combine. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterMin extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterMin} + */ + public static class Options { + + /** + * @param useLocking If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterMin operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to reduce into `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterMin + */ + public static ScatterMin create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterMin", scope.makeOpName("ScatterMin")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterMin(opBuilder.build()); + } + + /** + * @param useLocking If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as `ref`. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterMin(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMul.java new file mode 100644 index 00000000000..19a49ba8d69 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMul.java @@ -0,0 +1,129 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Multiplies sparse updates into a variable reference. + *

    + * This operation computes + *

    {@code
    + *     # Scalar indices
    + *     ref[indices, ...] *= updates[...]
    + * 
    + *     # Vector indices (for each i)
    + *     ref[indices[i], ...] *= updates[i, ...]
    + * 
    + *     # High rank indices (for each i, ..., j)
    + *     ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...]
    + * }
    + * This operation outputs `ref` after the update is done. + * This makes it easier to chain operations that need to use the reset value. + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their contributions multiply. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterMul extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterMul} + */ + public static class Options { + + /** + * @param useLocking If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterMul operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to multiply to `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterMul + */ + public static ScatterMul create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterMul", scope.makeOpName("ScatterMul")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterMul(opBuilder.build()); + } + + /** + * @param useLocking If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as `ref`. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterMul(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNd.java new file mode 100644 index 00000000000..ddba3889939 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNd.java @@ -0,0 +1,153 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Scatter `updates` into a new tensor according to `indices`. + *

    + * Creates a new tensor by applying sparse `updates` to individual values or + * slices within a tensor (initially zero for numeric, empty for string) of + * the given `shape` according to indices. This operator is the inverse of the + * `tf.gather_nd` operator which extracts values or slices from a given tensor. + *

    + * This operation is similar to tensor_scatter_add, except that the tensor is + * zero-initialized. Calling `tf.scatter_nd(indices, values, shape)` is identical + * to `tensor_scatter_add(tf.zeros(shape, values.dtype), indices, values)` + *

    + * If `indices` contains duplicates, then their updates are accumulated (summed). + *

    + * WARNING: The order in which updates are applied is nondeterministic, so the + * output will be nondeterministic if `indices` contains duplicates -- because + * of some numerical approximation issues, numbers summed in different order + * may yield different results. + *

    + * `indices` is an integer tensor containing indices into a new tensor of shape + * `shape`. The last dimension of `indices` can be at most the rank of `shape`: + *

    + * indices.shape[-1] <= shape.rank + *

    + * The last dimension of `indices` corresponds to indices into elements + * (if `indices.shape[-1] = shape.rank`) or slices + * (if `indices.shape[-1] < shape.rank`) along dimension `indices.shape[-1]` of + * `shape`. `updates` is a tensor with shape + *

    + * indices.shape[:-1] + shape[indices.shape[-1]:] + *

    + * The simplest form of scatter is to insert individual elements in a tensor by + * index. For example, say we want to insert 4 scattered elements in a rank-1 + * tensor with 8 elements. + *

    + *

    + * + *
    + *

    + * In Python, this scatter operation would look like this: + *

    {@code
    + *     indices = tf.constant([[4], [3], [1], [7]])
    + *     updates = tf.constant([9, 10, 11, 12])
    + *     shape = tf.constant([8])
    + *     scatter = tf.scatter_nd(indices, updates, shape)
    + *     with tf.Session() as sess:
    + *       print(sess.run(scatter))
    + * }
    + * The resulting tensor would look like this: + *

    + * [0, 11, 0, 10, 9, 0, 0, 12] + *

    + * We can also, insert entire slices of a higher rank tensor all at once. For + * example, if we wanted to insert two slices in the first dimension of a + * rank-3 tensor with two matrices of new values. + *

    + *

    + * + *
    + *

    + * In Python, this scatter operation would look like this: + *

    {@code
    + *     indices = tf.constant([[0], [2]])
    + *     updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
    + *                             [7, 7, 7, 7], [8, 8, 8, 8]],
    + *                            [[5, 5, 5, 5], [6, 6, 6, 6],
    + *                             [7, 7, 7, 7], [8, 8, 8, 8]]])
    + *     shape = tf.constant([4, 4, 4])
    + *     scatter = tf.scatter_nd(indices, updates, shape)
    + *     with tf.Session() as sess:
    + *       print(sess.run(scatter))
    + * }
    + * The resulting tensor would look like this: + *

    + * [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], + * [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], + * [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], + * [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]] + *

    + * Note that on CPU, if an out of bound index is found, an error is returned. + * On GPU, if an out of bound index is found, the index is ignored. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ScatterNd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ScatterNd operation. + * + * @param scope current scope + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @param shape 1-D. The shape of the resulting tensor. + * @return a new instance of ScatterNd + */ + public static ScatterNd create(Scope scope, Operand indices, Operand updates, Operand shape) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterNd", scope.makeOpName("ScatterNd")); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ScatterNd(opBuilder.build()); + } + + /** + * A new tensor with the given shape and updates applied according + * to the indices. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ScatterNd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdAdd.java new file mode 100644 index 00000000000..ad997e2b67a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdAdd.java @@ -0,0 +1,144 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse addition to individual values or slices in a Variable. + *

    + * `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. + *

    + * `indices` must be integer tensor, containing indices into `ref`. + * It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. + *

    + * The innermost dimension of `indices` (with length `K`) corresponds to + * indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th + * dimension of `ref`. + *

    + * `updates` is `Tensor` of rank `Q-1+P-K` with shape: + *

    {@code
    + * [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]
    + * }
    + * For example, say we want to add 4 scattered elements to a rank-1 tensor to + * 8 elements. In Python, that addition would look like this: + *
    {@code
    + * ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8])
    + * indices = tf.constant([[4], [3], [1], [7]])
    + * updates = tf.constant([9, 10, 11, 12])
    + * add = tf.scatter_nd_add(ref, indices, updates)
    + * with tf.Session() as sess:
    + *   print sess.run(add)
    + * }
    + * The resulting update to ref would look like this: + *

    + * [1, 13, 3, 14, 14, 6, 7, 20] + *

    + * See `tf.scatter_nd` for more details about how to make updates to + * slices. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterNdAdd extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdAdd} + */ + public static class Options { + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterNdAdd operation. + * + * @param scope current scope + * @param ref A mutable Tensor. Should be from a Variable node. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated values + * to add to ref. + * @param options carries optional attributes values + * @return a new instance of ScatterNdAdd + */ + public static ScatterNdAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdAdd", scope.makeOpName("ScatterNdAdd")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterNdAdd(opBuilder.build()); + } + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as ref. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterNdAdd(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdNonAliasingAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdNonAliasingAdd.java new file mode 100644 index 00000000000..c2466d58877 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdNonAliasingAdd.java @@ -0,0 +1,110 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse addition to `input` using individual values or slices + *

    + * from `updates` according to indices `indices`. The updates are non-aliasing: + * `input` is only modified in-place if no other operations will use it. + * Otherwise, a copy of `input` is made. This operation has a gradient with + * respect to both `input` and `updates`. + *

    + * `input` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. + *

    + * `indices` must be integer tensor, containing indices into `input`. + * It must be shape \\([d_0, ..., d_{Q-2}, K]\\) where `0 < K <= P`. + *

    + * The innermost dimension of `indices` (with length `K`) corresponds to + * indices into elements (if `K = P`) or `(P-K)`-dimensional slices + * (if `K < P`) along the `K`th dimension of `input`. + *

    + * `updates` is `Tensor` of rank `Q-1+P-K` with shape: + *

    + * $$[d_0, ..., d_{Q-2}, input.shape[K], ..., input.shape[P-1]].$$ + *

    + * For example, say we want to add 4 scattered elements to a rank-1 tensor to 8 + * elements. In Python, that addition would look like this: + *

    + * input = tf.constant([1, 2, 3, 4, 5, 6, 7, 8]) + * indices = tf.constant([[4], [3], [1], [7]]) + * updates = tf.constant([9, 10, 11, 12]) + * output = tf.scatter_nd_non_aliasing_add(input, indices, updates) + * with tf.Session() as sess: + * print(sess.run(output)) + *

    + * The resulting value `output` would look like this: + *

    + * [1, 13, 3, 14, 14, 6, 7, 20] + *

    + * See `tf.scatter_nd` for more details about how to make updates to slices. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ScatterNdNonAliasingAdd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ScatterNdNonAliasingAdd operation. + * + * @param scope current scope + * @param input A Tensor. + * @param indices A Tensor. Must be one of the following types: `int32`, `int64`. + * A tensor of indices into `input`. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated values + * to add to `input`. + * @return a new instance of ScatterNdNonAliasingAdd + */ + public static ScatterNdNonAliasingAdd create(Scope scope, Operand input, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdNonAliasingAdd", scope.makeOpName("ScatterNdNonAliasingAdd")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ScatterNdNonAliasingAdd(opBuilder.build()); + } + + /** + * A `Tensor` with the same shape as `input`, containing values of `input` + * updated with `updates`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ScatterNdNonAliasingAdd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdSub.java new file mode 100644 index 00000000000..989d2085ad9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdSub.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse subtraction to individual values or slices in a Variable. + *

    + * within a given variable according to `indices`. + *

    + * `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. + *

    + * `indices` must be integer tensor, containing indices into `ref`. + * It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. + *

    + * The innermost dimension of `indices` (with length `K`) corresponds to + * indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th + * dimension of `ref`. + *

    + * `updates` is `Tensor` of rank `Q-1+P-K` with shape: + *

    {@code
    + * [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]
    + * }
    + * For example, say we want to subtract 4 scattered elements from a rank-1 tensor + * with 8 elements. In Python, that subtraction would look like this: + *
    {@code
    + * ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8])
    + * indices = tf.constant([[4], [3], [1], [7]])
    + * updates = tf.constant([9, 10, 11, 12])
    + * sub = tf.scatter_nd_sub(ref, indices, updates)
    + * with tf.Session() as sess:
    + *   print sess.run(sub)
    + * }
    + * The resulting update to ref would look like this: + *

    + * [1, -9, 3, -6, -4, 6, 7, -4] + *

    + * See `tf.scatter_nd` for more details about how to make updates to + * slices. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterNdSub extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdSub} + */ + public static class Options { + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterNdSub operation. + * + * @param scope current scope + * @param ref A mutable Tensor. Should be from a Variable node. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated values + * to subtract from ref. + * @param options carries optional attributes values + * @return a new instance of ScatterNdSub + */ + public static ScatterNdSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdSub", scope.makeOpName("ScatterNdSub")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterNdSub(opBuilder.build()); + } + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as ref. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterNdSub(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdUpdate.java new file mode 100644 index 00000000000..e9465e76800 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdUpdate.java @@ -0,0 +1,148 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse `updates` to individual values or slices within a given + *

    + * variable according to `indices`. + *

    + * `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. + *

    + * `indices` must be integer tensor, containing indices into `ref`. + * It must be shape \\([d_0, ..., d_{Q-2}, K]\\) where `0 < K <= P`. + *

    + * The innermost dimension of `indices` (with length `K`) corresponds to + * indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th + * dimension of `ref`. + *

    + * `updates` is `Tensor` of rank `Q-1+P-K` with shape: + *

    + * $$[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]].$$ + *

    + * For example, say we want to update 4 scattered elements to a rank-1 tensor to + * 8 elements. In Python, that update would look like this: + *

    {@code
    + *     ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8])
    + *     indices = tf.constant([[4], [3], [1] ,[7]])
    + *     updates = tf.constant([9, 10, 11, 12])
    + *     update = tf.scatter_nd_update(ref, indices, updates)
    + *     with tf.Session() as sess:
    + *       print sess.run(update)
    + * }
    + * The resulting update to ref would look like this: + *

    + * [1, 11, 3, 10, 9, 6, 7, 12] + *

    + * See `tf.scatter_nd` for more details about how to make updates to + * slices. + *

    + * See also `tf.scatter_update` and `tf.batch_scatter_update`. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterNdUpdate extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdUpdate} + */ + public static class Options { + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterNdUpdate operation. + * + * @param scope current scope + * @param ref A mutable Tensor. Should be from a Variable node. + * @param indices A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + * @param updates A Tensor. Must have the same type as ref. A tensor of updated + * values to add to ref. + * @param options carries optional attributes values + * @return a new instance of ScatterNdUpdate + */ + public static ScatterNdUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdUpdate", scope.makeOpName("ScatterNdUpdate")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterNdUpdate(opBuilder.build()); + } + + /** + * @param useLocking An optional bool. Defaults to True. If True, the assignment will + * be protected by a lock; otherwise the behavior is undefined, + * but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as ref. Returned as a convenience for operations that want to + * use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterNdUpdate(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterSub.java new file mode 100644 index 00000000000..80086275101 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterSub.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Subtracts sparse updates to a variable reference. + *

    + *

    {@code
    + *     # Scalar indices
    + *     ref[indices, ...] -= updates[...]
    + * 
    + *     # Vector indices (for each i)
    + *     ref[indices[i], ...] -= updates[i, ...]
    + * 
    + *     # High rank indices (for each i, ..., j)
    + *     ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...]
    + * }
    + * This operation outputs `ref` after the update is done. + * This makes it easier to chain operations that need to use the reset value. + *

    + * Duplicate entries are handled correctly: if multiple `indices` reference + * the same location, their (negated) contributions add. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterSub extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterSub} + */ + public static class Options { + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterSub operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to subtract from `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterSub + */ + public static ScatterSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterSub", scope.makeOpName("ScatterSub")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterSub(opBuilder.build()); + } + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as `ref`. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterSub(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterUpdate.java new file mode 100644 index 00000000000..d9b272a03dd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterUpdate.java @@ -0,0 +1,136 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies sparse updates to a variable reference. + *

    + * This operation computes + *

    {@code
    + *     # Scalar indices
    + *     ref[indices, ...] = updates[...]
    + * 
    + *     # Vector indices (for each i)
    + *     ref[indices[i], ...] = updates[i, ...]
    + * 
    + *     # High rank indices (for each i, ..., j)
    + *     ref[indices[i, ..., j], ...] = updates[i, ..., j, ...]
    + * }
    + * This operation outputs `ref` after the update is done. + * This makes it easier to chain operations that need to use the reset value. + *

    + * If values in `ref` is to be updated more than once, because there are + * duplicate entries in `indices`, the order at which the updates happen + * for each value is undefined. + *

    + * Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. + *

    + *

    + * + *
    + *

    + * See also `tf.batch_scatter_update` and `tf.scatter_nd_update`. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class ScatterUpdate extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterUpdate} + */ + public static class Options { + + /** + * @param useLocking If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ScatterUpdate operation. + * + * @param scope current scope + * @param ref Should be from a `Variable` node. + * @param indices A tensor of indices into the first dimension of `ref`. + * @param updates A tensor of updated values to store in `ref`. + * @param options carries optional attributes values + * @return a new instance of ScatterUpdate + */ + public static ScatterUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ScatterUpdate", scope.makeOpName("ScatterUpdate")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ScatterUpdate(opBuilder.build()); + } + + /** + * @param useLocking If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * = Same as `ref`. Returned as a convenience for operations that want + * to use the updated values after the update is done. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private ScatterUpdate(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SelectV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SelectV2.java new file mode 100644 index 00000000000..a3241878b9b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SelectV2.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator +public final class SelectV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SelectV2 operation. + * + * @param scope current scope + * @param condition + * @param t + * @param e + * @return a new instance of SelectV2 + */ + public static SelectV2 create(Scope scope, Operand condition, Operand t, Operand e) { + OperationBuilder opBuilder = scope.env().opBuilder("SelectV2", scope.makeOpName("SelectV2")); + opBuilder.addInput(condition.asOutput()); + opBuilder.addInput(t.asOutput()); + opBuilder.addInput(e.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SelectV2(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SelectV2(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SendTPUEmbeddingGradients.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SendTPUEmbeddingGradients.java new file mode 100644 index 00000000000..4c575124a88 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SendTPUEmbeddingGradients.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Performs gradient updates of embedding tables. + */ +public final class SendTPUEmbeddingGradients extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SendTPUEmbeddingGradients operation. + * + * @param scope current scope + * @param inputs A TensorList of gradients with which to update embedding tables. + * This argument has the same length and shapes as the return value of + * RecvTPUEmbeddingActivations, but contains gradients of the model's loss + * with respect to the embedding activations. The embedding tables are updated + * from these gradients via the optimizer specified in the TPU embedding + * configuration given to tpu.initialize_system. + * @param learningRates A TensorList of float32 scalars, one for each dynamic learning + * rate tag: see the comments in + * //third_party/tensorflow/core/protobuf/tpu/optimization_parameters.proto. + * Multiple tables can share the same dynamic learning rate tag as specified + * in the configuration. If the learning rates for all tables are constant, + * this list should be empty. + * @param config Serialized TPUEmbeddingConfiguration proto. + * @return a new instance of SendTPUEmbeddingGradients + */ + public static SendTPUEmbeddingGradients create(Scope scope, Iterable> inputs, Iterable> learningRates, String config) { + OperationBuilder opBuilder = scope.env().opBuilder("SendTPUEmbeddingGradients", scope.makeOpName("SendTPUEmbeddingGradients")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder.addInputList(Operands.asOutputs(learningRates)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("config", config); + return new SendTPUEmbeddingGradients(opBuilder.build()); + } + + + private SendTPUEmbeddingGradients(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetDiff1d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetDiff1d.java new file mode 100644 index 00000000000..f7de18583d1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetDiff1d.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the difference between two lists of numbers or strings. + *

    + * Given a list `x` and a list `y`, this operation returns a list `out` that + * represents all values that are in `x` but not in `y`. The returned list `out` + * is sorted in the same order that the numbers appear in `x` (duplicates are + * preserved). This operation also returns a list `idx` that represents the + * position of each `out` element in `x`. In other words: + *

    + * `out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]` + *

    + * For example, given this input: + *

    {@code
    + * x = [1, 2, 3, 4, 5, 6]
    + * y = [1, 3, 5]
    + * }
    + * This operation would return: + *
    {@code
    + * out ==> [2, 4, 6]
    + * idx ==> [1, 3, 5]
    + * }
    + * + * + * @param data type for {@code out()} output + * @param data type for {@code idx()} output + */ +@Operator +public final class SetDiff1d extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SetDiff1d operation. + * + * @param scope current scope + * @param x 1-D. Values to keep. + * @param y 1-D. Values to remove. + * @param outIdx + * @return a new instance of SetDiff1d + */ + public static SetDiff1d create(Scope scope, Operand x, Operand y, Class outIdx) { + OperationBuilder opBuilder = scope.env().opBuilder("ListDiff", scope.makeOpName("SetDiff1d")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_idx", DataType.fromClass(outIdx)); + return new SetDiff1d(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new SetDiff1d operation using default output types. + * + * @param scope current scope + * @param x 1-D. Values to keep. + * @param y 1-D. Values to remove. + * @return a new instance of SetDiff1d + */ + public static SetDiff1d create(Scope scope, Operand x, Operand y) { + return create(scope, x, y, Integer.class); + } + + /** + * 1-D. Values present in `x` but not in `y`. + */ + public Output out() { + return out; + } + + /** + * 1-D. Positions of `x` values preserved in `out`. + */ + public Output idx() { + return idx; + } + + private Output out; + private Output idx; + + private SetDiff1d(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + idx = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetSize.java new file mode 100644 index 00000000000..02a1241ec23 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetSize.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Number of unique elements along last dimension of input `set`. + *

    + * Input `set` is a `SparseTensor` represented by `set_indices`, `set_values`, + * and `set_shape`. The last dimension contains values in a set, duplicates are + * allowed but ignored. + *

    + * If `validate_indices` is `True`, this op validates the order and range of `set` + * indices. + */ +@Operator +public final class SetSize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.SetSize} + */ + public static class Options { + + /** + * @param validateIndices + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + + private Boolean validateIndices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SetSize operation. + * + * @param scope current scope + * @param setIndices 2D `Tensor`, indices of a `SparseTensor`. + * @param setValues 1D `Tensor`, values of a `SparseTensor`. + * @param setShape 1D `Tensor`, shape of a `SparseTensor`. + * @param options carries optional attributes values + * @return a new instance of SetSize + */ + public static SetSize create(Scope scope, Operand setIndices, Operand setValues, Operand setShape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SetSize", scope.makeOpName("SetSize")); + opBuilder.addInput(setIndices.asOutput()); + opBuilder.addInput(setValues.asOutput()); + opBuilder.addInput(setShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.validateIndices != null) { + opBuilder.setAttr("validate_indices", opts.validateIndices); + } + } + } + return new SetSize(opBuilder.build()); + } + + /** + * @param validateIndices + */ + public static Options validateIndices(Boolean validateIndices) { + return new Options().validateIndices(validateIndices); + } + + /** + * For `set` ranked `n`, this is a `Tensor` with rank `n-1`, and the same 1st + * `n-1` dimensions as `set`. Each value is the number of unique elements in + * the corresponding `[0...n-1]` dimension of `set`. + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private SetSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Shape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Shape.java new file mode 100644 index 00000000000..84c85161ebb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Shape.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the shape of a tensor. + *

    + * This operation returns a 1-D integer tensor representing the shape of `input`. + *

    + * For example: + *

    {@code
    + * # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]
    + * shape(t) ==> [2, 2, 3]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Shape extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Shape operation. + * + * @param scope current scope + * @param input + * @param outType + * @return a new instance of Shape + */ + public static Shape create(Scope scope, Operand input, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("Shape", scope.makeOpName("Shape")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new Shape(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Shape operation using default output types. + * + * @param scope current scope + * @param input + * @return a new instance of Shape + */ + public static Shape create(Scope scope, Operand input) { + return create(scope, input, Integer.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Shape(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShapeN.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShapeN.java new file mode 100644 index 00000000000..686f6c9884f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShapeN.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns shape of tensors. + *

    + * This operation returns N 1-D integer tensors representing shape of `input[i]s`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class ShapeN extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new ShapeN operation. + * + * @param scope current scope + * @param input + * @param outType + * @return a new instance of ShapeN + */ + public static ShapeN create(Scope scope, Iterable> input, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("ShapeN", scope.makeOpName("ShapeN")); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new ShapeN(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new ShapeN operation using default output types. + * + * @param scope current scope + * @param input + * @return a new instance of ShapeN + */ + public static ShapeN create(Scope scope, Iterable> input) { + return create(scope, input, Integer.class); + } + + /** + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + private List> output; + + @SuppressWarnings("unchecked") + private ShapeN(Operation operation) { + super(operation); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList((Output[])operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShardDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShardDataset.java new file mode 100644 index 00000000000..ba5acf442ee --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShardDataset.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a `Dataset` that includes only 1/`num_shards` of this dataset. + */ +public final class ShardDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ShardDataset} + */ + public static class Options { + + /** + * @param requireNonEmpty + */ + public Options requireNonEmpty(Boolean requireNonEmpty) { + this.requireNonEmpty = requireNonEmpty; + return this; + } + + private Boolean requireNonEmpty; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ShardDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param numShards An integer representing the number of shards operating in parallel. + * @param index An integer representing the current worker index. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of ShardDataset + */ + public static ShardDataset create(Scope scope, Operand inputDataset, Operand numShards, Operand index, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ShardDataset", scope.makeOpName("ShardDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numShards.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.requireNonEmpty != null) { + opBuilder.setAttr("require_non_empty", opts.requireNonEmpty); + } + } + } + return new ShardDataset(opBuilder.build()); + } + + /** + * @param requireNonEmpty + */ + public static Options requireNonEmpty(Boolean requireNonEmpty) { + return new Options().requireNonEmpty(requireNonEmpty); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ShardDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShuffleDatasetV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShuffleDatasetV2.java new file mode 100644 index 00000000000..2c494712878 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShuffleDatasetV2.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ShuffleDatasetV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ShuffleDatasetV2 operation. + * + * @param scope current scope + * @param inputDataset + * @param bufferSize + * @param seedGenerator + * @param outputTypes + * @param outputShapes + * @return a new instance of ShuffleDatasetV2 + */ + public static ShuffleDatasetV2 create(Scope scope, Operand inputDataset, Operand bufferSize, Operand seedGenerator, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ShuffleDatasetV2", scope.makeOpName("ShuffleDatasetV2")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder.addInput(seedGenerator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ShuffleDatasetV2(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ShuffleDatasetV2(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShutdownDistributedTPU.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShutdownDistributedTPU.java new file mode 100644 index 00000000000..fbfce9b0437 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShutdownDistributedTPU.java @@ -0,0 +1,48 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Shuts down a running distributed TPU system. + *

    + * The op returns an error if no system is running. + */ +public final class ShutdownDistributedTPU extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ShutdownDistributedTPU operation. + * + * @param scope current scope + * @return a new instance of ShutdownDistributedTPU + */ + public static ShutdownDistributedTPU create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("ShutdownDistributedTPU", scope.makeOpName("ShutdownDistributedTPU")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ShutdownDistributedTPU(opBuilder.build()); + } + + + private ShutdownDistributedTPU(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Size.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Size.java new file mode 100644 index 00000000000..2b3c84e4ac0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Size.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the size of a tensor. + *

    + * This operation returns an integer representing the number of elements in + * `input`. + *

    + * For example: + *

    {@code
    + * # 't' is [[[1, 1,, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]]
    + * size(t) ==> 12
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Size extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Size operation. + * + * @param scope current scope + * @param input + * @param outType + * @return a new instance of Size + */ + public static Size create(Scope scope, Operand input, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("Size", scope.makeOpName("Size")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new Size(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Size operation using default output types. + * + * @param scope current scope + * @param input + * @return a new instance of Size + */ + public static Size create(Scope scope, Operand input) { + return create(scope, input, Integer.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Size(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Skipgram.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Skipgram.java new file mode 100644 index 00000000000..612f394d615 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Skipgram.java @@ -0,0 +1,193 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Parses a text file and creates a batch of examples. + */ +@Operator +public final class Skipgram extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Skipgram} + */ + public static class Options { + + /** + * @param windowSize The number of words to predict to the left and right of the target. + */ + public Options windowSize(Long windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * @param minCount The minimum number of word occurrences for it to be included in the + * vocabulary. + */ + public Options minCount(Long minCount) { + this.minCount = minCount; + return this; + } + + /** + * @param subsample Threshold for word occurrence. Words that appear with higher + * frequency will be randomly down-sampled. Set to 0 to disable. + */ + public Options subsample(Float subsample) { + this.subsample = subsample; + return this; + } + + private Long windowSize; + private Long minCount; + private Float subsample; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Skipgram operation. + * + * @param scope current scope + * @param filename The corpus's text file name. + * @param batchSize The size of produced batch. + * @param options carries optional attributes values + * @return a new instance of Skipgram + */ + public static Skipgram create(Scope scope, String filename, Long batchSize, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Skipgram", scope.makeOpName("Skipgram")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("filename", filename); + opBuilder.setAttr("batch_size", batchSize); + if (options != null) { + for (Options opts : options) { + if (opts.windowSize != null) { + opBuilder.setAttr("window_size", opts.windowSize); + } + if (opts.minCount != null) { + opBuilder.setAttr("min_count", opts.minCount); + } + if (opts.subsample != null) { + opBuilder.setAttr("subsample", opts.subsample); + } + } + } + return new Skipgram(opBuilder.build()); + } + + /** + * @param windowSize The number of words to predict to the left and right of the target. + */ + public static Options windowSize(Long windowSize) { + return new Options().windowSize(windowSize); + } + + /** + * @param minCount The minimum number of word occurrences for it to be included in the + * vocabulary. + */ + public static Options minCount(Long minCount) { + return new Options().minCount(minCount); + } + + /** + * @param subsample Threshold for word occurrence. Words that appear with higher + * frequency will be randomly down-sampled. Set to 0 to disable. + */ + public static Options subsample(Float subsample) { + return new Options().subsample(subsample); + } + + /** + * A vector of words in the corpus. + */ + public Output vocabWord() { + return vocabWord; + } + + /** + * Frequencies of words. Sorted in the non-ascending order. + */ + public Output vocabFreq() { + return vocabFreq; + } + + /** + * Number of words per epoch in the data file. + */ + public Output wordsPerEpoch() { + return wordsPerEpoch; + } + + /** + * The current epoch number. + */ + public Output currentEpoch() { + return currentEpoch; + } + + /** + * The total number of words processed so far. + */ + public Output totalWordsProcessed() { + return totalWordsProcessed; + } + + /** + * A vector of word ids. + */ + public Output examples() { + return examples; + } + + /** + * A vector of word ids. + */ + public Output labels() { + return labels; + } + + private Output vocabWord; + private Output vocabFreq; + private Output wordsPerEpoch; + private Output currentEpoch; + private Output totalWordsProcessed; + private Output examples; + private Output labels; + + private Skipgram(Operation operation) { + super(operation); + int outputIdx = 0; + vocabWord = operation.output(outputIdx++); + vocabFreq = operation.output(outputIdx++); + wordsPerEpoch = operation.output(outputIdx++); + currentEpoch = operation.output(outputIdx++); + totalWordsProcessed = operation.output(outputIdx++); + examples = operation.output(outputIdx++); + labels = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SleepDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SleepDataset.java new file mode 100644 index 00000000000..70b419697be --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SleepDataset.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class SleepDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SleepDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param sleepMicroseconds + * @param outputTypes + * @param outputShapes + * @return a new instance of SleepDataset + */ + public static SleepDataset create(Scope scope, Operand inputDataset, Operand sleepMicroseconds, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("SleepDataset", scope.makeOpName("SleepDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(sleepMicroseconds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new SleepDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SleepDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Slice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Slice.java new file mode 100644 index 00000000000..fe591d2c7f3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Slice.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Return a slice from 'input'. + *

    + * The output tensor is a tensor with dimensions described by 'size' + * whose values are extracted from 'input' starting at the offsets in + * 'begin'. + *

    + * Requirements: + * 0 <= begin[i] <= begin[i] + size[i] <= Di for i in [0, n) + * + * @param data type for {@code output()} output + */ +@Operator +public final class Slice extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Slice operation. + * + * @param scope current scope + * @param input + * @param begin begin[i] specifies the offset into the 'i'th dimension of + * 'input' to slice from. + * @param size size[i] specifies the number of elements of the 'i'th dimension + * of 'input' to slice. If size[i] is -1, all remaining elements in dimension + * i are included in the slice (i.e. this is equivalent to setting + * size[i] = input.dim_size(i) - begin[i]). + * @return a new instance of Slice + */ + public static Slice create(Scope scope, Operand input, Operand begin, Operand size) { + OperationBuilder opBuilder = scope.env().opBuilder("Slice", scope.makeOpName("Slice")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(begin.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Slice(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Slice(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SlidingWindowDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SlidingWindowDataset.java new file mode 100644 index 00000000000..117a4738579 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SlidingWindowDataset.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that passes a sliding window over `input_dataset`. + */ +public final class SlidingWindowDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SlidingWindowDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param windowSize A scalar representing the number of elements in the + * sliding window. + * @param windowShift A scalar representing the steps moving the sliding window + * forward in one iteration. It must be positive. + * @param windowStride A scalar representing the stride of the input elements of the sliding window. + * It must be positive. + * @param outputTypes + * @param outputShapes + * @return a new instance of SlidingWindowDataset + */ + public static SlidingWindowDataset create(Scope scope, Operand inputDataset, Operand windowSize, Operand windowShift, Operand windowStride, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("SlidingWindowDataset", scope.makeOpName("SlidingWindowDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(windowSize.asOutput()); + opBuilder.addInput(windowShift.asOutput()); + opBuilder.addInput(windowStride.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new SlidingWindowDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SlidingWindowDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Snapshot.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Snapshot.java new file mode 100644 index 00000000000..748418da94f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Snapshot.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a copy of the input tensor. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Snapshot extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Snapshot operation. + * + * @param scope current scope + * @param input + * @return a new instance of Snapshot + */ + public static Snapshot create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("Snapshot", scope.makeOpName("Snapshot")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Snapshot(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Snapshot(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SnapshotDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SnapshotDataset.java new file mode 100644 index 00000000000..24ba2438bbf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SnapshotDataset.java @@ -0,0 +1,273 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that will write to / read from a snapshot. + *

    + * This dataset attempts to determine whether a valid snapshot exists at the + * `snapshot_path`, and reads from the snapshot in lieu of using `input_dataset`. + * If not, it will run the preprocessing pipeline as usual, and write out a + * snapshot of the data processed for future use. + */ +public final class SnapshotDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.SnapshotDataset} + */ + public static class Options { + + /** + * @param compression + */ + public Options compression(String compression) { + this.compression = compression; + return this; + } + + /** + * @param readerPathPrefix + */ + public Options readerPathPrefix(String readerPathPrefix) { + this.readerPathPrefix = readerPathPrefix; + return this; + } + + /** + * @param writerPathPrefix + */ + public Options writerPathPrefix(String writerPathPrefix) { + this.writerPathPrefix = writerPathPrefix; + return this; + } + + /** + * @param shardSizeBytes + */ + public Options shardSizeBytes(Long shardSizeBytes) { + this.shardSizeBytes = shardSizeBytes; + return this; + } + + /** + * @param pendingSnapshotExpirySeconds + */ + public Options pendingSnapshotExpirySeconds(Long pendingSnapshotExpirySeconds) { + this.pendingSnapshotExpirySeconds = pendingSnapshotExpirySeconds; + return this; + } + + /** + * @param numReaderThreads + */ + public Options numReaderThreads(Long numReaderThreads) { + this.numReaderThreads = numReaderThreads; + return this; + } + + /** + * @param readerBufferSize + */ + public Options readerBufferSize(Long readerBufferSize) { + this.readerBufferSize = readerBufferSize; + return this; + } + + /** + * @param numWriterThreads + */ + public Options numWriterThreads(Long numWriterThreads) { + this.numWriterThreads = numWriterThreads; + return this; + } + + /** + * @param writerBufferSize + */ + public Options writerBufferSize(Long writerBufferSize) { + this.writerBufferSize = writerBufferSize; + return this; + } + + private String compression; + private String readerPathPrefix; + private String writerPathPrefix; + private Long shardSizeBytes; + private Long pendingSnapshotExpirySeconds; + private Long numReaderThreads; + private Long readerBufferSize; + private Long numWriterThreads; + private Long writerBufferSize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SnapshotDataset operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @param path The path we should write snapshots to / read snapshots from. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of SnapshotDataset + */ + public static SnapshotDataset create(Scope scope, Operand inputDataset, Operand path, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SnapshotDataset", scope.makeOpName("SnapshotDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(path.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.compression != null) { + opBuilder.setAttr("compression", opts.compression); + } + if (opts.readerPathPrefix != null) { + opBuilder.setAttr("reader_path_prefix", opts.readerPathPrefix); + } + if (opts.writerPathPrefix != null) { + opBuilder.setAttr("writer_path_prefix", opts.writerPathPrefix); + } + if (opts.shardSizeBytes != null) { + opBuilder.setAttr("shard_size_bytes", opts.shardSizeBytes); + } + if (opts.pendingSnapshotExpirySeconds != null) { + opBuilder.setAttr("pending_snapshot_expiry_seconds", opts.pendingSnapshotExpirySeconds); + } + if (opts.numReaderThreads != null) { + opBuilder.setAttr("num_reader_threads", opts.numReaderThreads); + } + if (opts.readerBufferSize != null) { + opBuilder.setAttr("reader_buffer_size", opts.readerBufferSize); + } + if (opts.numWriterThreads != null) { + opBuilder.setAttr("num_writer_threads", opts.numWriterThreads); + } + if (opts.writerBufferSize != null) { + opBuilder.setAttr("writer_buffer_size", opts.writerBufferSize); + } + } + } + return new SnapshotDataset(opBuilder.build()); + } + + /** + * @param compression + */ + public static Options compression(String compression) { + return new Options().compression(compression); + } + + /** + * @param readerPathPrefix + */ + public static Options readerPathPrefix(String readerPathPrefix) { + return new Options().readerPathPrefix(readerPathPrefix); + } + + /** + * @param writerPathPrefix + */ + public static Options writerPathPrefix(String writerPathPrefix) { + return new Options().writerPathPrefix(writerPathPrefix); + } + + /** + * @param shardSizeBytes + */ + public static Options shardSizeBytes(Long shardSizeBytes) { + return new Options().shardSizeBytes(shardSizeBytes); + } + + /** + * @param pendingSnapshotExpirySeconds + */ + public static Options pendingSnapshotExpirySeconds(Long pendingSnapshotExpirySeconds) { + return new Options().pendingSnapshotExpirySeconds(pendingSnapshotExpirySeconds); + } + + /** + * @param numReaderThreads + */ + public static Options numReaderThreads(Long numReaderThreads) { + return new Options().numReaderThreads(numReaderThreads); + } + + /** + * @param readerBufferSize + */ + public static Options readerBufferSize(Long readerBufferSize) { + return new Options().readerBufferSize(readerBufferSize); + } + + /** + * @param numWriterThreads + */ + public static Options numWriterThreads(Long numWriterThreads) { + return new Options().numWriterThreads(numWriterThreads); + } + + /** + * @param writerBufferSize + */ + public static Options writerBufferSize(Long writerBufferSize) { + return new Options().writerBufferSize(writerBufferSize); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SnapshotDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SpaceToBatchNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SpaceToBatchNd.java new file mode 100644 index 00000000000..986a0477372 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SpaceToBatchNd.java @@ -0,0 +1,173 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * SpaceToBatch for N-D tensors of type T. + *

    + * This operation divides "spatial" dimensions `[1, ..., M]` of the input into a + * grid of blocks of shape `block_shape`, and interleaves these blocks with the + * "batch" dimension (0) such that in the output, the spatial dimensions + * `[1, ..., M]` correspond to the position within the grid, and the batch + * dimension combines both the position within a spatial block and the original + * batch position. Prior to division into blocks, the spatial dimensions of the + * input are optionally zero padded according to `paddings`. See below for a + * precise description. + * + * @param data type for {@code output()} output + */ +@Operator +public final class SpaceToBatchNd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SpaceToBatchNd operation. + * + * @param scope current scope + * @param input N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, + * where spatial_shape has `M` dimensions. + * @param blockShape 1-D with shape `[M]`, all values must be >= 1. + * @param paddings 2-D with shape `[M, 2]`, all values must be >= 0. + * `paddings[i] = [pad_start, pad_end]` specifies the padding for input dimension + * `i + 1`, which corresponds to spatial dimension `i`. It is required that + * `block_shape[i]` divides `input_shape[i + 1] + pad_start + pad_end`. + *

    + * This operation is equivalent to the following steps: + *

    + * 1. Zero-pad the start and end of dimensions `[1, ..., M]` of the + * input according to `paddings` to produce `padded` of shape `padded_shape`. + *

    + * 2. Reshape `padded` to `reshaped_padded` of shape: + *

    + * [batch] + + * [padded_shape[1] / block_shape[0], + * block_shape[0], + * ..., + * padded_shape[M] / block_shape[M-1], + * block_shape[M-1]] + + * remaining_shape + *

    + * 3. Permute dimensions of `reshaped_padded` to produce + * `permuted_reshaped_padded` of shape: + *

    + * block_shape + + * [batch] + + * [padded_shape[1] / block_shape[0], + * ..., + * padded_shape[M] / block_shape[M-1]] + + * remaining_shape + *

    + * 4. Reshape `permuted_reshaped_padded` to flatten `block_shape` into the batch + * dimension, producing an output tensor of shape: + *

    + * [batch * prod(block_shape)] + + * [padded_shape[1] / block_shape[0], + * ..., + * padded_shape[M] / block_shape[M-1]] + + * remaining_shape + *

    + * Some examples: + *

    + * (1) For the following input of shape `[1, 2, 2, 1]`, `block_shape = [2, 2]`, and + * `paddings = [[0, 0], [0, 0]]`: + *

    {@code
    +   * x = [[[[1], [2]], [[3], [4]]]]
    +   * }
    + * The output tensor has shape `[4, 1, 1, 1]` and value: + *
    {@code
    +   * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
    +   * }
    + * (2) For the following input of shape `[1, 2, 2, 3]`, `block_shape = [2, 2]`, and + * `paddings = [[0, 0], [0, 0]]`: + *
    {@code
    +   * x = [[[[1, 2, 3], [4, 5, 6]],
    +   *       [[7, 8, 9], [10, 11, 12]]]]
    +   * }
    + * The output tensor has shape `[4, 1, 1, 3]` and value: + *
    {@code
    +   * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
    +   * }
    + * (3) For the following input of shape `[1, 4, 4, 1]`, `block_shape = [2, 2]`, and + * `paddings = [[0, 0], [0, 0]]`: + *
    {@code
    +   * x = [[[[1],   [2],  [3],  [4]],
    +   *       [[5],   [6],  [7],  [8]],
    +   *       [[9],  [10], [11],  [12]],
    +   *       [[13], [14], [15],  [16]]]]
    +   * }
    + * The output tensor has shape `[4, 2, 2, 1]` and value: + *
    {@code
    +   * x = [[[[1], [3]], [[9], [11]]],
    +   *      [[[2], [4]], [[10], [12]]],
    +   *      [[[5], [7]], [[13], [15]]],
    +   *      [[[6], [8]], [[14], [16]]]]
    +   * }
    + * (4) For the following input of shape `[2, 2, 4, 1]`, block_shape = `[2, 2]`, and + * paddings = `[[0, 0], [2, 0]]`: + *
    {@code
    +   * x = [[[[1],   [2],  [3],  [4]],
    +   *       [[5],   [6],  [7],  [8]]],
    +   *      [[[9],  [10], [11],  [12]],
    +   *       [[13], [14], [15],  [16]]]]
    +   * }
    + * The output tensor has shape `[8, 1, 3, 1]` and value: + *
    {@code
    +   * x = [[[[0], [1], [3]]], [[[0], [9], [11]]],
    +   *      [[[0], [2], [4]]], [[[0], [10], [12]]],
    +   *      [[[0], [5], [7]]], [[[0], [13], [15]]],
    +   *      [[[0], [6], [8]]], [[[0], [14], [16]]]]
    +   * }
    + * Among others, this operation is useful for reducing atrous convolution into + * regular convolution. + * @return a new instance of SpaceToBatchNd + */ + public static SpaceToBatchNd create(Scope scope, Operand input, Operand blockShape, Operand paddings) { + OperationBuilder opBuilder = scope.env().opBuilder("SpaceToBatchND", scope.makeOpName("SpaceToBatchNd")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(blockShape.asOutput()); + opBuilder.addInput(paddings.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SpaceToBatchNd(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SpaceToBatchNd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SparseApplyAdagradV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SparseApplyAdagradV2.java new file mode 100644 index 00000000000..bb5d24d6dba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SparseApplyAdagradV2.java @@ -0,0 +1,138 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Update relevant entries in '*var' and '*accum' according to the adagrad scheme. + *

    + * That is for rows we have grad for, we update var and accum as follows: + * $$accum += grad * grad$$ + * $$var -= lr * grad * (1 / sqrt(accum))$$ + * + * @param data type for {@code out()} output + */ +public final class SparseApplyAdagradV2 extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.SparseApplyAdagradV2} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyAdagradV2 operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyAdagradV2 + */ + public static SparseApplyAdagradV2 create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyAdagradV2", scope.makeOpName("SparseApplyAdagradV2")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new SparseApplyAdagradV2(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyAdagradV2(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Split.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Split.java new file mode 100644 index 00000000000..f07b4ef8898 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Split.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Splits a tensor into `num_split` tensors along one dimension. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Split extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new Split operation. + * + * @param scope current scope + * @param axis 0-D. The dimension along which to split. Must be in the range + * `[-rank(value), rank(value))`. + * @param value The tensor to split. + * @param numSplit The number of ways to split. Must evenly divide + * `value.shape[split_dim]`. + * @return a new instance of Split + */ + public static Split create(Scope scope, Operand axis, Operand value, Long numSplit) { + OperationBuilder opBuilder = scope.env().opBuilder("Split", scope.makeOpName("Split")); + opBuilder.addInput(axis.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_split", numSplit); + return new Split(opBuilder.build()); + } + + /** + * They are identically shaped tensors, whose shape matches that of `value` + * except along `axis`, where their sizes are + * `values.shape[split_dim] / num_split`. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + private List> output; + + @SuppressWarnings("unchecked") + private Split(Operation operation) { + super(operation); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList((Output[])operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SplitV.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SplitV.java new file mode 100644 index 00000000000..bc2ca20f0a8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SplitV.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Splits a tensor into `num_split` tensors along one dimension. + * + * @param data type for {@code output()} output + */ +@Operator +public final class SplitV extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new SplitV operation. + * + * @param scope current scope + * @param value The tensor to split. + * @param sizeSplits list containing the sizes of each output tensor along the split + * dimension. Must sum to the dimension of value along split_dim. + * Can contain one -1 indicating that dimension is to be inferred. + * @param axis 0-D. The dimension along which to split. Must be in the range + * `[-rank(value), rank(value))`. + * @param numSplit + * @return a new instance of SplitV + */ + public static SplitV create(Scope scope, Operand value, Operand sizeSplits, Operand axis, Long numSplit) { + OperationBuilder opBuilder = scope.env().opBuilder("SplitV", scope.makeOpName("SplitV")); + opBuilder.addInput(value.asOutput()); + opBuilder.addInput(sizeSplits.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_split", numSplit); + return new SplitV(opBuilder.build()); + } + + /** + * Tensors whose shape matches that of `value` + * except along `axis`, where their sizes are + * `size_splits[i]`. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + private List> output; + + @SuppressWarnings("unchecked") + private SplitV(Operation operation) { + super(operation); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList((Output[])operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Squeeze.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Squeeze.java new file mode 100644 index 00000000000..fd78ecc7438 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Squeeze.java @@ -0,0 +1,130 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Removes dimensions of size 1 from the shape of a tensor. + *

    + * Given a tensor `input`, this operation returns a tensor of the same type with + * all dimensions of size 1 removed. If you don't want to remove all size 1 + * dimensions, you can remove specific size 1 dimensions by specifying + * `axis`. + *

    + * For example: + *

    {@code
    + * # 't' is a tensor of shape [1, 2, 1, 3, 1, 1]
    + * shape(squeeze(t)) ==> [2, 3]
    + * }
    + * Or, to remove specific size 1 dimensions: + *
    {@code
    + * # 't' is a tensor of shape [1, 2, 1, 3, 1, 1]
    + * shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1]
    + * }
    + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Squeeze extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Squeeze} + */ + public static class Options { + + /** + * @param axis If specified, only squeezes the dimensions listed. The dimension + * index starts at 0. It is an error to squeeze a dimension that is not 1. Must + * be in the range `[-rank(input), rank(input))`. + */ + public Options axis(List axis) { + this.axis = axis; + return this; + } + + private List axis; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Squeeze operation. + * + * @param scope current scope + * @param input The `input` to squeeze. + * @param options carries optional attributes values + * @return a new instance of Squeeze + */ + public static Squeeze create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Squeeze", scope.makeOpName("Squeeze")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.axis != null) { + long[] axisArray = new long[opts.axis.size()]; + for (int i = 0; i < axisArray.length; ++i) { + axisArray[i] = opts.axis.get(i); + } + opBuilder.setAttr("squeeze_dims", axisArray); + } + } + } + return new Squeeze(opBuilder.build()); + } + + /** + * @param axis If specified, only squeezes the dimensions listed. The dimension + * index starts at 0. It is an error to squeeze a dimension that is not 1. Must + * be in the range `[-rank(input), rank(input))`. + */ + public static Options axis(List axis) { + return new Options().axis(axis); + } + + /** + * Contains the same data as `input`, but has one or more dimensions of + * size 1 removed. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Squeeze(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Stack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Stack.java new file mode 100644 index 00000000000..8b49699ec2b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Stack.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Packs a list of `N` rank-`R` tensors into one rank-`(R+1)` tensor. + *

    + * Packs the `N` tensors in `values` into a tensor with rank one higher than each + * tensor in `values`, by packing them along the `axis` dimension. + * Given a list of tensors of shape `(A, B, C)`; + *

    + * if `axis == 0` then the `output` tensor will have the shape `(N, A, B, C)`. + * if `axis == 1` then the `output` tensor will have the shape `(A, N, B, C)`. + * Etc. + *

    + * For example: + *

    {@code
    + * # 'x' is [1, 4]
    + * # 'y' is [2, 5]
    + * # 'z' is [3, 6]
    + * pack([x, y, z]) => [[1, 4], [2, 5], [3, 6]]  # Pack along first dim.
    + * pack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]]
    + * }
    + * This is the opposite of `unpack`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Stack extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Stack} + */ + public static class Options { + + /** + * @param axis Dimension along which to pack. Negative values wrap around, so the + * valid range is `[-(R+1), R+1)`. + */ + public Options axis(Long axis) { + this.axis = axis; + return this; + } + + private Long axis; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Stack operation. + * + * @param scope current scope + * @param values Must be of same shape and type. + * @param options carries optional attributes values + * @return a new instance of Stack + */ + public static Stack create(Scope scope, Iterable> values, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Pack", scope.makeOpName("Stack")); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.axis != null) { + opBuilder.setAttr("axis", opts.axis); + } + } + } + return new Stack(opBuilder.build()); + } + + /** + * @param axis Dimension along which to pack. Negative values wrap around, so the + * valid range is `[-(R+1), R+1)`. + */ + public static Options axis(Long axis) { + return new Options().axis(axis); + } + + /** + * The packed tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Stack(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Stage.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Stage.java new file mode 100644 index 00000000000..2ba4cffb377 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Stage.java @@ -0,0 +1,153 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Stage values similar to a lightweight Enqueue. + *

    + * The basic functionality of this Op is similar to a queue with many + * fewer capabilities and options. This Op is optimized for performance. + */ +@Operator +public final class Stage extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Stage} + */ + public static class Options { + + /** + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit The maximum number of bytes allowed for Tensors in the Staging Area. + * If > 0, inserts will block until sufficient space is available. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName It is necessary to match this name to the matching Unstage Op. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Stage operation. + * + * @param scope current scope + * @param values a list of tensors + * dtypes A list of data types that inserted values should adhere to. + * @param options carries optional attributes values + * @return a new instance of Stage + */ + public static Stage create(Scope scope, Iterable> values, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Stage", scope.makeOpName("Stage")); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new Stage(opBuilder.build()); + } + + /** + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit The maximum number of bytes allowed for Tensors in the Staging Area. + * If > 0, inserts will block until sufficient space is available. + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName It is necessary to match this name to the matching Unstage Op. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + + private Stage(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StageClear.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StageClear.java new file mode 100644 index 00000000000..a8232f541ff --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StageClear.java @@ -0,0 +1,147 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op removes all elements in the underlying container. + */ +@Operator +public final class StageClear extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StageClear} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StageClear operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of StageClear + */ + public static StageClear create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StageClear", scope.makeOpName("StageClear")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new StageClear(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + + private StageClear(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StagePeek.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StagePeek.java new file mode 100644 index 00000000000..c2b76b92ec0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StagePeek.java @@ -0,0 +1,174 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op peeks at the values at the specified index. If the + *

    + * underlying container does not contain sufficient elements + * this op will block until it does. This Op is optimized for + * performance. + */ +@Operator +public final class StagePeek extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StagePeek} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StagePeek operation. + * + * @param scope current scope + * @param index + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of StagePeek + */ + public static StagePeek create(Scope scope, Operand index, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StagePeek", scope.makeOpName("StagePeek")); + opBuilder.addInput(index.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new StagePeek(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public List> values() { + return values; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) values.iterator(); + } + + private List> values; + + private StagePeek(Operation operation) { + super(operation); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StageSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StageSize.java new file mode 100644 index 00000000000..1822f34ed99 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StageSize.java @@ -0,0 +1,163 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op returns the number of elements in the underlying container. + */ +@Operator +public final class StageSize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StageSize} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StageSize operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of StageSize + */ + public static StageSize create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StageSize", scope.makeOpName("StageSize")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new StageSize(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private StageSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulRandomBinomial.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulRandomBinomial.java new file mode 100644 index 00000000000..10f78abfbd8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulRandomBinomial.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator +public final class StatefulRandomBinomial extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatefulRandomBinomial operation. + * + * @param scope current scope + * @param resource + * @param algorithm + * @param shape + * @param counts + * @param probs + * @param dtype + * @return a new instance of StatefulRandomBinomial + */ + public static StatefulRandomBinomial create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand counts, Operand probs, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatefulRandomBinomial", scope.makeOpName("StatefulRandomBinomial")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(algorithm.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(counts.asOutput()); + opBuilder.addInput(probs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatefulRandomBinomial(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatefulRandomBinomial operation using default output types. + * + * @param scope current scope + * @param resource + * @param algorithm + * @param shape + * @param counts + * @param probs + * @return a new instance of StatefulRandomBinomial + */ + public static StatefulRandomBinomial create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand counts, Operand probs) { + return create(scope, resource, algorithm, shape, counts, probs, Long.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatefulRandomBinomial(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormal.java new file mode 100644 index 00000000000..f0f61c60ec8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormal.java @@ -0,0 +1,88 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from a normal distribution. This op is deprecated in favor of op 'StatefulStandardNormalV2' + *

    + * The generated values will have mean 0 and standard deviation 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class StatefulStandardNormal extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatefulStandardNormal operation. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of StatefulStandardNormal + */ + public static StatefulStandardNormal create(Scope scope, Operand resource, Operand shape, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatefulStandardNormal", scope.makeOpName("StatefulStandardNormal")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatefulStandardNormal(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatefulStandardNormal operation using default output types. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param shape The shape of the output tensor. + * @return a new instance of StatefulStandardNormal + */ + public static StatefulStandardNormal create(Scope scope, Operand resource, Operand shape) { + return create(scope, resource, shape, Float.class); + } + + /** + * A tensor of the specified shape filled with random normal values. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatefulStandardNormal(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormalV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormalV2.java new file mode 100644 index 00000000000..0e12656238d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormalV2.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from a normal distribution. + *

    + * The generated values will have mean 0 and standard deviation 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class StatefulStandardNormalV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatefulStandardNormalV2 operation. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of StatefulStandardNormalV2 + */ + public static StatefulStandardNormalV2 create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatefulStandardNormalV2", scope.makeOpName("StatefulStandardNormalV2")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(algorithm.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatefulStandardNormalV2(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatefulStandardNormalV2 operation using default output types. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @return a new instance of StatefulStandardNormalV2 + */ + public static StatefulStandardNormalV2 create(Scope scope, Operand resource, Operand algorithm, Operand shape) { + return create(scope, resource, algorithm, shape, Float.class); + } + + /** + * A tensor of the specified shape filled with random normal values. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatefulStandardNormalV2(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulTruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulTruncatedNormal.java new file mode 100644 index 00000000000..fd190a04c0d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulTruncatedNormal.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Outputs random values from a truncated normal distribution. + *

    + * The generated values follow a normal distribution with mean 0 and standard + * deviation 1, except that values whose magnitude is more than 2 standard + * deviations from the mean are dropped and re-picked. + * + * @param data type for {@code output()} output + */ +public final class StatefulTruncatedNormal extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatefulTruncatedNormal operation. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of StatefulTruncatedNormal + */ + public static StatefulTruncatedNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatefulTruncatedNormal", scope.makeOpName("StatefulTruncatedNormal")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(algorithm.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatefulTruncatedNormal(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatefulTruncatedNormal operation using default output types. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @return a new instance of StatefulTruncatedNormal + */ + public static StatefulTruncatedNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape) { + return create(scope, resource, algorithm, shape, Float.class); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatefulTruncatedNormal(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniform.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniform.java new file mode 100644 index 00000000000..e38edeff019 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniform.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Outputs random values from a uniform distribution. + *

    + * The generated values follow a uniform distribution in the range `[0, 1)`. The + * lower bound 0 is included in the range, while the upper bound 1 is excluded. + * + * @param data type for {@code output()} output + */ +public final class StatefulUniform extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatefulUniform operation. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of StatefulUniform + */ + public static StatefulUniform create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatefulUniform", scope.makeOpName("StatefulUniform")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(algorithm.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatefulUniform(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatefulUniform operation using default output types. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @return a new instance of StatefulUniform + */ + public static StatefulUniform create(Scope scope, Operand resource, Operand algorithm, Operand shape) { + return create(scope, resource, algorithm, shape, Float.class); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatefulUniform(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformFullInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformFullInt.java new file mode 100644 index 00000000000..03d3a5c7c8a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformFullInt.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Outputs random integers from a uniform distribution. + *

    + * The generated values are uniform integers covering the whole range of `dtype`. + * + * @param data type for {@code output()} output + */ +public final class StatefulUniformFullInt extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatefulUniformFullInt operation. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @return a new instance of StatefulUniformFullInt + */ + public static StatefulUniformFullInt create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatefulUniformFullInt", scope.makeOpName("StatefulUniformFullInt")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(algorithm.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatefulUniformFullInt(opBuilder.build()); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatefulUniformFullInt(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformInt.java new file mode 100644 index 00000000000..c68cdf33f00 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformInt.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Outputs random integers from a uniform distribution. + *

    + * The generated values are uniform integers in the range `[minval, maxval)`. + * The lower bound `minval` is included in the range, while the upper bound + * `maxval` is excluded. + *

    + * The random integers are slightly biased unless `maxval - minval` is an exact + * power of two. The bias is small for values of `maxval - minval` significantly + * smaller than the range of the output (either `2^32` or `2^64`). + * + * @param data type for {@code output()} output + */ +public final class StatefulUniformInt extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatefulUniformInt operation. + * + * @param scope current scope + * @param resource The handle of the resource variable that stores the state of the RNG. + * @param algorithm The RNG algorithm. + * @param shape The shape of the output tensor. + * @param minval Minimum value (inclusive, scalar). + * @param maxval Maximum value (exclusive, scalar). + * @return a new instance of StatefulUniformInt + */ + public static StatefulUniformInt create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand minval, Operand maxval) { + OperationBuilder opBuilder = scope.env().opBuilder("StatefulUniformInt", scope.makeOpName("StatefulUniformInt")); + opBuilder.addInput(resource.asOutput()); + opBuilder.addInput(algorithm.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(minval.asOutput()); + opBuilder.addInput(maxval.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new StatefulUniformInt(opBuilder.build()); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatefulUniformInt(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorHandleV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorHandleV2.java new file mode 100644 index 00000000000..9e1e930862d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorHandleV2.java @@ -0,0 +1,115 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class StatsAggregatorHandleV2 extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StatsAggregatorHandleV2} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StatsAggregatorHandleV2 operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of StatsAggregatorHandleV2 + */ + public static StatsAggregatorHandleV2 create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StatsAggregatorHandleV2", scope.makeOpName("StatsAggregatorHandleV2")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new StatsAggregatorHandleV2(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private StatsAggregatorHandleV2(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorSetSummaryWriter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorSetSummaryWriter.java new file mode 100644 index 00000000000..83de21836bf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorSetSummaryWriter.java @@ -0,0 +1,51 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Set a summary_writer_interface to record statistics using given stats_aggregator. + */ +public final class StatsAggregatorSetSummaryWriter extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new StatsAggregatorSetSummaryWriter operation. + * + * @param scope current scope + * @param statsAggregator + * @param summary + * @return a new instance of StatsAggregatorSetSummaryWriter + */ + public static StatsAggregatorSetSummaryWriter create(Scope scope, Operand statsAggregator, Operand summary) { + OperationBuilder opBuilder = scope.env().opBuilder("StatsAggregatorSetSummaryWriter", scope.makeOpName("StatsAggregatorSetSummaryWriter")); + opBuilder.addInput(statsAggregator.asOutput()); + opBuilder.addInput(summary.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new StatsAggregatorSetSummaryWriter(opBuilder.build()); + } + + + private StatsAggregatorSetSummaryWriter(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StopGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StopGradient.java new file mode 100644 index 00000000000..8911bb9c9f8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StopGradient.java @@ -0,0 +1,93 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Stops gradient computation. + *

    + * When executed in a graph, this op outputs its input tensor as-is. + *

    + * When building ops to compute gradients, this op prevents the contribution of + * its inputs to be taken into account. Normally, the gradient generator adds ops + * to a graph to compute the derivatives of a specified 'loss' by recursively + * finding out inputs that contributed to its computation. If you insert this op + * in the graph it inputs are masked from the gradient generator. They are not + * taken into account for computing gradients. + *

    + * This is useful any time you want to compute a value with TensorFlow but need + * to pretend that the value was a constant. Some examples include: + *

      + *
    • + * The EM algorithm where the M-step should not involve backpropagation + * through the output of the E-step. + *
    • + *
    • + * Contrastive divergence training of Boltzmann machines where, when + * differentiating the energy function, the training must not backpropagate + * through the graph that generated the samples from the model. + *
    • + *
    • + * Adversarial training, where no backprop should happen through the adversarial + * example generation process. + * + * @param data type for {@code output()} output + */ +@Operator +public final class StopGradient extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StopGradient operation. + * + * @param scope current scope + * @param input + * @return a new instance of StopGradient + */ + public static StopGradient create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("StopGradient", scope.makeOpName("StopGradient")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new StopGradient(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StopGradient(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSlice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSlice.java new file mode 100644 index 00000000000..0e8361c5688 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSlice.java @@ -0,0 +1,310 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Return a strided slice from `input`. + *

      + * Note, most python users will want to use the Python `Tensor.__getitem__` + * or `Variable.__getitem__` rather than this op directly. + *

      + * The goal of this op is to produce a new tensor with a subset of + * the elements from the `n` dimensional `input` tensor. The subset is chosen using + * a sequence of `m` sparse range specifications encoded into the arguments + * of this function. Note, in some cases + * `m` could be equal to `n`, but this need not be the case. Each + * range specification entry can be one of the following: + *

      + * - An ellipsis (...). Ellipses are used to imply zero or more + * dimensions of full-dimension selection and are produced using + * `ellipsis_mask`. For example, `foo[...]` is the identity slice. + *

      + * - A new axis. This is used to insert a new shape=1 dimension and is + * produced using `new_axis_mask`. For example, `foo[:, ...]` where + * `foo` is shape `(3, 4)` produces a `(1, 3, 4)` tensor. + *

      + * - A range `begin:end:stride`. This is used to specify how much to choose from + * a given dimension. `stride` can be any integer but 0. `begin` is an integer + * which represents the index of the first value to select while `end` represents + * the index of the last value to select. The number of values selected in each + * dimension is `end - begin` if `stride > 0` and `begin - end` if `stride < 0`. + * `begin` and `end` can be negative where `-1` is the last element, `-2` is + * the second to last. `begin_mask` controls whether to replace the explicitly + * given `begin` with an implicit effective value of `0` if `stride > 0` and + * `-1` if `stride < 0`. `end_mask` is analogous but produces the number + * required to create the largest open interval. For example, given a shape + * `(3,)` tensor `foo[:]`, the effective `begin` and `end` are `0` and `3`. Do + * not assume this is equivalent to `foo[0:-1]` which has an effective `begin` + * and `end` of `0` and `2`. Another example is `foo[-2::-1]` which reverses the + * first dimension of a tensor while dropping the last two (in the original + * order elements). For example `foo = [1,2,3,4]; foo[-2::-1]` is `[4,3]`. + *

      + * - A single index. This is used to keep only elements that have a given + * index. For example (`foo[2, :]` on a shape `(5,6)` tensor produces a + * shape `(6,)` tensor. This is encoded in `begin` and `end` and + * `shrink_axis_mask`. + *

      + * Each conceptual range specification is encoded in the op's argument. This + * encoding is best understand by considering a non-trivial example. In + * particular, + * `foo[1, 2:4, None, ..., :-3:-1, :]` will be encoded as + *

      {@code
      + * begin = [1, 2, x, x, 0, x] # x denotes don't care (usually 0)
      + * end = [2, 4, x, x, -3, x]
      + * strides = [1, 1, x, x, -1, 1]
      + * begin_mask = 1<<4 | 1 << 5 = 48
      + * end_mask = 1<<5 = 32
      + * ellipsis_mask = 1<<3 = 8
      + * new_axis_mask = 1<<2 4
      + * shrink_axis_mask = 1<<0
      + * }
      + * In this case if `foo.shape` is (5, 5, 5, 5, 5, 5) the final shape of + * the slice becomes (2, 1, 5, 5, 2, 5). + * Let us walk step by step through each argument specification. + *

      + * 1. The first argument in the example slice is turned into `begin = 1` and + * `end = begin + 1 = 2`. To disambiguate from the original spec `2:4` we + * also set the appropriate bit in `shrink_axis_mask`. + *

      + * 2. `2:4` is contributes 2, 4, 1 to begin, end, and stride. All masks have + * zero bits contributed. + *

      + * 3. None is a synonym for `tf.newaxis`. This means insert a dimension of size 1 + * dimension in the final shape. Dummy values are contributed to begin, + * end and stride, while the new_axis_mask bit is set. + *

      + * 4. `...` grab the full ranges from as many dimensions as needed to + * fully specify a slice for every dimension of the input shape. + *

      + * 5. `:-3:-1` shows the use of negative indices. A negative index `i` associated + * with a dimension that has shape `s` is converted to a positive index + * `s + i`. So `-1` becomes `s-1` (i.e. the last element). This conversion + * is done internally so begin, end and strides receive x, -3, and -1. + * The appropriate begin_mask bit is set to indicate the start range is the + * full range (ignoring the x). + *

      + * 6. `:` indicates that the entire contents of the corresponding dimension + * is selected. This is equivalent to `::` or `0::1`. begin, end, and strides + * receive 0, 0, and 1, respectively. The appropriate bits in `begin_mask` and + * `end_mask` are also set. + *

      + * Requirements: + * `0 != strides[i] for i in [0, m)` + * `ellipsis_mask must be a power of two (only one ellipsis)` + * + * @param data type for {@code output()} output + */ +@Operator +public final class StridedSlice extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StridedSlice} + */ + public static class Options { + + /** + * @param beginMask a bitmask where a bit i being 1 means to ignore the begin + * value and instead use the largest interval possible. At runtime + * begin[i] will be replaced with `[0, n-1)` if `stride[i] > 0` or + * `[-1, n-1]` if `stride[i] < 0` + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * @param endMask analogous to `begin_mask` + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * @param ellipsisMask a bitmask where bit `i` being 1 means the `i`th + * position is actually an ellipsis. One bit at most can be 1. + * If `ellipsis_mask == 0`, then an implicit ellipsis mask of `1 << (m+1)` + * is provided. This means that `foo[3:5] == foo[3:5, ...]`. An ellipsis + * implicitly creates as many range specifications as necessary to fully + * specify the sliced range for every dimension. For example for a 4-dimensional + * tensor `foo` the slice `foo[2, ..., 5:8]` implies `foo[2, :, :, 5:8]`. + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * @param newAxisMask a bitmask where bit `i` being 1 means the `i`th + * specification creates a new shape 1 dimension. For example + * `foo[:4, tf.newaxis, :2]` would produce a shape `(4, 1, 2)` tensor. + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * @param shrinkAxisMask a bitmask where bit `i` implies that the `i`th + * specification should shrink the dimensionality. begin and end + * must imply a slice of size 1 in the dimension. For example in + * python one might do `foo[:, 3, :]` which would result in + * `shrink_axis_mask` being 2. + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + + private Long beginMask; + private Long endMask; + private Long ellipsisMask; + private Long newAxisMask; + private Long shrinkAxisMask; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StridedSlice operation. + * + * @param scope current scope + * @param input + * @param begin `begin[k]` specifies the offset into the `k`th range specification. + * The exact dimension this corresponds to will be determined by context. + * Out-of-bounds values will be silently clamped. If the `k`th bit of + * `begin_mask` then `begin[k]` is ignored and the full range of the + * appropriate dimension is used instead. Negative values causes indexing + * to start from the highest element e.g. If `foo==[1,2,3]` then `foo[-1]==3`. + * @param end `end[i]` is like `begin` with the exception that `end_mask` is + * used to determine full ranges. + * @param strides `strides[i]` specifies the increment in the `i`th specification + * after extracting a given element. Negative indices will reverse + * the original order. Out or range values are + * clamped to `[0,dim[i]) if slice[i]>0` or `[-1,dim[i]-1] if slice[i] < 0` + * @param options carries optional attributes values + * @return a new instance of StridedSlice + */ + public static StridedSlice create(Scope scope, Operand input, Operand begin, Operand end, Operand strides, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StridedSlice", scope.makeOpName("StridedSlice")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(begin.asOutput()); + opBuilder.addInput(end.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.beginMask != null) { + opBuilder.setAttr("begin_mask", opts.beginMask); + } + if (opts.endMask != null) { + opBuilder.setAttr("end_mask", opts.endMask); + } + if (opts.ellipsisMask != null) { + opBuilder.setAttr("ellipsis_mask", opts.ellipsisMask); + } + if (opts.newAxisMask != null) { + opBuilder.setAttr("new_axis_mask", opts.newAxisMask); + } + if (opts.shrinkAxisMask != null) { + opBuilder.setAttr("shrink_axis_mask", opts.shrinkAxisMask); + } + } + } + return new StridedSlice(opBuilder.build()); + } + + /** + * @param beginMask a bitmask where a bit i being 1 means to ignore the begin + * value and instead use the largest interval possible. At runtime + * begin[i] will be replaced with `[0, n-1)` if `stride[i] > 0` or + * `[-1, n-1]` if `stride[i] < 0` + */ + public static Options beginMask(Long beginMask) { + return new Options().beginMask(beginMask); + } + + /** + * @param endMask analogous to `begin_mask` + */ + public static Options endMask(Long endMask) { + return new Options().endMask(endMask); + } + + /** + * @param ellipsisMask a bitmask where bit `i` being 1 means the `i`th + * position is actually an ellipsis. One bit at most can be 1. + * If `ellipsis_mask == 0`, then an implicit ellipsis mask of `1 << (m+1)` + * is provided. This means that `foo[3:5] == foo[3:5, ...]`. An ellipsis + * implicitly creates as many range specifications as necessary to fully + * specify the sliced range for every dimension. For example for a 4-dimensional + * tensor `foo` the slice `foo[2, ..., 5:8]` implies `foo[2, :, :, 5:8]`. + */ + public static Options ellipsisMask(Long ellipsisMask) { + return new Options().ellipsisMask(ellipsisMask); + } + + /** + * @param newAxisMask a bitmask where bit `i` being 1 means the `i`th + * specification creates a new shape 1 dimension. For example + * `foo[:4, tf.newaxis, :2]` would produce a shape `(4, 1, 2)` tensor. + */ + public static Options newAxisMask(Long newAxisMask) { + return new Options().newAxisMask(newAxisMask); + } + + /** + * @param shrinkAxisMask a bitmask where bit `i` implies that the `i`th + * specification should shrink the dimensionality. begin and end + * must imply a slice of size 1 in the dimension. For example in + * python one might do `foo[:, 3, :]` which would result in + * `shrink_axis_mask` being 2. + */ + public static Options shrinkAxisMask(Long shrinkAxisMask) { + return new Options().shrinkAxisMask(shrinkAxisMask); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StridedSlice(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSliceAssign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSliceAssign.java new file mode 100644 index 00000000000..a08e68bcf52 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSliceAssign.java @@ -0,0 +1,193 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Assign `value` to the sliced l-value reference of `ref`. + *

      + * The values of `value` are assigned to the positions in the variable + * `ref` that are selected by the slice parameters. The slice parameters + * `begin`, `end`, `strides`, etc. work exactly as in `StridedSlice`. + *

      + * NOTE this op currently does not support broadcasting and so `value`'s + * shape must be exactly the shape produced by the slice of `ref`. + * + * @param data type for {@code outputRef()} output + */ +@Operator +public final class StridedSliceAssign extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StridedSliceAssign} + */ + public static class Options { + + /** + * @param beginMask + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * @param endMask + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * @param ellipsisMask + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * @param newAxisMask + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * @param shrinkAxisMask + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + + private Long beginMask; + private Long endMask; + private Long ellipsisMask; + private Long newAxisMask; + private Long shrinkAxisMask; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StridedSliceAssign operation. + * + * @param scope current scope + * @param ref + * @param begin + * @param end + * @param strides + * @param value + * @param options carries optional attributes values + * @return a new instance of StridedSliceAssign + */ + public static StridedSliceAssign create(Scope scope, Operand ref, Operand begin, Operand end, Operand strides, Operand value, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StridedSliceAssign", scope.makeOpName("StridedSliceAssign")); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(begin.asOutput()); + opBuilder.addInput(end.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.beginMask != null) { + opBuilder.setAttr("begin_mask", opts.beginMask); + } + if (opts.endMask != null) { + opBuilder.setAttr("end_mask", opts.endMask); + } + if (opts.ellipsisMask != null) { + opBuilder.setAttr("ellipsis_mask", opts.ellipsisMask); + } + if (opts.newAxisMask != null) { + opBuilder.setAttr("new_axis_mask", opts.newAxisMask); + } + if (opts.shrinkAxisMask != null) { + opBuilder.setAttr("shrink_axis_mask", opts.shrinkAxisMask); + } + } + } + return new StridedSliceAssign(opBuilder.build()); + } + + /** + * @param beginMask + */ + public static Options beginMask(Long beginMask) { + return new Options().beginMask(beginMask); + } + + /** + * @param endMask + */ + public static Options endMask(Long endMask) { + return new Options().endMask(endMask); + } + + /** + * @param ellipsisMask + */ + public static Options ellipsisMask(Long ellipsisMask) { + return new Options().ellipsisMask(ellipsisMask); + } + + /** + * @param newAxisMask + */ + public static Options newAxisMask(Long newAxisMask) { + return new Options().newAxisMask(newAxisMask); + } + + /** + * @param shrinkAxisMask + */ + public static Options shrinkAxisMask(Long shrinkAxisMask) { + return new Options().shrinkAxisMask(shrinkAxisMask); + } + + /** + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + private Output outputRef; + + private StridedSliceAssign(Operation operation) { + super(operation); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSliceGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSliceGrad.java new file mode 100644 index 00000000000..d2db9ddf8b9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StridedSliceGrad.java @@ -0,0 +1,195 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the gradient of `StridedSlice`. + *

      + * Since `StridedSlice` cuts out pieces of its `input` which is size + * `shape`, its gradient will have the same shape (which is passed here + * as `shape`). The gradient will be zero in any element that the slice + * does not select. + *

      + * Arguments are the same as StridedSliceGrad with the exception that + * `dy` is the input gradient to be propagated and `shape` is the + * shape of `StridedSlice`'s `input`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class StridedSliceGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StridedSliceGrad} + */ + public static class Options { + + /** + * @param beginMask + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * @param endMask + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * @param ellipsisMask + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * @param newAxisMask + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * @param shrinkAxisMask + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + + private Long beginMask; + private Long endMask; + private Long ellipsisMask; + private Long newAxisMask; + private Long shrinkAxisMask; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StridedSliceGrad operation. + * + * @param scope current scope + * @param shape + * @param begin + * @param end + * @param strides + * @param dy + * @param options carries optional attributes values + * @return a new instance of StridedSliceGrad + */ + public static StridedSliceGrad create(Scope scope, Operand shape, Operand begin, Operand end, Operand strides, Operand dy, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StridedSliceGrad", scope.makeOpName("StridedSliceGrad")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(begin.asOutput()); + opBuilder.addInput(end.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder.addInput(dy.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.beginMask != null) { + opBuilder.setAttr("begin_mask", opts.beginMask); + } + if (opts.endMask != null) { + opBuilder.setAttr("end_mask", opts.endMask); + } + if (opts.ellipsisMask != null) { + opBuilder.setAttr("ellipsis_mask", opts.ellipsisMask); + } + if (opts.newAxisMask != null) { + opBuilder.setAttr("new_axis_mask", opts.newAxisMask); + } + if (opts.shrinkAxisMask != null) { + opBuilder.setAttr("shrink_axis_mask", opts.shrinkAxisMask); + } + } + } + return new StridedSliceGrad(opBuilder.build()); + } + + /** + * @param beginMask + */ + public static Options beginMask(Long beginMask) { + return new Options().beginMask(beginMask); + } + + /** + * @param endMask + */ + public static Options endMask(Long endMask) { + return new Options().endMask(endMask); + } + + /** + * @param ellipsisMask + */ + public static Options ellipsisMask(Long ellipsisMask) { + return new Options().ellipsisMask(ellipsisMask); + } + + /** + * @param newAxisMask + */ + public static Options newAxisMask(Long newAxisMask) { + return new Options().newAxisMask(newAxisMask); + } + + /** + * @param shrinkAxisMask + */ + public static Options shrinkAxisMask(Long shrinkAxisMask) { + return new Options().shrinkAxisMask(shrinkAxisMask); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StridedSliceGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringLower.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringLower.java new file mode 100644 index 00000000000..d9552ccee37 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringLower.java @@ -0,0 +1,99 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator +public final class StringLower extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StringLower} + */ + public static class Options { + + /** + * @param encoding + */ + public Options encoding(String encoding) { + this.encoding = encoding; + return this; + } + + private String encoding; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StringLower operation. + * + * @param scope current scope + * @param input + * @param options carries optional attributes values + * @return a new instance of StringLower + */ + public static StringLower create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StringLower", scope.makeOpName("StringLower")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.encoding != null) { + opBuilder.setAttr("encoding", opts.encoding); + } + } + } + return new StringLower(opBuilder.build()); + } + + /** + * @param encoding + */ + public static Options encoding(String encoding) { + return new Options().encoding(encoding); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StringLower(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringNGrams.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringNGrams.java new file mode 100644 index 00000000000..82818eaad6b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringNGrams.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates ngrams from ragged string data. + *

      + * This op accepts a ragged tensor with 1 ragged dimension containing only + * strings and outputs a ragged tensor with 1 ragged dimension containing ngrams + * of that string, joined along the innermost axis. + * + * @param data type for {@code ngramsSplits()} output + */ +@Operator +public final class StringNGrams extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new StringNGrams operation. + * + * @param scope current scope + * @param data The values tensor of the ragged string tensor to make ngrams out of. Must be a + * 1D string tensor. + * @param dataSplits The splits tensor of the ragged string tensor to make ngrams out of. + * @param separator The string to append between elements of the token. Use "" for no separator. + * @param ngramWidths The sizes of the ngrams to create. + * @param leftPad The string to use to pad the left side of the ngram sequence. Only used if + * pad_width != 0. + * @param rightPad The string to use to pad the right side of the ngram sequence. Only used if + * pad_width != 0. + * @param padWidth The number of padding elements to add to each side of each + * sequence. Note that padding will never be greater than 'ngram_widths'-1 + * regardless of this value. If `pad_width=-1`, then add `max(ngram_widths)-1` + * elements. + * @param preserveShortSequences + * @return a new instance of StringNGrams + */ + public static StringNGrams create(Scope scope, Operand data, Operand dataSplits, String separator, List ngramWidths, String leftPad, String rightPad, Long padWidth, Boolean preserveShortSequences) { + OperationBuilder opBuilder = scope.env().opBuilder("StringNGrams", scope.makeOpName("StringNGrams")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(dataSplits.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("separator", separator); + long[] ngramWidthsArray = new long[ngramWidths.size()]; + for (int i = 0; i < ngramWidthsArray.length; ++i) { + ngramWidthsArray[i] = ngramWidths.get(i); + } + opBuilder.setAttr("ngram_widths", ngramWidthsArray); + opBuilder.setAttr("left_pad", leftPad); + opBuilder.setAttr("right_pad", rightPad); + opBuilder.setAttr("pad_width", padWidth); + opBuilder.setAttr("preserve_short_sequences", preserveShortSequences); + return new StringNGrams(opBuilder.build()); + } + + /** + * The values tensor of the output ngrams ragged tensor. + */ + public Output ngrams() { + return ngrams; + } + + /** + * The splits tensor of the output ngrams ragged tensor. + */ + public Output ngramsSplits() { + return ngramsSplits; + } + + private Output ngrams; + private Output ngramsSplits; + + private StringNGrams(Operation operation) { + super(operation); + int outputIdx = 0; + ngrams = operation.output(outputIdx++); + ngramsSplits = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringUpper.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringUpper.java new file mode 100644 index 00000000000..5a6792f855c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringUpper.java @@ -0,0 +1,99 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator +public final class StringUpper extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.StringUpper} + */ + public static class Options { + + /** + * @param encoding + */ + public Options encoding(String encoding) { + this.encoding = encoding; + return this; + } + + private String encoding; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StringUpper operation. + * + * @param scope current scope + * @param input + * @param options carries optional attributes values + * @return a new instance of StringUpper + */ + public static StringUpper create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StringUpper", scope.makeOpName("StringUpper")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.encoding != null) { + opBuilder.setAttr("encoding", opts.encoding); + } + } + } + return new StringUpper(opBuilder.build()); + } + + /** + * @param encoding + */ + public static Options encoding(String encoding) { + return new Options().encoding(encoding); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StringUpper(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Sum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Sum.java new file mode 100644 index 00000000000..71f003c2a3b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Sum.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum of elements across dimensions of a tensor. + *

      + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Sum extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Sum} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Sum operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of Sum + */ + public static Sum create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Sum", scope.makeOpName("Sum")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new Sum(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Sum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SwitchCond.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SwitchCond.java new file mode 100644 index 00000000000..111d0d3fd21 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SwitchCond.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Forwards `data` to the output port determined by `pred`. + *

      + * If `pred` is true, the `data` input is forwarded to `output_true`. Otherwise, + * the data goes to `output_false`. + *

      + * See also `RefSwitch` and `Merge`. + * + * @param data type for {@code outputFalse()} output + */ +@Operator +public final class SwitchCond extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SwitchCond operation. + * + * @param scope current scope + * @param data The tensor to be forwarded to the appropriate output. + * @param pred A scalar that specifies which output port will receive data. + * @return a new instance of SwitchCond + */ + public static SwitchCond create(Scope scope, Operand data, Operand pred) { + OperationBuilder opBuilder = scope.env().opBuilder("Switch", scope.makeOpName("SwitchCond")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(pred.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SwitchCond(opBuilder.build()); + } + + /** + * If `pred` is false, data will be forwarded to this output. + */ + public Output outputFalse() { + return outputFalse; + } + + /** + * If `pred` is true, data will be forwarded to this output. + */ + public Output outputTrue() { + return outputTrue; + } + + private Output outputFalse; + private Output outputTrue; + + private SwitchCond(Operation operation) { + super(operation); + int outputIdx = 0; + outputFalse = operation.output(outputIdx++); + outputTrue = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUCompilationResult.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUCompilationResult.java new file mode 100644 index 00000000000..2504c60fa08 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUCompilationResult.java @@ -0,0 +1,62 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * CompilationResultProto indicating the status of the TPU compilation. + */ +public final class TPUCompilationResult extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TPUCompilationResult operation. + * + * @param scope current scope + * @return a new instance of TPUCompilationResult + */ + public static TPUCompilationResult create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("TPUCompilationResult", scope.makeOpName("TPUCompilationResult")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TPUCompilationResult(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TPUCompilationResult(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUEmbeddingActivations.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUEmbeddingActivations.java new file mode 100644 index 00000000000..04769e14ff1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUEmbeddingActivations.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * An op enabling differentiation of TPU Embeddings. + *

      + * This op simply returns its first input, which is assumed to have been sliced + * from the Tensors returned by TPUEmbeddingDequeueActivations. The presence of + * this op, and its first argument being a trainable Variable, enables automatic + * differentiation of graphs containing embeddings via the TPU Embedding Python + * libraries. + */ +public final class TPUEmbeddingActivations extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TPUEmbeddingActivations operation. + * + * @param scope current scope + * @param embeddingVariable A trainable variable, enabling optimizers to find this op. + * @param slicedActivations The embedding activations Tensor to return. + * @param tableId The id of the table in the embedding layer configuration from which + * these activations were computed. + * @param lookupId Identifier of the set of embedding indices which produced these + * activations. + * @return a new instance of TPUEmbeddingActivations + */ + public static TPUEmbeddingActivations create(Scope scope, Operand embeddingVariable, Operand slicedActivations, Long tableId, Long lookupId) { + OperationBuilder opBuilder = scope.env().opBuilder("TPUEmbeddingActivations", scope.makeOpName("TPUEmbeddingActivations")); + opBuilder.addInput(embeddingVariable.asOutput()); + opBuilder.addInput(slicedActivations.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("table_id", tableId); + opBuilder.setAttr("lookup_id", lookupId); + return new TPUEmbeddingActivations(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TPUEmbeddingActivations(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUOrdinalSelector.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUOrdinalSelector.java new file mode 100644 index 00000000000..3c1cf19fa90 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUOrdinalSelector.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A TPU core selector Op. + *

      + * This Op produces a set of TPU cores (for warm-up) or a single TPU core + * (for regular inference) to execute the TPU program on. The output is + * consumed by TPUPartitionedCall. + */ +public final class TPUOrdinalSelector extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TPUOrdinalSelector operation. + * + * @param scope current scope + * @return a new instance of TPUOrdinalSelector + */ + public static TPUOrdinalSelector create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("TPUOrdinalSelector", scope.makeOpName("TPUOrdinalSelector")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TPUOrdinalSelector(opBuilder.build()); + } + + /** + * A vector 1 or more TPU cores. + */ + public Output deviceOrdinals() { + return deviceOrdinals; + } + + @Override + public Output asOutput() { + return deviceOrdinals; + } + + private Output deviceOrdinals; + + private TPUOrdinalSelector(Operation operation) { + super(operation); + int outputIdx = 0; + deviceOrdinals = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicateMetadata.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicateMetadata.java new file mode 100644 index 00000000000..54ef808fa37 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicateMetadata.java @@ -0,0 +1,251 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Metadata indicaitng how the TPU computation should be replicated. + */ +public final class TPUReplicateMetadata extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TPUReplicateMetadata} + */ + public static class Options { + + /** + * @param numCoresPerReplica Number of cores per replica. Used for model parallelism. + */ + public Options numCoresPerReplica(Long numCoresPerReplica) { + this.numCoresPerReplica = numCoresPerReplica; + return this; + } + + /** + * @param topology TopologyProto indicating the topology of the TPU pod slice. + */ + public Options topology(String topology) { + this.topology = topology; + return this; + } + + /** + * @param useTpu Whether to place the computation on the TPU. + */ + public Options useTpu(Boolean useTpu) { + this.useTpu = useTpu; + return this; + } + + /** + * @param deviceAssignment The assignment of devices for the computation. + */ + public Options deviceAssignment(List deviceAssignment) { + this.deviceAssignment = deviceAssignment; + return this; + } + + /** + * @param computationShape DEPRECATED. Use num_cores_per_replica instead. + */ + public Options computationShape(List computationShape) { + this.computationShape = computationShape; + return this; + } + + /** + * @param hostComputeCore + */ + public Options hostComputeCore(List hostComputeCore) { + this.hostComputeCore = hostComputeCore; + return this; + } + + /** + * @param paddingMap + */ + public Options paddingMap(List paddingMap) { + this.paddingMap = paddingMap; + return this; + } + + /** + * @param stepMarkerLocation + */ + public Options stepMarkerLocation(String stepMarkerLocation) { + this.stepMarkerLocation = stepMarkerLocation; + return this; + } + + /** + * @param allowSoftPlacement + */ + public Options allowSoftPlacement(Boolean allowSoftPlacement) { + this.allowSoftPlacement = allowSoftPlacement; + return this; + } + + private Long numCoresPerReplica; + private String topology; + private Boolean useTpu; + private List deviceAssignment; + private List computationShape; + private List hostComputeCore; + private List paddingMap; + private String stepMarkerLocation; + private Boolean allowSoftPlacement; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TPUReplicateMetadata operation. + * + * @param scope current scope + * @param numReplicas Number of replicas of the computation + * @param options carries optional attributes values + * @return a new instance of TPUReplicateMetadata + */ + public static TPUReplicateMetadata create(Scope scope, Long numReplicas, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TPUReplicateMetadata", scope.makeOpName("TPUReplicateMetadata")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_replicas", numReplicas); + if (options != null) { + for (Options opts : options) { + if (opts.numCoresPerReplica != null) { + opBuilder.setAttr("num_cores_per_replica", opts.numCoresPerReplica); + } + if (opts.topology != null) { + opBuilder.setAttr("topology", opts.topology); + } + if (opts.useTpu != null) { + opBuilder.setAttr("use_tpu", opts.useTpu); + } + if (opts.deviceAssignment != null) { + long[] deviceAssignmentArray = new long[opts.deviceAssignment.size()]; + for (int i = 0; i < deviceAssignmentArray.length; ++i) { + deviceAssignmentArray[i] = opts.deviceAssignment.get(i); + } + opBuilder.setAttr("device_assignment", deviceAssignmentArray); + } + if (opts.computationShape != null) { + long[] computationShapeArray = new long[opts.computationShape.size()]; + for (int i = 0; i < computationShapeArray.length; ++i) { + computationShapeArray[i] = opts.computationShape.get(i); + } + opBuilder.setAttr("computation_shape", computationShapeArray); + } + if (opts.hostComputeCore != null) { + String[] hostComputeCoreArray = new String[opts.hostComputeCore.size()]; + for (int i = 0; i < hostComputeCoreArray.length; ++i) { + hostComputeCoreArray[i] = opts.hostComputeCore.get(i); + } + opBuilder.setAttr("host_compute_core", hostComputeCoreArray); + } + if (opts.paddingMap != null) { + String[] paddingMapArray = new String[opts.paddingMap.size()]; + for (int i = 0; i < paddingMapArray.length; ++i) { + paddingMapArray[i] = opts.paddingMap.get(i); + } + opBuilder.setAttr("padding_map", paddingMapArray); + } + if (opts.stepMarkerLocation != null) { + opBuilder.setAttr("step_marker_location", opts.stepMarkerLocation); + } + if (opts.allowSoftPlacement != null) { + opBuilder.setAttr("allow_soft_placement", opts.allowSoftPlacement); + } + } + } + return new TPUReplicateMetadata(opBuilder.build()); + } + + /** + * @param numCoresPerReplica Number of cores per replica. Used for model parallelism. + */ + public static Options numCoresPerReplica(Long numCoresPerReplica) { + return new Options().numCoresPerReplica(numCoresPerReplica); + } + + /** + * @param topology TopologyProto indicating the topology of the TPU pod slice. + */ + public static Options topology(String topology) { + return new Options().topology(topology); + } + + /** + * @param useTpu Whether to place the computation on the TPU. + */ + public static Options useTpu(Boolean useTpu) { + return new Options().useTpu(useTpu); + } + + /** + * @param deviceAssignment The assignment of devices for the computation. + */ + public static Options deviceAssignment(List deviceAssignment) { + return new Options().deviceAssignment(deviceAssignment); + } + + /** + * @param computationShape DEPRECATED. Use num_cores_per_replica instead. + */ + public static Options computationShape(List computationShape) { + return new Options().computationShape(computationShape); + } + + /** + * @param hostComputeCore + */ + public static Options hostComputeCore(List hostComputeCore) { + return new Options().hostComputeCore(hostComputeCore); + } + + /** + * @param paddingMap + */ + public static Options paddingMap(List paddingMap) { + return new Options().paddingMap(paddingMap); + } + + /** + * @param stepMarkerLocation + */ + public static Options stepMarkerLocation(String stepMarkerLocation) { + return new Options().stepMarkerLocation(stepMarkerLocation); + } + + /** + * @param allowSoftPlacement + */ + public static Options allowSoftPlacement(Boolean allowSoftPlacement) { + return new Options().allowSoftPlacement(allowSoftPlacement); + } + + + private TPUReplicateMetadata(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedInput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedInput.java new file mode 100644 index 00000000000..10acf326651 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedInput.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Connects N inputs to an N-way replicated TPU computation. + * + * @param data type for {@code output()} output + */ +public final class TPUReplicatedInput extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TPUReplicatedInput operation. + * + * @param scope current scope + * @param inputs + * @return a new instance of TPUReplicatedInput + */ + public static TPUReplicatedInput create(Scope scope, Iterable> inputs) { + OperationBuilder opBuilder = scope.env().opBuilder("TPUReplicatedInput", scope.makeOpName("TPUReplicatedInput")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TPUReplicatedInput(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TPUReplicatedInput(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedOutput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedOutput.java new file mode 100644 index 00000000000..07569410f8a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedOutput.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Connects outputs of an N-way replicated computation to N outputs. + * + * @param data type for {@code outputs()} output + */ +public final class TPUReplicatedOutput extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new TPUReplicatedOutput operation. + * + * @param scope current scope + * @param input + * @param numReplicas + * @return a new instance of TPUReplicatedOutput + */ + public static TPUReplicatedOutput create(Scope scope, Operand input, Long numReplicas) { + OperationBuilder opBuilder = scope.env().opBuilder("TPUReplicatedOutput", scope.makeOpName("TPUReplicatedOutput")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_replicas", numReplicas); + return new TPUReplicatedOutput(opBuilder.build()); + } + + /** + */ + public List> outputs() { + return outputs; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outputs.iterator(); + } + + private List> outputs; + + @SuppressWarnings("unchecked") + private TPUReplicatedOutput(Operation operation) { + super(operation); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList((Output[])operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TemporaryVariable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TemporaryVariable.java new file mode 100644 index 00000000000..cf6fd881f25 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TemporaryVariable.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a tensor that may be mutated, but only persists within a single step. + *

      + * This is an experimental op for internal use only and it is possible to use this + * op in unsafe ways. DO NOT USE unless you fully understand the risks. + *

      + * It is the caller's responsibility to ensure that 'ref' is eventually passed to a + * matching 'DestroyTemporaryVariable' op after all other uses have completed. + *

      + * Outputs a ref to the tensor state so it may be read or modified. + *

      + * E.g. + * var = state_ops._temporary_variable([1, 2], types.float_) + * var_name = var.op.name + * var = state_ops.assign(var, [[4.0, 5.0]]) + * var = state_ops.assign_add(var, [[6.0, 7.0]]) + * final = state_ops._destroy_temporary_variable(var, var_name=var_name) + * + * @param data type for {@code ref()} output + */ +@Operator +public final class TemporaryVariable extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TemporaryVariable} + */ + public static class Options { + + /** + * @param varName Overrides the name used for the temporary variable resource. Default + * value is the name of the 'TemporaryVariable' op (which is guaranteed unique). + */ + public Options varName(String varName) { + this.varName = varName; + return this; + } + + private String varName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TemporaryVariable operation. + * + * @param scope current scope + * @param shape The shape of the variable tensor. + * @param dtype The type of elements in the variable tensor. + * @param options carries optional attributes values + * @return a new instance of TemporaryVariable + */ + public static TemporaryVariable create(Scope scope, Shape shape, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TemporaryVariable", scope.makeOpName("TemporaryVariable")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape", shape); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.varName != null) { + opBuilder.setAttr("var_name", opts.varName); + } + } + } + return new TemporaryVariable(opBuilder.build()); + } + + /** + * @param varName Overrides the name used for the temporary variable resource. Default + * value is the name of the 'TemporaryVariable' op (which is guaranteed unique). + */ + public static Options varName(String varName) { + return new Options().varName(varName); + } + + /** + * A reference to the variable tensor. + */ + public Output ref() { + return ref; + } + + @Override + public Output asOutput() { + return ref; + } + + private Output ref; + + private TemporaryVariable(Operation operation) { + super(operation); + int outputIdx = 0; + ref = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArray.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArray.java new file mode 100644 index 00000000000..ff6879c5973 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArray.java @@ -0,0 +1,211 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * An array of Tensors of given size. + *

      + * Write data via Write and read via Read or Pack. + */ +@Operator +public final class TensorArray extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArray} + */ + public static class Options { + + /** + * @param elementShape The expected shape of an element, if known. Used to + * validate the shapes of TensorArray elements. If this shape is not + * fully specified, gathering zero-size TensorArrays is an error. + */ + public Options elementShape(Shape elementShape) { + this.elementShape = elementShape; + return this; + } + + /** + * @param dynamicSize A boolean that determines whether writes to the TensorArray + * are allowed to grow the size. By default, this is not allowed. + */ + public Options dynamicSize(Boolean dynamicSize) { + this.dynamicSize = dynamicSize; + return this; + } + + /** + * @param clearAfterRead If true (default), Tensors in the TensorArray are cleared + * after being read. This disables multiple read semantics but allows early + * release of memory. + */ + public Options clearAfterRead(Boolean clearAfterRead) { + this.clearAfterRead = clearAfterRead; + return this; + } + + /** + * @param identicalElementShapes If true (default is false), then all + * elements in the TensorArray will be expected to have have identical shapes. + * This allows certain behaviors, like dynamically checking for + * consistent shapes on write, and being able to fill in properly + * shaped zero tensors on stack -- even if the element_shape attribute + * is not fully defined. + */ + public Options identicalElementShapes(Boolean identicalElementShapes) { + this.identicalElementShapes = identicalElementShapes; + return this; + } + + /** + * @param tensorArrayName Overrides the name used for the temporary tensor_array + * resource. Default value is the name of the 'TensorArray' op (which + * is guaranteed unique). + */ + public Options tensorArrayName(String tensorArrayName) { + this.tensorArrayName = tensorArrayName; + return this; + } + + private Shape elementShape; + private Boolean dynamicSize; + private Boolean clearAfterRead; + private Boolean identicalElementShapes; + private String tensorArrayName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorArray operation. + * + * @param scope current scope + * @param size The size of the array. + * @param dtype The type of the elements on the tensor_array. + * @param options carries optional attributes values + * @return a new instance of TensorArray + */ + public static TensorArray create(Scope scope, Operand size, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayV3", scope.makeOpName("TensorArray")); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.elementShape != null) { + opBuilder.setAttr("element_shape", opts.elementShape); + } + if (opts.dynamicSize != null) { + opBuilder.setAttr("dynamic_size", opts.dynamicSize); + } + if (opts.clearAfterRead != null) { + opBuilder.setAttr("clear_after_read", opts.clearAfterRead); + } + if (opts.identicalElementShapes != null) { + opBuilder.setAttr("identical_element_shapes", opts.identicalElementShapes); + } + if (opts.tensorArrayName != null) { + opBuilder.setAttr("tensor_array_name", opts.tensorArrayName); + } + } + } + return new TensorArray(opBuilder.build()); + } + + /** + * @param elementShape The expected shape of an element, if known. Used to + * validate the shapes of TensorArray elements. If this shape is not + * fully specified, gathering zero-size TensorArrays is an error. + */ + public static Options elementShape(Shape elementShape) { + return new Options().elementShape(elementShape); + } + + /** + * @param dynamicSize A boolean that determines whether writes to the TensorArray + * are allowed to grow the size. By default, this is not allowed. + */ + public static Options dynamicSize(Boolean dynamicSize) { + return new Options().dynamicSize(dynamicSize); + } + + /** + * @param clearAfterRead If true (default), Tensors in the TensorArray are cleared + * after being read. This disables multiple read semantics but allows early + * release of memory. + */ + public static Options clearAfterRead(Boolean clearAfterRead) { + return new Options().clearAfterRead(clearAfterRead); + } + + /** + * @param identicalElementShapes If true (default is false), then all + * elements in the TensorArray will be expected to have have identical shapes. + * This allows certain behaviors, like dynamically checking for + * consistent shapes on write, and being able to fill in properly + * shaped zero tensors on stack -- even if the element_shape attribute + * is not fully defined. + */ + public static Options identicalElementShapes(Boolean identicalElementShapes) { + return new Options().identicalElementShapes(identicalElementShapes); + } + + /** + * @param tensorArrayName Overrides the name used for the temporary tensor_array + * resource. Default value is the name of the 'TensorArray' op (which + * is guaranteed unique). + */ + public static Options tensorArrayName(String tensorArrayName) { + return new Options().tensorArrayName(tensorArrayName); + } + + /** + * The handle to the TensorArray. + */ + public Output handle() { + return handle; + } + + /** + * A scalar used to control gradient flow. + */ + public Output flow() { + return flow; + } + + private Output handle; + private Output flow; + + private TensorArray(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + flow = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayClose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayClose.java new file mode 100644 index 00000000000..3339a38a587 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayClose.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Delete the TensorArray from its resource container. + *

      + * This enables the user to close and release the resource in the middle + * of a step/run. + */ +@Operator +public final class TensorArrayClose extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new TensorArrayClose operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray (output of TensorArray or TensorArrayGrad). + * @return a new instance of TensorArrayClose + */ + public static TensorArrayClose create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayCloseV3", scope.makeOpName("TensorArrayClose")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorArrayClose(opBuilder.build()); + } + + + private TensorArrayClose(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayConcat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayConcat.java new file mode 100644 index 00000000000..a1ebefdb5d3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayConcat.java @@ -0,0 +1,133 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Concat the elements from the TensorArray into value `value`. + *

      + * Takes `T` elements of shapes + *

      + *

      {@code
      + *   (n0 x d0 x d1 x ...), (n1 x d0 x d1 x ...), ..., (n(T-1) x d0 x d1 x ...)
      + *   }
      + * and concatenates them into a Tensor of shape: + *

      + *

      {@code
      + * (n0 + n1 + ... + n(T-1) x d0 x d1 x ...)}
      + * All elements must have the same shape (excepting the first dimension). + * + * @param data type for {@code value()} output + */ +@Operator +public final class TensorArrayConcat extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArrayConcat} + */ + public static class Options { + + /** + * @param elementShapeExcept0 The expected shape of an element, if known, + * excluding the first dimension. Used to validate the shapes of + * TensorArray elements. If this shape is not fully specified, concatenating + * zero-size TensorArrays is an error. + */ + public Options elementShapeExcept0(Shape elementShapeExcept0) { + this.elementShapeExcept0 = elementShapeExcept0; + return this; + } + + private Shape elementShapeExcept0; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorArrayConcat operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param dtype The type of the elem that is returned. + * @param options carries optional attributes values + * @return a new instance of TensorArrayConcat + */ + public static TensorArrayConcat create(Scope scope, Operand handle, Operand flowIn, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayConcatV3", scope.makeOpName("TensorArrayConcat")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.elementShapeExcept0 != null) { + opBuilder.setAttr("element_shape_except0", opts.elementShapeExcept0); + } + } + } + return new TensorArrayConcat(opBuilder.build()); + } + + /** + * @param elementShapeExcept0 The expected shape of an element, if known, + * excluding the first dimension. Used to validate the shapes of + * TensorArray elements. If this shape is not fully specified, concatenating + * zero-size TensorArrays is an error. + */ + public static Options elementShapeExcept0(Shape elementShapeExcept0) { + return new Options().elementShapeExcept0(elementShapeExcept0); + } + + /** + * All of the elements in the TensorArray, concatenated along the first + * axis. + */ + public Output value() { + return value; + } + + /** + * A vector of the row sizes of the original T elements in the + * value output. In the example above, this would be the values: + * `(n1, n2, ..., n(T-1))`. + */ + public Output lengths() { + return lengths; + } + + private Output value; + private Output lengths; + + private TensorArrayConcat(Operation operation) { + super(operation); + int outputIdx = 0; + value = operation.output(outputIdx++); + lengths = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGather.java new file mode 100644 index 00000000000..b278852627a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGather.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gather specific elements from the TensorArray into output `value`. + *

      + * All elements selected by `indices` must have the same shape. + * + * @param data type for {@code value()} output + */ +@Operator +public final class TensorArrayGather extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArrayGather} + */ + public static class Options { + + /** + * @param elementShape The expected shape of an element, if known. Used to + * validate the shapes of TensorArray elements. If this shape is not + * fully specified, gathering zero-size TensorArrays is an error. + */ + public Options elementShape(Shape elementShape) { + this.elementShape = elementShape; + return this; + } + + private Shape elementShape; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorArrayGather operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray. + * @param indices The locations in the TensorArray from which to read tensor elements. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param dtype The type of the elem that is returned. + * @param options carries optional attributes values + * @return a new instance of TensorArrayGather + */ + public static TensorArrayGather create(Scope scope, Operand handle, Operand indices, Operand flowIn, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayGatherV3", scope.makeOpName("TensorArrayGather")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.elementShape != null) { + opBuilder.setAttr("element_shape", opts.elementShape); + } + } + } + return new TensorArrayGather(opBuilder.build()); + } + + /** + * @param elementShape The expected shape of an element, if known. Used to + * validate the shapes of TensorArray elements. If this shape is not + * fully specified, gathering zero-size TensorArrays is an error. + */ + public static Options elementShape(Shape elementShape) { + return new Options().elementShape(elementShape); + } + + /** + * All of the elements in the TensorArray, concatenated along a new + * axis (the new dimension 0). + */ + public Output value() { + return value; + } + + @Override + public Output asOutput() { + return value; + } + + private Output value; + + private TensorArrayGather(Operation operation) { + super(operation); + int outputIdx = 0; + value = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGrad.java new file mode 100644 index 00000000000..d16394fcf2d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGrad.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a TensorArray for storing the gradients of values in the given handle. + *

      + * If the given TensorArray gradient already exists, returns a reference to it. + *

      + * Locks the size of the original TensorArray by disabling its dynamic size flag. + *

      + * **A note about the input flow_in:** + *

      + * The handle flow_in forces the execution of the gradient lookup to occur + * only after certain other operations have occurred. For example, when + * the forward TensorArray is dynamically sized, writes to this TensorArray + * may resize the object. The gradient TensorArray is statically sized based + * on the size of the forward TensorArray when this operation executes. + * Furthermore, the size of the forward TensorArray is frozen by this call. + * As a result, the flow is used to ensure that the call to generate the gradient + * TensorArray only happens after all writes are executed. + *

      + * In the case of dynamically sized TensorArrays, gradient computation should + * only be performed on read operations that have themselves been chained via + * flow to occur only after all writes have executed. That way the final size + * of the forward TensorArray is known when this operation is called. + *

      + * **A note about the source attribute:** + *

      + * TensorArray gradient calls use an accumulator TensorArray object. If + * multiple gradients are calculated and run in the same session, the multiple + * gradient nodes may accidentally flow through the same accumulator TensorArray. + * This double counts and generally breaks the TensorArray gradient flow. + *

      + * The solution is to identify which gradient call this particular + * TensorArray gradient is being called in. This is performed by identifying + * a unique string (e.g. "gradients", "gradients_1", ...) from the input + * gradient Tensor's name. This string is used as a suffix when creating + * the TensorArray gradient object here (the attribute `source`). + *

      + * The attribute `source` is added as a suffix to the forward TensorArray's + * name when performing the creation / lookup, so that each separate gradient + * calculation gets its own TensorArray accumulator. + */ +@Operator +public final class TensorArrayGrad extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new TensorArrayGrad operation. + * + * @param scope current scope + * @param handle The handle to the forward TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param source The gradient source string, used to decide which gradient TensorArray + * to return. + * @return a new instance of TensorArrayGrad + */ + public static TensorArrayGrad create(Scope scope, Operand handle, Operand flowIn, String source) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayGradV3", scope.makeOpName("TensorArrayGrad")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("source", source); + return new TensorArrayGrad(opBuilder.build()); + } + + /** + */ + public Output gradHandle() { + return gradHandle; + } + + /** + */ + public Output flowOut() { + return flowOut; + } + + private Output gradHandle; + private Output flowOut; + + private TensorArrayGrad(Operation operation) { + super(operation); + int outputIdx = 0; + gradHandle = operation.output(outputIdx++); + flowOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGradWithShape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGradWithShape.java new file mode 100644 index 00000000000..26fb985b1b4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayGradWithShape.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a TensorArray for storing multiple gradients of values in the given handle. + *

      + * Similar to TensorArrayGradV3. However it creates an accumulator with an + * expanded shape compared to the input TensorArray whose gradient is being + * computed. This enables multiple gradients for the same TensorArray to be + * calculated using the same accumulator. + */ +@Operator +public final class TensorArrayGradWithShape extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new TensorArrayGradWithShape operation. + * + * @param scope current scope + * @param handle The handle to the forward TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param shapeToPrepend An int32 vector representing a shape. Elements in the gradient accumulator will + * have shape which is this shape_to_prepend value concatenated with shape of the + * elements in the TensorArray corresponding to the input handle. + * @param source The gradient source string, used to decide which gradient TensorArray + * to return. + * @return a new instance of TensorArrayGradWithShape + */ + public static TensorArrayGradWithShape create(Scope scope, Operand handle, Operand flowIn, Operand shapeToPrepend, String source) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayGradWithShape", scope.makeOpName("TensorArrayGradWithShape")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder.addInput(shapeToPrepend.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("source", source); + return new TensorArrayGradWithShape(opBuilder.build()); + } + + /** + */ + public Output gradHandle() { + return gradHandle; + } + + /** + */ + public Output flowOut() { + return flowOut; + } + + private Output gradHandle; + private Output flowOut; + + private TensorArrayGradWithShape(Operation operation) { + super(operation); + int outputIdx = 0; + gradHandle = operation.output(outputIdx++); + flowOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayPack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayPack.java new file mode 100644 index 00000000000..d7d12c53177 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayPack.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code value()} output + */ +@Operator +public final class TensorArrayPack extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArrayPack} + */ + public static class Options { + + /** + * @param elementShape + */ + public Options elementShape(Shape elementShape) { + this.elementShape = elementShape; + return this; + } + + private Shape elementShape; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorArrayPack operation. + * + * @param scope current scope + * @param handle + * @param flowIn + * @param dtype + * @param options carries optional attributes values + * @return a new instance of TensorArrayPack + */ + public static TensorArrayPack create(Scope scope, Operand handle, Operand flowIn, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayPack", scope.makeOpName("TensorArrayPack")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.elementShape != null) { + opBuilder.setAttr("element_shape", opts.elementShape); + } + } + } + return new TensorArrayPack(opBuilder.build()); + } + + /** + * @param elementShape + */ + public static Options elementShape(Shape elementShape) { + return new Options().elementShape(elementShape); + } + + /** + */ + public Output value() { + return value; + } + + @Override + public Output asOutput() { + return value; + } + + private Output value; + + private TensorArrayPack(Operation operation) { + super(operation); + int outputIdx = 0; + value = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayRead.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayRead.java new file mode 100644 index 00000000000..73c7e2046f6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayRead.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Read an element from the TensorArray into output `value`. + * + * @param data type for {@code value()} output + */ +@Operator +public final class TensorArrayRead extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorArrayRead operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray. + * @param index + * @param flowIn A float scalar that enforces proper chaining of operations. + * @param dtype The type of the elem that is returned. + * @return a new instance of TensorArrayRead + */ + public static TensorArrayRead create(Scope scope, Operand handle, Operand index, Operand flowIn, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayReadV3", scope.makeOpName("TensorArrayRead")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new TensorArrayRead(opBuilder.build()); + } + + /** + * The tensor that is read from the TensorArray. + */ + public Output value() { + return value; + } + + @Override + public Output asOutput() { + return value; + } + + private Output value; + + private TensorArrayRead(Operation operation) { + super(operation); + int outputIdx = 0; + value = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayScatter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayScatter.java new file mode 100644 index 00000000000..f67302ef00b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayScatter.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Scatter the data from the input value into specific TensorArray elements. + *

      + * `indices` must be a vector, its length must match the first dim of `value`. + */ +@Operator +public final class TensorArrayScatter extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorArrayScatter operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray. + * @param indices The locations at which to write the tensor elements. + * @param value The concatenated tensor to write to the TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArrayScatter + */ + public static TensorArrayScatter create(Scope scope, Operand handle, Operand indices, Operand value, Operand flowIn) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayScatterV3", scope.makeOpName("TensorArrayScatter")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorArrayScatter(opBuilder.build()); + } + + /** + * A float scalar that enforces proper chaining of operations. + */ + public Output flowOut() { + return flowOut; + } + + @Override + public Output asOutput() { + return flowOut; + } + + private Output flowOut; + + private TensorArrayScatter(Operation operation) { + super(operation); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySize.java new file mode 100644 index 00000000000..1ff64e8d978 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySize.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Get the current size of the TensorArray. + */ +@Operator +public final class TensorArraySize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorArraySize operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray (output of TensorArray or TensorArrayGrad). + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArraySize + */ + public static TensorArraySize create(Scope scope, Operand handle, Operand flowIn) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArraySizeV3", scope.makeOpName("TensorArraySize")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorArraySize(opBuilder.build()); + } + + /** + * The current size of the TensorArray. + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private TensorArraySize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySplit.java new file mode 100644 index 00000000000..92d1998daff --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySplit.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Split the data from the input value into TensorArray elements. + *

      + * Assuming that `lengths` takes on values + *

      + *

      {@code
      + * (n0, n1, ..., n(T-1))}
      + * and that `value` has shape + *

      + *

      {@code
      + * (n0 + n1 + ... + n(T-1) x d0 x d1 x ...)}
      + * , + *

      + * this splits values into a TensorArray with T tensors. + *

      + * TensorArray index t will be the subtensor of values with starting position + *

      + *

      {@code
      + * (n0 + n1 + ... + n(t-1), 0, 0, ...)}
      + * and having size + *

      + *

      {@code
      + * nt x d0 x d1 x ...}
      + * + */ +@Operator +public final class TensorArraySplit extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorArraySplit operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray. + * @param value The concatenated tensor to write to the TensorArray. + * @param lengths The vector of lengths, how to split the rows of value into the + * TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArraySplit + */ + public static TensorArraySplit create(Scope scope, Operand handle, Operand value, Operand lengths, Operand flowIn) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArraySplitV3", scope.makeOpName("TensorArraySplit")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder.addInput(lengths.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorArraySplit(opBuilder.build()); + } + + /** + * A float scalar that enforces proper chaining of operations. + */ + public Output flowOut() { + return flowOut; + } + + @Override + public Output asOutput() { + return flowOut; + } + + private Output flowOut; + + private TensorArraySplit(Operation operation) { + super(operation); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayUnpack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayUnpack.java new file mode 100644 index 00000000000..7123f91ca2f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayUnpack.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator +public final class TensorArrayUnpack extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorArrayUnpack operation. + * + * @param scope current scope + * @param handle + * @param value + * @param flowIn + * @return a new instance of TensorArrayUnpack + */ + public static TensorArrayUnpack create(Scope scope, Operand handle, Operand value, Operand flowIn) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayUnpack", scope.makeOpName("TensorArrayUnpack")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorArrayUnpack(opBuilder.build()); + } + + /** + */ + public Output flowOut() { + return flowOut; + } + + @Override + public Output asOutput() { + return flowOut; + } + + private Output flowOut; + + private TensorArrayUnpack(Operation operation) { + super(operation); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayWrite.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayWrite.java new file mode 100644 index 00000000000..ba7b307491d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayWrite.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Push an element onto the tensor_array. + */ +@Operator +public final class TensorArrayWrite extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorArrayWrite operation. + * + * @param scope current scope + * @param handle The handle to a TensorArray. + * @param index The position to write to inside the TensorArray. + * @param value The tensor to write to the TensorArray. + * @param flowIn A float scalar that enforces proper chaining of operations. + * @return a new instance of TensorArrayWrite + */ + public static TensorArrayWrite create(Scope scope, Operand handle, Operand index, Operand value, Operand flowIn) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayWriteV3", scope.makeOpName("TensorArrayWrite")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder.addInput(flowIn.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorArrayWrite(opBuilder.build()); + } + + /** + * A float scalar that enforces proper chaining of operations. + */ + public Output flowOut() { + return flowOut; + } + + @Override + public Output asOutput() { + return flowOut; + } + + private Output flowOut; + + private TensorArrayWrite(Operation operation) { + super(operation); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestCreateTreeVariable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestCreateTreeVariable.java new file mode 100644 index 00000000000..5e77b4929ad --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestCreateTreeVariable.java @@ -0,0 +1,51 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a tree resource and returns a handle to it. + */ +public final class TensorForestCreateTreeVariable extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new TensorForestCreateTreeVariable operation. + * + * @param scope current scope + * @param treeHandle Handle to the tree resource to be created. + * @param treeConfig Serialized proto string of the boosted_trees.Tree. + * @return a new instance of TensorForestCreateTreeVariable + */ + public static TensorForestCreateTreeVariable create(Scope scope, Operand treeHandle, Operand treeConfig) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorForestCreateTreeVariable", scope.makeOpName("TensorForestCreateTreeVariable")); + opBuilder.addInput(treeHandle.asOutput()); + opBuilder.addInput(treeConfig.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorForestCreateTreeVariable(opBuilder.build()); + } + + + private TensorForestCreateTreeVariable(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeDeserialize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeDeserialize.java new file mode 100644 index 00000000000..1587f244af8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeDeserialize.java @@ -0,0 +1,51 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Deserializes a proto into the tree handle + */ +public final class TensorForestTreeDeserialize extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new TensorForestTreeDeserialize operation. + * + * @param scope current scope + * @param treeHandle Handle to the tree resource to be restored. + * @param treeConfig Serialied proto string of the boosted_trees.Tree proto. + * @return a new instance of TensorForestTreeDeserialize + */ + public static TensorForestTreeDeserialize create(Scope scope, Operand treeHandle, Operand treeConfig) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorForestTreeDeserialize", scope.makeOpName("TensorForestTreeDeserialize")); + opBuilder.addInput(treeHandle.asOutput()); + opBuilder.addInput(treeConfig.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorForestTreeDeserialize(opBuilder.build()); + } + + + private TensorForestTreeDeserialize(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeIsInitializedOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeIsInitializedOp.java new file mode 100644 index 00000000000..154d6368488 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeIsInitializedOp.java @@ -0,0 +1,65 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Checks whether a tree has been initialized. + */ +public final class TensorForestTreeIsInitializedOp extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorForestTreeIsInitializedOp operation. + * + * @param scope current scope + * @param treeHandle Handle to the tree. + * @return a new instance of TensorForestTreeIsInitializedOp + */ + public static TensorForestTreeIsInitializedOp create(Scope scope, Operand treeHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorForestTreeIsInitializedOp", scope.makeOpName("TensorForestTreeIsInitializedOp")); + opBuilder.addInput(treeHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorForestTreeIsInitializedOp(opBuilder.build()); + } + + /** + * Whether the tree is initialized. + */ + public Output isInitialized() { + return isInitialized; + } + + @Override + public Output asOutput() { + return isInitialized; + } + + private Output isInitialized; + + private TensorForestTreeIsInitializedOp(Operation operation) { + super(operation); + int outputIdx = 0; + isInitialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreePredict.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreePredict.java new file mode 100644 index 00000000000..dcbd95d11ed --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreePredict.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Output the logits for the given input data + */ +public final class TensorForestTreePredict extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorForestTreePredict operation. + * + * @param scope current scope + * @param treeHandle Handle to the tree resource. + * @param denseFeatures Rank 2 dense features tensor. + * @param logitsDimension Scalar, dimension of the logits. + * @return a new instance of TensorForestTreePredict + */ + public static TensorForestTreePredict create(Scope scope, Operand treeHandle, Operand denseFeatures, Long logitsDimension) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorForestTreePredict", scope.makeOpName("TensorForestTreePredict")); + opBuilder.addInput(treeHandle.asOutput()); + opBuilder.addInput(denseFeatures.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("logits_dimension", logitsDimension); + return new TensorForestTreePredict(opBuilder.build()); + } + + /** + * The logits predictions from the tree for each instance in the batch. + */ + public Output logits() { + return logits; + } + + @Override + public Output asOutput() { + return logits; + } + + private Output logits; + + private TensorForestTreePredict(Operation operation) { + super(operation); + int outputIdx = 0; + logits = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeResourceHandleOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeResourceHandleOp.java new file mode 100644 index 00000000000..7e2beb37827 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeResourceHandleOp.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a handle to a TensorForestTreeResource + */ +public final class TensorForestTreeResourceHandleOp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorForestTreeResourceHandleOp} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorForestTreeResourceHandleOp operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of TensorForestTreeResourceHandleOp + */ + public static TensorForestTreeResourceHandleOp create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorForestTreeResourceHandleOp", scope.makeOpName("TensorForestTreeResourceHandleOp")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new TensorForestTreeResourceHandleOp(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output resource() { + return resource; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) resource; + } + + private Output resource; + + private TensorForestTreeResourceHandleOp(Operation operation) { + super(operation); + int outputIdx = 0; + resource = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSerialize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSerialize.java new file mode 100644 index 00000000000..2f2f9d65770 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSerialize.java @@ -0,0 +1,65 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Serializes the tree handle to a proto + */ +public final class TensorForestTreeSerialize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorForestTreeSerialize operation. + * + * @param scope current scope + * @param treeHandle Handle to the tree resource to be serialized. + * @return a new instance of TensorForestTreeSerialize + */ + public static TensorForestTreeSerialize create(Scope scope, Operand treeHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorForestTreeSerialize", scope.makeOpName("TensorForestTreeSerialize")); + opBuilder.addInput(treeHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorForestTreeSerialize(opBuilder.build()); + } + + /** + * Serialied proto string of the tree resource. + */ + public Output treeConfig() { + return treeConfig; + } + + @Override + public Output asOutput() { + return treeConfig; + } + + private Output treeConfig; + + private TensorForestTreeSerialize(Operation operation) { + super(operation); + int outputIdx = 0; + treeConfig = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSize.java new file mode 100644 index 00000000000..754be16d3a8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSize.java @@ -0,0 +1,65 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Get the number of nodes in a tree + */ +public final class TensorForestTreeSize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorForestTreeSize operation. + * + * @param scope current scope + * @param treeHandle Handle to the tree resource. + * @return a new instance of TensorForestTreeSize + */ + public static TensorForestTreeSize create(Scope scope, Operand treeHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorForestTreeSize", scope.makeOpName("TensorForestTreeSize")); + opBuilder.addInput(treeHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorForestTreeSize(opBuilder.build()); + } + + /** + * The size of the tree. + */ + public Output treeSize() { + return treeSize; + } + + @Override + public Output asOutput() { + return treeSize; + } + + private Output treeSize; + + private TensorForestTreeSize(Operation operation) { + super(operation); + int outputIdx = 0; + treeSize = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcat.java new file mode 100644 index 00000000000..7e4cbb155ca --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcat.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Concats all tensors in the list along the 0th dimension. + *

      + * Requires that all tensors have the same shape except the first dimension. + *

      + * input_handle: The input list. + * tensor: The concated result. + * lengths: Output tensor containing sizes of the 0th dimension of tensors in the list, used for computing the gradient. + * + * + * @param data type for {@code tensor()} output + */ +@Operator +public final class TensorListConcat extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorListConcat} + */ + public static class Options { + + /** + * @param elementShape + */ + public Options elementShape(Shape elementShape) { + this.elementShape = elementShape; + return this; + } + + private Shape elementShape; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorListConcat operation. + * + * @param scope current scope + * @param inputHandle + * @param elementDtype + * @param options carries optional attributes values + * @return a new instance of TensorListConcat + */ + public static TensorListConcat create(Scope scope, Operand inputHandle, Class elementDtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListConcat", scope.makeOpName("TensorListConcat")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.elementShape != null) { + opBuilder.setAttr("element_shape", opts.elementShape); + } + } + } + return new TensorListConcat(opBuilder.build()); + } + + /** + * @param elementShape + */ + public static Options elementShape(Shape elementShape) { + return new Options().elementShape(elementShape); + } + + /** + */ + public Output tensor() { + return tensor; + } + + /** + */ + public Output lengths() { + return lengths; + } + + private Output tensor; + private Output lengths; + + private TensorListConcat(Operation operation) { + super(operation); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + lengths = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcatLists.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcatLists.java new file mode 100644 index 00000000000..0fb9e873943 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcatLists.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator +public final class TensorListConcatLists extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListConcatLists operation. + * + * @param scope current scope + * @param inputA + * @param inputB + * @param elementDtype + * @return a new instance of TensorListConcatLists + */ + public static TensorListConcatLists create(Scope scope, Operand inputA, Operand inputB, Class elementDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListConcatLists", scope.makeOpName("TensorListConcatLists")); + opBuilder.addInput(inputA.asOutput()); + opBuilder.addInput(inputB.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + return new TensorListConcatLists(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private TensorListConcatLists(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcatV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcatV2.java new file mode 100644 index 00000000000..9cfadcd50ba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcatV2.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Concats all tensors in the list along the 0th dimension. + *

      + * Requires that all tensors have the same shape except the first dimension. + *

      + * input_handle: The input list. + * element_shape: The shape of the uninitialized elements in the list. If the first + * dimension is not -1, it is assumed that all list elements have the same + * leading dim. + * leading_dims: The list of leading dims of uninitialized list elements. Used if + * the leading dim of input_handle.element_shape or the element_shape input arg + * is not already set. + * tensor: The concated result. + * lengths: Output tensor containing sizes of the 0th dimension of tensors in the list, used for computing the gradient. + * + * + * @param data type for {@code tensor()} output + */ +@Operator +public final class TensorListConcatV2 extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new TensorListConcatV2 operation. + * + * @param scope current scope + * @param inputHandle + * @param elementShape + * @param leadingDims + * @param elementDtype + * @return a new instance of TensorListConcatV2 + */ + public static TensorListConcatV2 create(Scope scope, Operand inputHandle, Operand elementShape, Operand leadingDims, Class elementDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListConcatV2", scope.makeOpName("TensorListConcatV2")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder.addInput(leadingDims.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + return new TensorListConcatV2(opBuilder.build()); + } + + /** + */ + public Output tensor() { + return tensor; + } + + /** + */ + public Output lengths() { + return lengths; + } + + private Output tensor; + private Output lengths; + + private TensorListConcatV2(Operation operation) { + super(operation); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + lengths = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListElementShape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListElementShape.java new file mode 100644 index 00000000000..2a2fc172c2b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListElementShape.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * The shape of the elements of the given list, as a tensor. + *

      + * input_handle: the list + * element_shape: the shape of elements of the list + * + * @param data type for {@code elementShape()} output + */ +@Operator +public final class TensorListElementShape extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListElementShape operation. + * + * @param scope current scope + * @param inputHandle + * @param shapeType + * @return a new instance of TensorListElementShape + */ + public static TensorListElementShape create(Scope scope, Operand inputHandle, Class shapeType) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListElementShape", scope.makeOpName("TensorListElementShape")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape_type", DataType.fromClass(shapeType)); + return new TensorListElementShape(opBuilder.build()); + } + + /** + */ + public Output elementShape() { + return elementShape; + } + + @Override + public Output asOutput() { + return elementShape; + } + + private Output elementShape; + + private TensorListElementShape(Operation operation) { + super(operation); + int outputIdx = 0; + elementShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListFromTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListFromTensor.java new file mode 100644 index 00000000000..4d68d970eb8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListFromTensor.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a TensorList which, when stacked, has the value of `tensor`. + *

      + * Each tensor in the result list corresponds to one row of the input tensor. + *

      + * tensor: The input tensor. + * output_handle: The list. + */ +@Operator +public final class TensorListFromTensor extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListFromTensor operation. + * + * @param scope current scope + * @param tensor + * @param elementShape + * @return a new instance of TensorListFromTensor + */ + public static TensorListFromTensor create(Scope scope, Operand tensor, Operand elementShape) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListFromTensor", scope.makeOpName("TensorListFromTensor")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListFromTensor(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListFromTensor(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListGather.java new file mode 100644 index 00000000000..6f54e07d340 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListGather.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a Tensor by indexing into the TensorList. + *

      + * Each row in the produced Tensor corresponds to the element in the TensorList + * specified by the given index (see `tf.gather`). + *

      + * input_handle: The input tensor list. + * indices: The indices used to index into the list. + * values: The tensor. + * + * @param data type for {@code values()} output + */ +@Operator +public final class TensorListGather extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListGather operation. + * + * @param scope current scope + * @param inputHandle + * @param indices + * @param elementShape + * @param elementDtype + * @return a new instance of TensorListGather + */ + public static TensorListGather create(Scope scope, Operand inputHandle, Operand indices, Operand elementShape, Class elementDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListGather", scope.makeOpName("TensorListGather")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + return new TensorListGather(opBuilder.build()); + } + + /** + */ + public Output values() { + return values; + } + + @Override + public Output asOutput() { + return values; + } + + private Output values; + + private TensorListGather(Operation operation) { + super(operation); + int outputIdx = 0; + values = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListGetItem.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListGetItem.java new file mode 100644 index 00000000000..7accbc95616 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListGetItem.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code item()} output + */ +@Operator +public final class TensorListGetItem extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListGetItem operation. + * + * @param scope current scope + * @param inputHandle + * @param index + * @param elementShape + * @param elementDtype + * @return a new instance of TensorListGetItem + */ + public static TensorListGetItem create(Scope scope, Operand inputHandle, Operand index, Operand elementShape, Class elementDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListGetItem", scope.makeOpName("TensorListGetItem")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + return new TensorListGetItem(opBuilder.build()); + } + + /** + */ + public Output item() { + return item; + } + + @Override + public Output asOutput() { + return item; + } + + private Output item; + + private TensorListGetItem(Operation operation) { + super(operation); + int outputIdx = 0; + item = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListLength.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListLength.java new file mode 100644 index 00000000000..68a2a09c424 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListLength.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the number of tensors in the input tensor list. + *

      + * input_handle: the input list + * length: the number of tensors in the list + */ +@Operator +public final class TensorListLength extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListLength operation. + * + * @param scope current scope + * @param inputHandle + * @return a new instance of TensorListLength + */ + public static TensorListLength create(Scope scope, Operand inputHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListLength", scope.makeOpName("TensorListLength")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListLength(opBuilder.build()); + } + + /** + */ + public Output length() { + return length; + } + + @Override + public Output asOutput() { + return length; + } + + private Output length; + + private TensorListLength(Operation operation) { + super(operation); + int outputIdx = 0; + length = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPopBack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPopBack.java new file mode 100644 index 00000000000..57c0528f747 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPopBack.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the last element of the input list as well as a list with all but that element. + *

      + * Fails if the list is empty. + *

      + * input_handle: the input list + * tensor: the withdrawn last element of the list + * element_dtype: the type of elements in the list + * element_shape: the shape of the output tensor + * + * @param data type for {@code tensor()} output + */ +@Operator +public final class TensorListPopBack extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new TensorListPopBack operation. + * + * @param scope current scope + * @param inputHandle + * @param elementShape + * @param elementDtype + * @return a new instance of TensorListPopBack + */ + public static TensorListPopBack create(Scope scope, Operand inputHandle, Operand elementShape, Class elementDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListPopBack", scope.makeOpName("TensorListPopBack")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + return new TensorListPopBack(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + /** + */ + public Output tensor() { + return tensor; + } + + private Output outputHandle; + private Output tensor; + + private TensorListPopBack(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + tensor = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBack.java new file mode 100644 index 00000000000..dbe77e4f128 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBack.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a list which has the passed-in `Tensor` as last element and the other elements of the given list in `input_handle`. + *

      + * tensor: The tensor to put on the list. + * input_handle: The old list. + * output_handle: A list with the elements of the old list followed by tensor. + * element_dtype: the type of elements in the list. + * element_shape: a shape compatible with that of elements in the list. + */ +@Operator +public final class TensorListPushBack extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListPushBack operation. + * + * @param scope current scope + * @param inputHandle + * @param tensor + * @return a new instance of TensorListPushBack + */ + public static TensorListPushBack create(Scope scope, Operand inputHandle, Operand tensor) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListPushBack", scope.makeOpName("TensorListPushBack")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListPushBack(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListPushBack(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBackBatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBackBatch.java new file mode 100644 index 00000000000..763c60dcfcf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBackBatch.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator +public final class TensorListPushBackBatch extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListPushBackBatch operation. + * + * @param scope current scope + * @param inputHandles + * @param tensor + * @return a new instance of TensorListPushBackBatch + */ + public static TensorListPushBackBatch create(Scope scope, Operand inputHandles, Operand tensor) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListPushBackBatch", scope.makeOpName("TensorListPushBackBatch")); + opBuilder.addInput(inputHandles.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListPushBackBatch(opBuilder.build()); + } + + /** + */ + public Output outputHandles() { + return outputHandles; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandles; + } + + private Output outputHandles; + + private TensorListPushBackBatch(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandles = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListReserve.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListReserve.java new file mode 100644 index 00000000000..e6cbc6172cc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListReserve.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * List of the given size with empty elements. + *

      + * element_shape: the shape of the future elements of the list + * num_elements: the number of elements to reserve + * handle: the output list + * element_dtype: the desired type of elements in the list. + */ +@Operator +public final class TensorListReserve extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListReserve operation. + * + * @param scope current scope + * @param elementShape + * @param numElements + * @param elementDtype + * @return a new instance of TensorListReserve + */ + public static TensorListReserve create(Scope scope, Operand elementShape, Operand numElements, Class elementDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListReserve", scope.makeOpName("TensorListReserve")); + opBuilder.addInput(elementShape.asOutput()); + opBuilder.addInput(numElements.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + return new TensorListReserve(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private TensorListReserve(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListResize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListResize.java new file mode 100644 index 00000000000..5b7721a8584 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListResize.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Resizes the list. + *

      + * + * input_handle: the input list + * size: size of the output list + * + */ +@Operator +public final class TensorListResize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListResize operation. + * + * @param scope current scope + * @param inputHandle + * @param size + * @return a new instance of TensorListResize + */ + public static TensorListResize create(Scope scope, Operand inputHandle, Operand size) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListResize", scope.makeOpName("TensorListResize")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListResize(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListResize(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatter.java new file mode 100644 index 00000000000..2c852c7f612 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatter.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a TensorList by indexing into a Tensor. + *

      + * Each member of the TensorList corresponds to one row of the input tensor, + * specified by the given index (see `tf.gather`). + *

      + * tensor: The input tensor. + * indices: The indices used to index into the list. + * element_shape: The shape of the elements in the list (can be less specified than + * the shape of the tensor). + * output_handle: The TensorList. + */ +@Operator +public final class TensorListScatter extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListScatter operation. + * + * @param scope current scope + * @param tensor + * @param indices + * @param elementShape + * @return a new instance of TensorListScatter + */ + public static TensorListScatter create(Scope scope, Operand tensor, Operand indices, Operand elementShape) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListScatter", scope.makeOpName("TensorListScatter")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListScatter(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListScatter(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterIntoExistingList.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterIntoExistingList.java new file mode 100644 index 00000000000..8b174850855 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterIntoExistingList.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Scatters tensor at indices in an input list. + *

      + * Each member of the TensorList corresponds to one row of the input tensor, + * specified by the given index (see `tf.gather`). + *

      + * input_handle: The list to scatter into. + * tensor: The input tensor. + * indices: The indices used to index into the list. + * output_handle: The TensorList. + */ +@Operator +public final class TensorListScatterIntoExistingList extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListScatterIntoExistingList operation. + * + * @param scope current scope + * @param inputHandle + * @param tensor + * @param indices + * @return a new instance of TensorListScatterIntoExistingList + */ + public static TensorListScatterIntoExistingList create(Scope scope, Operand inputHandle, Operand tensor, Operand indices) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListScatterIntoExistingList", scope.makeOpName("TensorListScatterIntoExistingList")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListScatterIntoExistingList(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListScatterIntoExistingList(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterV2.java new file mode 100644 index 00000000000..26037b18856 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterV2.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a TensorList by indexing into a Tensor. + *

      + * Each member of the TensorList corresponds to one row of the input tensor, + * specified by the given index (see `tf.gather`). + *

      + * tensor: The input tensor. + * indices: The indices used to index into the list. + * element_shape: The shape of the elements in the list (can be less specified than + * the shape of the tensor). + * num_elements: The size of the output list. Must be large enough to accommodate + * the largest index in indices. If -1, the list is just large enough to include + * the largest index in indices. + * output_handle: The TensorList. + */ +@Operator +public final class TensorListScatterV2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListScatterV2 operation. + * + * @param scope current scope + * @param tensor + * @param indices + * @param elementShape + * @param numElements + * @return a new instance of TensorListScatterV2 + */ + public static TensorListScatterV2 create(Scope scope, Operand tensor, Operand indices, Operand elementShape, Operand numElements) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListScatterV2", scope.makeOpName("TensorListScatterV2")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder.addInput(numElements.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListScatterV2(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListScatterV2(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSetItem.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSetItem.java new file mode 100644 index 00000000000..b2c6887ea52 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSetItem.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator +public final class TensorListSetItem extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListSetItem operation. + * + * @param scope current scope + * @param inputHandle + * @param index + * @param item + * @return a new instance of TensorListSetItem + */ + public static TensorListSetItem create(Scope scope, Operand inputHandle, Operand index, Operand item) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListSetItem", scope.makeOpName("TensorListSetItem")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder.addInput(item.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListSetItem(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListSetItem(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSplit.java new file mode 100644 index 00000000000..1aabadcea15 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSplit.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Splits a tensor into a list. + *

      + * list[i] corresponds to lengths[i] tensors from the input tensor. + * The tensor must have rank at least 1 and contain exactly sum(lengths) elements. + *

      + * tensor: The input tensor. + * element_shape: A shape compatible with that of elements in the tensor. + * lengths: Vector of sizes of the 0th dimension of tensors in the list. + * output_handle: The list. + */ +@Operator +public final class TensorListSplit extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorListSplit operation. + * + * @param scope current scope + * @param tensor + * @param elementShape + * @param lengths + * @return a new instance of TensorListSplit + */ + public static TensorListSplit create(Scope scope, Operand tensor, Operand elementShape, Operand lengths) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListSplit", scope.makeOpName("TensorListSplit")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder.addInput(lengths.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorListSplit(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private TensorListSplit(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListStack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListStack.java new file mode 100644 index 00000000000..0e7c18a51fc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListStack.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Stacks all tensors in the list. + *

      + * Requires that all tensors have the same shape. + *

      + * input_handle: the input list + * tensor: the gathered result + * num_elements: optional. If not -1, the number of elements in the list. + * + * + * @param data type for {@code tensor()} output + */ +@Operator +public final class TensorListStack extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorListStack} + */ + public static class Options { + + /** + * @param numElements + */ + public Options numElements(Long numElements) { + this.numElements = numElements; + return this; + } + + private Long numElements; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorListStack operation. + * + * @param scope current scope + * @param inputHandle + * @param elementShape + * @param elementDtype + * @param options carries optional attributes values + * @return a new instance of TensorListStack + */ + public static TensorListStack create(Scope scope, Operand inputHandle, Operand elementShape, Class elementDtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorListStack", scope.makeOpName("TensorListStack")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(elementShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("element_dtype", DataType.fromClass(elementDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.numElements != null) { + opBuilder.setAttr("num_elements", opts.numElements); + } + } + } + return new TensorListStack(opBuilder.build()); + } + + /** + * @param numElements + */ + public static Options numElements(Long numElements) { + return new Options().numElements(numElements); + } + + /** + */ + public Output tensor() { + return tensor; + } + + @Override + public Output asOutput() { + return tensor; + } + + private Output tensor; + + private TensorListStack(Operation operation) { + super(operation); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterAdd.java new file mode 100644 index 00000000000..2254d8cc222 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterAdd.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds sparse `updates` to an existing tensor according to `indices`. + *

      + * This operation creates a new tensor by adding sparse `updates` to the passed + * in `tensor`. + * This operation is very similar to `tf.scatter_nd_add`, except that the updates + * are added onto an existing tensor (as opposed to a variable). If the memory + * for the existing tensor cannot be re-used, a copy is made and updated. + *

      + * `indices` is an integer tensor containing indices into a new tensor of shape + * `shape`. The last dimension of `indices` can be at most the rank of `shape`: + *

      + * indices.shape[-1] <= shape.rank + *

      + * The last dimension of `indices` corresponds to indices into elements + * (if `indices.shape[-1] = shape.rank`) or slices + * (if `indices.shape[-1] < shape.rank`) along dimension `indices.shape[-1]` of + * `shape`. `updates` is a tensor with shape + *

      + * indices.shape[:-1] + shape[indices.shape[-1]:] + *

      + * The simplest form of tensor_scatter_add is to add individual elements to a + * tensor by index. For example, say we want to add 4 elements in a rank-1 + * tensor with 8 elements. + *

      + * In Python, this scatter add operation would look like this: + *

      {@code
      + *     indices = tf.constant([[4], [3], [1], [7]])
      + *     updates = tf.constant([9, 10, 11, 12])
      + *     tensor = tf.ones([8], dtype=tf.int32)
      + *     updated = tf.tensor_scatter_add(tensor, indices, updates)
      + *     with tf.Session() as sess:
      + *       print(sess.run(scatter))
      + * }
      + * The resulting tensor would look like this: + *

      + * [1, 12, 1, 11, 10, 1, 1, 13] + *

      + * We can also, insert entire slices of a higher rank tensor all at once. For + * example, if we wanted to insert two slices in the first dimension of a + * rank-3 tensor with two matrices of new values. + *

      + * In Python, this scatter add operation would look like this: + *

      {@code
      + *     indices = tf.constant([[0], [2]])
      + *     updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
      + *                             [7, 7, 7, 7], [8, 8, 8, 8]],
      + *                            [[5, 5, 5, 5], [6, 6, 6, 6],
      + *                             [7, 7, 7, 7], [8, 8, 8, 8]]])
      + *     tensor = tf.ones([4, 4, 4])
      + *     updated = tf.tensor_scatter_add(tensor, indices, updates)
      + *     with tf.Session() as sess:
      + *       print(sess.run(scatter))
      + * }
      + * The resulting tensor would look like this: + *

      + * [[[6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8], [9, 9, 9, 9]], + * [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], + * [[6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8], [9, 9, 9, 9]], + * [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]] + *

      + * Note that on CPU, if an out of bound index is found, an error is returned. + * On GPU, if an out of bound index is found, the index is ignored. + * + * @param data type for {@code output()} output + */ +@Operator +public final class TensorScatterAdd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorScatterAdd operation. + * + * @param scope current scope + * @param tensor Tensor to copy/update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @return a new instance of TensorScatterAdd + */ + public static TensorScatterAdd create(Scope scope, Operand tensor, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterAdd", scope.makeOpName("TensorScatterAdd")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorScatterAdd(opBuilder.build()); + } + + /** + * A new tensor copied from tensor and updates added according to the indices. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TensorScatterAdd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterSub.java new file mode 100644 index 00000000000..5c721652041 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterSub.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Subtracts sparse `updates` from an existing tensor according to `indices`. + *

      + * This operation creates a new tensor by subtracting sparse `updates` from the + * passed in `tensor`. + * This operation is very similar to `tf.scatter_nd_sub`, except that the updates + * are subtracted from an existing tensor (as opposed to a variable). If the memory + * for the existing tensor cannot be re-used, a copy is made and updated. + *

      + * `indices` is an integer tensor containing indices into a new tensor of shape + * `shape`. The last dimension of `indices` can be at most the rank of `shape`: + *

      + * indices.shape[-1] <= shape.rank + *

      + * The last dimension of `indices` corresponds to indices into elements + * (if `indices.shape[-1] = shape.rank`) or slices + * (if `indices.shape[-1] < shape.rank`) along dimension `indices.shape[-1]` of + * `shape`. `updates` is a tensor with shape + *

      + * indices.shape[:-1] + shape[indices.shape[-1]:] + *

      + * The simplest form of tensor_scatter_sub is to subtract individual elements + * from a tensor by index. For example, say we want to insert 4 scattered elements + * in a rank-1 tensor with 8 elements. + *

      + * In Python, this scatter subtract operation would look like this: + *

      {@code
      + *     indices = tf.constant([[4], [3], [1], [7]])
      + *     updates = tf.constant([9, 10, 11, 12])
      + *     tensor = tf.ones([8], dtype=tf.int32)
      + *     updated = tf.tensor_scatter_sub(tensor, indices, updates)
      + *     with tf.Session() as sess:
      + *       print(sess.run(scatter))
      + * }
      + * The resulting tensor would look like this: + *

      + * [1, -10, 1, -9, -8, 1, 1, -11] + *

      + * We can also, insert entire slices of a higher rank tensor all at once. For + * example, if we wanted to insert two slices in the first dimension of a + * rank-3 tensor with two matrices of new values. + *

      + * In Python, this scatter add operation would look like this: + *

      {@code
      + *     indices = tf.constant([[0], [2]])
      + *     updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
      + *                             [7, 7, 7, 7], [8, 8, 8, 8]],
      + *                            [[5, 5, 5, 5], [6, 6, 6, 6],
      + *                             [7, 7, 7, 7], [8, 8, 8, 8]]])
      + *     tensor = tf.ones([4, 4, 4])
      + *     updated = tf.tensor_scatter_sub(tensor, indices, updates)
      + *     with tf.Session() as sess:
      + *       print(sess.run(scatter))
      + * }
      + * The resulting tensor would look like this: + *

      + * [[[-4, -4, -4, -4], [-5, -5, -5, -5], [-6, -6, -6, -6], [-7, -7, -7, -7]], + * [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], + * [[-4, -4, -4, -4], [-5, -5, -5, -5], [-6, -6, -6, -6], [-7, -7, -7, -7]], + * [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]] + *

      + * Note that on CPU, if an out of bound index is found, an error is returned. + * On GPU, if an out of bound index is found, the index is ignored. + * + * @param data type for {@code output()} output + */ +@Operator +public final class TensorScatterSub extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorScatterSub operation. + * + * @param scope current scope + * @param tensor Tensor to copy/update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @return a new instance of TensorScatterSub + */ + public static TensorScatterSub create(Scope scope, Operand tensor, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterSub", scope.makeOpName("TensorScatterSub")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorScatterSub(opBuilder.build()); + } + + /** + * A new tensor copied from tensor and updates subtracted according to the indices. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TensorScatterSub(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterUpdate.java new file mode 100644 index 00000000000..f8337f3d3d8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterUpdate.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Scatter `updates` into an existing tensor according to `indices`. + *

      + * This operation creates a new tensor by applying sparse `updates` to the passed + * in `tensor`. + * This operation is very similar to `tf.scatter_nd`, except that the updates are + * scattered onto an existing tensor (as opposed to a zero-tensor). If the memory + * for the existing tensor cannot be re-used, a copy is made and updated. + *

      + * If `indices` contains duplicates, then their updates are accumulated (summed). + *

      + * WARNING: The order in which updates are applied is nondeterministic, so the + * output will be nondeterministic if `indices` contains duplicates -- because + * of some numerical approximation issues, numbers summed in different order + * may yield different results. + *

      + * `indices` is an integer tensor containing indices into a new tensor of shape + * `shape`. The last dimension of `indices` can be at most the rank of `shape`: + *

      + * indices.shape[-1] <= shape.rank + *

      + * The last dimension of `indices` corresponds to indices into elements + * (if `indices.shape[-1] = shape.rank`) or slices + * (if `indices.shape[-1] < shape.rank`) along dimension `indices.shape[-1]` of + * `shape`. `updates` is a tensor with shape + *

      + * indices.shape[:-1] + shape[indices.shape[-1]:] + *

      + * The simplest form of scatter is to insert individual elements in a tensor by + * index. For example, say we want to insert 4 scattered elements in a rank-1 + * tensor with 8 elements. + *

      + *

      + * + *
      + *

      + * In Python, this scatter operation would look like this: + *

      {@code
      + *     indices = tf.constant([[4], [3], [1], [7]])
      + *     updates = tf.constant([9, 10, 11, 12])
      + *     tensor = tf.ones([8], dtype=tf.int32)
      + *     updated = tf.tensor_scatter_update(tensor, indices, updates)
      + *     with tf.Session() as sess:
      + *       print(sess.run(scatter))
      + * }
      + * The resulting tensor would look like this: + *

      + * [1, 11, 1, 10, 9, 1, 1, 12] + *

      + * We can also, insert entire slices of a higher rank tensor all at once. For + * example, if we wanted to insert two slices in the first dimension of a + * rank-3 tensor with two matrices of new values. + *

      + * In Python, this scatter operation would look like this: + *

      {@code
      + *     indices = tf.constant([[0], [2]])
      + *     updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
      + *                             [7, 7, 7, 7], [8, 8, 8, 8]],
      + *                            [[5, 5, 5, 5], [6, 6, 6, 6],
      + *                             [7, 7, 7, 7], [8, 8, 8, 8]]])
      + *     tensor = tf.ones([4, 4, 4])
      + *     updated = tf.tensor_scatter_update(tensor, indices, updates)
      + *     with tf.Session() as sess:
      + *       print(sess.run(scatter))
      + * }
      + * The resulting tensor would look like this: + *

      + * [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], + * [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], + * [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], + * [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]] + *

      + * Note that on CPU, if an out of bound index is found, an error is returned. + * On GPU, if an out of bound index is found, the index is ignored. + * + * @param data type for {@code output()} output + */ +@Operator +public final class TensorScatterUpdate extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorScatterUpdate operation. + * + * @param scope current scope + * @param tensor Tensor to copy/update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @return a new instance of TensorScatterUpdate + */ + public static TensorScatterUpdate create(Scope scope, Operand tensor, Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterUpdate", scope.makeOpName("TensorScatterUpdate")); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorScatterUpdate(opBuilder.build()); + } + + /** + * A new tensor with the given shape and updates applied according + * to the indices. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TensorScatterUpdate(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorStridedSliceUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorStridedSliceUpdate.java new file mode 100644 index 00000000000..8d55b509994 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorStridedSliceUpdate.java @@ -0,0 +1,193 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Assign `value` to the sliced l-value reference of `input`. + *

      + * The values of `value` are assigned to the positions in the tensor `input` that + * are selected by the slice parameters. The slice parameters `begin` `end` + * `strides` etc. work exactly as in `StridedSlice`. + *

      + * NOTE this op currently does not support broadcasting and so `value`'s shape + * must be exactly the shape produced by the slice of `input`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class TensorStridedSliceUpdate extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorStridedSliceUpdate} + */ + public static class Options { + + /** + * @param beginMask + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * @param endMask + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * @param ellipsisMask + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * @param newAxisMask + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * @param shrinkAxisMask + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + + private Long beginMask; + private Long endMask; + private Long ellipsisMask; + private Long newAxisMask; + private Long shrinkAxisMask; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TensorStridedSliceUpdate operation. + * + * @param scope current scope + * @param input + * @param begin + * @param end + * @param strides + * @param value + * @param options carries optional attributes values + * @return a new instance of TensorStridedSliceUpdate + */ + public static TensorStridedSliceUpdate create(Scope scope, Operand input, Operand begin, Operand end, Operand strides, Operand value, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorStridedSliceUpdate", scope.makeOpName("TensorStridedSliceUpdate")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(begin.asOutput()); + opBuilder.addInput(end.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.beginMask != null) { + opBuilder.setAttr("begin_mask", opts.beginMask); + } + if (opts.endMask != null) { + opBuilder.setAttr("end_mask", opts.endMask); + } + if (opts.ellipsisMask != null) { + opBuilder.setAttr("ellipsis_mask", opts.ellipsisMask); + } + if (opts.newAxisMask != null) { + opBuilder.setAttr("new_axis_mask", opts.newAxisMask); + } + if (opts.shrinkAxisMask != null) { + opBuilder.setAttr("shrink_axis_mask", opts.shrinkAxisMask); + } + } + } + return new TensorStridedSliceUpdate(opBuilder.build()); + } + + /** + * @param beginMask + */ + public static Options beginMask(Long beginMask) { + return new Options().beginMask(beginMask); + } + + /** + * @param endMask + */ + public static Options endMask(Long endMask) { + return new Options().endMask(endMask); + } + + /** + * @param ellipsisMask + */ + public static Options ellipsisMask(Long ellipsisMask) { + return new Options().ellipsisMask(ellipsisMask); + } + + /** + * @param newAxisMask + */ + public static Options newAxisMask(Long newAxisMask) { + return new Options().newAxisMask(newAxisMask); + } + + /** + * @param shrinkAxisMask + */ + public static Options shrinkAxisMask(Long shrinkAxisMask) { + return new Options().shrinkAxisMask(shrinkAxisMask); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TensorStridedSliceUpdate(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolDataset.java new file mode 100644 index 00000000000..fa1ac884355 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that uses a custom thread pool to compute `input_dataset`. + */ +public final class ThreadPoolDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ThreadPoolDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param threadPool A resource produced by the ThreadPoolHandle op. + * @param outputTypes + * @param outputShapes + * @return a new instance of ThreadPoolDataset + */ + public static ThreadPoolDataset create(Scope scope, Operand inputDataset, Operand threadPool, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ThreadPoolDataset", scope.makeOpName("ThreadPoolDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(threadPool.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ThreadPoolDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ThreadPoolDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolHandle.java new file mode 100644 index 00000000000..74958fc21ec --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolHandle.java @@ -0,0 +1,145 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that uses a custom thread pool to compute `input_dataset`. + */ +public final class ThreadPoolHandle extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.ThreadPoolHandle} + */ + public static class Options { + + /** + * @param maxIntraOpParallelism The maximum degree of parallelism to use within operations that execute on this + * threadpool. + */ + public Options maxIntraOpParallelism(Long maxIntraOpParallelism) { + this.maxIntraOpParallelism = maxIntraOpParallelism; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long maxIntraOpParallelism; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ThreadPoolHandle operation. + * + * @param scope current scope + * @param numThreads The number of threads in the thread pool. + * @param displayName A human-readable name for the threads that may be visible in some + * visualizations. + * threadpool. + * @param options carries optional attributes values + * @return a new instance of ThreadPoolHandle + */ + public static ThreadPoolHandle create(Scope scope, Long numThreads, String displayName, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ThreadPoolHandle", scope.makeOpName("ThreadPoolHandle")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_threads", numThreads); + opBuilder.setAttr("display_name", displayName); + if (options != null) { + for (Options opts : options) { + if (opts.maxIntraOpParallelism != null) { + opBuilder.setAttr("max_intra_op_parallelism", opts.maxIntraOpParallelism); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new ThreadPoolHandle(opBuilder.build()); + } + + /** + * @param maxIntraOpParallelism The maximum degree of parallelism to use within operations that execute on this + * threadpool. + */ + public static Options maxIntraOpParallelism(Long maxIntraOpParallelism) { + return new Options().maxIntraOpParallelism(maxIntraOpParallelism); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * A resource that can be consumed by one or more ExperimentalThreadPoolDataset + * ops. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ThreadPoolHandle(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Tile.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Tile.java new file mode 100644 index 00000000000..f1d174cce9a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Tile.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Constructs a tensor by tiling a given tensor. + *

      + * This operation creates a new tensor by replicating `input` `multiples` times. + * The output tensor's i'th dimension has `input.dims(i) * multiples[i]` elements, + * and the values of `input` are replicated `multiples[i]` times along the 'i'th + * dimension. For example, tiling `[a b c d]` by `[2]` produces + * `[a b c d a b c d]`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Tile extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Tile operation. + * + * @param scope current scope + * @param input 1-D or higher. + * @param multiples 1-D. Length must be the same as the number of dimensions in `input` + * @return a new instance of Tile + */ + public static Tile create(Scope scope, Operand input, Operand multiples) { + OperationBuilder opBuilder = scope.env().opBuilder("Tile", scope.makeOpName("Tile")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(multiples.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Tile(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Tile(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Timestamp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Timestamp.java new file mode 100644 index 00000000000..4db9d22f4b2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Timestamp.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Provides the time since epoch in seconds. + *

      + * Returns the timestamp as a `float64` for seconds since the Unix epoch. + *

      + * Note: the timestamp is computed when the op is executed, not when it is added + * to the graph. + */ +@Operator +public final class Timestamp extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Timestamp operation. + * + * @param scope current scope + * @return a new instance of Timestamp + */ + public static Timestamp create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("Timestamp", scope.makeOpName("Timestamp")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Timestamp(opBuilder.build()); + } + + /** + */ + public Output ts() { + return ts; + } + + @Override + public Output asOutput() { + return ts; + } + + private Output ts; + + private Timestamp(Operation operation) { + super(operation); + int outputIdx = 0; + ts = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalMatMul.java new file mode 100644 index 00000000000..425287073ca --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalMatMul.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Calculate product with tridiagonal matrix. + *

      + * Calculates product of two matrices, where left matrix is a tridiagonal matrix. + * + * @param data type for {@code output()} output + */ +public final class TridiagonalMatMul extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TridiagonalMatMul operation. + * + * @param scope current scope + * @param superdiag Tensor of shape `[..., 1, M]`, representing superdiagonals of + * tri-diagonal matrices to the left of multiplication. Last element is ingored. + * @param maindiag Tensor of shape `[..., 1, M]`, representing main diagonals of tri-diagonal + * matrices to the left of multiplication. + * @param subdiag Tensor of shape `[..., 1, M]`, representing subdiagonals of tri-diagonal + * matrices to the left of multiplication. First element is ingored. + * @param rhs Tensor of shape `[..., M, N]`, representing MxN matrices to the right of + * multiplication. + * @return a new instance of TridiagonalMatMul + */ + public static TridiagonalMatMul create(Scope scope, Operand superdiag, Operand maindiag, Operand subdiag, Operand rhs) { + OperationBuilder opBuilder = scope.env().opBuilder("TridiagonalMatMul", scope.makeOpName("TridiagonalMatMul")); + opBuilder.addInput(superdiag.asOutput()); + opBuilder.addInput(maindiag.asOutput()); + opBuilder.addInput(subdiag.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TridiagonalMatMul(opBuilder.build()); + } + + /** + * Tensor of shape `[..., M, N]` containing the product. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TridiagonalMatMul(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalSolve.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalSolve.java new file mode 100644 index 00000000000..2a7f9f09ee8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalSolve.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Solves tridiagonal systems of equations. + *

      + * Solves tridiagonal systems of equations. + * Supports batch dimensions and multiple right-hand sides per each left-hand + * side. + * On CPU, solution is computed via Gaussian elimination with or without partial + * pivoting, depending on `partial_pivoting` attribute. On GPU, Nvidia's cuSPARSE + * library is used: https://docs.nvidia.com/cuda/cusparse/index.html#gtsv + * + * @param data type for {@code output()} output + */ +public final class TridiagonalSolve extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TridiagonalSolve} + */ + public static class Options { + + /** + * @param partialPivoting Whether to apply partial pivoting. Partial pivoting makes the procedure more + * stable, but slower. + */ + public Options partialPivoting(Boolean partialPivoting) { + this.partialPivoting = partialPivoting; + return this; + } + + private Boolean partialPivoting; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TridiagonalSolve operation. + * + * @param scope current scope + * @param diagonals Tensor of shape `[..., 3, M]` whose innermost 2 dimensions represent the + * tridiagonal matrices with three rows being the superdiagonal, diagonals, and + * subdiagonals, in order. The last element of the superdiagonal and the first + * element of the subdiagonal is ignored. + * @param rhs Tensor of shape `[..., M, K]`, representing K right-hand sides per each + * left-hand side. + * @param options carries optional attributes values + * @return a new instance of TridiagonalSolve + */ + public static TridiagonalSolve create(Scope scope, Operand diagonals, Operand rhs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TridiagonalSolve", scope.makeOpName("TridiagonalSolve")); + opBuilder.addInput(diagonals.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.partialPivoting != null) { + opBuilder.setAttr("partial_pivoting", opts.partialPivoting); + } + } + } + return new TridiagonalSolve(opBuilder.build()); + } + + /** + * @param partialPivoting Whether to apply partial pivoting. Partial pivoting makes the procedure more + * stable, but slower. + */ + public static Options partialPivoting(Boolean partialPivoting) { + return new Options().partialPivoting(partialPivoting); + } + + /** + * Tensor of shape `[..., M, K]` containing the solutions + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TridiagonalSolve(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TryRpc.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TryRpc.java new file mode 100644 index 00000000000..b0b8a5b7d60 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TryRpc.java @@ -0,0 +1,219 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Perform batches of RPC requests. + *

      + * This op asynchronously performs either a single RPC request, or a batch + * of requests. RPC requests are defined by three main parameters: + *

      + * - `address` (the host+port or BNS address of the request) + * - `method` (the method name for the request) + * - `request` (the serialized proto string, or vector of strings, + * of the RPC request argument). + *

      + * For example, if you have an RPC service running on port localhost:2345, + * and its interface is configured with the following proto declaration: + *

      {@code
      + * service MyService {
      + *   rpc MyMethod(MyRequestProto) returns (MyResponseProto) {
      + *   }
      + * };
      + * }
      + * then call this op with arguments: + *
      {@code
      + * address = "localhost:2345"
      + * method = "MyService/MyMethod"
      + * }
      + * The `request` tensor is a string tensor representing serialized `MyRequestProto` + * strings; and the output string tensor `response` will have the same shape + * and contain (upon successful completion) corresponding serialized + * `MyResponseProto` strings. + *

      + * For example, to send a single, empty, `MyRequestProto`, call + * this op with `request = ""`. To send 5 parallel empty requests, + * call this op with `request = ["", "", "", "", ""]`. + *

      + * More generally, one can create a batch of `MyRequestProto` serialized protos + * from regular batched tensors using the `encode_proto` op, and convert + * the response `MyResponseProto` serialized protos to batched tensors + * using the `decode_proto` op. + *

      + * NOTE Working with serialized proto strings is faster than instantiating + * actual proto objects in memory, so no performance degradation is expected + * compared to writing custom kernels for this workflow. + *

      + * Unlike the standard `Rpc` op, if the connection fails or the remote worker + * returns an error status, this op does not reraise the exception. + * Instead, the `status_code` and `status_message` entry for the corresponding RPC + * call is set with the error returned from the RPC call. The `response` tensor + * will contain valid response values for those minibatch entries whose RPCs did + * not fail; the rest of the entries will have empty strings. + */ +@Operator +public final class TryRpc extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.TryRpc} + */ + public static class Options { + + /** + * @param protocol RPC protocol to use. Empty string means use the default protocol. + * Options include 'grpc'. + */ + public Options protocol(String protocol) { + this.protocol = protocol; + return this; + } + + /** + * @param failFast `boolean`. If `true` (default), then failures to connect + * (i.e., the server does not immediately respond) cause an RPC failure. + */ + public Options failFast(Boolean failFast) { + this.failFast = failFast; + return this; + } + + /** + * @param timeoutInMs `int`. If `0` (default), then the kernel will run the RPC + * request and only time out if the RPC deadline passes or the session times out. + * If this value is greater than `0`, then the op will raise an exception if + * the RPC takes longer than `timeout_in_ms`. + */ + public Options timeoutInMs(Long timeoutInMs) { + this.timeoutInMs = timeoutInMs; + return this; + } + + private String protocol; + private Boolean failFast; + private Long timeoutInMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TryRpc operation. + * + * @param scope current scope + * @param address `0-D` or `1-D`. The address (i.e. host_name:port) of the RPC server. + * If this tensor has more than 1 element, then multiple parallel rpc requests + * are sent. This argument broadcasts with `method` and `request`. + * @param method `0-D` or `1-D`. The method address on the RPC server. + * If this tensor has more than 1 element, then multiple parallel rpc requests + * are sent. This argument broadcasts with `address` and `request`. + * @param request `0-D` or `1-D`. Serialized proto strings: the rpc request argument. + * If this tensor has more than 1 element, then multiple parallel rpc requests + * are sent. This argument broadcasts with `address` and `method`. + * @param options carries optional attributes values + * @return a new instance of TryRpc + */ + public static TryRpc create(Scope scope, Operand address, Operand method, Operand request, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TryRpc", scope.makeOpName("TryRpc")); + opBuilder.addInput(address.asOutput()); + opBuilder.addInput(method.asOutput()); + opBuilder.addInput(request.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.protocol != null) { + opBuilder.setAttr("protocol", opts.protocol); + } + if (opts.failFast != null) { + opBuilder.setAttr("fail_fast", opts.failFast); + } + if (opts.timeoutInMs != null) { + opBuilder.setAttr("timeout_in_ms", opts.timeoutInMs); + } + } + } + return new TryRpc(opBuilder.build()); + } + + /** + * @param protocol RPC protocol to use. Empty string means use the default protocol. + * Options include 'grpc'. + */ + public static Options protocol(String protocol) { + return new Options().protocol(protocol); + } + + /** + * @param failFast `boolean`. If `true` (default), then failures to connect + * (i.e., the server does not immediately respond) cause an RPC failure. + */ + public static Options failFast(Boolean failFast) { + return new Options().failFast(failFast); + } + + /** + * @param timeoutInMs `int`. If `0` (default), then the kernel will run the RPC + * request and only time out if the RPC deadline passes or the session times out. + * If this value is greater than `0`, then the op will raise an exception if + * the RPC takes longer than `timeout_in_ms`. + */ + public static Options timeoutInMs(Long timeoutInMs) { + return new Options().timeoutInMs(timeoutInMs); + } + + /** + * Same shape as `request`. Serialized proto strings: the rpc responses. + */ + public Output response() { + return response; + } + + /** + * Same shape as `request`. Values correspond to tensorflow Status enum codes. + */ + public Output statusCode() { + return statusCode; + } + + /** + * Same shape as `request`. Values correspond to Status messages + * returned from the RPC calls. + */ + public Output statusMessage() { + return statusMessage; + } + + private Output response; + private Output statusCode; + private Output statusMessage; + + private TryRpc(Operation operation) { + super(operation); + int outputIdx = 0; + response = operation.output(outputIdx++); + statusCode = operation.output(outputIdx++); + statusMessage = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unbatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unbatch.java new file mode 100644 index 00000000000..6250f31703d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unbatch.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reverses the operation of Batch for a single output Tensor. + *

      + * An instance of Unbatch either receives an empty batched_tensor, in which case it + * asynchronously waits until the values become available from a concurrently + * running instance of Unbatch with the same container and shared_name, or receives + * a non-empty batched_tensor in which case it finalizes all other concurrently + * running instances and outputs its own element from the batch. + *

      + * batched_tensor: The possibly transformed output of Batch. The size of the first + * dimension should remain unchanged by the transformations for the operation to + * work. + * batch_index: The matching batch_index obtained from Batch. + * id: The id scalar emitted by Batch. + * unbatched_tensor: The Tensor corresponding to this execution. + * timeout_micros: Maximum amount of time (in microseconds) to wait to receive the + * batched input tensor associated with a given invocation of the op. + * container: Container to control resource sharing. + * shared_name: Instances of Unbatch with the same container and shared_name are + * assumed to possibly belong to the same batch. If left empty, the op name will + * be used as the shared name. + * + * @param data type for {@code unbatchedTensor()} output + */ +@Operator +public final class Unbatch extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Unbatch} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Unbatch operation. + * + * @param scope current scope + * @param batchedTensor + * @param batchIndex + * @param id + * @param timeoutMicros + * @param options carries optional attributes values + * @return a new instance of Unbatch + */ + public static Unbatch create(Scope scope, Operand batchedTensor, Operand batchIndex, Operand id, Long timeoutMicros, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Unbatch", scope.makeOpName("Unbatch")); + opBuilder.addInput(batchedTensor.asOutput()); + opBuilder.addInput(batchIndex.asOutput()); + opBuilder.addInput(id.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("timeout_micros", timeoutMicros); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new Unbatch(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output unbatchedTensor() { + return unbatchedTensor; + } + + @Override + public Output asOutput() { + return unbatchedTensor; + } + + private Output unbatchedTensor; + + private Unbatch(Operation operation) { + super(operation); + int outputIdx = 0; + unbatchedTensor = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnbatchGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnbatchGrad.java new file mode 100644 index 00000000000..801444645cb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnbatchGrad.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gradient of Unbatch. + *

      + * Acts like Batch but using the given batch_index index of batching things as they + * become available. This ensures that the gradients are propagated back in the + * same session which did the forward pass. + *

      + * original_input: The input to the Unbatch operation this is the gradient of. + * batch_index: The batch_index given to the Unbatch operation this is the gradient + * of. + * grad: The downstream gradient. + * id: The id scalar emitted by Batch. + * batched_grad: The return value, either an empty tensor or the batched gradient. + * container: Container to control resource sharing. + * shared_name: Instances of UnbatchGrad with the same container and shared_name + * are assumed to possibly belong to the same batch. If left empty, the op name + * will be used as the shared name. + * + * @param data type for {@code batchedGrad()} output + */ +@Operator +public final class UnbatchGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.UnbatchGrad} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new UnbatchGrad operation. + * + * @param scope current scope + * @param originalInput + * @param batchIndex + * @param grad + * @param id + * @param options carries optional attributes values + * @return a new instance of UnbatchGrad + */ + public static UnbatchGrad create(Scope scope, Operand originalInput, Operand batchIndex, Operand grad, Operand id, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("UnbatchGrad", scope.makeOpName("UnbatchGrad")); + opBuilder.addInput(originalInput.asOutput()); + opBuilder.addInput(batchIndex.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(id.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new UnbatchGrad(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output batchedGrad() { + return batchedGrad; + } + + @Override + public Output asOutput() { + return batchedGrad; + } + + private Output batchedGrad; + + private UnbatchGrad(Operation operation) { + super(operation); + int outputIdx = 0; + batchedGrad = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnicodeDecode.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnicodeDecode.java new file mode 100644 index 00000000000..36c46dd3a06 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnicodeDecode.java @@ -0,0 +1,202 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Decodes each string in `input` into a sequence of Unicode code points. + *

      + * The character codepoints for all strings are returned using a single vector + * `char_values`, with strings expanded to characters in row-major order. + *

      + * The `row_splits` tensor indicates where the codepoints for + * each input string begin and end within the `char_values` tensor. + * In particular, the values for the `i`th + * string (in row-major order) are stored in the slice + * `[row_splits[i]:row_splits[i+1]]`. Thus: + *

        + *
      • + * `char_values[row_splits[i]+j]` is the Unicode codepoint for the `j`th + * character in the `i`th string (in row-major order). + *
      • + *
      • + * `row_splits[i+1] - row_splits[i]` is the number of characters in the `i`th + * string (in row-major order). + * + * @param data type for {@code rowSplits()} output + */ +public final class UnicodeDecode extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.core.UnicodeDecode} + */ + public static class Options { + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public Options errors(String errors) { + this.errors = errors; + return this; + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD or U+65533.) + */ + public Options replacementChar(Long replacementChar) { + this.replacementChar = replacementChar; + return this; + } + + /** + * @param replaceControlCharacters Whether to replace the C0 control characters (00-1F) with the + * `replacement_char`. Default is false. + */ + public Options replaceControlCharacters(Boolean replaceControlCharacters) { + this.replaceControlCharacters = replaceControlCharacters; + return this; + } + + private String errors; + private Long replacementChar; + private Boolean replaceControlCharacters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new UnicodeDecode operation. + * + * @param scope current scope + * @param input The text to be decoded. Can have any shape. Note that the output is flattened + * to a vector of char values. + * @param inputEncoding Text encoding of the input strings. This is any of the encodings supported + * by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. + * @param Tsplits + * @param options carries optional attributes values + * @return a new instance of UnicodeDecode + */ + public static UnicodeDecode create(Scope scope, Operand input, String inputEncoding, Class Tsplits, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("UnicodeDecode", scope.makeOpName("UnicodeDecode")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("input_encoding", inputEncoding); + opBuilder.setAttr("Tsplits", DataType.fromClass(Tsplits)); + if (options != null) { + for (Options opts : options) { + if (opts.errors != null) { + opBuilder.setAttr("errors", opts.errors); + } + if (opts.replacementChar != null) { + opBuilder.setAttr("replacement_char", opts.replacementChar); + } + if (opts.replaceControlCharacters != null) { + opBuilder.setAttr("replace_control_characters", opts.replaceControlCharacters); + } + } + } + return new UnicodeDecode(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new UnicodeDecode operation using default output types. + * + * @param scope current scope + * @param input The text to be decoded. Can have any shape. Note that the output is flattened + * to a vector of char values. + * @param inputEncoding Text encoding of the input strings. This is any of the encodings supported + * by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. + * @param options carries optional attributes values + * @return a new instance of UnicodeDecode + */ + public static UnicodeDecode create(Scope scope, Operand input, String inputEncoding, Options... options) { + return create(scope, input, inputEncoding, Long.class, options); + } + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public static Options errors(String errors) { + return new Options().errors(errors); + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD or U+65533.) + */ + public static Options replacementChar(Long replacementChar) { + return new Options().replacementChar(replacementChar); + } + + /** + * @param replaceControlCharacters Whether to replace the C0 control characters (00-1F) with the + * `replacement_char`. Default is false. + */ + public static Options replaceControlCharacters(Boolean replaceControlCharacters) { + return new Options().replaceControlCharacters(replaceControlCharacters); + } + + /** + * A 1D int32 tensor containing the row splits. + */ + public Output rowSplits() { + return rowSplits; + } + + /** + * A 1D int32 Tensor containing the decoded codepoints. + */ + public Output charValues() { + return charValues; + } + + private Output rowSplits; + private Output charValues; + + private UnicodeDecode(Operation operation) { + super(operation); + int outputIdx = 0; + rowSplits = operation.output(outputIdx++); + charValues = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnicodeEncode.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnicodeEncode.java new file mode 100644 index 00000000000..93304921ef3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnicodeEncode.java @@ -0,0 +1,159 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Encode a tensor of ints into unicode strings. + *

        + * Returns a vector of strings, where `output[i]` is constructed by encoding the + * Unicode codepoints in `input_values[input_splits[i]:input_splits[i+1]]` + * using `output_encoding`. + *

        + * --- + *

        + * Example: + *

        {@code
        + * input_values = [72, 101, 108, 108, 111, 87, 111, 114, 108, 100]
        + * input_splits = [0, 5, 10]
        + * output_encoding = 'UTF-8'
        + * 
        + * output = ['Hello', 'World']
        + * }
        + * + */ +public final class UnicodeEncode extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.UnicodeEncode} + */ + public static class Options { + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public Options errors(String errors) { + this.errors = errors; + return this; + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD (U+65533). + */ + public Options replacementChar(Long replacementChar) { + this.replacementChar = replacementChar; + return this; + } + + private String errors; + private Long replacementChar; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new UnicodeEncode operation. + * + * @param scope current scope + * @param inputValues A 1D tensor containing the unicode codepoints that should be encoded. + * @param inputSplits A 1D tensor specifying how the unicode codepoints should be split into strings. + * In particular, `output[i]` is constructed by encoding the codepoints in the + * slice `input_values[input_splits[i]:input_splits[i+1]]`. + * @param outputEncoding Unicode encoding of the output strings. Valid encodings are: `"UTF-8", + * "UTF-16-BE", and "UTF-32-BE"`. + * @param options carries optional attributes values + * @return a new instance of UnicodeEncode + */ + public static UnicodeEncode create(Scope scope, Operand inputValues, Operand inputSplits, String outputEncoding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("UnicodeEncode", scope.makeOpName("UnicodeEncode")); + opBuilder.addInput(inputValues.asOutput()); + opBuilder.addInput(inputSplits.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("output_encoding", outputEncoding); + if (options != null) { + for (Options opts : options) { + if (opts.errors != null) { + opBuilder.setAttr("errors", opts.errors); + } + if (opts.replacementChar != null) { + opBuilder.setAttr("replacement_char", opts.replacementChar); + } + } + } + return new UnicodeEncode(opBuilder.build()); + } + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public static Options errors(String errors) { + return new Options().errors(errors); + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD (U+65533). + */ + public static Options replacementChar(Long replacementChar) { + return new Options().replacementChar(replacementChar); + } + + /** + * The 1-D Tensor of strings encoded from the provided unicode codepoints. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnicodeEncode(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unique.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unique.java new file mode 100644 index 00000000000..ae743e96409 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unique.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Finds unique elements along an axis of a tensor. + *

        + * This operation either returns a tensor `y` containing unique elements + * along the `axis` of a tensor. The returned unique elements is sorted + * in the same order as they occur along `axis` in `x`. + * This operation also returns a tensor `idx` that is the same size as + * the number of the elements in `x` along the `axis` dimension. It + * contains the index in the unique output `y`. + * In other words, for an `1-D` tensor `x` with `axis = None: + *

        + * `y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` + *

        + * For example: + *

        {@code
        + * # tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8]
        + * y, idx = unique(x)
        + * y ==> [1, 2, 4, 7, 8]
        + * idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4]
        + * }
        + * For an `2-D` tensor `x` with `axis = 0`: + *
        {@code
        + * # tensor 'x' is [[1, 0, 0],
        + * #                [1, 0, 0],
        + * #                [2, 0, 0]]
        + * y, idx = unique(x, axis=0)
        + * y ==> [[1, 0, 0],
        + *        [2, 0, 0]]
        + * idx ==> [0, 0, 1]
        + * }
        + * For an `2-D` tensor `x` with `axis = 1`: + *
        {@code
        + * # tensor 'x' is [[1, 0, 0],
        + * #                [1, 0, 0],
        + * #                [2, 0, 0]]
        + * y, idx = unique(x, axis=1)
        + * y ==> [[1, 0],
        + *        [1, 0],
        + *        [2, 0]]
        + * idx ==> [0, 1, 1]
        + * }
        + * + * + * @param data type for {@code y()} output + * @param data type for {@code idx()} output + */ +@Operator +public final class Unique extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new Unique operation. + * + * @param scope current scope + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * find the unique elements. + * @param outIdx + * @return a new instance of Unique + */ + public static Unique create(Scope scope, Operand x, Operand axis, Class outIdx) { + OperationBuilder opBuilder = scope.env().opBuilder("UniqueV2", scope.makeOpName("Unique")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_idx", DataType.fromClass(outIdx)); + return new Unique(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Unique operation using default output types. + * + * @param scope current scope + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * find the unique elements. + * @return a new instance of Unique + */ + public static Unique create(Scope scope, Operand x, Operand axis) { + return create(scope, x, axis, Integer.class); + } + + /** + * A `Tensor`. Unique elements along the `axis` of `Tensor` x. + */ + public Output y() { + return y; + } + + /** + * A 1-D Tensor. Has the same type as x that contains the index of each + * value of x in the output y. + */ + public Output idx() { + return idx; + } + + private Output y; + private Output idx; + + private Unique(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + idx = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueDataset.java new file mode 100644 index 00000000000..f07590cdf22 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueDataset.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that contains the unique elements of `input_dataset`. + */ +public final class UniqueDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UniqueDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of UniqueDataset + */ + public static UniqueDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("UniqueDataset", scope.makeOpName("UniqueDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new UniqueDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private UniqueDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueWithCounts.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueWithCounts.java new file mode 100644 index 00000000000..63e7435ec8b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueWithCounts.java @@ -0,0 +1,147 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Finds unique elements along an axis of a tensor. + *

        + * This operation either returns a tensor `y` containing unique elements + * along the `axis` of a tensor. The returned unique elements is sorted + * in the same order as they occur along `axis` in `x`. + * This operation also returns a tensor `idx` and a tensor `count` + * that are the same size as the number of the elements in `x` along the + * `axis` dimension. The `idx` contains the index in the unique output `y` + * and the `count` contains the count in the unique output `y`. + * In other words, for an `1-D` tensor `x` with `axis = None: + *

        + * `y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` + *

        + * For example: + *

        {@code
        + * # tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8]
        + * y, idx, count = unique_with_counts(x)
        + * y ==> [1, 2, 4, 7, 8]
        + * idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4]
        + * count ==> [2, 1, 3, 1, 2]
        + * }
        + * For an `2-D` tensor `x` with `axis = 0`: + *
        {@code
        + * # tensor 'x' is [[1, 0, 0],
        + * #                [1, 0, 0],
        + * #                [2, 0, 0]]
        + * y, idx, count = unique_with_counts(x, axis=0)
        + * y ==> [[1, 0, 0],
        + *        [2, 0, 0]]
        + * idx ==> [0, 0, 1]
        + * count ==> [2, 1]
        + * }
        + * For an `2-D` tensor `x` with `axis = 1`: + *
        {@code
        + * # tensor 'x' is [[1, 0, 0],
        + * #                [1, 0, 0],
        + * #                [2, 0, 0]]
        + * y, idx, count = unique_with_counts(x, axis=1)
        + * y ==> [[1, 0],
        + *        [1, 0],
        + *        [2, 0]]
        + * idx ==> [0, 1, 1]
        + * count ==> [1, 2]
        + * }
        + * + * + * @param data type for {@code y()} output + * @param data type for {@code idx()} output + */ +@Operator +public final class UniqueWithCounts extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new UniqueWithCounts operation. + * + * @param scope current scope + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * find the unique elements. + * @param outIdx + * @return a new instance of UniqueWithCounts + */ + public static UniqueWithCounts create(Scope scope, Operand x, Operand axis, Class outIdx) { + OperationBuilder opBuilder = scope.env().opBuilder("UniqueWithCountsV2", scope.makeOpName("UniqueWithCounts")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_idx", DataType.fromClass(outIdx)); + return new UniqueWithCounts(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new UniqueWithCounts operation using default output types. + * + * @param scope current scope + * @param x A `Tensor`. + * @param axis A `Tensor` of type `int32` (default: None). The axis of the Tensor to + * find the unique elements. + * @return a new instance of UniqueWithCounts + */ + public static UniqueWithCounts create(Scope scope, Operand x, Operand axis) { + return create(scope, x, axis, Integer.class); + } + + /** + * A `Tensor`. Unique elements along the `axis` of `Tensor` x. + */ + public Output y() { + return y; + } + + /** + * A 1-D Tensor. Has the same type as x that contains the index of each + * value of x in the output y. + */ + public Output idx() { + return idx; + } + + /** + * A 1-D Tensor. The count of each value of x in the output y. + */ + public Output count() { + return count; + } + + private Output y; + private Output idx; + private Output count; + + private UniqueWithCounts(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + idx = operation.output(outputIdx++); + count = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnravelIndex.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnravelIndex.java new file mode 100644 index 00000000000..b73ecb4699c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnravelIndex.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts a flat index or array of flat indices into a tuple of + *

        + * coordinate arrays. + *

        + * @compatibility(numpy) + * Equivalent to np.unravel_index + * @end_compatibility + * + * @param data type for {@code output()} output + */ +@Operator +public final class UnravelIndex extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnravelIndex operation. + * + * @param scope current scope + * @param indices An 0-D or 1-D `int` Tensor whose elements are indices into the + * flattened version of an array of dimensions dims. + * @param dims An 1-D `int` Tensor. The shape of the array to use for unraveling + * indices. + * @return a new instance of UnravelIndex + */ + public static UnravelIndex create(Scope scope, Operand indices, Operand dims) { + OperationBuilder opBuilder = scope.env().opBuilder("UnravelIndex", scope.makeOpName("UnravelIndex")); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(dims.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new UnravelIndex(opBuilder.build()); + } + + /** + * An 2-D (or 1-D if indices is 0-D) tensor where each row has the + * same shape as the indices array. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnravelIndex(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnsortedSegmentJoin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnsortedSegmentJoin.java new file mode 100644 index 00000000000..c25175c3a02 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnsortedSegmentJoin.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Joins the elements of `inputs` based on `segment_ids`. + *

        + * Computes the string join along segments of a tensor. + * Given `segment_ids` with rank `N` and `data` with rank `N+M`: + *

        + * `output[i, k1...kM] = strings.join([data[j1...jN, k1...kM])` + *

        + * where the join is over all [j1...jN] such that segment_ids[j1...jN] = i. + * Strings are joined in row-major order. + *

        + * For example: + *

        {@code
        + * inputs = [['Y', 'q', 'c'], ['Y', '6', '6'], ['p', 'G', 'a']]
        + * output_array = string_ops.unsorted_segment_join(inputs=inputs,
        + *                                                 segment_ids=[1, 0, 1],
        + *                                                 num_segments=2,
        + *                                                 separator=':'))
        + * # output_array ==> [['Y', '6', '6'], ['Y:p', 'q:G', 'c:a']]
        + * 
        + * 
        + * inputs = ['this', 'is', 'a', 'test']
        + * output_array = string_ops.unsorted_segment_join(inputs=inputs,
        + *                                                 segment_ids=[0, 0, 0, 0],
        + *                                                 num_segments=1,
        + *                                                 separator=':'))
        + * # output_array ==> ['this:is:a:test']
        + * }
        + * + */ +@Operator +public final class UnsortedSegmentJoin extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.UnsortedSegmentJoin} + */ + public static class Options { + + /** + * @param separator The separator to use when joining. + */ + public Options separator(String separator) { + this.separator = separator; + return this; + } + + private String separator; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new UnsortedSegmentJoin operation. + * + * @param scope current scope + * @param inputs The input to be joined. + * @param segmentIds A tensor whose shape is a prefix of data.shape. Negative segment ids are not + * supported. + * @param numSegments A scalar. + * @param options carries optional attributes values + * @return a new instance of UnsortedSegmentJoin + */ + public static UnsortedSegmentJoin create(Scope scope, Operand inputs, Operand segmentIds, Operand numSegments, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentJoin", scope.makeOpName("UnsortedSegmentJoin")); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.separator != null) { + opBuilder.setAttr("separator", opts.separator); + } + } + } + return new UnsortedSegmentJoin(opBuilder.build()); + } + + /** + * @param separator The separator to use when joining. + */ + public static Options separator(String separator) { + return new Options().separator(separator); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnsortedSegmentJoin(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unstack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unstack.java new file mode 100644 index 00000000000..5db08f57536 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unstack.java @@ -0,0 +1,127 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Unpacks a given dimension of a rank-`R` tensor into `num` rank-`(R-1)` tensors. + *

        + * Unpacks `num` tensors from `value` by chipping it along the `axis` dimension. + * For example, given a tensor of shape `(A, B, C, D)`; + *

        + * If `axis == 0` then the i'th tensor in `output` is the slice `value[i, :, :, :]` + * and each tensor in `output` will have shape `(B, C, D)`. (Note that the + * dimension unpacked along is gone, unlike `split`). + *

        + * If `axis == 1` then the i'th tensor in `output` is the slice `value[:, i, :, :]` + * and each tensor in `output` will have shape `(A, C, D)`. + * Etc. + *

        + * This is the opposite of `pack`. + * + * @param data type for {@code output()} output + */ +@Operator +public final class Unstack extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Unstack} + */ + public static class Options { + + /** + * @param axis Dimension along which to unpack. Negative values wrap around, so the + * valid range is `[-R, R)`. + */ + public Options axis(Long axis) { + this.axis = axis; + return this; + } + + private Long axis; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Unstack operation. + * + * @param scope current scope + * @param value 1-D or higher, with `axis` dimension size equal to `num`. + * @param num + * @param options carries optional attributes values + * @return a new instance of Unstack + */ + public static Unstack create(Scope scope, Operand value, Long num, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Unpack", scope.makeOpName("Unstack")); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num", num); + if (options != null) { + for (Options opts : options) { + if (opts.axis != null) { + opBuilder.setAttr("axis", opts.axis); + } + } + } + return new Unstack(opBuilder.build()); + } + + /** + * @param axis Dimension along which to unpack. Negative values wrap around, so the + * valid range is `[-R, R)`. + */ + public static Options axis(Long axis) { + return new Options().axis(axis); + } + + /** + * The list of tensors unpacked from `value`. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + private List> output; + + @SuppressWarnings("unchecked") + private Unstack(Operation operation) { + super(operation); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList((Output[])operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unstage.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unstage.java new file mode 100644 index 00000000000..1655c06b038 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unstage.java @@ -0,0 +1,171 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Op is similar to a lightweight Dequeue. + *

        + * The basic functionality is similar to dequeue with many fewer + * capabilities and options. This Op is optimized for performance. + */ +@Operator +public final class Unstage extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Unstage} + */ + public static class Options { + + /** + * @param capacity + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param memoryLimit + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private Long memoryLimit; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Unstage operation. + * + * @param scope current scope + * @param dtypes + * @param options carries optional attributes values + * @return a new instance of Unstage + */ + public static Unstage create(Scope scope, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Unstage", scope.makeOpName("Unstage")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.memoryLimit != null) { + opBuilder.setAttr("memory_limit", opts.memoryLimit); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new Unstage(opBuilder.build()); + } + + /** + * @param capacity + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param memoryLimit + */ + public static Options memoryLimit(Long memoryLimit) { + return new Options().memoryLimit(memoryLimit); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public List> values() { + return values; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) values.iterator(); + } + + private List> values; + + private Unstage(Operation operation) { + super(operation); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnwrapDatasetVariant.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnwrapDatasetVariant.java new file mode 100644 index 00000000000..c73e8a948f9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnwrapDatasetVariant.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class UnwrapDatasetVariant extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnwrapDatasetVariant operation. + * + * @param scope current scope + * @param inputHandle + * @return a new instance of UnwrapDatasetVariant + */ + public static UnwrapDatasetVariant create(Scope scope, Operand inputHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("UnwrapDatasetVariant", scope.makeOpName("UnwrapDatasetVariant")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new UnwrapDatasetVariant(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private UnwrapDatasetVariant(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UpperBound.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UpperBound.java new file mode 100644 index 00000000000..70c8e8769dd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UpperBound.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Applies upper_bound(sorted_search_values, values) along each row. + *

        + * Each set of rows with the same index in (sorted_inputs, values) is treated + * independently. The resulting row is the equivalent of calling + * `np.searchsorted(sorted_inputs, values, side='right')`. + *

        + * The result is not a global index to the entire + * `Tensor`, but rather just the index in the last dimension. + *

        + * A 2-D example: + * sorted_sequence = [[0, 3, 9, 9, 10], + * [1, 2, 3, 4, 5]] + * values = [[2, 4, 9], + * [0, 2, 6]] + *

        + * result = UpperBound(sorted_sequence, values) + *

        + * result == [[1, 2, 4], + * [0, 2, 5]] + * + * @param data type for {@code output()} output + */ +public final class UpperBound extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UpperBound operation. + * + * @param scope current scope + * @param sortedInputs 2-D Tensor where each row is ordered. + * @param values 2-D Tensor with the same numbers of rows as `sorted_search_values`. Contains + * the values that will be searched for in `sorted_search_values`. + * @param outType + * @return a new instance of UpperBound + */ + public static UpperBound create(Scope scope, Operand sortedInputs, Operand values, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("UpperBound", scope.makeOpName("UpperBound")); + opBuilder.addInput(sortedInputs.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new UpperBound(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new UpperBound operation using default output types. + * + * @param scope current scope + * @param sortedInputs 2-D Tensor where each row is ordered. + * @param values 2-D Tensor with the same numbers of rows as `sorted_search_values`. Contains + * the values that will be searched for in `sorted_search_values`. + * @return a new instance of UpperBound + */ + public static UpperBound create(Scope scope, Operand sortedInputs, Operand values) { + return create(scope, sortedInputs, values, Integer.class); + } + + /** + * A `Tensor` with the same shape as `values`. It contains the last scalar index + * into the last dimension where values can be inserted without changing the + * ordered property. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UpperBound(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VarHandleOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VarHandleOp.java new file mode 100644 index 00000000000..86ac34af81c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VarHandleOp.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates a handle to a Variable resource. + */ +@Operator +public final class VarHandleOp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.VarHandleOp} + */ + public static class Options { + + /** + * @param container the container this variable is placed in. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName the name by which this variable is referred to. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new VarHandleOp operation. + * + * @param scope current scope + * @param dtype the type of this variable. Must agree with the dtypes + * of all ops using this variable. + * @param shape The (possibly partially specified) shape of this variable. + * @param options carries optional attributes values + * @return a new instance of VarHandleOp + */ + public static VarHandleOp create(Scope scope, Class dtype, Shape shape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("VarHandleOp", scope.makeOpName("VarHandleOp")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + opBuilder.setAttr("shape", shape); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new VarHandleOp(opBuilder.build()); + } + + /** + * @param container the container this variable is placed in. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName the name by which this variable is referred to. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output resource() { + return resource; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) resource; + } + + private Output resource; + + private VarHandleOp(Operation operation) { + super(operation); + int outputIdx = 0; + resource = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VarIsInitializedOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VarIsInitializedOp.java new file mode 100644 index 00000000000..bae968632b6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VarIsInitializedOp.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Checks whether a resource handle-based variable has been initialized. + */ +@Operator +public final class VarIsInitializedOp extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new VarIsInitializedOp operation. + * + * @param scope current scope + * @param resource the input resource handle. + * @return a new instance of VarIsInitializedOp + */ + public static VarIsInitializedOp create(Scope scope, Operand resource) { + OperationBuilder opBuilder = scope.env().opBuilder("VarIsInitializedOp", scope.makeOpName("VarIsInitializedOp")); + opBuilder.addInput(resource.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new VarIsInitializedOp(opBuilder.build()); + } + + /** + * a scalar boolean which is true if the variable has been + * initialized. + */ + public Output isInitialized() { + return isInitialized; + } + + @Override + public Output asOutput() { + return isInitialized; + } + + private Output isInitialized; + + private VarIsInitializedOp(Operation operation) { + super(operation); + int outputIdx = 0; + isInitialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Variable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Variable.java new file mode 100644 index 00000000000..8c017bf8682 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Variable.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Holds state in the form of a tensor that persists across steps. + *

        + * Outputs a ref to the tensor state so it may be read or modified. + * TODO(zhifengc/mrry): Adds a pointer to a more detail document + * about sharing states in tensorflow. + * + * @param data type for {@code ref()} output + */ +@Operator +public final class Variable extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.core.Variable} + */ + public static class Options { + + /** + * @param container If non-empty, this variable is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this variable is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Variable operation. + * + * @param scope current scope + * @param shape The shape of the variable tensor. + * @param dtype The type of elements in the variable tensor. + * @param options carries optional attributes values + * @return a new instance of Variable + */ + public static Variable create(Scope scope, Shape shape, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("VariableV2", scope.makeOpName("Variable")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape", shape); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new Variable(opBuilder.build()); + } + + /** + * @param container If non-empty, this variable is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this variable is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * A reference to the variable tensor. + */ + public Output ref() { + return ref; + } + + @Override + public Output asOutput() { + return ref; + } + + private Output ref; + + private Variable(Operation operation) { + super(operation); + int outputIdx = 0; + ref = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VariableShape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VariableShape.java new file mode 100644 index 00000000000..6e3d1e0a65d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/VariableShape.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the shape of the variable pointed to by `resource`. + *

        + * This operation returns a 1-D integer tensor representing the shape of `input`. + *

        + * For example: + *

        {@code
        + * # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]
        + * shape(t) ==> [2, 2, 3]
        + * }
        + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class VariableShape extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new VariableShape operation. + * + * @param scope current scope + * @param input + * @param outType + * @return a new instance of VariableShape + */ + public static VariableShape create(Scope scope, Operand input, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("VariableShape", scope.makeOpName("VariableShape")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new VariableShape(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new VariableShape operation using default output types. + * + * @param scope current scope + * @param input + * @return a new instance of VariableShape + */ + public static VariableShape create(Scope scope, Operand input) { + return create(scope, input, Integer.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private VariableShape(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where.java new file mode 100644 index 00000000000..cb344ae0e1d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where.java @@ -0,0 +1,126 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns locations of nonzero / true values in a tensor. + *

        + * This operation returns the coordinates of true elements in `condition`. The + * coordinates are returned in a 2-D tensor where the first dimension (rows) + * represents the number of true elements, and the second dimension (columns) + * represents the coordinates of the true elements. Keep in mind, the shape of + * the output tensor can vary depending on how many true values there are in + * `condition`. Indices are output in row-major order. + *

        + * For example: + *

        {@code
        + * # 'input' tensor is [[True, False]
        + * #                    [True, False]]
        + * # 'input' has two true values, so output has two coordinates.
        + * # 'input' has rank of 2, so coordinates have two indices.
        + * where(input) ==> [[0, 0],
        + *                   [1, 0]]
        + * 
        + * # `condition` tensor is [[[True, False]
        + * #                     [True, False]]
        + * #                    [[False, True]
        + * #                     [False, True]]
        + * #                    [[False, False]
        + * #                     [False, True]]]
        + * # 'input' has 5 true values, so output has 5 coordinates.
        + * # 'input' has rank of 3, so coordinates have three indices.
        + * where(input) ==> [[0, 0, 0],
        + *                   [0, 1, 0],
        + *                   [1, 0, 1],
        + *                   [1, 1, 1],
        + *                   [2, 1, 1]]
        + * 
        + * # `condition` tensor is [[[1.5,  0.0]
        + * #                     [-0.5, 0.0]]
        + * #                    [[0.0,  0.25]
        + * #                     [0.0,  0.75]]
        + * #                    [[0.0,  0.0]
        + * #                     [0.0,  0.01]]]
        + * # 'input' has 5 nonzero values, so output has 5 coordinates.
        + * # 'input' has rank of 3, so coordinates have three indices.
        + * where(input) ==> [[0, 0, 0],
        + *                   [0, 1, 0],
        + *                   [1, 0, 1],
        + *                   [1, 1, 1],
        + *                   [2, 1, 1]]
        + * 
        + * # `condition` tensor is [[[1.5 + 0.0j, 0.0  + 0.0j]
        + * #                     [0.0 + 0.5j, 0.0  + 0.0j]]
        + * #                    [[0.0 + 0.0j, 0.25 + 1.5j]
        + * #                     [0.0 + 0.0j, 0.75 + 0.0j]]
        + * #                    [[0.0 + 0.0j, 0.0  + 0.0j]
        + * #                     [0.0 + 0.0j, 0.01 + 0.0j]]]
        + * # 'input' has 5 nonzero magnitude values, so output has 5 coordinates.
        + * # 'input' has rank of 3, so coordinates have three indices.
        + * where(input) ==> [[0, 0, 0],
        + *                   [0, 1, 0],
        + *                   [1, 0, 1],
        + *                   [1, 1, 1],
        + *                   [2, 1, 1]]
        + * }
        + * + */ +@Operator +public final class Where extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Where operation. + * + * @param scope current scope + * @param condition + * @return a new instance of Where + */ + public static Where create(Scope scope, Operand condition) { + OperationBuilder opBuilder = scope.env().opBuilder("Where", scope.makeOpName("Where")); + opBuilder.addInput(condition.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Where(opBuilder.build()); + } + + /** + */ + public Output index() { + return index; + } + + @Override + public Output asOutput() { + return index; + } + + private Output index; + + private Where(Operation operation) { + super(operation); + int outputIdx = 0; + index = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where3.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where3.java new file mode 100644 index 00000000000..3450e63be8d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where3.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Selects elements from `x` or `y`, depending on `condition`. + *

        + * The `x`, and `y` tensors must all have the same shape, and the + * output will also have that shape. + *

        + * The `condition` tensor must be a scalar if `x` and `y` are scalars. + * If `x` and `y` are vectors or higher rank, then `condition` must be either a + * scalar, a vector with size matching the first dimension of `x`, or must have + * the same shape as `x`. + *

        + * The `condition` tensor acts as a mask that chooses, based on the value at each + * element, whether the corresponding element / row in the output should be + * taken from `x` (if true) or `y` (if false). + *

        + * If `condition` is a vector and `x` and `y` are higher rank matrices, then + * it chooses which row (outer dimension) to copy from `x` and `y`. + * If `condition` has the same shape as `x` and `y`, then it chooses which + * element to copy from `x` and `y`. + *

        + * For example: + *

        {@code
        + * # 'condition' tensor is [[True,  False]
        + * #                        [False, True]]
        + * # 't' is [[1, 2],
        + * #         [3, 4]]
        + * # 'e' is [[5, 6],
        + * #         [7, 8]]
        + * select(condition, t, e)  # => [[1, 6], [7, 4]]
        + * 
        + * 
        + * # 'condition' tensor is [True, False]
        + * # 't' is [[1, 2],
        + * #         [3, 4]]
        + * # 'e' is [[5, 6],
        + * #         [7, 8]]
        + * select(condition, t, e) ==> [[1, 2],
        + *                              [7, 8]]
        + * 
        + * }
        + * + * + * @param data type for {@code output()} output + */ +@Operator +public final class Where3 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Where3 operation. + * + * @param scope current scope + * @param condition + * @param x = A `Tensor` which may have the same shape as `condition`. + * If `condition` is rank 1, `x` may have higher rank, + * but its first dimension must match the size of `condition`. + * @param y = A `Tensor` with the same type and shape as `x`. + * @return a new instance of Where3 + */ + public static Where3 create(Scope scope, Operand condition, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Select", scope.makeOpName("Where3")); + opBuilder.addInput(condition.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Where3(opBuilder.build()); + } + + /** + * = A `Tensor` with the same type and shape as `x` and `y`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Where3(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WorkerHeartbeat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WorkerHeartbeat.java new file mode 100644 index 00000000000..fb2a52de7a0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WorkerHeartbeat.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Worker heartbeat op. + *

        + * Heartbeats may be sent periodically to indicate the coordinator is still active, + * to retrieve the current worker status and to expedite shutdown when necessary. + */ +public final class WorkerHeartbeat extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new WorkerHeartbeat operation. + * + * @param scope current scope + * @param request A string tensor containing a serialized WorkerHeartbeatRequest + * @return a new instance of WorkerHeartbeat + */ + public static WorkerHeartbeat create(Scope scope, Operand request) { + OperationBuilder opBuilder = scope.env().opBuilder("WorkerHeartbeat", scope.makeOpName("WorkerHeartbeat")); + opBuilder.addInput(request.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WorkerHeartbeat(opBuilder.build()); + } + + /** + * A string tensor containing a serialized WorkerHeartbeatResponse + */ + public Output response() { + return response; + } + + @Override + public Output asOutput() { + return response; + } + + private Output response; + + private WorkerHeartbeat(Operation operation) { + super(operation); + int outputIdx = 0; + response = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WrapDatasetVariant.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WrapDatasetVariant.java new file mode 100644 index 00000000000..8e5cbf4561b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WrapDatasetVariant.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class WrapDatasetVariant extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new WrapDatasetVariant operation. + * + * @param scope current scope + * @param inputHandle + * @return a new instance of WrapDatasetVariant + */ + public static WrapDatasetVariant create(Scope scope, Operand inputHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("WrapDatasetVariant", scope.makeOpName("WrapDatasetVariant")); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WrapDatasetVariant(opBuilder.build()); + } + + /** + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + private Output outputHandle; + + private WrapDatasetVariant(Operation operation) { + super(operation); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WriteRawProtoSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WriteRawProtoSummary.java new file mode 100644 index 00000000000..bf6df0f2f75 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/WriteRawProtoSummary.java @@ -0,0 +1,52 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class WriteRawProtoSummary extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new WriteRawProtoSummary operation. + * + * @param scope current scope + * @param writer + * @param step + * @param tensor + * @return a new instance of WriteRawProtoSummary + */ + public static WriteRawProtoSummary create(Scope scope, Operand writer, Operand step, Operand tensor) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteRawProtoSummary", scope.makeOpName("WriteRawProtoSummary")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WriteRawProtoSummary(opBuilder.build()); + } + + + private WriteRawProtoSummary(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ZerosLike.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ZerosLike.java new file mode 100644 index 00000000000..1e6c43a5475 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ZerosLike.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.core; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a tensor of zeros with the same shape and type as x. + * + * @param data type for {@code y()} output + */ +@Operator +public final class ZerosLike extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ZerosLike operation. + * + * @param scope current scope + * @param x a tensor of type T. + * @return a new instance of ZerosLike + */ + public static ZerosLike create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("ZerosLike", scope.makeOpName("ZerosLike")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ZerosLike(opBuilder.build()); + } + + /** + * a tensor of the same shape and type as x but filled with zeros. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private ZerosLike(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/AnonymousIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/AnonymousIterator.java new file mode 100644 index 00000000000..8c32480c5d0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/AnonymousIterator.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A container for an iterator resource. + */ +@Operator(group = "data") +public final class AnonymousIterator extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AnonymousIterator operation. + * + * @param scope current scope + * @param outputTypes + * @param outputShapes + * @return a new instance of AnonymousIterator + */ + public static AnonymousIterator create(Scope scope, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("AnonymousIterator", scope.makeOpName("AnonymousIterator")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new AnonymousIterator(opBuilder.build()); + } + + /** + * A handle to the iterator that can be passed to a "MakeIterator" or + * "IteratorGetNext" op. In contrast to Iterator, AnonymousIterator prevents + * resource sharing by name, and does not keep a reference to the resource + * container. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private AnonymousIterator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/BatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/BatchDataset.java new file mode 100644 index 00000000000..c594bd3bac9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/BatchDataset.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that batches `batch_size` elements from `input_dataset`. + */ +public final class BatchDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.BatchDataset} + */ + public static class Options { + + /** + * @param parallelCopy + */ + public Options parallelCopy(Boolean parallelCopy) { + this.parallelCopy = parallelCopy; + return this; + } + + private Boolean parallelCopy; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param batchSize A scalar representing the number of elements to accumulate in a batch. + * @param dropRemainder A scalar representing whether the last batch should be dropped in case its size + * is smaller than desired. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of BatchDataset + */ + public static BatchDataset create(Scope scope, Operand inputDataset, Operand batchSize, Operand dropRemainder, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchDatasetV2", scope.makeOpName("BatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(batchSize.asOutput()); + opBuilder.addInput(dropRemainder.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.parallelCopy != null) { + opBuilder.setAttr("parallel_copy", opts.parallelCopy); + } + } + } + return new BatchDataset(opBuilder.build()); + } + + /** + * @param parallelCopy + */ + public static Options parallelCopy(Boolean parallelCopy) { + return new Options().parallelCopy(parallelCopy); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private BatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/BytesProducedStatsDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/BytesProducedStatsDataset.java new file mode 100644 index 00000000000..700e1946b4e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/BytesProducedStatsDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Records the bytes size of each element of `input_dataset` in a StatsAggregator. + */ +public final class BytesProducedStatsDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BytesProducedStatsDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param tag + * @param outputTypes + * @param outputShapes + * @return a new instance of BytesProducedStatsDataset + */ + public static BytesProducedStatsDataset create(Scope scope, Operand inputDataset, Operand tag, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("BytesProducedStatsDataset", scope.makeOpName("BytesProducedStatsDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new BytesProducedStatsDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private BytesProducedStatsDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/CacheDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/CacheDataset.java new file mode 100644 index 00000000000..4d101f3b01d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/CacheDataset.java @@ -0,0 +1,88 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that caches elements from `input_dataset`. + *

        + * A CacheDataset will iterate over the input_dataset, and store tensors. If the + * cache already exists, the cache will be used. If the cache is inappropriate + * (e.g. cannot be opened, contains tensors of the wrong shape / size), an error + * will the returned when used. + */ +public final class CacheDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CacheDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param filename A path on the filesystem where we should cache the dataset. Note: this + * will be a directory. + * @param outputTypes + * @param outputShapes + * @return a new instance of CacheDataset + */ + public static CacheDataset create(Scope scope, Operand inputDataset, Operand filename, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("CacheDataset", scope.makeOpName("CacheDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(filename.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new CacheDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private CacheDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ConcatenateDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ConcatenateDataset.java new file mode 100644 index 00000000000..792b569027b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ConcatenateDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that concatenates `input_dataset` with `another_dataset`. + */ +public final class ConcatenateDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ConcatenateDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param anotherDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of ConcatenateDataset + */ + public static ConcatenateDataset create(Scope scope, Operand inputDataset, Operand anotherDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ConcatenateDataset", scope.makeOpName("ConcatenateDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(anotherDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ConcatenateDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ConcatenateDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToGraph.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToGraph.java new file mode 100644 index 00000000000..28518414f5b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToGraph.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns a serialized GraphDef representing `input_dataset`. + *

        + * Returns a graph representation for `input_dataset`. + */ +public final class DatasetToGraph extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DatasetToGraph operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the dataset to return the graph representation for. + * @return a new instance of DatasetToGraph + */ + public static DatasetToGraph create(Scope scope, Operand inputDataset) { + OperationBuilder opBuilder = scope.env().opBuilder("DatasetToGraph", scope.makeOpName("DatasetToGraph")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DatasetToGraph(opBuilder.build()); + } + + /** + * The graph representation of the dataset (as serialized GraphDef). + */ + public Output graph() { + return graph; + } + + @Override + public Output asOutput() { + return graph; + } + + private Output graph; + + private DatasetToGraph(Operation operation) { + super(operation); + int outputIdx = 0; + graph = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToSingleElement.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToSingleElement.java new file mode 100644 index 00000000000..bd9843a560e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToSingleElement.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Outputs the single element from the given dataset. + */ +public final class DatasetToSingleElement extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new DatasetToSingleElement operation. + * + * @param scope current scope + * @param dataset A handle to a dataset that contains a single element. + * @param outputTypes + * @param outputShapes + * @return a new instance of DatasetToSingleElement + */ + public static DatasetToSingleElement create(Scope scope, Operand dataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("DatasetToSingleElement", scope.makeOpName("DatasetToSingleElement")); + opBuilder.addInput(dataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new DatasetToSingleElement(opBuilder.build()); + } + + /** + * The components of the single element of `input`. + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private DatasetToSingleElement(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToTfRecord.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToTfRecord.java new file mode 100644 index 00000000000..18e3cb86616 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DatasetToTfRecord.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Writes the given dataset to the given file using the TFRecord format. + */ +public final class DatasetToTfRecord extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DatasetToTfRecord operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the dataset to write. + * @param filename A scalar string tensor representing the filename to use. + * @param compressionType A scalar string tensor containing either (i) the empty string (no + * compression), (ii) "ZLIB", or (iii) "GZIP". + * @return a new instance of DatasetToTfRecord + */ + public static DatasetToTfRecord create(Scope scope, Operand inputDataset, Operand filename, Operand compressionType) { + OperationBuilder opBuilder = scope.env().opBuilder("DatasetToTFRecord", scope.makeOpName("DatasetToTfRecord")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(filename.asOutput()); + opBuilder.addInput(compressionType.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DatasetToTfRecord(opBuilder.build()); + } + + + private DatasetToTfRecord(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DenseToSparseBatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DenseToSparseBatchDataset.java new file mode 100644 index 00000000000..90dc80bc15a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DenseToSparseBatchDataset.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that batches input elements into a SparseTensor. + */ +public final class DenseToSparseBatchDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DenseToSparseBatchDataset operation. + * + * @param scope current scope + * @param inputDataset A handle to an input dataset. Must have a single component. + * @param batchSize A scalar representing the number of elements to accumulate in a + * batch. + * @param rowShape A vector representing the dense shape of each row in the produced + * SparseTensor. The shape may be partially specified, using `-1` to indicate + * that a particular dimension should use the maximum size of all batch elements. + * @param outputTypes + * @param outputShapes + * @return a new instance of DenseToSparseBatchDataset + */ + public static DenseToSparseBatchDataset create(Scope scope, Operand inputDataset, Operand batchSize, Operand rowShape, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("DenseToSparseBatchDataset", scope.makeOpName("DenseToSparseBatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(batchSize.asOutput()); + opBuilder.addInput(rowShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new DenseToSparseBatchDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private DenseToSparseBatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DeserializeIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DeserializeIterator.java new file mode 100644 index 00000000000..0623dbbc2d7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/DeserializeIterator.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts the given variant tensor to an iterator and stores it in the given resource. + */ +@Operator(group = "data") +public final class DeserializeIterator extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeserializeIterator operation. + * + * @param scope current scope + * @param resourceHandle A handle to an iterator resource. + * @param serialized A variant tensor storing the state of the iterator contained in the + * resource. + * @return a new instance of DeserializeIterator + */ + public static DeserializeIterator create(Scope scope, Operand resourceHandle, Operand serialized) { + OperationBuilder opBuilder = scope.env().opBuilder("DeserializeIterator", scope.makeOpName("DeserializeIterator")); + opBuilder.addInput(resourceHandle.asOutput()); + opBuilder.addInput(serialized.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DeserializeIterator(opBuilder.build()); + } + + + private DeserializeIterator(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalAssertNextDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalAssertNextDataset.java new file mode 100644 index 00000000000..a2f9d112692 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalAssertNextDataset.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalAssertNextDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalAssertNextDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param transformations + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalAssertNextDataset + */ + public static ExperimentalAssertNextDataset create(Scope scope, Operand inputDataset, Operand transformations, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalAssertNextDataset", scope.makeOpName("ExperimentalAssertNextDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(transformations.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalAssertNextDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalAssertNextDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalCsvDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalCsvDataset.java new file mode 100644 index 00000000000..3a697cfe391 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalCsvDataset.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalCsvDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalCsvDataset operation. + * + * @param scope current scope + * @param filenames + * @param compressionType + * @param bufferSize + * @param header + * @param fieldDelim + * @param useQuoteDelim + * @param naValue + * @param selectCols + * @param recordDefaults + * @param outputShapes + * @return a new instance of ExperimentalCsvDataset + */ + public static ExperimentalCsvDataset create(Scope scope, Operand filenames, Operand compressionType, Operand bufferSize, Operand header, Operand fieldDelim, Operand useQuoteDelim, Operand naValue, Operand selectCols, Iterable> recordDefaults, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalCSVDataset", scope.makeOpName("ExperimentalCsvDataset")); + opBuilder.addInput(filenames.asOutput()); + opBuilder.addInput(compressionType.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder.addInput(header.asOutput()); + opBuilder.addInput(fieldDelim.asOutput()); + opBuilder.addInput(useQuoteDelim.asOutput()); + opBuilder.addInput(naValue.asOutput()); + opBuilder.addInput(selectCols.asOutput()); + opBuilder.addInputList(Operands.asOutputs(recordDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalCsvDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalCsvDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalDirectedInterleaveDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalDirectedInterleaveDataset.java new file mode 100644 index 00000000000..39086287aa5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalDirectedInterleaveDataset.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A substitute for `InterleaveDataset` on a fixed list of `N` datasets. + */ +public final class ExperimentalDirectedInterleaveDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalDirectedInterleaveDataset operation. + * + * @param scope current scope + * @param selectorInputDataset A dataset of scalar `DT_INT64` elements that determines which of the + * `N` data inputs should produce the next output element. + * @param dataInputDatasets `N` datasets with the same type that will be interleaved according to + * the values of `selector_input_dataset`. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalDirectedInterleaveDataset + */ + public static ExperimentalDirectedInterleaveDataset create(Scope scope, Operand selectorInputDataset, Iterable> dataInputDatasets, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalDirectedInterleaveDataset", scope.makeOpName("ExperimentalDirectedInterleaveDataset")); + opBuilder.addInput(selectorInputDataset.asOutput()); + opBuilder.addInputList(Operands.asOutputs(dataInputDatasets)); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalDirectedInterleaveDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalDirectedInterleaveDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalIgnoreErrorsDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalIgnoreErrorsDataset.java new file mode 100644 index 00000000000..79b9a24ad61 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalIgnoreErrorsDataset.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that contains the elements of `input_dataset` ignoring errors. + */ +public final class ExperimentalIgnoreErrorsDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalIgnoreErrorsDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalIgnoreErrorsDataset + */ + public static ExperimentalIgnoreErrorsDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalIgnoreErrorsDataset", scope.makeOpName("ExperimentalIgnoreErrorsDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalIgnoreErrorsDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalIgnoreErrorsDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalIteratorGetDevice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalIteratorGetDevice.java new file mode 100644 index 00000000000..0ff6ed8ba6a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalIteratorGetDevice.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Returns the name of the device on which `resource` has been placed. + */ +public final class ExperimentalIteratorGetDevice extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalIteratorGetDevice operation. + * + * @param scope current scope + * @param resource + * @return a new instance of ExperimentalIteratorGetDevice + */ + public static ExperimentalIteratorGetDevice create(Scope scope, Operand resource) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalIteratorGetDevice", scope.makeOpName("ExperimentalIteratorGetDevice")); + opBuilder.addInput(resource.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ExperimentalIteratorGetDevice(opBuilder.build()); + } + + /** + */ + public Output device() { + return device; + } + + @Override + public Output asOutput() { + return device; + } + + private Output device; + + private ExperimentalIteratorGetDevice(Operation operation) { + super(operation); + int outputIdx = 0; + device = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalLmdbDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalLmdbDataset.java new file mode 100644 index 00000000000..e7ff7edb297 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalLmdbDataset.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalLmdbDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalLmdbDataset operation. + * + * @param scope current scope + * @param filenames + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalLmdbDataset + */ + public static ExperimentalLmdbDataset create(Scope scope, Operand filenames, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalLMDBDataset", scope.makeOpName("ExperimentalLmdbDataset")); + opBuilder.addInput(filenames.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalLmdbDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalLmdbDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalNonSerializableDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalNonSerializableDataset.java new file mode 100644 index 00000000000..ec86f58fe33 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalNonSerializableDataset.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalNonSerializableDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalNonSerializableDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalNonSerializableDataset + */ + public static ExperimentalNonSerializableDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalNonSerializableDataset", scope.makeOpName("ExperimentalNonSerializableDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalNonSerializableDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalNonSerializableDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalSleepDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalSleepDataset.java new file mode 100644 index 00000000000..97ddc80cce9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalSleepDataset.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ExperimentalSleepDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalSleepDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param sleepMicroseconds + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalSleepDataset + */ + public static ExperimentalSleepDataset create(Scope scope, Operand inputDataset, Operand sleepMicroseconds, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalSleepDataset", scope.makeOpName("ExperimentalSleepDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(sleepMicroseconds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalSleepDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalSleepDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalThreadPoolDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalThreadPoolDataset.java new file mode 100644 index 00000000000..3971d80dba5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalThreadPoolDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that uses a custom thread pool to compute `input_dataset`. + */ +public final class ExperimentalThreadPoolDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalThreadPoolDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param threadPool A resource produced by the ThreadPoolHandle op. + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalThreadPoolDataset + */ + public static ExperimentalThreadPoolDataset create(Scope scope, Operand inputDataset, Operand threadPool, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalThreadPoolDataset", scope.makeOpName("ExperimentalThreadPoolDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(threadPool.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalThreadPoolDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalThreadPoolDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalThreadPoolHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalThreadPoolHandle.java new file mode 100644 index 00000000000..51a1edeadcf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalThreadPoolHandle.java @@ -0,0 +1,145 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that uses a custom thread pool to compute `input_dataset`. + */ +public final class ExperimentalThreadPoolHandle extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.ExperimentalThreadPoolHandle} + */ + public static class Options { + + /** + * @param maxIntraOpParallelism The maximum degree of parallelism to use within operations that execute on this + * threadpool. + */ + public Options maxIntraOpParallelism(Long maxIntraOpParallelism) { + this.maxIntraOpParallelism = maxIntraOpParallelism; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long maxIntraOpParallelism; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ExperimentalThreadPoolHandle operation. + * + * @param scope current scope + * @param numThreads The number of threads in the thread pool. + * @param displayName A human-readable name for the threads that may be visible in some + * visualizations. + * threadpool. + * @param options carries optional attributes values + * @return a new instance of ExperimentalThreadPoolHandle + */ + public static ExperimentalThreadPoolHandle create(Scope scope, Long numThreads, String displayName, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalThreadPoolHandle", scope.makeOpName("ExperimentalThreadPoolHandle")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_threads", numThreads); + opBuilder.setAttr("display_name", displayName); + if (options != null) { + for (Options opts : options) { + if (opts.maxIntraOpParallelism != null) { + opBuilder.setAttr("max_intra_op_parallelism", opts.maxIntraOpParallelism); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new ExperimentalThreadPoolHandle(opBuilder.build()); + } + + /** + * @param maxIntraOpParallelism The maximum degree of parallelism to use within operations that execute on this + * threadpool. + */ + public static Options maxIntraOpParallelism(Long maxIntraOpParallelism) { + return new Options().maxIntraOpParallelism(maxIntraOpParallelism); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * A resource that can be consumed by one or more ExperimentalThreadPoolDataset + * ops. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalThreadPoolHandle(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalUniqueDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalUniqueDataset.java new file mode 100644 index 00000000000..b63464c3aeb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ExperimentalUniqueDataset.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that contains the unique elements of `input_dataset`. + */ +public final class ExperimentalUniqueDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExperimentalUniqueDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of ExperimentalUniqueDataset + */ + public static ExperimentalUniqueDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ExperimentalUniqueDataset", scope.makeOpName("ExperimentalUniqueDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ExperimentalUniqueDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ExperimentalUniqueDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/FilterByLastComponentDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/FilterByLastComponentDataset.java new file mode 100644 index 00000000000..8eddecb919f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/FilterByLastComponentDataset.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset containing elements of first component of `input_dataset` having true in the last component. + */ +public final class FilterByLastComponentDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new FilterByLastComponentDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of FilterByLastComponentDataset + */ + public static FilterByLastComponentDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("FilterByLastComponentDataset", scope.makeOpName("FilterByLastComponentDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new FilterByLastComponentDataset(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private FilterByLastComponentDataset(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/FixedLengthRecordDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/FixedLengthRecordDataset.java new file mode 100644 index 00000000000..5745ad001b5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/FixedLengthRecordDataset.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class FixedLengthRecordDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new FixedLengthRecordDataset operation. + * + * @param scope current scope + * @param filenames + * @param headerBytes + * @param recordBytes + * @param footerBytes + * @param bufferSize + * @param compressionType + * @return a new instance of FixedLengthRecordDataset + */ + public static FixedLengthRecordDataset create(Scope scope, Operand filenames, Operand headerBytes, Operand recordBytes, Operand footerBytes, Operand bufferSize, Operand compressionType) { + OperationBuilder opBuilder = scope.env().opBuilder("FixedLengthRecordDatasetV2", scope.makeOpName("FixedLengthRecordDataset")); + opBuilder.addInput(filenames.asOutput()); + opBuilder.addInput(headerBytes.asOutput()); + opBuilder.addInput(recordBytes.asOutput()); + opBuilder.addInput(footerBytes.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder.addInput(compressionType.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new FixedLengthRecordDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private FixedLengthRecordDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/Iterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/Iterator.java new file mode 100644 index 00000000000..0ff360a0836 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/Iterator.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class Iterator extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Iterator operation. + * + * @param scope current scope + * @param sharedName + * @param container + * @param outputTypes + * @param outputShapes + * @return a new instance of Iterator + */ + public static Iterator create(Scope scope, String sharedName, String container, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("IteratorV2", scope.makeOpName("Iterator")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shared_name", sharedName); + opBuilder.setAttr("container", container); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new Iterator(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private Iterator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorFromStringHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorFromStringHandle.java new file mode 100644 index 00000000000..74b4b5cae8f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorFromStringHandle.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class IteratorFromStringHandle extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.IteratorFromStringHandle} + */ + public static class Options { + + /** + * @param outputShapes + */ + public Options outputShapes(List outputShapes) { + this.outputShapes = outputShapes; + return this; + } + + private List outputShapes; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new IteratorFromStringHandle operation. + * + * @param scope current scope + * @param stringHandle + * @param outputTypes + * @param options carries optional attributes values + * @return a new instance of IteratorFromStringHandle + */ + public static IteratorFromStringHandle create(Scope scope, Operand stringHandle, List> outputTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("IteratorFromStringHandleV2", scope.makeOpName("IteratorFromStringHandle")); + opBuilder.addInput(stringHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.outputShapes != null) { + Shape[] outputShapesArray = new Shape[opts.outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = opts.outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + } + } + } + return new IteratorFromStringHandle(opBuilder.build()); + } + + /** + * @param outputShapes + */ + public static Options outputShapes(List outputShapes) { + return new Options().outputShapes(outputShapes); + } + + /** + */ + public Output resourceHandle() { + return resourceHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) resourceHandle; + } + + private Output resourceHandle; + + private IteratorFromStringHandle(Operation operation) { + super(operation); + int outputIdx = 0; + resourceHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNext.java new file mode 100644 index 00000000000..5965a8119e8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNext.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gets the next output from the given iterator . + */ +@Operator(group = "data") +public final class IteratorGetNext extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new IteratorGetNext operation. + * + * @param scope current scope + * @param iterator + * @param outputTypes + * @param outputShapes + * @return a new instance of IteratorGetNext + */ + public static IteratorGetNext create(Scope scope, Operand iterator, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("IteratorGetNext", scope.makeOpName("IteratorGetNext")); + opBuilder.addInput(iterator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new IteratorGetNext(opBuilder.build()); + } + + /** + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private IteratorGetNext(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNextAsOptional.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNextAsOptional.java new file mode 100644 index 00000000000..6fdcd47cfbf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNextAsOptional.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gets the next output from the given iterator as an Optional variant. + */ +@Operator(group = "data") +public final class IteratorGetNextAsOptional extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IteratorGetNextAsOptional operation. + * + * @param scope current scope + * @param iterator + * @param outputTypes + * @param outputShapes + * @return a new instance of IteratorGetNextAsOptional + */ + public static IteratorGetNextAsOptional create(Scope scope, Operand iterator, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("IteratorGetNextAsOptional", scope.makeOpName("IteratorGetNextAsOptional")); + opBuilder.addInput(iterator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new IteratorGetNextAsOptional(opBuilder.build()); + } + + /** + */ + public Output optional() { + return optional; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) optional; + } + + private Output optional; + + private IteratorGetNextAsOptional(Operation operation) { + super(operation); + int outputIdx = 0; + optional = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNextSync.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNextSync.java new file mode 100644 index 00000000000..3a6220283ba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorGetNextSync.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gets the next output from the given iterator. + *

        + * This operation is a synchronous version IteratorGetNext. It should only be used + * in situations where the iterator does not block the calling thread, or where + * the calling thread is not a member of the thread pool used to execute parallel + * operations (e.g. in eager mode). + */ +@Operator(group = "data") +public final class IteratorGetNextSync extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new IteratorGetNextSync operation. + * + * @param scope current scope + * @param iterator + * @param outputTypes + * @param outputShapes + * @return a new instance of IteratorGetNextSync + */ + public static IteratorGetNextSync create(Scope scope, Operand iterator, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("IteratorGetNextSync", scope.makeOpName("IteratorGetNextSync")); + opBuilder.addInput(iterator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new IteratorGetNextSync(opBuilder.build()); + } + + /** + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private IteratorGetNextSync(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorToStringHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorToStringHandle.java new file mode 100644 index 00000000000..260ae89deb5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/IteratorToStringHandle.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts the given `resource_handle` representing an iterator to a string. + */ +@Operator(group = "data") +public final class IteratorToStringHandle extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IteratorToStringHandle operation. + * + * @param scope current scope + * @param resourceHandle A handle to an iterator resource. + * @return a new instance of IteratorToStringHandle + */ + public static IteratorToStringHandle create(Scope scope, Operand resourceHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("IteratorToStringHandle", scope.makeOpName("IteratorToStringHandle")); + opBuilder.addInput(resourceHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IteratorToStringHandle(opBuilder.build()); + } + + /** + * A string representation of the given handle. + */ + public Output stringHandle() { + return stringHandle; + } + + @Override + public Output asOutput() { + return stringHandle; + } + + private Output stringHandle; + + private IteratorToStringHandle(Operation operation) { + super(operation); + int outputIdx = 0; + stringHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/LatencyStatsDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/LatencyStatsDataset.java new file mode 100644 index 00000000000..6b92e81c155 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/LatencyStatsDataset.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Records the latency of producing `input_dataset` elements in a StatsAggregator. + */ +public final class LatencyStatsDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LatencyStatsDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param tag + * @param outputTypes + * @param outputShapes + * @return a new instance of LatencyStatsDataset + */ + public static LatencyStatsDataset create(Scope scope, Operand inputDataset, Operand tag, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("LatencyStatsDataset", scope.makeOpName("LatencyStatsDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new LatencyStatsDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private LatencyStatsDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/LeakyReluGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/LeakyReluGrad.java new file mode 100644 index 00000000000..35b86c1f9a8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/LeakyReluGrad.java @@ -0,0 +1,104 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes rectified linear gradients for a LeakyRelu operation. + * + * @param data type for {@code backprops()} output + */ +public final class LeakyReluGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.LeakyReluGrad} + */ + public static class Options { + + /** + * @param alpha + */ + public Options alpha(Float alpha) { + this.alpha = alpha; + return this; + } + + private Float alpha; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LeakyReluGrad operation. + * + * @param scope current scope + * @param gradients The backpropagated gradients to the corresponding LeakyRelu operation. + * @param features The features passed as input to the corresponding LeakyRelu operation, + * OR the outputs of that operation (both work equivalently). + * @param options carries optional attributes values + * @return a new instance of LeakyReluGrad + */ + public static LeakyReluGrad create(Scope scope, Operand gradients, Operand features, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LeakyReluGrad", scope.makeOpName("LeakyReluGrad")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alpha != null) { + opBuilder.setAttr("alpha", opts.alpha); + } + } + } + return new LeakyReluGrad(opBuilder.build()); + } + + /** + * @param alpha + */ + public static Options alpha(Float alpha) { + return new Options().alpha(alpha); + } + + /** + * `gradients * (features > 0) + alpha * gradients * (features <= 0)`. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private LeakyReluGrad(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MakeIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MakeIterator.java new file mode 100644 index 00000000000..1bca7862401 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MakeIterator.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Makes a new iterator from the given `dataset` and stores it in `iterator`. + *

        + * This operation may be executed multiple times. Each execution will reset the + * iterator in `iterator` to the first element of `dataset`. + */ +@Operator(group = "data") +public final class MakeIterator extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new MakeIterator operation. + * + * @param scope current scope + * @param dataset + * @param iterator + * @return a new instance of MakeIterator + */ + public static MakeIterator create(Scope scope, Operand dataset, Operand iterator) { + OperationBuilder opBuilder = scope.env().opBuilder("MakeIterator", scope.makeOpName("MakeIterator")); + opBuilder.addInput(dataset.asOutput()); + opBuilder.addInput(iterator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MakeIterator(opBuilder.build()); + } + + + private MakeIterator(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MatchingFilesDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MatchingFilesDataset.java new file mode 100644 index 00000000000..b8fdd733dba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MatchingFilesDataset.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class MatchingFilesDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MatchingFilesDataset operation. + * + * @param scope current scope + * @param patterns + * @return a new instance of MatchingFilesDataset + */ + public static MatchingFilesDataset create(Scope scope, Operand patterns) { + OperationBuilder opBuilder = scope.env().opBuilder("MatchingFilesDataset", scope.makeOpName("MatchingFilesDataset")); + opBuilder.addInput(patterns.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MatchingFilesDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private MatchingFilesDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ModelDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ModelDataset.java new file mode 100644 index 00000000000..674dd0819cd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ModelDataset.java @@ -0,0 +1,135 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Identity transformation that models performance. + *

        + * Identity transformation that models performance. + */ +public final class ModelDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.ModelDataset} + */ + public static class Options { + + /** + * @param algorithm + */ + public Options algorithm(Long algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * @param cpuBudget + */ + public Options cpuBudget(Long cpuBudget) { + this.cpuBudget = cpuBudget; + return this; + } + + private Long algorithm; + private Long cpuBudget; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ModelDataset operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of ModelDataset + */ + public static ModelDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ModelDataset", scope.makeOpName("ModelDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.algorithm != null) { + opBuilder.setAttr("algorithm", opts.algorithm); + } + if (opts.cpuBudget != null) { + opBuilder.setAttr("cpu_budget", opts.cpuBudget); + } + } + } + return new ModelDataset(opBuilder.build()); + } + + /** + * @param algorithm + */ + public static Options algorithm(Long algorithm) { + return new Options().algorithm(algorithm); + } + + /** + * @param cpuBudget + */ + public static Options cpuBudget(Long cpuBudget) { + return new Options().cpuBudget(cpuBudget); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ModelDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIterator.java new file mode 100644 index 00000000000..c7d53fabf40 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIterator.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a MultiDeviceIterator resource. + */ +public final class MultiDeviceIterator extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MultiDeviceIterator operation. + * + * @param scope current scope + * @param devices A list of devices the iterator works across. + * @param sharedName If non-empty, this resource will be shared under the given name + * across multiple sessions. + * @param container If non-empty, this resource is placed in the given container. + * Otherwise, a default container is used. + * @param outputTypes The type list for the return values. + * @param outputShapes The list of shapes being produced. + * @return a new instance of MultiDeviceIterator + */ + public static MultiDeviceIterator create(Scope scope, List devices, String sharedName, String container, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("MultiDeviceIterator", scope.makeOpName("MultiDeviceIterator")); + opBuilder = scope.applyControlDependencies(opBuilder); + String[] devicesArray = new String[devices.size()]; + for (int i = 0; i < devicesArray.length; ++i) { + devicesArray[i] = devices.get(i); + } + opBuilder.setAttr("devices", devicesArray); + opBuilder.setAttr("shared_name", sharedName); + opBuilder.setAttr("container", container); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new MultiDeviceIterator(opBuilder.build()); + } + + /** + * Handle to the resource created. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private MultiDeviceIterator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorFromStringHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorFromStringHandle.java new file mode 100644 index 00000000000..d4ea259b9b7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorFromStringHandle.java @@ -0,0 +1,113 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Generates a MultiDeviceIterator resource from its provided string handle. + */ +public final class MultiDeviceIteratorFromStringHandle extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.MultiDeviceIteratorFromStringHandle} + */ + public static class Options { + + /** + * @param outputShapes The list of shapes being produced. + */ + public Options outputShapes(List outputShapes) { + this.outputShapes = outputShapes; + return this; + } + + private List outputShapes; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MultiDeviceIteratorFromStringHandle operation. + * + * @param scope current scope + * @param stringHandle String representing the resource. + * @param outputTypes The type list for the return values. + * @param options carries optional attributes values + * @return a new instance of MultiDeviceIteratorFromStringHandle + */ + public static MultiDeviceIteratorFromStringHandle create(Scope scope, Operand stringHandle, List> outputTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MultiDeviceIteratorFromStringHandle", scope.makeOpName("MultiDeviceIteratorFromStringHandle")); + opBuilder.addInput(stringHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.outputShapes != null) { + Shape[] outputShapesArray = new Shape[opts.outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = opts.outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + } + } + } + return new MultiDeviceIteratorFromStringHandle(opBuilder.build()); + } + + /** + * @param outputShapes The list of shapes being produced. + */ + public static Options outputShapes(List outputShapes) { + return new Options().outputShapes(outputShapes); + } + + /** + * A MultiDeviceIterator resource. + */ + public Output multiDeviceIterator() { + return multiDeviceIterator; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) multiDeviceIterator; + } + + private Output multiDeviceIterator; + + private MultiDeviceIteratorFromStringHandle(Operation operation) { + super(operation); + int outputIdx = 0; + multiDeviceIterator = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorGetNextFromShard.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorGetNextFromShard.java new file mode 100644 index 00000000000..4dc63877b76 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorGetNextFromShard.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Gets next element for the provided shard number. + */ +public final class MultiDeviceIteratorGetNextFromShard extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new MultiDeviceIteratorGetNextFromShard operation. + * + * @param scope current scope + * @param multiDeviceIterator A MultiDeviceIterator resource. + * @param shardNum Integer representing which shard to fetch data for. + * @param incarnationId Which incarnation of the MultiDeviceIterator is running. + * @param outputTypes The type list for the return values. + * @param outputShapes The list of shapes being produced. + * @return a new instance of MultiDeviceIteratorGetNextFromShard + */ + public static MultiDeviceIteratorGetNextFromShard create(Scope scope, Operand multiDeviceIterator, Operand shardNum, Operand incarnationId, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("MultiDeviceIteratorGetNextFromShard", scope.makeOpName("MultiDeviceIteratorGetNextFromShard")); + opBuilder.addInput(multiDeviceIterator.asOutput()); + opBuilder.addInput(shardNum.asOutput()); + opBuilder.addInput(incarnationId.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new MultiDeviceIteratorGetNextFromShard(opBuilder.build()); + } + + /** + * Result of the get_next on the dataset. + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private MultiDeviceIteratorGetNextFromShard(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorInit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorInit.java new file mode 100644 index 00000000000..db3c3056a4f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorInit.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Initializes the multi device iterator with the given dataset. + */ +public final class MultiDeviceIteratorInit extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MultiDeviceIteratorInit operation. + * + * @param scope current scope + * @param dataset Dataset to be iterated upon. + * @param multiDeviceIterator A MultiDeviceIteratorResource. + * @param maxBufferSize The maximum size of the host side per device buffer to keep. + * @return a new instance of MultiDeviceIteratorInit + */ + public static MultiDeviceIteratorInit create(Scope scope, Operand dataset, Operand multiDeviceIterator, Operand maxBufferSize) { + OperationBuilder opBuilder = scope.env().opBuilder("MultiDeviceIteratorInit", scope.makeOpName("MultiDeviceIteratorInit")); + opBuilder.addInput(dataset.asOutput()); + opBuilder.addInput(multiDeviceIterator.asOutput()); + opBuilder.addInput(maxBufferSize.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MultiDeviceIteratorInit(opBuilder.build()); + } + + /** + * An int64 indicating which incarnation of the MultiDeviceIterator + * is running. + */ + public Output incarnationId() { + return incarnationId; + } + + @Override + public Output asOutput() { + return incarnationId; + } + + private Output incarnationId; + + private MultiDeviceIteratorInit(Operation operation) { + super(operation); + int outputIdx = 0; + incarnationId = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorToStringHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorToStringHandle.java new file mode 100644 index 00000000000..7afe979686e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/MultiDeviceIteratorToStringHandle.java @@ -0,0 +1,65 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Produces a string handle for the given MultiDeviceIterator. + */ +public final class MultiDeviceIteratorToStringHandle extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MultiDeviceIteratorToStringHandle operation. + * + * @param scope current scope + * @param multiDeviceIterator A MultiDeviceIterator resource. + * @return a new instance of MultiDeviceIteratorToStringHandle + */ + public static MultiDeviceIteratorToStringHandle create(Scope scope, Operand multiDeviceIterator) { + OperationBuilder opBuilder = scope.env().opBuilder("MultiDeviceIteratorToStringHandle", scope.makeOpName("MultiDeviceIteratorToStringHandle")); + opBuilder.addInput(multiDeviceIterator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MultiDeviceIteratorToStringHandle(opBuilder.build()); + } + + /** + * A string representing the resource. + */ + public Output stringHandle() { + return stringHandle; + } + + @Override + public Output asOutput() { + return stringHandle; + } + + private Output stringHandle; + + private MultiDeviceIteratorToStringHandle(Operation operation) { + super(operation); + int outputIdx = 0; + stringHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptimizeDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptimizeDataset.java new file mode 100644 index 00000000000..e10d976296f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptimizeDataset.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset by applying optimizations to `input_dataset`. + *

        + * Creates a dataset by applying optimizations to `input_dataset`. + */ +public final class OptimizeDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.OptimizeDataset} + */ + public static class Options { + + /** + * @param optimizationConfigs + */ + public Options optimizationConfigs(List optimizationConfigs) { + this.optimizationConfigs = optimizationConfigs; + return this; + } + + private List optimizationConfigs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new OptimizeDataset operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @param optimizations A `tf.string` vector `tf.Tensor` identifying optimizations to use. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of OptimizeDataset + */ + public static OptimizeDataset create(Scope scope, Operand inputDataset, Operand optimizations, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("OptimizeDataset", scope.makeOpName("OptimizeDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(optimizations.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.optimizationConfigs != null) { + String[] optimizationConfigsArray = new String[opts.optimizationConfigs.size()]; + for (int i = 0; i < optimizationConfigsArray.length; ++i) { + optimizationConfigsArray[i] = opts.optimizationConfigs.get(i); + } + opBuilder.setAttr("optimization_configs", optimizationConfigsArray); + } + } + } + return new OptimizeDataset(opBuilder.build()); + } + + /** + * @param optimizationConfigs + */ + public static Options optimizationConfigs(List optimizationConfigs) { + return new Options().optimizationConfigs(optimizationConfigs); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private OptimizeDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalFromValue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalFromValue.java new file mode 100644 index 00000000000..64f2779707e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalFromValue.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Constructs an Optional variant from a tuple of tensors. + */ +@Operator(group = "data") +public final class OptionalFromValue extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new OptionalFromValue operation. + * + * @param scope current scope + * @param components + * @return a new instance of OptionalFromValue + */ + public static OptionalFromValue create(Scope scope, Iterable> components) { + OperationBuilder opBuilder = scope.env().opBuilder("OptionalFromValue", scope.makeOpName("OptionalFromValue")); + opBuilder.addInputList(Operands.asOutputs(components)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new OptionalFromValue(opBuilder.build()); + } + + /** + */ + public Output optional() { + return optional; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) optional; + } + + private Output optional; + + private OptionalFromValue(Operation operation) { + super(operation); + int outputIdx = 0; + optional = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalGetValue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalGetValue.java new file mode 100644 index 00000000000..de21fc8a37d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalGetValue.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the value stored in an Optional variant or raises an error if none exists. + */ +@Operator(group = "data") +public final class OptionalGetValue extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new OptionalGetValue operation. + * + * @param scope current scope + * @param optional + * @param outputTypes + * @param outputShapes + * @return a new instance of OptionalGetValue + */ + public static OptionalGetValue create(Scope scope, Operand optional, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("OptionalGetValue", scope.makeOpName("OptionalGetValue")); + opBuilder.addInput(optional.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new OptionalGetValue(opBuilder.build()); + } + + /** + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private OptionalGetValue(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalHasValue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalHasValue.java new file mode 100644 index 00000000000..a748bf1f05d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalHasValue.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns true if and only if the given Optional variant has a value. + */ +@Operator(group = "data") +public final class OptionalHasValue extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new OptionalHasValue operation. + * + * @param scope current scope + * @param optional + * @return a new instance of OptionalHasValue + */ + public static OptionalHasValue create(Scope scope, Operand optional) { + OperationBuilder opBuilder = scope.env().opBuilder("OptionalHasValue", scope.makeOpName("OptionalHasValue")); + opBuilder.addInput(optional.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new OptionalHasValue(opBuilder.build()); + } + + /** + */ + public Output hasValue() { + return hasValue; + } + + @Override + public Output asOutput() { + return hasValue; + } + + private Output hasValue; + + private OptionalHasValue(Operation operation) { + super(operation); + int outputIdx = 0; + hasValue = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalNone.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalNone.java new file mode 100644 index 00000000000..56bea55c07f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/OptionalNone.java @@ -0,0 +1,65 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Creates an Optional variant with no value. + */ +@Operator(group = "data") +public final class OptionalNone extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new OptionalNone operation. + * + * @param scope current scope + * @return a new instance of OptionalNone + */ + public static OptionalNone create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("OptionalNone", scope.makeOpName("OptionalNone")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new OptionalNone(opBuilder.build()); + } + + /** + */ + public Output optional() { + return optional; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) optional; + } + + private Output optional; + + private OptionalNone(Operation operation) { + super(operation); + int outputIdx = 0; + optional = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/PaddedBatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/PaddedBatchDataset.java new file mode 100644 index 00000000000..5873b6ba110 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/PaddedBatchDataset.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that batches and pads `batch_size` elements from the input. + */ +public final class PaddedBatchDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.PaddedBatchDataset} + */ + public static class Options { + + /** + * @param parallelCopy + */ + public Options parallelCopy(Boolean parallelCopy) { + this.parallelCopy = parallelCopy; + return this; + } + + private Boolean parallelCopy; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new PaddedBatchDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param batchSize A scalar representing the number of elements to accumulate in a + * batch. + * @param paddedShapes A list of int64 tensors representing the desired padded shapes + * of the corresponding output components. These shapes may be partially + * specified, using `-1` to indicate that a particular dimension should be + * padded to the maximum size of all batch elements. + * @param paddingValues A list of scalars containing the padding value to use for + * each of the outputs. + * @param dropRemainder A scalar representing whether the last batch should be dropped in case its size + * is smaller than desired. + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of PaddedBatchDataset + */ + public static PaddedBatchDataset create(Scope scope, Operand inputDataset, Operand batchSize, Iterable> paddedShapes, Iterable> paddingValues, Operand dropRemainder, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("PaddedBatchDatasetV2", scope.makeOpName("PaddedBatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(batchSize.asOutput()); + opBuilder.addInputList(Operands.asOutputs(paddedShapes)); + opBuilder.addInputList(Operands.asOutputs(paddingValues)); + opBuilder.addInput(dropRemainder.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.parallelCopy != null) { + opBuilder.setAttr("parallel_copy", opts.parallelCopy); + } + } + } + return new PaddedBatchDataset(opBuilder.build()); + } + + /** + * @param parallelCopy + */ + public static Options parallelCopy(Boolean parallelCopy) { + return new Options().parallelCopy(parallelCopy); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private PaddedBatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ParseExampleDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ParseExampleDataset.java new file mode 100644 index 00000000000..f04a9b09629 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ParseExampleDataset.java @@ -0,0 +1,156 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Transforms `input_dataset` containing `Example` protos as vectors of DT_STRING into a dataset of `Tensor` or `SparseTensor` objects representing the parsed features. + */ +public final class ParseExampleDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.ParseExampleDataset} + */ + public static class Options { + + /** + * @param sloppy + */ + public Options sloppy(Boolean sloppy) { + this.sloppy = sloppy; + return this; + } + + private Boolean sloppy; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ParseExampleDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param numParallelCalls + * @param denseDefaults A dict mapping string keys to `Tensor`s. + * The keys of the dict must match the dense_keys of the feature. + * @param sparseKeys A list of string keys in the examples features. + * The results for these keys will be returned as `SparseTensor` objects. + * @param denseKeys A list of Ndense string Tensors (scalars). + * The keys expected in the Examples features associated with dense values. + * @param sparseTypes A list of `DTypes` of the same length as `sparse_keys`. + * Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), + * and `tf.string` (`BytesList`) are supported. + * @param denseShapes List of tuples with the same length as `dense_keys`. + * The shape of the data for each dense feature referenced by `dense_keys`. + * Required for any input tensors identified by `dense_keys`. Must be + * either fully defined, or may contain an unknown first dimension. + * An unknown first dimension means the feature is treated as having + * a variable number of blocks, and the output shape along this dimension + * is considered unknown at graph build time. Padding is applied for + * minibatch elements smaller than the maximum number of blocks for the + * given feature along this dimension. + * @param outputTypes The type list for the return values. + * @param outputShapes The list of shapes being produced. + * @param options carries optional attributes values + * @return a new instance of ParseExampleDataset + */ + public static ParseExampleDataset create(Scope scope, Operand inputDataset, Operand numParallelCalls, Iterable> denseDefaults, List sparseKeys, List denseKeys, List> sparseTypes, List denseShapes, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ParseExampleDataset", scope.makeOpName("ParseExampleDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(numParallelCalls.asOutput()); + opBuilder.addInputList(Operands.asOutputs(denseDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + String[] sparseKeysArray = new String[sparseKeys.size()]; + for (int i = 0; i < sparseKeysArray.length; ++i) { + sparseKeysArray[i] = sparseKeys.get(i); + } + opBuilder.setAttr("sparse_keys", sparseKeysArray); + String[] denseKeysArray = new String[denseKeys.size()]; + for (int i = 0; i < denseKeysArray.length; ++i) { + denseKeysArray[i] = denseKeys.get(i); + } + opBuilder.setAttr("dense_keys", denseKeysArray); + DataType[] sparseTypesArray = new DataType[sparseTypes.size()]; + for (int i = 0; i < sparseTypesArray.length; ++i) { + sparseTypesArray[i] = DataType.fromClass(sparseTypes.get(i)); + } + opBuilder.setAttr("sparse_types", sparseTypesArray); + Shape[] denseShapesArray = new Shape[denseShapes.size()]; + for (int i = 0; i < denseShapesArray.length; ++i) { + denseShapesArray[i] = denseShapes.get(i); + } + opBuilder.setAttr("dense_shapes", denseShapesArray); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.sloppy != null) { + opBuilder.setAttr("sloppy", opts.sloppy); + } + } + } + return new ParseExampleDataset(opBuilder.build()); + } + + /** + * @param sloppy + */ + public static Options sloppy(Boolean sloppy) { + return new Options().sloppy(sloppy); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ParseExampleDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/PrefetchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/PrefetchDataset.java new file mode 100644 index 00000000000..096630a8aa4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/PrefetchDataset.java @@ -0,0 +1,117 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that asynchronously prefetches elements from `input_dataset`. + */ +public final class PrefetchDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.PrefetchDataset} + */ + public static class Options { + + /** + * @param slackPeriod + */ + public Options slackPeriod(Long slackPeriod) { + this.slackPeriod = slackPeriod; + return this; + } + + private Long slackPeriod; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new PrefetchDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param bufferSize The maximum number of elements to buffer in an iterator over + * this dataset. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of PrefetchDataset + */ + public static PrefetchDataset create(Scope scope, Operand inputDataset, Operand bufferSize, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("PrefetchDataset", scope.makeOpName("PrefetchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.slackPeriod != null) { + opBuilder.setAttr("slack_period", opts.slackPeriod); + } + } + } + return new PrefetchDataset(opBuilder.build()); + } + + /** + * @param slackPeriod + */ + public static Options slackPeriod(Long slackPeriod) { + return new Options().slackPeriod(slackPeriod); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private PrefetchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RandomDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RandomDataset.java new file mode 100644 index 00000000000..71df62da0f7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RandomDataset.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a Dataset that returns pseudorandom numbers. + */ +public final class RandomDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RandomDataset operation. + * + * @param scope current scope + * @param seed A scalar seed for the random number generator. If either seed or + * seed2 is set to be non-zero, the random number generator is seeded + * by the given seed. Otherwise, a random seed is used. + * @param seed2 A second scalar seed to avoid seed collision. + * @param outputTypes + * @param outputShapes + * @return a new instance of RandomDataset + */ + public static RandomDataset create(Scope scope, Operand seed, Operand seed2, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomDataset", scope.makeOpName("RandomDataset")); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(seed2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new RandomDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private RandomDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RangeDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RangeDataset.java new file mode 100644 index 00000000000..7b15aa0072c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RangeDataset.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset with a range of values. Corresponds to python's xrange. + */ +public final class RangeDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RangeDataset operation. + * + * @param scope current scope + * @param start corresponds to start in python's xrange(). + * @param stop corresponds to stop in python's xrange(). + * @param step corresponds to step in python's xrange(). + * @param outputTypes + * @param outputShapes + * @return a new instance of RangeDataset + */ + public static RangeDataset create(Scope scope, Operand start, Operand stop, Operand step, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("RangeDataset", scope.makeOpName("RangeDataset")); + opBuilder.addInput(start.asOutput()); + opBuilder.addInput(stop.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new RangeDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private RangeDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RepeatDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RepeatDataset.java new file mode 100644 index 00000000000..f158b146189 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/RepeatDataset.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that emits the outputs of `input_dataset` `count` times. + */ +public final class RepeatDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RepeatDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param count A scalar representing the number of times that `input_dataset` should + * be repeated. A value of `-1` indicates that it should be repeated infinitely. + * @param outputTypes + * @param outputShapes + * @return a new instance of RepeatDataset + */ + public static RepeatDataset create(Scope scope, Operand inputDataset, Operand count, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("RepeatDataset", scope.makeOpName("RepeatDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(count.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new RepeatDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private RepeatDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SerializeIterator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SerializeIterator.java new file mode 100644 index 00000000000..c712e14af45 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SerializeIterator.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts the given `resource_handle` representing an iterator to a variant tensor. + */ +@Operator(group = "data") +public final class SerializeIterator extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SerializeIterator operation. + * + * @param scope current scope + * @param resourceHandle A handle to an iterator resource. + * @return a new instance of SerializeIterator + */ + public static SerializeIterator create(Scope scope, Operand resourceHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("SerializeIterator", scope.makeOpName("SerializeIterator")); + opBuilder.addInput(resourceHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SerializeIterator(opBuilder.build()); + } + + /** + * A variant tensor storing the state of the iterator contained in the + * resource. + */ + public Output serialized() { + return serialized; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) serialized; + } + + private Output serialized; + + private SerializeIterator(Operation operation) { + super(operation); + int outputIdx = 0; + serialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SetStatsAggregatorDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SetStatsAggregatorDataset.java new file mode 100644 index 00000000000..48af6285bb5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SetStatsAggregatorDataset.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class SetStatsAggregatorDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SetStatsAggregatorDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param statsAggregator + * @param tag + * @param counterPrefix + * @param outputTypes + * @param outputShapes + * @return a new instance of SetStatsAggregatorDataset + */ + public static SetStatsAggregatorDataset create(Scope scope, Operand inputDataset, Operand statsAggregator, Operand tag, Operand counterPrefix, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("SetStatsAggregatorDataset", scope.makeOpName("SetStatsAggregatorDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(statsAggregator.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(counterPrefix.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new SetStatsAggregatorDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SetStatsAggregatorDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ShuffleAndRepeatDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ShuffleAndRepeatDataset.java new file mode 100644 index 00000000000..ceab49af5b6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ShuffleAndRepeatDataset.java @@ -0,0 +1,95 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that shuffles and repeats elements from `input_dataset` + *

        + * pseudorandomly. + */ +public final class ShuffleAndRepeatDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ShuffleAndRepeatDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param bufferSize The number of output elements to buffer in an iterator over + * this dataset. Compare with the `min_after_dequeue` attr when creating a + * `RandomShuffleQueue`. + * @param seed A scalar seed for the random number generator. If either `seed` or + * `seed2` is set to be non-zero, the random number generator is seeded + * by the given seed. Otherwise, a random seed is used. + * @param seed2 A second scalar seed to avoid seed collision. + * @param count A scalar representing the number of times the underlying dataset + * should be repeated. The default is `-1`, which results in infinite repetition. + * @param outputTypes + * @param outputShapes + * @return a new instance of ShuffleAndRepeatDataset + */ + public static ShuffleAndRepeatDataset create(Scope scope, Operand inputDataset, Operand bufferSize, Operand seed, Operand seed2, Operand count, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ShuffleAndRepeatDataset", scope.makeOpName("ShuffleAndRepeatDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(seed2.asOutput()); + opBuilder.addInput(count.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ShuffleAndRepeatDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ShuffleAndRepeatDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ShuffleDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ShuffleDataset.java new file mode 100644 index 00000000000..52742e28d8a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ShuffleDataset.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that shuffles elements from `input_dataset` pseudorandomly. + */ +public final class ShuffleDataset extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.ShuffleDataset} + */ + public static class Options { + + /** + * @param reshuffleEachIteration If true, each iterator over this dataset will be given + * a different pseudorandomly generated seed, based on a sequence seeded by the + * `seed` and `seed2` inputs. If false, each iterator will be given the same + * seed, and repeated iteration over this dataset will yield the exact same + * sequence of results. + */ + public Options reshuffleEachIteration(Boolean reshuffleEachIteration) { + this.reshuffleEachIteration = reshuffleEachIteration; + return this; + } + + private Boolean reshuffleEachIteration; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ShuffleDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param bufferSize The number of output elements to buffer in an iterator over + * this dataset. Compare with the `min_after_dequeue` attr when creating a + * `RandomShuffleQueue`. + * @param seed A scalar seed for the random number generator. If either `seed` or + * `seed2` is set to be non-zero, the random number generator is seeded + * by the given seed. Otherwise, a random seed is used. + * @param seed2 A second scalar seed to avoid seed collision. + * @param outputTypes + * @param outputShapes + * @param options carries optional attributes values + * @return a new instance of ShuffleDataset + */ + public static ShuffleDataset create(Scope scope, Operand inputDataset, Operand bufferSize, Operand seed, Operand seed2, List> outputTypes, List outputShapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ShuffleDataset", scope.makeOpName("ShuffleDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(seed2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.reshuffleEachIteration != null) { + opBuilder.setAttr("reshuffle_each_iteration", opts.reshuffleEachIteration); + } + } + } + return new ShuffleDataset(opBuilder.build()); + } + + /** + * @param reshuffleEachIteration If true, each iterator over this dataset will be given + * a different pseudorandomly generated seed, based on a sequence seeded by the + * `seed` and `seed2` inputs. If false, each iterator will be given the same + * seed, and repeated iteration over this dataset will yield the exact same + * sequence of results. + */ + public static Options reshuffleEachIteration(Boolean reshuffleEachIteration) { + return new Options().reshuffleEachIteration(reshuffleEachIteration); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ShuffleDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SkipDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SkipDataset.java new file mode 100644 index 00000000000..fe94dd1ac72 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SkipDataset.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that skips `count` elements from the `input_dataset`. + */ +public final class SkipDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SkipDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param count A scalar representing the number of elements from the `input_dataset` + * that should be skipped. If count is -1, skips everything. + * @param outputTypes + * @param outputShapes + * @return a new instance of SkipDataset + */ + public static SkipDataset create(Scope scope, Operand inputDataset, Operand count, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("SkipDataset", scope.makeOpName("SkipDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(count.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new SkipDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SkipDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SparseTensorSliceDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SparseTensorSliceDataset.java new file mode 100644 index 00000000000..96b63e4f1c8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SparseTensorSliceDataset.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that splits a SparseTensor into elements row-wise. + */ +public final class SparseTensorSliceDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseTensorSliceDataset operation. + * + * @param scope current scope + * @param indices + * @param values + * @param denseShape + * @return a new instance of SparseTensorSliceDataset + */ + public static SparseTensorSliceDataset create(Scope scope, Operand indices, Operand values, Operand denseShape) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseTensorSliceDataset", scope.makeOpName("SparseTensorSliceDataset")); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder.addInput(denseShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseTensorSliceDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SparseTensorSliceDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SqlDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SqlDataset.java new file mode 100644 index 00000000000..6f942382557 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SqlDataset.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that executes a SQL query and emits rows of the result set. + */ +public final class SqlDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SqlDataset operation. + * + * @param scope current scope + * @param driverName The database type. Currently, the only supported type is 'sqlite'. + * @param dataSourceName A connection string to connect to the database. + * @param query A SQL query to execute. + * @param outputTypes + * @param outputShapes + * @return a new instance of SqlDataset + */ + public static SqlDataset create(Scope scope, Operand driverName, Operand dataSourceName, Operand query, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("SqlDataset", scope.makeOpName("SqlDataset")); + opBuilder.addInput(driverName.asOutput()); + opBuilder.addInput(dataSourceName.asOutput()); + opBuilder.addInput(query.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new SqlDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private SqlDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/StatsAggregatorHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/StatsAggregatorHandle.java new file mode 100644 index 00000000000..c21655f2c0d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/StatsAggregatorHandle.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a statistics manager resource. + */ +public final class StatsAggregatorHandle extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.data.StatsAggregatorHandle} + */ + public static class Options { + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StatsAggregatorHandle operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of StatsAggregatorHandle + */ + public static StatsAggregatorHandle create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StatsAggregatorHandle", scope.makeOpName("StatsAggregatorHandle")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new StatsAggregatorHandle(opBuilder.build()); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private StatsAggregatorHandle(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TakeDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TakeDataset.java new file mode 100644 index 00000000000..8fa273a7d18 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TakeDataset.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that contains `count` elements from the `input_dataset`. + */ +public final class TakeDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TakeDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param count A scalar representing the number of elements from the `input_dataset` + * that should be taken. A value of `-1` indicates that all of `input_dataset` + * is taken. + * @param outputTypes + * @param outputShapes + * @return a new instance of TakeDataset + */ + public static TakeDataset create(Scope scope, Operand inputDataset, Operand count, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("TakeDataset", scope.makeOpName("TakeDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(count.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new TakeDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private TakeDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TensorDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TensorDataset.java new file mode 100644 index 00000000000..9af25709b76 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TensorDataset.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that emits `components` as a tuple of tensors once. + */ +public final class TensorDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorDataset operation. + * + * @param scope current scope + * @param components + * @param outputShapes + * @return a new instance of TensorDataset + */ + public static TensorDataset create(Scope scope, Iterable> components, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorDataset", scope.makeOpName("TensorDataset")); + opBuilder.addInputList(Operands.asOutputs(components)); + opBuilder = scope.applyControlDependencies(opBuilder); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new TensorDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private TensorDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TensorSliceDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TensorSliceDataset.java new file mode 100644 index 00000000000..7b2ac67022a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TensorSliceDataset.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that emits each dim-0 slice of `components` once. + */ +public final class TensorSliceDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorSliceDataset operation. + * + * @param scope current scope + * @param components + * @param outputShapes + * @return a new instance of TensorSliceDataset + */ + public static TensorSliceDataset create(Scope scope, Iterable> components, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorSliceDataset", scope.makeOpName("TensorSliceDataset")); + opBuilder.addInputList(Operands.asOutputs(components)); + opBuilder = scope.applyControlDependencies(opBuilder); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new TensorSliceDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private TensorSliceDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TextLineDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TextLineDataset.java new file mode 100644 index 00000000000..bde1fa9762f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TextLineDataset.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that emits the lines of one or more text files. + */ +public final class TextLineDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TextLineDataset operation. + * + * @param scope current scope + * @param filenames A scalar or a vector containing the name(s) of the file(s) to be + * read. + * @param compressionType A scalar containing either (i) the empty string (no + * compression), (ii) "ZLIB", or (iii) "GZIP". + * @param bufferSize A scalar containing the number of bytes to buffer. + * @return a new instance of TextLineDataset + */ + public static TextLineDataset create(Scope scope, Operand filenames, Operand compressionType, Operand bufferSize) { + OperationBuilder opBuilder = scope.env().opBuilder("TextLineDataset", scope.makeOpName("TextLineDataset")); + opBuilder.addInput(filenames.asOutput()); + opBuilder.addInput(compressionType.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TextLineDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private TextLineDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TfRecordDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TfRecordDataset.java new file mode 100644 index 00000000000..558c8cf0532 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/TfRecordDataset.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that emits the records from one or more TFRecord files. + */ +public final class TfRecordDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TfRecordDataset operation. + * + * @param scope current scope + * @param filenames A scalar or vector containing the name(s) of the file(s) to be + * read. + * @param compressionType A scalar containing either (i) the empty string (no + * compression), (ii) "ZLIB", or (iii) "GZIP". + * @param bufferSize A scalar representing the number of bytes to buffer. A value of + * 0 means no buffering will be performed. + * @return a new instance of TfRecordDataset + */ + public static TfRecordDataset create(Scope scope, Operand filenames, Operand compressionType, Operand bufferSize) { + OperationBuilder opBuilder = scope.env().opBuilder("TFRecordDataset", scope.makeOpName("TfRecordDataset")); + opBuilder.addInput(filenames.asOutput()); + opBuilder.addInput(compressionType.asOutput()); + opBuilder.addInput(bufferSize.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TfRecordDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private TfRecordDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/UnbatchDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/UnbatchDataset.java new file mode 100644 index 00000000000..826f48f42d4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/UnbatchDataset.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A dataset that splits the elements of its input into multiple elements. + */ +public final class UnbatchDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnbatchDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param outputTypes + * @param outputShapes + * @return a new instance of UnbatchDataset + */ + public static UnbatchDataset create(Scope scope, Operand inputDataset, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("UnbatchDataset", scope.makeOpName("UnbatchDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new UnbatchDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private UnbatchDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/WindowDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/WindowDataset.java new file mode 100644 index 00000000000..fcaaf2c1d75 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/WindowDataset.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A dataset that creates window datasets from the input dataset. + */ +public final class WindowDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new WindowDataset operation. + * + * @param scope current scope + * @param inputDataset + * @param size A scalar representing the number of elements to accumulate in a window. + * @param shift A scalar representing the steps moving the sliding window forward in one + * iteration. It must be positive. + * @param stride A scalar representing the stride of the input elements of the sliding window. + * It must be positive. + * @param dropRemainder A scalar representing whether a window should be dropped in case its size is + * smaller than desired. + * @param outputTypes + * @param outputShapes + * @return a new instance of WindowDataset + */ + public static WindowDataset create(Scope scope, Operand inputDataset, Operand size, Operand shift, Operand stride, Operand dropRemainder, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("WindowDataset", scope.makeOpName("WindowDataset")); + opBuilder.addInput(inputDataset.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder.addInput(shift.asOutput()); + opBuilder.addInput(stride.asOutput()); + opBuilder.addInput(dropRemainder.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new WindowDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private WindowDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ZipDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ZipDataset.java new file mode 100644 index 00000000000..2d57e4ae891 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/ZipDataset.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.data; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Creates a dataset that zips together `input_datasets`. + */ +public final class ZipDataset extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ZipDataset operation. + * + * @param scope current scope + * @param inputDatasets + * @param outputTypes + * @param outputShapes + * @return a new instance of ZipDataset + */ + public static ZipDataset create(Scope scope, Iterable> inputDatasets, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ZipDataset", scope.makeOpName("ZipDataset")); + opBuilder.addInputList(Operands.asOutputs(inputDatasets)); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] outputTypesArray = new DataType[outputTypes.size()]; + for (int i = 0; i < outputTypesArray.length; ++i) { + outputTypesArray[i] = DataType.fromClass(outputTypes.get(i)); + } + opBuilder.setAttr("output_types", outputTypesArray); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0; i < outputShapesArray.length; ++i) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + return new ZipDataset(opBuilder.build()); + } + + /** + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private ZipDataset(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/AsString.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/AsString.java new file mode 100644 index 00000000000..8cafae3ce4a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/AsString.java @@ -0,0 +1,192 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.dtypes; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts each entry in the given tensor to strings. + *

        + * Supports many numeric types and boolean. + *

        + * For Unicode, see the + * [https://www.tensorflow.org/tutorials/representation/unicode](Working with Unicode text) + * tutorial. + */ +@Operator(group = "dtypes") +public final class AsString extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.dtypes.AsString} + */ + public static class Options { + + /** + * @param precision The post-decimal precision to use for floating point numbers. + * Only used if precision > -1. + */ + public Options precision(Long precision) { + this.precision = precision; + return this; + } + + /** + * @param scientific Use scientific notation for floating point numbers. + */ + public Options scientific(Boolean scientific) { + this.scientific = scientific; + return this; + } + + /** + * @param shortest Use shortest representation (either scientific or standard) for + * floating point numbers. + */ + public Options shortest(Boolean shortest) { + this.shortest = shortest; + return this; + } + + /** + * @param width Pad pre-decimal numbers to this width. + * Applies to both floating point and integer numbers. + * Only used if width > -1. + */ + public Options width(Long width) { + this.width = width; + return this; + } + + /** + * @param fill The value to pad if width > -1. If empty, pads with spaces. + * Another typical value is '0'. String cannot be longer than 1 character. + */ + public Options fill(String fill) { + this.fill = fill; + return this; + } + + private Long precision; + private Boolean scientific; + private Boolean shortest; + private Long width; + private String fill; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AsString operation. + * + * @param scope current scope + * @param input + * @param options carries optional attributes values + * @return a new instance of AsString + */ + public static AsString create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AsString", scope.makeOpName("AsString")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.precision != null) { + opBuilder.setAttr("precision", opts.precision); + } + if (opts.scientific != null) { + opBuilder.setAttr("scientific", opts.scientific); + } + if (opts.shortest != null) { + opBuilder.setAttr("shortest", opts.shortest); + } + if (opts.width != null) { + opBuilder.setAttr("width", opts.width); + } + if (opts.fill != null) { + opBuilder.setAttr("fill", opts.fill); + } + } + } + return new AsString(opBuilder.build()); + } + + /** + * @param precision The post-decimal precision to use for floating point numbers. + * Only used if precision > -1. + */ + public static Options precision(Long precision) { + return new Options().precision(precision); + } + + /** + * @param scientific Use scientific notation for floating point numbers. + */ + public static Options scientific(Boolean scientific) { + return new Options().scientific(scientific); + } + + /** + * @param shortest Use shortest representation (either scientific or standard) for + * floating point numbers. + */ + public static Options shortest(Boolean shortest) { + return new Options().shortest(shortest); + } + + /** + * @param width Pad pre-decimal numbers to this width. + * Applies to both floating point and integer numbers. + * Only used if width > -1. + */ + public static Options width(Long width) { + return new Options().width(width); + } + + /** + * @param fill The value to pad if width > -1. If empty, pads with spaces. + * Another typical value is '0'. String cannot be longer than 1 character. + */ + public static Options fill(String fill) { + return new Options().fill(fill); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AsString(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Cast.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Cast.java new file mode 100644 index 00000000000..68383454081 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Cast.java @@ -0,0 +1,105 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.dtypes; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Cast x of type SrcT to y of DstT. + * + * @param data type for {@code y()} output + */ +@Operator(group = "dtypes") +public final class Cast extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.dtypes.Cast} + */ + public static class Options { + + /** + * @param Truncate + */ + public Options Truncate(Boolean Truncate) { + this.Truncate = Truncate; + return this; + } + + private Boolean Truncate; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Cast operation. + * + * @param scope current scope + * @param x + * @param DstT + * @param options carries optional attributes values + * @return a new instance of Cast + */ + public static Cast create(Scope scope, Operand x, Class DstT, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Cast", scope.makeOpName("Cast")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("DstT", DataType.fromClass(DstT)); + if (options != null) { + for (Options opts : options) { + if (opts.Truncate != null) { + opBuilder.setAttr("Truncate", opts.Truncate); + } + } + } + return new Cast(opBuilder.build()); + } + + /** + * @param Truncate + */ + public static Options Truncate(Boolean Truncate) { + return new Options().Truncate(Truncate); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Cast(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Complex.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Complex.java new file mode 100644 index 00000000000..dbb221ec065 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Complex.java @@ -0,0 +1,88 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.dtypes; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts two real numbers to a complex number. + *

        + * Given a tensor `real` representing the real part of a complex number, and a + * tensor `imag` representing the imaginary part of a complex number, this + * operation returns complex numbers elementwise of the form \\(a + bj\\), where + * a represents the `real` part and b represents the `imag` part. + *

        + * The input tensors `real` and `imag` must have the same shape. + *

        + * For example: + *

        {@code
        + * # tensor 'real' is [2.25, 3.25]
        + * # tensor `imag` is [4.75, 5.75]
        + * tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]]
        + * }
        + * + * + * @param data type for {@code out()} output + */ +@Operator(group = "dtypes") +public final class Complex extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Complex operation. + * + * @param scope current scope + * @param real + * @param imag + * @param Tout + * @return a new instance of Complex + */ + public static Complex create(Scope scope, Operand real, Operand imag, Class Tout) { + OperationBuilder opBuilder = scope.env().opBuilder("Complex", scope.makeOpName("Complex")); + opBuilder.addInput(real.asOutput()); + opBuilder.addInput(imag.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Tout", DataType.fromClass(Tout)); + return new Complex(opBuilder.build()); + } + + /** + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private Complex(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustContrast.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustContrast.java new file mode 100644 index 00000000000..4133440f9d5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustContrast.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adjust the contrast of one or more images. + *

        + * `images` is a tensor of at least 3 dimensions. The last 3 dimensions are + * interpreted as `[height, width, channels]`. The other dimensions only + * represent a collection of images, such as `[batch, height, width, channels].` + *

        + * Contrast is adjusted independently for each channel of each image. + *

        + * For each channel, the Op first computes the mean of the image pixels in the + * channel and then adjusts each component of each pixel to + * `(x - mean) * contrast_factor + mean`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class AdjustContrast extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AdjustContrast operation. + * + * @param scope current scope + * @param images Images to adjust. At least 3-D. + * @param contrastFactor A float multiplier for adjusting contrast. + * @return a new instance of AdjustContrast + */ + public static AdjustContrast create(Scope scope, Operand images, Operand contrastFactor) { + OperationBuilder opBuilder = scope.env().opBuilder("AdjustContrastv2", scope.makeOpName("AdjustContrast")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(contrastFactor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AdjustContrast(opBuilder.build()); + } + + /** + * The contrast-adjusted image or images. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AdjustContrast(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustHue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustHue.java new file mode 100644 index 00000000000..67eb95e5faa --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustHue.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adjust the hue of one or more images. + *

        + * `images` is a tensor of at least 3 dimensions. The last dimension is + * interpretted as channels, and must be three. + *

        + * The input image is considered in the RGB colorspace. Conceptually, the RGB + * colors are first mapped into HSV. A delta is then applied all the hue values, + * and then remapped back to RGB colorspace. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class AdjustHue extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AdjustHue operation. + * + * @param scope current scope + * @param images Images to adjust. At least 3-D. + * @param delta A float delta to add to the hue. + * @return a new instance of AdjustHue + */ + public static AdjustHue create(Scope scope, Operand images, Operand delta) { + OperationBuilder opBuilder = scope.env().opBuilder("AdjustHue", scope.makeOpName("AdjustHue")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AdjustHue(opBuilder.build()); + } + + /** + * The hue-adjusted image or images. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AdjustHue(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustSaturation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustSaturation.java new file mode 100644 index 00000000000..e1397a5942e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/AdjustSaturation.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adjust the saturation of one or more images. + *

        + * `images` is a tensor of at least 3 dimensions. The last dimension is + * interpretted as channels, and must be three. + *

        + * The input image is considered in the RGB colorspace. Conceptually, the RGB + * colors are first mapped into HSV. A scale is then applied all the saturation + * values, and then remapped back to RGB colorspace. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class AdjustSaturation extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AdjustSaturation operation. + * + * @param scope current scope + * @param images Images to adjust. At least 3-D. + * @param scale A float scale to add to the saturation. + * @return a new instance of AdjustSaturation + */ + public static AdjustSaturation create(Scope scope, Operand images, Operand scale) { + OperationBuilder opBuilder = scope.env().opBuilder("AdjustSaturation", scope.makeOpName("AdjustSaturation")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(scale.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AdjustSaturation(opBuilder.build()); + } + + /** + * The hue-adjusted image or images. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AdjustSaturation(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResize.java new file mode 100644 index 00000000000..3e012342d61 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResize.java @@ -0,0 +1,160 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Extracts crops from the input image tensor and resizes them. + *

        + * Extracts crops from the input image tensor and resizes them using bilinear + * sampling or nearest neighbor sampling (possibly with aspect ratio change) to a + * common output size specified by `crop_size`. This is more general than the + * `crop_to_bounding_box` op which extracts a fixed size slice from the input image + * and does not allow resizing or aspect ratio change. + *

        + * Returns a tensor with `crops` from the input `image` at positions defined at the + * bounding box locations in `boxes`. The cropped boxes are all resized (with + * bilinear or nearest neighbor interpolation) to a fixed + * `size = [crop_height, crop_width]`. The result is a 4-D tensor + * `[num_boxes, crop_height, crop_width, depth]`. The resizing is corner aligned. + * In particular, if `boxes = [[0, 0, 1, 1]]`, the method will give identical + * results to using `tf.image.resize_bilinear()` or + * `tf.image.resize_nearest_neighbor()`(depends on the `method` argument) with + * `align_corners=True`. + */ +@Operator(group = "image") +public final class CropAndResize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.CropAndResize} + */ + public static class Options { + + /** + * @param method A string specifying the sampling method for resizing. It can be either + * `"bilinear"` or `"nearest"` and default to `"bilinear"`. Currently two sampling + * methods are supported: Bilinear and Nearest Neighbor. + */ + public Options method(String method) { + this.method = method; + return this; + } + + /** + * @param extrapolationValue Value used for extrapolation, when applicable. + */ + public Options extrapolationValue(Float extrapolationValue) { + this.extrapolationValue = extrapolationValue; + return this; + } + + private String method; + private Float extrapolationValue; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CropAndResize operation. + * + * @param scope current scope + * @param image A 4-D tensor of shape `[batch, image_height, image_width, depth]`. + * Both `image_height` and `image_width` need to be positive. + * @param boxes A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor + * specifies the coordinates of a box in the `box_ind[i]` image and is specified + * in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of + * `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the + * `[0, 1]` interval of normalized image height is mapped to + * `[0, image_height - 1]` in image height coordinates. We do allow `y1` > `y2`, in + * which case the sampled crop is an up-down flipped version of the original + * image. The width dimension is treated similarly. Normalized coordinates + * outside the `[0, 1]` range are allowed, in which case we use + * `extrapolation_value` to extrapolate the input image values. + * @param boxInd A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. + * The value of `box_ind[i]` specifies the image that the `i`-th box refers to. + * @param cropSize A 1-D tensor of 2 elements, `size = [crop_height, crop_width]`. All + * cropped image patches are resized to this size. The aspect ratio of the image + * content is not preserved. Both `crop_height` and `crop_width` need to be + * positive. + * @param options carries optional attributes values + * @return a new instance of CropAndResize + */ + public static CropAndResize create(Scope scope, Operand image, Operand boxes, Operand boxInd, Operand cropSize, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CropAndResize", scope.makeOpName("CropAndResize")); + opBuilder.addInput(image.asOutput()); + opBuilder.addInput(boxes.asOutput()); + opBuilder.addInput(boxInd.asOutput()); + opBuilder.addInput(cropSize.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.method != null) { + opBuilder.setAttr("method", opts.method); + } + if (opts.extrapolationValue != null) { + opBuilder.setAttr("extrapolation_value", opts.extrapolationValue); + } + } + } + return new CropAndResize(opBuilder.build()); + } + + /** + * @param method A string specifying the sampling method for resizing. It can be either + * `"bilinear"` or `"nearest"` and default to `"bilinear"`. Currently two sampling + * methods are supported: Bilinear and Nearest Neighbor. + */ + public static Options method(String method) { + return new Options().method(method); + } + + /** + * @param extrapolationValue Value used for extrapolation, when applicable. + */ + public static Options extrapolationValue(Float extrapolationValue) { + return new Options().extrapolationValue(extrapolationValue); + } + + /** + * A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. + */ + public Output crops() { + return crops; + } + + @Override + public Output asOutput() { + return crops; + } + + private Output crops; + + private CropAndResize(Operation operation) { + super(operation); + int outputIdx = 0; + crops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradBoxes.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradBoxes.java new file mode 100644 index 00000000000..bbece0dd10c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradBoxes.java @@ -0,0 +1,120 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradient of the crop_and_resize op wrt the input boxes tensor. + */ +@Operator(group = "image") +public final class CropAndResizeGradBoxes extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.CropAndResizeGradBoxes} + */ + public static class Options { + + /** + * @param method A string specifying the interpolation method. Only 'bilinear' is + * supported for now. + */ + public Options method(String method) { + this.method = method; + return this; + } + + private String method; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CropAndResizeGradBoxes operation. + * + * @param scope current scope + * @param grads A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. + * @param image A 4-D tensor of shape `[batch, image_height, image_width, depth]`. + * Both `image_height` and `image_width` need to be positive. + * @param boxes A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor + * specifies the coordinates of a box in the `box_ind[i]` image and is specified + * in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of + * `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the + * `[0, 1]` interval of normalized image height is mapped to + * `[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in + * which case the sampled crop is an up-down flipped version of the original + * image. The width dimension is treated similarly. Normalized coordinates + * outside the `[0, 1]` range are allowed, in which case we use + * `extrapolation_value` to extrapolate the input image values. + * @param boxInd A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. + * The value of `box_ind[i]` specifies the image that the `i`-th box refers to. + * @param options carries optional attributes values + * @return a new instance of CropAndResizeGradBoxes + */ + public static CropAndResizeGradBoxes create(Scope scope, Operand grads, Operand image, Operand boxes, Operand boxInd, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CropAndResizeGradBoxes", scope.makeOpName("CropAndResizeGradBoxes")); + opBuilder.addInput(grads.asOutput()); + opBuilder.addInput(image.asOutput()); + opBuilder.addInput(boxes.asOutput()); + opBuilder.addInput(boxInd.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.method != null) { + opBuilder.setAttr("method", opts.method); + } + } + } + return new CropAndResizeGradBoxes(opBuilder.build()); + } + + /** + * @param method A string specifying the interpolation method. Only 'bilinear' is + * supported for now. + */ + public static Options method(String method) { + return new Options().method(method); + } + + /** + * A 2-D tensor of shape `[num_boxes, 4]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CropAndResizeGradBoxes(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradImage.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradImage.java new file mode 100644 index 00000000000..c53c14b2de4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradImage.java @@ -0,0 +1,126 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradient of the crop_and_resize op wrt the input image tensor. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class CropAndResizeGradImage extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.CropAndResizeGradImage} + */ + public static class Options { + + /** + * @param method A string specifying the interpolation method. Only 'bilinear' is + * supported for now. + */ + public Options method(String method) { + this.method = method; + return this; + } + + private String method; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CropAndResizeGradImage operation. + * + * @param scope current scope + * @param grads A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. + * @param boxes A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor + * specifies the coordinates of a box in the `box_ind[i]` image and is specified + * in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of + * `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the + * `[0, 1]` interval of normalized image height is mapped to + * `[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in + * which case the sampled crop is an up-down flipped version of the original + * image. The width dimension is treated similarly. Normalized coordinates + * outside the `[0, 1]` range are allowed, in which case we use + * `extrapolation_value` to extrapolate the input image values. + * @param boxInd A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. + * The value of `box_ind[i]` specifies the image that the `i`-th box refers to. + * @param imageSize A 1-D tensor with value `[batch, image_height, image_width, depth]` + * containing the original image size. Both `image_height` and `image_width` need + * to be positive. + * @param T + * @param options carries optional attributes values + * @return a new instance of CropAndResizeGradImage + */ + public static CropAndResizeGradImage create(Scope scope, Operand grads, Operand boxes, Operand boxInd, Operand imageSize, Class T, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CropAndResizeGradImage", scope.makeOpName("CropAndResizeGradImage")); + opBuilder.addInput(grads.asOutput()); + opBuilder.addInput(boxes.asOutput()); + opBuilder.addInput(boxInd.asOutput()); + opBuilder.addInput(imageSize.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("T", DataType.fromClass(T)); + if (options != null) { + for (Options opts : options) { + if (opts.method != null) { + opBuilder.setAttr("method", opts.method); + } + } + } + return new CropAndResizeGradImage(opBuilder.build()); + } + + /** + * @param method A string specifying the interpolation method. Only 'bilinear' is + * supported for now. + */ + public static Options method(String method) { + return new Options().method(method); + } + + /** + * A 4-D tensor of shape `[batch, image_height, image_width, depth]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CropAndResizeGradImage(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeAndCropJpeg.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeAndCropJpeg.java new file mode 100644 index 00000000000..5573175d7e8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeAndCropJpeg.java @@ -0,0 +1,238 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Decode and Crop a JPEG-encoded image to a uint8 tensor. + *

        + * The attr `channels` indicates the desired number of color channels for the + * decoded image. + *

        + * Accepted values are: + *

          + *
        • + * 0: Use the number of channels in the JPEG-encoded image. + *
        • + *
        • + * 1: output a grayscale image. + *
        • + *
        • + * 3: output an RGB image. + *
        • + *
        + * If needed, the JPEG-encoded image is transformed to match the requested number + * of color channels. + *

        + * The attr `ratio` allows downscaling the image by an integer factor during + * decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than + * downscaling the image later. + *

        + * It is equivalent to a combination of decode and crop, but much faster by only + * decoding partial jpeg image. + */ +@Operator(group = "image") +public final class DecodeAndCropJpeg extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.DecodeAndCropJpeg} + */ + public static class Options { + + /** + * @param channels Number of color channels for the decoded image. + */ + public Options channels(Long channels) { + this.channels = channels; + return this; + } + + /** + * @param ratio Downscaling ratio. + */ + public Options ratio(Long ratio) { + this.ratio = ratio; + return this; + } + + /** + * @param fancyUpscaling If true use a slower but nicer upscaling of the + * chroma planes (yuv420/422 only). + */ + public Options fancyUpscaling(Boolean fancyUpscaling) { + this.fancyUpscaling = fancyUpscaling; + return this; + } + + /** + * @param tryRecoverTruncated If true try to recover an image from truncated input. + */ + public Options tryRecoverTruncated(Boolean tryRecoverTruncated) { + this.tryRecoverTruncated = tryRecoverTruncated; + return this; + } + + /** + * @param acceptableFraction The minimum required fraction of lines before a truncated + * input is accepted. + */ + public Options acceptableFraction(Float acceptableFraction) { + this.acceptableFraction = acceptableFraction; + return this; + } + + /** + * @param dctMethod string specifying a hint about the algorithm used for + * decompression. Defaults to "" which maps to a system-specific + * default. Currently valid values are ["INTEGER_FAST", + * "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal + * jpeg library changes to a version that does not have that specific + * option.) + */ + public Options dctMethod(String dctMethod) { + this.dctMethod = dctMethod; + return this; + } + + private Long channels; + private Long ratio; + private Boolean fancyUpscaling; + private Boolean tryRecoverTruncated; + private Float acceptableFraction; + private String dctMethod; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeAndCropJpeg operation. + * + * @param scope current scope + * @param contents 0-D. The JPEG-encoded image. + * @param cropWindow 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width]. + * @param options carries optional attributes values + * @return a new instance of DecodeAndCropJpeg + */ + public static DecodeAndCropJpeg create(Scope scope, Operand contents, Operand cropWindow, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeAndCropJpeg", scope.makeOpName("DecodeAndCropJpeg")); + opBuilder.addInput(contents.asOutput()); + opBuilder.addInput(cropWindow.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.channels != null) { + opBuilder.setAttr("channels", opts.channels); + } + if (opts.ratio != null) { + opBuilder.setAttr("ratio", opts.ratio); + } + if (opts.fancyUpscaling != null) { + opBuilder.setAttr("fancy_upscaling", opts.fancyUpscaling); + } + if (opts.tryRecoverTruncated != null) { + opBuilder.setAttr("try_recover_truncated", opts.tryRecoverTruncated); + } + if (opts.acceptableFraction != null) { + opBuilder.setAttr("acceptable_fraction", opts.acceptableFraction); + } + if (opts.dctMethod != null) { + opBuilder.setAttr("dct_method", opts.dctMethod); + } + } + } + return new DecodeAndCropJpeg(opBuilder.build()); + } + + /** + * @param channels Number of color channels for the decoded image. + */ + public static Options channels(Long channels) { + return new Options().channels(channels); + } + + /** + * @param ratio Downscaling ratio. + */ + public static Options ratio(Long ratio) { + return new Options().ratio(ratio); + } + + /** + * @param fancyUpscaling If true use a slower but nicer upscaling of the + * chroma planes (yuv420/422 only). + */ + public static Options fancyUpscaling(Boolean fancyUpscaling) { + return new Options().fancyUpscaling(fancyUpscaling); + } + + /** + * @param tryRecoverTruncated If true try to recover an image from truncated input. + */ + public static Options tryRecoverTruncated(Boolean tryRecoverTruncated) { + return new Options().tryRecoverTruncated(tryRecoverTruncated); + } + + /** + * @param acceptableFraction The minimum required fraction of lines before a truncated + * input is accepted. + */ + public static Options acceptableFraction(Float acceptableFraction) { + return new Options().acceptableFraction(acceptableFraction); + } + + /** + * @param dctMethod string specifying a hint about the algorithm used for + * decompression. Defaults to "" which maps to a system-specific + * default. Currently valid values are ["INTEGER_FAST", + * "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal + * jpeg library changes to a version that does not have that specific + * option.) + */ + public static Options dctMethod(String dctMethod) { + return new Options().dctMethod(dctMethod); + } + + /** + * 3-D with shape `[height, width, channels]`.. + */ + public Output image() { + return image; + } + + @Override + public Output asOutput() { + return image; + } + + private Output image; + + private DecodeAndCropJpeg(Operation operation) { + super(operation); + int outputIdx = 0; + image = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeBmp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeBmp.java new file mode 100644 index 00000000000..9911c28450c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeBmp.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Decode the first frame of a BMP-encoded image to a uint8 tensor. + *

        + * The attr `channels` indicates the desired number of color channels for the + * decoded image. + *

        + * Accepted values are: + *

          + *
        • + * 0: Use the number of channels in the BMP-encoded image. + *
        • + *
        • + * 3: output an RGB image. + *
        • + *
        • + * 4: output an RGBA image. + */ +@Operator(group = "image") +public final class DecodeBmp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.DecodeBmp} + */ + public static class Options { + + /** + * @param channels + */ + public Options channels(Long channels) { + this.channels = channels; + return this; + } + + private Long channels; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeBmp operation. + * + * @param scope current scope + * @param contents 0-D. The BMP-encoded image. + * @param options carries optional attributes values + * @return a new instance of DecodeBmp + */ + public static DecodeBmp create(Scope scope, Operand contents, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeBmp", scope.makeOpName("DecodeBmp")); + opBuilder.addInput(contents.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.channels != null) { + opBuilder.setAttr("channels", opts.channels); + } + } + } + return new DecodeBmp(opBuilder.build()); + } + + /** + * @param channels + */ + public static Options channels(Long channels) { + return new Options().channels(channels); + } + + /** + * 3-D with shape `[height, width, channels]`. RGB order + */ + public Output image() { + return image; + } + + @Override + public Output asOutput() { + return image; + } + + private Output image; + + private DecodeBmp(Operation operation) { + super(operation); + int outputIdx = 0; + image = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeGif.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeGif.java new file mode 100644 index 00000000000..2e9f29eb6b3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeGif.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Decode the frame(s) of a GIF-encoded image to a uint8 tensor. + *

          + * GIF images with frame or transparency compression are not supported. + * On Linux and MacOS systems, convert animated GIFs from compressed to + * uncompressed by running: + *

          + * convert $src.gif -coalesce $dst.gif + *

          + * This op also supports decoding JPEGs and PNGs, though it is cleaner to use + * `tf.image.decode_image`. + */ +@Operator(group = "image") +public final class DecodeGif extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DecodeGif operation. + * + * @param scope current scope + * @param contents 0-D. The GIF-encoded image. + * @return a new instance of DecodeGif + */ + public static DecodeGif create(Scope scope, Operand contents) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeGif", scope.makeOpName("DecodeGif")); + opBuilder.addInput(contents.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DecodeGif(opBuilder.build()); + } + + /** + * 4-D with shape `[num_frames, height, width, 3]`. RGB channel order. + */ + public Output image() { + return image; + } + + @Override + public Output asOutput() { + return image; + } + + private Output image; + + private DecodeGif(Operation operation) { + super(operation); + int outputIdx = 0; + image = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeJpeg.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeJpeg.java new file mode 100644 index 00000000000..4fe7c18cb99 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodeJpeg.java @@ -0,0 +1,236 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Decode a JPEG-encoded image to a uint8 tensor. + *

          + * The attr `channels` indicates the desired number of color channels for the + * decoded image. + *

          + * Accepted values are: + *

            + *
          • + * 0: Use the number of channels in the JPEG-encoded image. + *
          • + *
          • + * 1: output a grayscale image. + *
          • + *
          • + * 3: output an RGB image. + *
          • + *
          + * If needed, the JPEG-encoded image is transformed to match the requested number + * of color channels. + *

          + * The attr `ratio` allows downscaling the image by an integer factor during + * decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than + * downscaling the image later. + *

          + * This op also supports decoding PNGs and non-animated GIFs since the interface is + * the same, though it is cleaner to use `tf.image.decode_image`. + */ +@Operator(group = "image") +public final class DecodeJpeg extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.DecodeJpeg} + */ + public static class Options { + + /** + * @param channels Number of color channels for the decoded image. + */ + public Options channels(Long channels) { + this.channels = channels; + return this; + } + + /** + * @param ratio Downscaling ratio. + */ + public Options ratio(Long ratio) { + this.ratio = ratio; + return this; + } + + /** + * @param fancyUpscaling If true use a slower but nicer upscaling of the + * chroma planes (yuv420/422 only). + */ + public Options fancyUpscaling(Boolean fancyUpscaling) { + this.fancyUpscaling = fancyUpscaling; + return this; + } + + /** + * @param tryRecoverTruncated If true try to recover an image from truncated input. + */ + public Options tryRecoverTruncated(Boolean tryRecoverTruncated) { + this.tryRecoverTruncated = tryRecoverTruncated; + return this; + } + + /** + * @param acceptableFraction The minimum required fraction of lines before a truncated + * input is accepted. + */ + public Options acceptableFraction(Float acceptableFraction) { + this.acceptableFraction = acceptableFraction; + return this; + } + + /** + * @param dctMethod string specifying a hint about the algorithm used for + * decompression. Defaults to "" which maps to a system-specific + * default. Currently valid values are ["INTEGER_FAST", + * "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal + * jpeg library changes to a version that does not have that specific + * option.) + */ + public Options dctMethod(String dctMethod) { + this.dctMethod = dctMethod; + return this; + } + + private Long channels; + private Long ratio; + private Boolean fancyUpscaling; + private Boolean tryRecoverTruncated; + private Float acceptableFraction; + private String dctMethod; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeJpeg operation. + * + * @param scope current scope + * @param contents 0-D. The JPEG-encoded image. + * @param options carries optional attributes values + * @return a new instance of DecodeJpeg + */ + public static DecodeJpeg create(Scope scope, Operand contents, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeJpeg", scope.makeOpName("DecodeJpeg")); + opBuilder.addInput(contents.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.channels != null) { + opBuilder.setAttr("channels", opts.channels); + } + if (opts.ratio != null) { + opBuilder.setAttr("ratio", opts.ratio); + } + if (opts.fancyUpscaling != null) { + opBuilder.setAttr("fancy_upscaling", opts.fancyUpscaling); + } + if (opts.tryRecoverTruncated != null) { + opBuilder.setAttr("try_recover_truncated", opts.tryRecoverTruncated); + } + if (opts.acceptableFraction != null) { + opBuilder.setAttr("acceptable_fraction", opts.acceptableFraction); + } + if (opts.dctMethod != null) { + opBuilder.setAttr("dct_method", opts.dctMethod); + } + } + } + return new DecodeJpeg(opBuilder.build()); + } + + /** + * @param channels Number of color channels for the decoded image. + */ + public static Options channels(Long channels) { + return new Options().channels(channels); + } + + /** + * @param ratio Downscaling ratio. + */ + public static Options ratio(Long ratio) { + return new Options().ratio(ratio); + } + + /** + * @param fancyUpscaling If true use a slower but nicer upscaling of the + * chroma planes (yuv420/422 only). + */ + public static Options fancyUpscaling(Boolean fancyUpscaling) { + return new Options().fancyUpscaling(fancyUpscaling); + } + + /** + * @param tryRecoverTruncated If true try to recover an image from truncated input. + */ + public static Options tryRecoverTruncated(Boolean tryRecoverTruncated) { + return new Options().tryRecoverTruncated(tryRecoverTruncated); + } + + /** + * @param acceptableFraction The minimum required fraction of lines before a truncated + * input is accepted. + */ + public static Options acceptableFraction(Float acceptableFraction) { + return new Options().acceptableFraction(acceptableFraction); + } + + /** + * @param dctMethod string specifying a hint about the algorithm used for + * decompression. Defaults to "" which maps to a system-specific + * default. Currently valid values are ["INTEGER_FAST", + * "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal + * jpeg library changes to a version that does not have that specific + * option.) + */ + public static Options dctMethod(String dctMethod) { + return new Options().dctMethod(dctMethod); + } + + /** + * 3-D with shape `[height, width, channels]`.. + */ + public Output image() { + return image; + } + + @Override + public Output asOutput() { + return image; + } + + private Output image; + + private DecodeJpeg(Operation operation) { + super(operation); + int outputIdx = 0; + image = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodePng.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodePng.java new file mode 100644 index 00000000000..2788de66b7f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DecodePng.java @@ -0,0 +1,143 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Decode a PNG-encoded image to a uint8 or uint16 tensor. + *

          + * The attr `channels` indicates the desired number of color channels for the + * decoded image. + *

          + * Accepted values are: + *

            + *
          • + * 0: Use the number of channels in the PNG-encoded image. + *
          • + *
          • + * 1: output a grayscale image. + *
          • + *
          • + * 3: output an RGB image. + *
          • + *
          • + * 4: output an RGBA image. + *
          • + *
          + * If needed, the PNG-encoded image is transformed to match the requested number + * of color channels. + *

          + * This op also supports decoding JPEGs and non-animated GIFs since the interface + * is the same, though it is cleaner to use `tf.image.decode_image`. + * + * @param data type for {@code image()} output + */ +@Operator(group = "image") +public final class DecodePng extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.DecodePng} + */ + public static class Options { + + /** + * @param channels Number of color channels for the decoded image. + */ + public Options channels(Long channels) { + this.channels = channels; + return this; + } + + private Long channels; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodePng operation. + * + * @param scope current scope + * @param contents 0-D. The PNG-encoded image. + * @param dtype + * @param options carries optional attributes values + * @return a new instance of DecodePng + */ + public static DecodePng create(Scope scope, Operand contents, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodePng", scope.makeOpName("DecodePng")); + opBuilder.addInput(contents.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.channels != null) { + opBuilder.setAttr("channels", opts.channels); + } + } + } + return new DecodePng(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new DecodePng operation using default output types. + * + * @param scope current scope + * @param contents 0-D. The PNG-encoded image. + * @param options carries optional attributes values + * @return a new instance of DecodePng + */ + public static DecodePng create(Scope scope, Operand contents, Options... options) { + return create(scope, contents, UInt8.class, options); + } + + /** + * @param channels Number of color channels for the decoded image. + */ + public static Options channels(Long channels) { + return new Options().channels(channels); + } + + /** + * 3-D with shape `[height, width, channels]`. + */ + public Output image() { + return image; + } + + @Override + public Output asOutput() { + return image; + } + + private Output image; + + private DecodePng(Operation operation) { + super(operation); + int outputIdx = 0; + image = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DrawBoundingBoxes.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DrawBoundingBoxes.java new file mode 100644 index 00000000000..34976c72e89 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/DrawBoundingBoxes.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Draw bounding boxes on a batch of images. + *

          + * Outputs a copy of `images` but draws on top of the pixels zero or more bounding + * boxes specified by the locations in `boxes`. The coordinates of the each + * bounding box in `boxes` are encoded as `[y_min, x_min, y_max, x_max]`. The + * bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and + * height of the underlying image. + *

          + * For example, if an image is 100 x 200 pixels (height x width) and the bounding + * box is `[0.1, 0.2, 0.5, 0.9]`, the upper-left and bottom-right coordinates of + * the bounding box will be `(40, 10)` to `(180, 50)` (in (x,y) coordinates). + *

          + * Parts of the bounding box may fall outside the image. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class DrawBoundingBoxes extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DrawBoundingBoxes operation. + * + * @param scope current scope + * @param images 4-D with shape `[batch, height, width, depth]`. A batch of images. + * @param boxes 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding + * boxes. + * @return a new instance of DrawBoundingBoxes + */ + public static DrawBoundingBoxes create(Scope scope, Operand images, Operand boxes) { + OperationBuilder opBuilder = scope.env().opBuilder("DrawBoundingBoxes", scope.makeOpName("DrawBoundingBoxes")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(boxes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DrawBoundingBoxes(opBuilder.build()); + } + + /** + * 4-D with the same shape as `images`. The batch of input images with + * bounding boxes drawn on the images. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DrawBoundingBoxes(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodeJpeg.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodeJpeg.java new file mode 100644 index 00000000000..59fe6db7989 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodeJpeg.java @@ -0,0 +1,282 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * JPEG-encode an image. + *

          + * `image` is a 3-D uint8 Tensor of shape `[height, width, channels]`. + *

          + * The attr `format` can be used to override the color format of the encoded + * output. Values can be: + *

            + *
          • + * `''`: Use a default format based on the number of channels in the image. + *
          • + *
          • + * `grayscale`: Output a grayscale JPEG image. The `channels` dimension + * of `image` must be 1. + *
          • + *
          • + * `rgb`: Output an RGB JPEG image. The `channels` dimension + * of `image` must be 3. + *
          • + *
          + * If `format` is not specified or is the empty string, a default format is picked + * in function of the number of channels in `image`: + *
            + *
          • + * 1: Output a grayscale image. + *
          • + *
          • + * 3: Output an RGB image. + */ +@Operator(group = "image") +public final class EncodeJpeg extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.EncodeJpeg} + */ + public static class Options { + + /** + * @param format Per pixel image format. + */ + public Options format(String format) { + this.format = format; + return this; + } + + /** + * @param quality Quality of the compression from 0 to 100 (higher is better and slower). + */ + public Options quality(Long quality) { + this.quality = quality; + return this; + } + + /** + * @param progressive If True, create a JPEG that loads progressively (coarse to fine). + */ + public Options progressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + /** + * @param optimizeSize If True, spend CPU/RAM to reduce size with no quality change. + */ + public Options optimizeSize(Boolean optimizeSize) { + this.optimizeSize = optimizeSize; + return this; + } + + /** + * @param chromaDownsampling See http://en.wikipedia.org/wiki/Chroma_subsampling. + */ + public Options chromaDownsampling(Boolean chromaDownsampling) { + this.chromaDownsampling = chromaDownsampling; + return this; + } + + /** + * @param densityUnit Unit used to specify `x_density` and `y_density`: + * pixels per inch (`'in'`) or centimeter (`'cm'`). + */ + public Options densityUnit(String densityUnit) { + this.densityUnit = densityUnit; + return this; + } + + /** + * @param xDensity Horizontal pixels per density unit. + */ + public Options xDensity(Long xDensity) { + this.xDensity = xDensity; + return this; + } + + /** + * @param yDensity Vertical pixels per density unit. + */ + public Options yDensity(Long yDensity) { + this.yDensity = yDensity; + return this; + } + + /** + * @param xmpMetadata If not empty, embed this XMP metadata in the image header. + */ + public Options xmpMetadata(String xmpMetadata) { + this.xmpMetadata = xmpMetadata; + return this; + } + + private String format; + private Long quality; + private Boolean progressive; + private Boolean optimizeSize; + private Boolean chromaDownsampling; + private String densityUnit; + private Long xDensity; + private Long yDensity; + private String xmpMetadata; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EncodeJpeg operation. + * + * @param scope current scope + * @param image 3-D with shape `[height, width, channels]`. + * @param options carries optional attributes values + * @return a new instance of EncodeJpeg + */ + public static EncodeJpeg create(Scope scope, Operand image, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EncodeJpeg", scope.makeOpName("EncodeJpeg")); + opBuilder.addInput(image.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.format != null) { + opBuilder.setAttr("format", opts.format); + } + if (opts.quality != null) { + opBuilder.setAttr("quality", opts.quality); + } + if (opts.progressive != null) { + opBuilder.setAttr("progressive", opts.progressive); + } + if (opts.optimizeSize != null) { + opBuilder.setAttr("optimize_size", opts.optimizeSize); + } + if (opts.chromaDownsampling != null) { + opBuilder.setAttr("chroma_downsampling", opts.chromaDownsampling); + } + if (opts.densityUnit != null) { + opBuilder.setAttr("density_unit", opts.densityUnit); + } + if (opts.xDensity != null) { + opBuilder.setAttr("x_density", opts.xDensity); + } + if (opts.yDensity != null) { + opBuilder.setAttr("y_density", opts.yDensity); + } + if (opts.xmpMetadata != null) { + opBuilder.setAttr("xmp_metadata", opts.xmpMetadata); + } + } + } + return new EncodeJpeg(opBuilder.build()); + } + + /** + * @param format Per pixel image format. + */ + public static Options format(String format) { + return new Options().format(format); + } + + /** + * @param quality Quality of the compression from 0 to 100 (higher is better and slower). + */ + public static Options quality(Long quality) { + return new Options().quality(quality); + } + + /** + * @param progressive If True, create a JPEG that loads progressively (coarse to fine). + */ + public static Options progressive(Boolean progressive) { + return new Options().progressive(progressive); + } + + /** + * @param optimizeSize If True, spend CPU/RAM to reduce size with no quality change. + */ + public static Options optimizeSize(Boolean optimizeSize) { + return new Options().optimizeSize(optimizeSize); + } + + /** + * @param chromaDownsampling See http://en.wikipedia.org/wiki/Chroma_subsampling. + */ + public static Options chromaDownsampling(Boolean chromaDownsampling) { + return new Options().chromaDownsampling(chromaDownsampling); + } + + /** + * @param densityUnit Unit used to specify `x_density` and `y_density`: + * pixels per inch (`'in'`) or centimeter (`'cm'`). + */ + public static Options densityUnit(String densityUnit) { + return new Options().densityUnit(densityUnit); + } + + /** + * @param xDensity Horizontal pixels per density unit. + */ + public static Options xDensity(Long xDensity) { + return new Options().xDensity(xDensity); + } + + /** + * @param yDensity Vertical pixels per density unit. + */ + public static Options yDensity(Long yDensity) { + return new Options().yDensity(yDensity); + } + + /** + * @param xmpMetadata If not empty, embed this XMP metadata in the image header. + */ + public static Options xmpMetadata(String xmpMetadata) { + return new Options().xmpMetadata(xmpMetadata); + } + + /** + * 0-D. JPEG-encoded image. + */ + public Output contents() { + return contents; + } + + @Override + public Output asOutput() { + return contents; + } + + private Output contents; + + private EncodeJpeg(Operation operation) { + super(operation); + int outputIdx = 0; + contents = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodeJpegVariableQuality.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodeJpegVariableQuality.java new file mode 100644 index 00000000000..be0c80ba4a9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodeJpegVariableQuality.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * JPEG encode input image with provided compression quality. + *

            + * `image` is a 3-D uint8 Tensor of shape `[height, width, channels]`. + * `quality` is an int32 jpeg compression quality value between 0 and 100. + * + */ +@Operator(group = "image") +public final class EncodeJpegVariableQuality extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new EncodeJpegVariableQuality operation. + * + * @param scope current scope + * @param images Images to adjust. At least 3-D. + * @param quality An int quality to encode to. + * @return a new instance of EncodeJpegVariableQuality + */ + public static EncodeJpegVariableQuality create(Scope scope, Operand images, Operand quality) { + OperationBuilder opBuilder = scope.env().opBuilder("EncodeJpegVariableQuality", scope.makeOpName("EncodeJpegVariableQuality")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(quality.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new EncodeJpegVariableQuality(opBuilder.build()); + } + + /** + * 0-D. JPEG-encoded image. + */ + public Output contents() { + return contents; + } + + @Override + public Output asOutput() { + return contents; + } + + private Output contents; + + private EncodeJpegVariableQuality(Operation operation) { + super(operation); + int outputIdx = 0; + contents = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodePng.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodePng.java new file mode 100644 index 00000000000..e033df5281f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodePng.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * PNG-encode an image. + *

            + * `image` is a 3-D uint8 or uint16 Tensor of shape `[height, width, channels]` + * where `channels` is: + *

              + *
            • + * 1: for grayscale. + *
            • + *
            • + * 2: for grayscale + alpha. + *
            • + *
            • + * 3: for RGB. + *
            • + *
            • + * 4: for RGBA. + *
            • + *
            + * The ZLIB compression level, `compression`, can be -1 for the PNG-encoder + * default or a value from 0 to 9. 9 is the highest compression level, generating + * the smallest output, but is slower. + */ +@Operator(group = "image") +public final class EncodePng extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.EncodePng} + */ + public static class Options { + + /** + * @param compression Compression level. + */ + public Options compression(Long compression) { + this.compression = compression; + return this; + } + + private Long compression; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EncodePng operation. + * + * @param scope current scope + * @param image 3-D with shape `[height, width, channels]`. + * @param options carries optional attributes values + * @return a new instance of EncodePng + */ + public static EncodePng create(Scope scope, Operand image, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EncodePng", scope.makeOpName("EncodePng")); + opBuilder.addInput(image.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.compression != null) { + opBuilder.setAttr("compression", opts.compression); + } + } + } + return new EncodePng(opBuilder.build()); + } + + /** + * @param compression Compression level. + */ + public static Options compression(Long compression) { + return new Options().compression(compression); + } + + /** + * 0-D. PNG-encoded image. + */ + public Output contents() { + return contents; + } + + @Override + public Output asOutput() { + return contents; + } + + private Output contents; + + private EncodePng(Operation operation) { + super(operation); + int outputIdx = 0; + contents = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractGlimpse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractGlimpse.java new file mode 100644 index 00000000000..e1cfec69dc1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractGlimpse.java @@ -0,0 +1,205 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Extracts a glimpse from the input tensor. + *

            + * Returns a set of windows called glimpses extracted at location + * `offsets` from the input tensor. If the windows only partially + * overlaps the inputs, the non overlapping areas will be filled with + * random noise. + *

            + * The result is a 4-D tensor of shape `[batch_size, glimpse_height, + * glimpse_width, channels]`. The channels and batch dimensions are the + * same as that of the input tensor. The height and width of the output + * windows are specified in the `size` parameter. + *

            + * The argument `normalized` and `centered` controls how the windows are built: + *

              + *
            • + * If the coordinates are normalized but not centered, 0.0 and 1.0 + * correspond to the minimum and maximum of each height and width + * dimension. + *
            • + *
            • + * If the coordinates are both normalized and centered, they range from + * -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper + * left corner, the lower right corner is located at (1.0, 1.0) and the + * center is at (0, 0). + *
            • + *
            • + * If the coordinates are not normalized they are interpreted as + * numbers of pixels. + */ +@Operator(group = "image") +public final class ExtractGlimpse extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ExtractGlimpse} + */ + public static class Options { + + /** + * @param centered indicates if the offset coordinates are centered relative to + * the image, in which case the (0, 0) offset is relative to the center + * of the input images. If false, the (0,0) offset corresponds to the + * upper left corner of the input images. + */ + public Options centered(Boolean centered) { + this.centered = centered; + return this; + } + + /** + * @param normalized indicates if the offset coordinates are normalized. + */ + public Options normalized(Boolean normalized) { + this.normalized = normalized; + return this; + } + + /** + * @param uniformNoise indicates if the noise should be generated using a + * uniform distribution or a Gaussian distribution. + */ + public Options uniformNoise(Boolean uniformNoise) { + this.uniformNoise = uniformNoise; + return this; + } + + /** + * @param noise indicates if the noise should `uniform`, `gaussian`, or + * `zero`. The default is `uniform` which means the the noise type + * will be decided by `uniform_noise`. + */ + public Options noise(String noise) { + this.noise = noise; + return this; + } + + private Boolean centered; + private Boolean normalized; + private Boolean uniformNoise; + private String noise; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ExtractGlimpse operation. + * + * @param scope current scope + * @param input A 4-D float tensor of shape `[batch_size, height, width, channels]`. + * @param size A 1-D tensor of 2 elements containing the size of the glimpses + * to extract. The glimpse height must be specified first, following + * by the glimpse width. + * @param offsets A 2-D integer tensor of shape `[batch_size, 2]` containing + * the y, x locations of the center of each window. + * @param options carries optional attributes values + * @return a new instance of ExtractGlimpse + */ + public static ExtractGlimpse create(Scope scope, Operand input, Operand size, Operand offsets, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ExtractGlimpse", scope.makeOpName("ExtractGlimpse")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder.addInput(offsets.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.centered != null) { + opBuilder.setAttr("centered", opts.centered); + } + if (opts.normalized != null) { + opBuilder.setAttr("normalized", opts.normalized); + } + if (opts.uniformNoise != null) { + opBuilder.setAttr("uniform_noise", opts.uniformNoise); + } + if (opts.noise != null) { + opBuilder.setAttr("noise", opts.noise); + } + } + } + return new ExtractGlimpse(opBuilder.build()); + } + + /** + * @param centered indicates if the offset coordinates are centered relative to + * the image, in which case the (0, 0) offset is relative to the center + * of the input images. If false, the (0,0) offset corresponds to the + * upper left corner of the input images. + */ + public static Options centered(Boolean centered) { + return new Options().centered(centered); + } + + /** + * @param normalized indicates if the offset coordinates are normalized. + */ + public static Options normalized(Boolean normalized) { + return new Options().normalized(normalized); + } + + /** + * @param uniformNoise indicates if the noise should be generated using a + * uniform distribution or a Gaussian distribution. + */ + public static Options uniformNoise(Boolean uniformNoise) { + return new Options().uniformNoise(uniformNoise); + } + + /** + * @param noise indicates if the noise should `uniform`, `gaussian`, or + * `zero`. The default is `uniform` which means the the noise type + * will be decided by `uniform_noise`. + */ + public static Options noise(String noise) { + return new Options().noise(noise); + } + + /** + * A tensor representing the glimpses `[batch_size, + * glimpse_height, glimpse_width, channels]`. + */ + public Output glimpse() { + return glimpse; + } + + @Override + public Output asOutput() { + return glimpse; + } + + private Output glimpse; + + private ExtractGlimpse(Operation operation) { + super(operation); + int outputIdx = 0; + glimpse = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractImagePatches.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractImagePatches.java new file mode 100644 index 00000000000..f8a52338103 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractImagePatches.java @@ -0,0 +1,99 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Extract `patches` from `images` and put them in the "depth" output dimension. + * + * @param data type for {@code patches()} output + */ +@Operator(group = "image") +public final class ExtractImagePatches extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExtractImagePatches operation. + * + * @param scope current scope + * @param images 4-D Tensor with shape `[batch, in_rows, in_cols, depth]`. + * @param ksizes The size of the sliding window for each dimension of `images`. + * @param strides How far the centers of two consecutive patches are in + * the images. Must be: `[1, stride_rows, stride_cols, 1]`. + * @param rates Must be: `[1, rate_rows, rate_cols, 1]`. This is the + * input stride, specifying how far two consecutive patch samples are in the + * input. Equivalent to extracting patches with + * `patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)`, followed by + * subsampling them spatially by a factor of `rates`. This is equivalent to + * `rate` in dilated (a.k.a. Atrous) convolutions. + * @param padding The type of padding algorithm to use. + * @return a new instance of ExtractImagePatches + */ + public static ExtractImagePatches create(Scope scope, Operand images, List ksizes, List strides, List rates, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("ExtractImagePatches", scope.makeOpName("ExtractImagePatches")); + opBuilder.addInput(images.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizesArray = new long[ksizes.size()]; + for (int i = 0; i < ksizesArray.length; ++i) { + ksizesArray[i] = ksizes.get(i); + } + opBuilder.setAttr("ksizes", ksizesArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + long[] ratesArray = new long[rates.size()]; + for (int i = 0; i < ratesArray.length; ++i) { + ratesArray[i] = rates.get(i); + } + opBuilder.setAttr("rates", ratesArray); + opBuilder.setAttr("padding", padding); + return new ExtractImagePatches(opBuilder.build()); + } + + /** + * 4-D Tensor with shape `[batch, out_rows, out_cols, ksize_rows * + * ksize_cols * depth]` containing image patches with size + * `ksize_rows x ksize_cols x depth` vectorized in the "depth" dimension. Note + * `out_rows` and `out_cols` are the dimensions of the output patches. + */ + public Output patches() { + return patches; + } + + @Override + public Output asOutput() { + return patches; + } + + private Output patches; + + private ExtractImagePatches(Operation operation) { + super(operation); + int outputIdx = 0; + patches = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractJpegShape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractJpegShape.java new file mode 100644 index 00000000000..85f9b22f619 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ExtractJpegShape.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Extract the shape information of a JPEG-encoded image. + *

              + * This op only parses the image header, so it is much faster than DecodeJpeg. + * + * @param data type for {@code imageShape()} output + */ +@Operator(group = "image") +public final class ExtractJpegShape extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ExtractJpegShape operation. + * + * @param scope current scope + * @param contents 0-D. The JPEG-encoded image. + * @param outputType (Optional) The output type of the operation (int32 or int64). + * Defaults to int32. + * @return a new instance of ExtractJpegShape + */ + public static ExtractJpegShape create(Scope scope, Operand contents, Class outputType) { + OperationBuilder opBuilder = scope.env().opBuilder("ExtractJpegShape", scope.makeOpName("ExtractJpegShape")); + opBuilder.addInput(contents.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("output_type", DataType.fromClass(outputType)); + return new ExtractJpegShape(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new ExtractJpegShape operation using default output types. + * + * @param scope current scope + * @param contents 0-D. The JPEG-encoded image. + * @return a new instance of ExtractJpegShape + */ + public static ExtractJpegShape create(Scope scope, Operand contents) { + return create(scope, contents, Integer.class); + } + + /** + * 1-D. The image shape with format [height, width, channels]. + */ + public Output imageShape() { + return imageShape; + } + + @Override + public Output asOutput() { + return imageShape; + } + + private Output imageShape; + + private ExtractJpegShape(Operation operation) { + super(operation); + int outputIdx = 0; + imageShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/HsvToRgb.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/HsvToRgb.java new file mode 100644 index 00000000000..a6dede6b80b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/HsvToRgb.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Convert one or more images from HSV to RGB. + *

              + * Outputs a tensor of the same shape as the `images` tensor, containing the RGB + * value of the pixels. The output is only well defined if the value in `images` + * are in `[0,1]`. + *

              + * See `rgb_to_hsv` for a description of the HSV encoding. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class HsvToRgb extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new HsvToRgb operation. + * + * @param scope current scope + * @param images 1-D or higher rank. HSV data to convert. Last dimension must be size 3. + * @return a new instance of HsvToRgb + */ + public static HsvToRgb create(Scope scope, Operand images) { + OperationBuilder opBuilder = scope.env().opBuilder("HSVToRGB", scope.makeOpName("HsvToRgb")); + opBuilder.addInput(images.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new HsvToRgb(opBuilder.build()); + } + + /** + * `images` converted to RGB. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private HsvToRgb(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/NonMaxSuppression.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/NonMaxSuppression.java new file mode 100644 index 00000000000..9cd2bbedece --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/NonMaxSuppression.java @@ -0,0 +1,139 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Greedily selects a subset of bounding boxes in descending order of score, + *

              + * pruning away boxes that have high intersection-over-union (IOU) overlap + * with previously selected boxes. Bounding boxes with score less than + * `score_threshold` are removed. Bounding boxes are supplied as + * [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any + * diagonal pair of box corners and the coordinates can be provided as normalized + * (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm + * is agnostic to where the origin is in the coordinate system and more + * generally is invariant to orthogonal transformations and translations + * of the coordinate system; thus translating or reflections of the coordinate + * system result in the same boxes being selected by the algorithm. + * The output of this operation is a set of integers indexing into the input + * collection of bounding boxes representing the selected boxes. The bounding + * box coordinates corresponding to the selected indices can then be obtained + * using the `tf.gather operation`. For example: + * selected_indices = tf.image.non_max_suppression_v2( + * boxes, scores, max_output_size, iou_threshold, score_threshold) + * selected_boxes = tf.gather(boxes, selected_indices) + */ +@Operator(group = "image") +public final class NonMaxSuppression extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.image.NonMaxSuppression} + */ + public static class Options { + + /** + * @param padToMaxOutputSize If true, the output `selected_indices` is padded to be of length + * `max_output_size`. Defaults to false. + */ + public Options padToMaxOutputSize(Boolean padToMaxOutputSize) { + this.padToMaxOutputSize = padToMaxOutputSize; + return this; + } + + private Boolean padToMaxOutputSize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new NonMaxSuppression operation. + * + * @param scope current scope + * @param boxes A 2-D float tensor of shape `[num_boxes, 4]`. + * @param scores A 1-D float tensor of shape `[num_boxes]` representing a single + * score corresponding to each box (each row of boxes). + * @param maxOutputSize A scalar integer tensor representing the maximum number of + * boxes to be selected by non max suppression. + * @param iouThreshold A 0-D float tensor representing the threshold for deciding whether + * boxes overlap too much with respect to IOU. + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * boxes based on score. + * @param options carries optional attributes values + * @return a new instance of NonMaxSuppression + */ + public static NonMaxSuppression create(Scope scope, Operand boxes, Operand scores, Operand maxOutputSize, Operand iouThreshold, Operand scoreThreshold, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("NonMaxSuppressionV4", scope.makeOpName("NonMaxSuppression")); + opBuilder.addInput(boxes.asOutput()); + opBuilder.addInput(scores.asOutput()); + opBuilder.addInput(maxOutputSize.asOutput()); + opBuilder.addInput(iouThreshold.asOutput()); + opBuilder.addInput(scoreThreshold.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.padToMaxOutputSize != null) { + opBuilder.setAttr("pad_to_max_output_size", opts.padToMaxOutputSize); + } + } + } + return new NonMaxSuppression(opBuilder.build()); + } + + /** + * @param padToMaxOutputSize If true, the output `selected_indices` is padded to be of length + * `max_output_size`. Defaults to false. + */ + public static Options padToMaxOutputSize(Boolean padToMaxOutputSize) { + return new Options().padToMaxOutputSize(padToMaxOutputSize); + } + + /** + * A 1-D integer tensor of shape `[M]` representing the selected + * indices from the boxes tensor, where `M <= max_output_size`. + */ + public Output selectedIndices() { + return selectedIndices; + } + + /** + * A 0-D integer tensor representing the number of valid elements in + * `selected_indices`, with the valid elements appearing first. + */ + public Output validOutputs() { + return validOutputs; + } + + private Output selectedIndices; + private Output validOutputs; + + private NonMaxSuppression(Operation operation) { + super(operation); + int outputIdx = 0; + selectedIndices = operation.output(outputIdx++); + validOutputs = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/NonMaxSuppressionWithOverlaps.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/NonMaxSuppressionWithOverlaps.java new file mode 100644 index 00000000000..01972dc3749 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/NonMaxSuppressionWithOverlaps.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Greedily selects a subset of bounding boxes in descending order of score, + *

              + * pruning away boxes that have high overlaps + * with previously selected boxes. Bounding boxes with score less than + * `score_threshold` are removed. N-by-n overlap values are supplied as square matrix, + * which allows for defining a custom overlap criterium (eg. intersection over union, + * intersection over area, etc.). + *

              + * The output of this operation is a set of integers indexing into the input + * collection of bounding boxes representing the selected boxes. The bounding + * box coordinates corresponding to the selected indices can then be obtained + * using the `tf.gather operation`. For example: + *

              + * selected_indices = tf.image.non_max_suppression_with_overlaps( + * overlaps, scores, max_output_size, overlap_threshold, score_threshold) + * selected_boxes = tf.gather(boxes, selected_indices) + */ +@Operator(group = "image") +public final class NonMaxSuppressionWithOverlaps extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new NonMaxSuppressionWithOverlaps operation. + * + * @param scope current scope + * @param overlaps A 2-D float tensor of shape `[num_boxes, num_boxes]` representing + * the n-by-n box overlap values. + * @param scores A 1-D float tensor of shape `[num_boxes]` representing a single + * score corresponding to each box (each row of boxes). + * @param maxOutputSize A scalar integer tensor representing the maximum number of + * boxes to be selected by non max suppression. + * @param overlapThreshold A 0-D float tensor representing the threshold for deciding whether + * boxes overlap too. + * @param scoreThreshold A 0-D float tensor representing the threshold for deciding when to remove + * boxes based on score. + * @return a new instance of NonMaxSuppressionWithOverlaps + */ + public static NonMaxSuppressionWithOverlaps create(Scope scope, Operand overlaps, Operand scores, Operand maxOutputSize, Operand overlapThreshold, Operand scoreThreshold) { + OperationBuilder opBuilder = scope.env().opBuilder("NonMaxSuppressionWithOverlaps", scope.makeOpName("NonMaxSuppressionWithOverlaps")); + opBuilder.addInput(overlaps.asOutput()); + opBuilder.addInput(scores.asOutput()); + opBuilder.addInput(maxOutputSize.asOutput()); + opBuilder.addInput(overlapThreshold.asOutput()); + opBuilder.addInput(scoreThreshold.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new NonMaxSuppressionWithOverlaps(opBuilder.build()); + } + + /** + * A 1-D integer tensor of shape `[M]` representing the selected + * indices from the boxes tensor, where `M <= max_output_size`. + */ + public Output selectedIndices() { + return selectedIndices; + } + + @Override + public Output asOutput() { + return selectedIndices; + } + + private Output selectedIndices; + + private NonMaxSuppressionWithOverlaps(Operation operation) { + super(operation); + int outputIdx = 0; + selectedIndices = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/QuantizedResizeBilinear.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/QuantizedResizeBilinear.java new file mode 100644 index 00000000000..dc14050baa3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/QuantizedResizeBilinear.java @@ -0,0 +1,145 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Resize quantized `images` to `size` using quantized bilinear interpolation. + *

              + * Input images and output images must be quantized types. + * + * @param data type for {@code resizedImages()} output + */ +@Operator(group = "image") +public final class QuantizedResizeBilinear extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.image.QuantizedResizeBilinear} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + /** + * @param halfPixelCenters + */ + public Options halfPixelCenters(Boolean halfPixelCenters) { + this.halfPixelCenters = halfPixelCenters; + return this; + } + + private Boolean alignCorners; + private Boolean halfPixelCenters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedResizeBilinear operation. + * + * @param scope current scope + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * new size for the images. + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of QuantizedResizeBilinear + */ + public static QuantizedResizeBilinear create(Scope scope, Operand images, Operand size, Operand min, Operand max, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedResizeBilinear", scope.makeOpName("QuantizedResizeBilinear")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder.addInput(min.asOutput()); + opBuilder.addInput(max.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + if (opts.halfPixelCenters != null) { + opBuilder.setAttr("half_pixel_centers", opts.halfPixelCenters); + } + } + } + return new QuantizedResizeBilinear(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * @param halfPixelCenters + */ + public static Options halfPixelCenters(Boolean halfPixelCenters) { + return new Options().halfPixelCenters(halfPixelCenters); + } + + /** + * 4-D with shape + * `[batch, new_height, new_width, channels]`. + */ + public Output resizedImages() { + return resizedImages; + } + + /** + */ + public Output outMin() { + return outMin; + } + + /** + */ + public Output outMax() { + return outMax; + } + + private Output resizedImages; + private Output outMin; + private Output outMax; + + private QuantizedResizeBilinear(Operation operation) { + super(operation); + int outputIdx = 0; + resizedImages = operation.output(outputIdx++); + outMin = operation.output(outputIdx++); + outMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/RandomCrop.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/RandomCrop.java new file mode 100644 index 00000000000..f3ca09d6b4e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/RandomCrop.java @@ -0,0 +1,135 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Randomly crop `image`. + *

              + * `size` is a 1-D int64 tensor with 2 elements representing the crop height and + * width. The values must be non negative. + *

              + * This Op picks a random location in `image` and crops a `height` by `width` + * rectangle from that location. The random location is picked so the cropped + * area will fit inside the original image. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class RandomCrop extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.RandomCrop} + */ + public static class Options { + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomCrop operation. + * + * @param scope current scope + * @param image 3-D of shape `[height, width, channels]`. + * @param size 1-D of length 2 containing: `crop_height`, `crop_width`.. + * @param options carries optional attributes values + * @return a new instance of RandomCrop + */ + public static RandomCrop create(Scope scope, Operand image, Operand size, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomCrop", scope.makeOpName("RandomCrop")); + opBuilder.addInput(image.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new RandomCrop(opBuilder.build()); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * 3-D of shape `[crop_height, crop_width, channels].` + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomCrop(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeArea.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeArea.java new file mode 100644 index 00000000000..dd01529633b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeArea.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Resize `images` to `size` using area interpolation. + *

              + * Input images can be of different types but output images are always float. + *

              + * The range of pixel values for the output image might be slightly different + * from the range for the input image because of limited numerical precision. + * To guarantee an output range, for example `[0.0, 1.0]`, apply + * `tf.clip_by_value` to the output. + *

              + * Each output pixel is computed by first transforming the pixel's footprint into + * the input tensor and then averaging the pixels that intersect the footprint. An + * input pixel's contribution to the average is weighted by the fraction of its + * area that intersects the footprint. This is the same as OpenCV's INTER_AREA. + */ +@Operator(group = "image") +public final class ResizeArea extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ResizeArea} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + private Boolean alignCorners; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResizeArea operation. + * + * @param scope current scope + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * new size for the images. + * @param options carries optional attributes values + * @return a new instance of ResizeArea + */ + public static ResizeArea create(Scope scope, Operand images, Operand size, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResizeArea", scope.makeOpName("ResizeArea")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + } + } + return new ResizeArea(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * 4-D with shape + * `[batch, new_height, new_width, channels]`. + */ + public Output resizedImages() { + return resizedImages; + } + + @Override + public Output asOutput() { + return resizedImages; + } + + private Output resizedImages; + + private ResizeArea(Operation operation) { + super(operation); + int outputIdx = 0; + resizedImages = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubic.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubic.java new file mode 100644 index 00000000000..1186b26ae2a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubic.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Resize `images` to `size` using bicubic interpolation. + *

              + * Input images can be of different types but output images are always float. + */ +@Operator(group = "image") +public final class ResizeBicubic extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ResizeBicubic} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + /** + * @param halfPixelCenters + */ + public Options halfPixelCenters(Boolean halfPixelCenters) { + this.halfPixelCenters = halfPixelCenters; + return this; + } + + private Boolean alignCorners; + private Boolean halfPixelCenters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResizeBicubic operation. + * + * @param scope current scope + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * new size for the images. + * @param options carries optional attributes values + * @return a new instance of ResizeBicubic + */ + public static ResizeBicubic create(Scope scope, Operand images, Operand size, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResizeBicubic", scope.makeOpName("ResizeBicubic")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + if (opts.halfPixelCenters != null) { + opBuilder.setAttr("half_pixel_centers", opts.halfPixelCenters); + } + } + } + return new ResizeBicubic(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * @param halfPixelCenters + */ + public static Options halfPixelCenters(Boolean halfPixelCenters) { + return new Options().halfPixelCenters(halfPixelCenters); + } + + /** + * 4-D with shape + * `[batch, new_height, new_width, channels]`. + */ + public Output resizedImages() { + return resizedImages; + } + + @Override + public Output asOutput() { + return resizedImages; + } + + private Output resizedImages; + + private ResizeBicubic(Operation operation) { + super(operation); + int outputIdx = 0; + resizedImages = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubicGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubicGrad.java new file mode 100644 index 00000000000..ceaf9dd4227 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubicGrad.java @@ -0,0 +1,127 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient of bicubic interpolation. + * + * @param data type for {@code output()} output + */ +public final class ResizeBicubicGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ResizeBicubicGrad} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and grad tensors are + * aligned. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + /** + * @param halfPixelCenters + */ + public Options halfPixelCenters(Boolean halfPixelCenters) { + this.halfPixelCenters = halfPixelCenters; + return this; + } + + private Boolean alignCorners; + private Boolean halfPixelCenters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResizeBicubicGrad operation. + * + * @param scope current scope + * @param grads 4-D with shape `[batch, height, width, channels]`. + * @param originalImage 4-D with shape `[batch, orig_height, orig_width, channels]`, + * The image tensor that was resized. + * @param options carries optional attributes values + * @return a new instance of ResizeBicubicGrad + */ + public static ResizeBicubicGrad create(Scope scope, Operand grads, Operand originalImage, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResizeBicubicGrad", scope.makeOpName("ResizeBicubicGrad")); + opBuilder.addInput(grads.asOutput()); + opBuilder.addInput(originalImage.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + if (opts.halfPixelCenters != null) { + opBuilder.setAttr("half_pixel_centers", opts.halfPixelCenters); + } + } + } + return new ResizeBicubicGrad(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and grad tensors are + * aligned. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * @param halfPixelCenters + */ + public static Options halfPixelCenters(Boolean halfPixelCenters) { + return new Options().halfPixelCenters(halfPixelCenters); + } + + /** + * 4-D with shape `[batch, orig_height, orig_width, channels]`. + * Gradients with respect to the input image. Input image must have been + * float or double. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ResizeBicubicGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinear.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinear.java new file mode 100644 index 00000000000..56ac725a0e8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinear.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Resize `images` to `size` using bilinear interpolation. + *

              + * Input images can be of different types but output images are always float. + */ +@Operator(group = "image") +public final class ResizeBilinear extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ResizeBilinear} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + /** + * @param halfPixelCenters + */ + public Options halfPixelCenters(Boolean halfPixelCenters) { + this.halfPixelCenters = halfPixelCenters; + return this; + } + + private Boolean alignCorners; + private Boolean halfPixelCenters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResizeBilinear operation. + * + * @param scope current scope + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * new size for the images. + * @param options carries optional attributes values + * @return a new instance of ResizeBilinear + */ + public static ResizeBilinear create(Scope scope, Operand images, Operand size, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResizeBilinear", scope.makeOpName("ResizeBilinear")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + if (opts.halfPixelCenters != null) { + opBuilder.setAttr("half_pixel_centers", opts.halfPixelCenters); + } + } + } + return new ResizeBilinear(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * @param halfPixelCenters + */ + public static Options halfPixelCenters(Boolean halfPixelCenters) { + return new Options().halfPixelCenters(halfPixelCenters); + } + + /** + * 4-D with shape + * `[batch, new_height, new_width, channels]`. + */ + public Output resizedImages() { + return resizedImages; + } + + @Override + public Output asOutput() { + return resizedImages; + } + + private Output resizedImages; + + private ResizeBilinear(Operation operation) { + super(operation); + int outputIdx = 0; + resizedImages = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinearGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinearGrad.java new file mode 100644 index 00000000000..f6e303d785e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinearGrad.java @@ -0,0 +1,127 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient of bilinear interpolation. + * + * @param data type for {@code output()} output + */ +public final class ResizeBilinearGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ResizeBilinearGrad} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and grad tensors are + * aligned. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + /** + * @param halfPixelCenters + */ + public Options halfPixelCenters(Boolean halfPixelCenters) { + this.halfPixelCenters = halfPixelCenters; + return this; + } + + private Boolean alignCorners; + private Boolean halfPixelCenters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResizeBilinearGrad operation. + * + * @param scope current scope + * @param grads 4-D with shape `[batch, height, width, channels]`. + * @param originalImage 4-D with shape `[batch, orig_height, orig_width, channels]`, + * The image tensor that was resized. + * @param options carries optional attributes values + * @return a new instance of ResizeBilinearGrad + */ + public static ResizeBilinearGrad create(Scope scope, Operand grads, Operand originalImage, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResizeBilinearGrad", scope.makeOpName("ResizeBilinearGrad")); + opBuilder.addInput(grads.asOutput()); + opBuilder.addInput(originalImage.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + if (opts.halfPixelCenters != null) { + opBuilder.setAttr("half_pixel_centers", opts.halfPixelCenters); + } + } + } + return new ResizeBilinearGrad(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and grad tensors are + * aligned. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * @param halfPixelCenters + */ + public static Options halfPixelCenters(Boolean halfPixelCenters) { + return new Options().halfPixelCenters(halfPixelCenters); + } + + /** + * 4-D with shape `[batch, orig_height, orig_width, channels]`. + * Gradients with respect to the input image. Input image must have been + * float or double. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ResizeBilinearGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeNearestNeighbor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeNearestNeighbor.java new file mode 100644 index 00000000000..499a2d7120d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeNearestNeighbor.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Resize `images` to `size` using nearest neighbor interpolation. + * + * @param data type for {@code resizedImages()} output + */ +@Operator(group = "image") +public final class ResizeNearestNeighbor extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ResizeNearestNeighbor} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + /** + * @param halfPixelCenters + */ + public Options halfPixelCenters(Boolean halfPixelCenters) { + this.halfPixelCenters = halfPixelCenters; + return this; + } + + private Boolean alignCorners; + private Boolean halfPixelCenters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResizeNearestNeighbor operation. + * + * @param scope current scope + * @param images 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * new size for the images. + * @param options carries optional attributes values + * @return a new instance of ResizeNearestNeighbor + */ + public static ResizeNearestNeighbor create(Scope scope, Operand images, Operand size, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResizeNearestNeighbor", scope.makeOpName("ResizeNearestNeighbor")); + opBuilder.addInput(images.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + if (opts.halfPixelCenters != null) { + opBuilder.setAttr("half_pixel_centers", opts.halfPixelCenters); + } + } + } + return new ResizeNearestNeighbor(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * @param halfPixelCenters + */ + public static Options halfPixelCenters(Boolean halfPixelCenters) { + return new Options().halfPixelCenters(halfPixelCenters); + } + + /** + * 4-D with shape + * `[batch, new_height, new_width, channels]`. + */ + public Output resizedImages() { + return resizedImages; + } + + @Override + public Output asOutput() { + return resizedImages; + } + + private Output resizedImages; + + private ResizeNearestNeighbor(Operation operation) { + super(operation); + int outputIdx = 0; + resizedImages = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeNearestNeighborGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeNearestNeighborGrad.java new file mode 100644 index 00000000000..7e2e0132acf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeNearestNeighborGrad.java @@ -0,0 +1,126 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient of nearest neighbor interpolation. + * + * @param data type for {@code output()} output + */ +public final class ResizeNearestNeighborGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.image.ResizeNearestNeighborGrad} + */ + public static class Options { + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and grad tensors are + * aligned. Defaults to false. + */ + public Options alignCorners(Boolean alignCorners) { + this.alignCorners = alignCorners; + return this; + } + + /** + * @param halfPixelCenters + */ + public Options halfPixelCenters(Boolean halfPixelCenters) { + this.halfPixelCenters = halfPixelCenters; + return this; + } + + private Boolean alignCorners; + private Boolean halfPixelCenters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResizeNearestNeighborGrad operation. + * + * @param scope current scope + * @param grads 4-D with shape `[batch, height, width, channels]`. + * @param size = A 1-D int32 Tensor of 2 elements: `orig_height, orig_width`. The + * original input size. + * @param options carries optional attributes values + * @return a new instance of ResizeNearestNeighborGrad + */ + public static ResizeNearestNeighborGrad create(Scope scope, Operand grads, Operand size, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResizeNearestNeighborGrad", scope.makeOpName("ResizeNearestNeighborGrad")); + opBuilder.addInput(grads.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alignCorners != null) { + opBuilder.setAttr("align_corners", opts.alignCorners); + } + if (opts.halfPixelCenters != null) { + opBuilder.setAttr("half_pixel_centers", opts.halfPixelCenters); + } + } + } + return new ResizeNearestNeighborGrad(opBuilder.build()); + } + + /** + * @param alignCorners If true, the centers of the 4 corner pixels of the input and grad tensors are + * aligned. Defaults to false. + */ + public static Options alignCorners(Boolean alignCorners) { + return new Options().alignCorners(alignCorners); + } + + /** + * @param halfPixelCenters + */ + public static Options halfPixelCenters(Boolean halfPixelCenters) { + return new Options().halfPixelCenters(halfPixelCenters); + } + + /** + * 4-D with shape `[batch, orig_height, orig_width, channels]`. Gradients + * with respect to the input image. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ResizeNearestNeighborGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/RgbToHsv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/RgbToHsv.java new file mode 100644 index 00000000000..1242eb3e345 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/RgbToHsv.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts one or more images from RGB to HSV. + *

              + * Outputs a tensor of the same shape as the `images` tensor, containing the HSV + * value of the pixels. The output is only well defined if the value in `images` + * are in `[0,1]`. + *

              + * `output[..., 0]` contains hue, `output[..., 1]` contains saturation, and + * `output[..., 2]` contains value. All HSV values are in `[0,1]`. A hue of 0 + * corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue. + * + * @param data type for {@code output()} output + */ +@Operator(group = "image") +public final class RgbToHsv extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RgbToHsv operation. + * + * @param scope current scope + * @param images 1-D or higher rank. RGB data to convert. Last dimension must be size 3. + * @return a new instance of RgbToHsv + */ + public static RgbToHsv create(Scope scope, Operand images) { + OperationBuilder opBuilder = scope.env().opBuilder("RGBToHSV", scope.makeOpName("RgbToHsv")); + opBuilder.addInput(images.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RgbToHsv(opBuilder.build()); + } + + /** + * `images` converted to HSV. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RgbToHsv(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/SampleDistortedBoundingBox.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/SampleDistortedBoundingBox.java new file mode 100644 index 00000000000..d6ce5294ea7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/SampleDistortedBoundingBox.java @@ -0,0 +1,284 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.image; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generate a single randomly distorted bounding box for an image. + *

              + * Bounding box annotations are often supplied in addition to ground-truth labels + * in image recognition or object localization tasks. A common technique for + * training such a system is to randomly distort an image while preserving + * its content, i.e. data augmentation. This Op outputs a randomly distorted + * localization of an object, i.e. bounding box, given an `image_size`, + * `bounding_boxes` and a series of constraints. + *

              + * The output of this Op is a single bounding box that may be used to crop the + * original image. The output is returned as 3 tensors: `begin`, `size` and + * `bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the + * image. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize + * what the bounding box looks like. + *

              + * Bounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The + * bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and + * height of the underlying image. + *

              + * For example, + *

              {@code
              + *     # Generate a single distorted bounding box.
              + *     begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box(
              + *         tf.shape(image),
              + *         bounding_boxes=bounding_boxes)
              + * 
              + *     # Draw the bounding box in an image summary.
              + *     image_with_box = tf.image.draw_bounding_boxes(tf.expand_dims(image, 0),
              + *                                                   bbox_for_draw)
              + *     tf.summary.image('images_with_box', image_with_box)
              + * 
              + *     # Employ the bounding box to distort the image.
              + *     distorted_image = tf.slice(image, begin, size)
              + * }
              + * Note that if no bounding box information is available, setting + * `use_image_if_no_bounding_boxes = true` will assume there is a single implicit + * bounding box covering the whole image. If `use_image_if_no_bounding_boxes` is + * false and no bounding boxes are supplied, an error is raised. + * + * @param data type for {@code begin()} output + */ +@Operator(group = "image") +public final class SampleDistortedBoundingBox extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.image.SampleDistortedBoundingBox} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to non-zero, the random number + * generator is seeded by the given `seed`. Otherwise, it is seeded by a random + * seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param aspectRatioRange The cropped area of the image must have an aspect ratio = + * width / height within this range. + */ + public Options aspectRatioRange(List aspectRatioRange) { + this.aspectRatioRange = aspectRatioRange; + return this; + } + + /** + * @param areaRange The cropped area of the image must contain a fraction of the + * supplied image within this range. + */ + public Options areaRange(List areaRange) { + this.areaRange = areaRange; + return this; + } + + /** + * @param maxAttempts Number of attempts at generating a cropped region of the image + * of the specified constraints. After `max_attempts` failures, return the entire + * image. + */ + public Options maxAttempts(Long maxAttempts) { + this.maxAttempts = maxAttempts; + return this; + } + + /** + * @param useImageIfNoBoundingBoxes Controls behavior if no bounding boxes supplied. + * If true, assume an implicit bounding box covering the whole input. If false, + * raise an error. + */ + public Options useImageIfNoBoundingBoxes(Boolean useImageIfNoBoundingBoxes) { + this.useImageIfNoBoundingBoxes = useImageIfNoBoundingBoxes; + return this; + } + + private Long seed; + private Long seed2; + private List aspectRatioRange; + private List areaRange; + private Long maxAttempts; + private Boolean useImageIfNoBoundingBoxes; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SampleDistortedBoundingBox operation. + * + * @param scope current scope + * @param imageSize 1-D, containing `[height, width, channels]`. + * @param boundingBoxes 3-D with shape `[batch, N, 4]` describing the N bounding boxes + * associated with the image. + * @param minObjectCovered The cropped area of the image must contain at least this + * fraction of any bounding box supplied. The value of this parameter should be + * non-negative. In the case of 0, the cropped area does not need to overlap + * any of the bounding boxes supplied. + * @param options carries optional attributes values + * @return a new instance of SampleDistortedBoundingBox + */ + public static SampleDistortedBoundingBox create(Scope scope, Operand imageSize, Operand boundingBoxes, Operand minObjectCovered, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SampleDistortedBoundingBoxV2", scope.makeOpName("SampleDistortedBoundingBox")); + opBuilder.addInput(imageSize.asOutput()); + opBuilder.addInput(boundingBoxes.asOutput()); + opBuilder.addInput(minObjectCovered.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.aspectRatioRange != null) { + float[] aspectRatioRangeArray = new float[opts.aspectRatioRange.size()]; + for (int i = 0; i < aspectRatioRangeArray.length; ++i) { + aspectRatioRangeArray[i] = opts.aspectRatioRange.get(i); + } + opBuilder.setAttr("aspect_ratio_range", aspectRatioRangeArray); + } + if (opts.areaRange != null) { + float[] areaRangeArray = new float[opts.areaRange.size()]; + for (int i = 0; i < areaRangeArray.length; ++i) { + areaRangeArray[i] = opts.areaRange.get(i); + } + opBuilder.setAttr("area_range", areaRangeArray); + } + if (opts.maxAttempts != null) { + opBuilder.setAttr("max_attempts", opts.maxAttempts); + } + if (opts.useImageIfNoBoundingBoxes != null) { + opBuilder.setAttr("use_image_if_no_bounding_boxes", opts.useImageIfNoBoundingBoxes); + } + } + } + return new SampleDistortedBoundingBox(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to non-zero, the random number + * generator is seeded by the given `seed`. Otherwise, it is seeded by a random + * seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param aspectRatioRange The cropped area of the image must have an aspect ratio = + * width / height within this range. + */ + public static Options aspectRatioRange(List aspectRatioRange) { + return new Options().aspectRatioRange(aspectRatioRange); + } + + /** + * @param areaRange The cropped area of the image must contain a fraction of the + * supplied image within this range. + */ + public static Options areaRange(List areaRange) { + return new Options().areaRange(areaRange); + } + + /** + * @param maxAttempts Number of attempts at generating a cropped region of the image + * of the specified constraints. After `max_attempts` failures, return the entire + * image. + */ + public static Options maxAttempts(Long maxAttempts) { + return new Options().maxAttempts(maxAttempts); + } + + /** + * @param useImageIfNoBoundingBoxes Controls behavior if no bounding boxes supplied. + * If true, assume an implicit bounding box covering the whole input. If false, + * raise an error. + */ + public static Options useImageIfNoBoundingBoxes(Boolean useImageIfNoBoundingBoxes) { + return new Options().useImageIfNoBoundingBoxes(useImageIfNoBoundingBoxes); + } + + /** + * 1-D, containing `[offset_height, offset_width, 0]`. Provide as input to + * `tf.slice`. + */ + public Output begin() { + return begin; + } + + /** + * 1-D, containing `[target_height, target_width, -1]`. Provide as input to + * `tf.slice`. + */ + public Output size() { + return size; + } + + /** + * 3-D with shape `[1, 1, 4]` containing the distorted bounding box. + * Provide as input to `tf.image.draw_bounding_boxes`. + */ + public Output bboxes() { + return bboxes; + } + + private Output begin; + private Output size; + private Output bboxes; + + private SampleDistortedBoundingBox(Operation operation) { + super(operation); + int outputIdx = 0; + begin = operation.output(outputIdx++); + size = operation.output(outputIdx++); + bboxes = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeBase64.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeBase64.java new file mode 100644 index 00000000000..1735129f05a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeBase64.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Decode web-safe base64-encoded strings. + *

              + * Input may or may not have padding at the end. See EncodeBase64 for padding. + * Web-safe means that input must use - and _ instead of + and /. + */ +@Operator(group = "io") +public final class DecodeBase64 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DecodeBase64 operation. + * + * @param scope current scope + * @param input Base64 strings to decode. + * @return a new instance of DecodeBase64 + */ + public static DecodeBase64 create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeBase64", scope.makeOpName("DecodeBase64")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DecodeBase64(opBuilder.build()); + } + + /** + * Decoded strings. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DecodeBase64(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeCompressed.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeCompressed.java new file mode 100644 index 00000000000..a2efaa23b26 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeCompressed.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Decompress strings. + *

              + * This op decompresses each element of the `bytes` input `Tensor`, which + * is assumed to be compressed using the given `compression_type`. + *

              + * The `output` is a string `Tensor` of the same shape as `bytes`, + * each element containing the decompressed data from the corresponding + * element in `bytes`. + */ +@Operator(group = "io") +public final class DecodeCompressed extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.DecodeCompressed} + */ + public static class Options { + + /** + * @param compressionType A scalar containing either (i) the empty string (no + * compression), (ii) "ZLIB", or (iii) "GZIP". + */ + public Options compressionType(String compressionType) { + this.compressionType = compressionType; + return this; + } + + private String compressionType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeCompressed operation. + * + * @param scope current scope + * @param bytes A Tensor of string which is compressed. + * @param options carries optional attributes values + * @return a new instance of DecodeCompressed + */ + public static DecodeCompressed create(Scope scope, Operand bytes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeCompressed", scope.makeOpName("DecodeCompressed")); + opBuilder.addInput(bytes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.compressionType != null) { + opBuilder.setAttr("compression_type", opts.compressionType); + } + } + } + return new DecodeCompressed(opBuilder.build()); + } + + /** + * @param compressionType A scalar containing either (i) the empty string (no + * compression), (ii) "ZLIB", or (iii) "GZIP". + */ + public static Options compressionType(String compressionType) { + return new Options().compressionType(compressionType); + } + + /** + * A Tensor with the same shape as input `bytes`, uncompressed + * from bytes. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DecodeCompressed(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeCsv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeCsv.java new file mode 100644 index 00000000000..2ae30d27060 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeCsv.java @@ -0,0 +1,182 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Convert CSV records to tensors. Each column maps to one tensor. + *

              + * RFC 4180 format is expected for the CSV records. + * (https://tools.ietf.org/html/rfc4180) + * Note that we allow leading and trailing spaces with int or float field. + */ +@Operator(group = "io") +public final class DecodeCsv extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.io.DecodeCsv} + */ + public static class Options { + + /** + * @param fieldDelim char delimiter to separate fields in a record. + */ + public Options fieldDelim(String fieldDelim) { + this.fieldDelim = fieldDelim; + return this; + } + + /** + * @param useQuoteDelim If false, treats double quotation marks as regular + * characters inside of the string fields (ignoring RFC 4180, Section 2, + * Bullet 5). + */ + public Options useQuoteDelim(Boolean useQuoteDelim) { + this.useQuoteDelim = useQuoteDelim; + return this; + } + + /** + * @param naValue Additional string to recognize as NA/NaN. + */ + public Options naValue(String naValue) { + this.naValue = naValue; + return this; + } + + /** + * @param selectCols + */ + public Options selectCols(List selectCols) { + this.selectCols = selectCols; + return this; + } + + private String fieldDelim; + private Boolean useQuoteDelim; + private String naValue; + private List selectCols; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeCsv operation. + * + * @param scope current scope + * @param records Each string is a record/row in the csv and all records should have + * the same format. + * @param recordDefaults One tensor per column of the input record, with either a + * scalar default value for that column or an empty vector if the column is + * required. + * @param options carries optional attributes values + * @return a new instance of DecodeCsv + */ + public static DecodeCsv create(Scope scope, Operand records, Iterable> recordDefaults, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeCSV", scope.makeOpName("DecodeCsv")); + opBuilder.addInput(records.asOutput()); + opBuilder.addInputList(Operands.asOutputs(recordDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.fieldDelim != null) { + opBuilder.setAttr("field_delim", opts.fieldDelim); + } + if (opts.useQuoteDelim != null) { + opBuilder.setAttr("use_quote_delim", opts.useQuoteDelim); + } + if (opts.naValue != null) { + opBuilder.setAttr("na_value", opts.naValue); + } + if (opts.selectCols != null) { + long[] selectColsArray = new long[opts.selectCols.size()]; + for (int i = 0; i < selectColsArray.length; ++i) { + selectColsArray[i] = opts.selectCols.get(i); + } + opBuilder.setAttr("select_cols", selectColsArray); + } + } + } + return new DecodeCsv(opBuilder.build()); + } + + /** + * @param fieldDelim char delimiter to separate fields in a record. + */ + public static Options fieldDelim(String fieldDelim) { + return new Options().fieldDelim(fieldDelim); + } + + /** + * @param useQuoteDelim If false, treats double quotation marks as regular + * characters inside of the string fields (ignoring RFC 4180, Section 2, + * Bullet 5). + */ + public static Options useQuoteDelim(Boolean useQuoteDelim) { + return new Options().useQuoteDelim(useQuoteDelim); + } + + /** + * @param naValue Additional string to recognize as NA/NaN. + */ + public static Options naValue(String naValue) { + return new Options().naValue(naValue); + } + + /** + * @param selectCols + */ + public static Options selectCols(List selectCols) { + return new Options().selectCols(selectCols); + } + + /** + * Each tensor will have the same shape as records. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + private List> output; + + private DecodeCsv(Operation operation) { + super(operation); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeJsonExample.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeJsonExample.java new file mode 100644 index 00000000000..4275a7c9e2b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeJsonExample.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Convert JSON-encoded Example records to binary protocol buffer strings. + *

              + * This op translates a tensor containing Example records, encoded using + * the [standard JSON + * mapping](https://developers.google.com/protocol-buffers/docs/proto3#json), + * into a tensor containing the same records encoded as binary protocol + * buffers. The resulting tensor can then be fed to any of the other + * Example-parsing ops. + */ +@Operator(group = "io") +public final class DecodeJsonExample extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DecodeJsonExample operation. + * + * @param scope current scope + * @param jsonExamples Each string is a JSON object serialized according to the JSON + * mapping of the Example proto. + * @return a new instance of DecodeJsonExample + */ + public static DecodeJsonExample create(Scope scope, Operand jsonExamples) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeJSONExample", scope.makeOpName("DecodeJsonExample")); + opBuilder.addInput(jsonExamples.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DecodeJsonExample(opBuilder.build()); + } + + /** + * Each string is a binary Example protocol buffer corresponding + * to the respective element of `json_examples`. + */ + public Output binaryExamples() { + return binaryExamples; + } + + @Override + public Output asOutput() { + return binaryExamples; + } + + private Output binaryExamples; + + private DecodeJsonExample(Operation operation) { + super(operation); + int outputIdx = 0; + binaryExamples = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeRaw.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeRaw.java new file mode 100644 index 00000000000..2329c9109b0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DecodeRaw.java @@ -0,0 +1,112 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reinterpret the bytes of a string as a vector of numbers. + * + * @param data type for {@code output()} output + */ +@Operator(group = "io") +public final class DecodeRaw extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.DecodeRaw} + */ + public static class Options { + + /** + * @param littleEndian Whether the input `bytes` are in little-endian order. + * Ignored for `out_type` values that are stored in a single byte like + * `uint8`. + */ + public Options littleEndian(Boolean littleEndian) { + this.littleEndian = littleEndian; + return this; + } + + private Boolean littleEndian; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DecodeRaw operation. + * + * @param scope current scope + * @param bytes All the elements must have the same length. + * @param outType + * @param options carries optional attributes values + * @return a new instance of DecodeRaw + */ + public static DecodeRaw create(Scope scope, Operand bytes, Class outType, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DecodeRaw", scope.makeOpName("DecodeRaw")); + opBuilder.addInput(bytes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + if (options != null) { + for (Options opts : options) { + if (opts.littleEndian != null) { + opBuilder.setAttr("little_endian", opts.littleEndian); + } + } + } + return new DecodeRaw(opBuilder.build()); + } + + /** + * @param littleEndian Whether the input `bytes` are in little-endian order. + * Ignored for `out_type` values that are stored in a single byte like + * `uint8`. + */ + public static Options littleEndian(Boolean littleEndian) { + return new Options().littleEndian(littleEndian); + } + + /** + * A Tensor with one more dimension than the input `bytes`. The + * added dimension will have size equal to the length of the elements + * of `bytes` divided by the number of bytes to represent `out_type`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DecodeRaw(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DeserializeManySparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DeserializeManySparse.java new file mode 100644 index 00000000000..07297007db8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/DeserializeManySparse.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Deserialize and concatenate `SparseTensors` from a serialized minibatch. + *

              + * The input `serialized_sparse` must be a string matrix of shape `[N x 3]` where + * `N` is the minibatch size and the rows correspond to packed outputs of + * `SerializeSparse`. The ranks of the original `SparseTensor` objects + * must all match. When the final `SparseTensor` is created, it has rank one + * higher than the ranks of the incoming `SparseTensor` objects + * (they have been concatenated along a new row dimension). + *

              + * The output `SparseTensor` object's shape values for all dimensions but the + * first are the max across the input `SparseTensor` objects' shape values + * for the corresponding dimensions. Its first shape value is `N`, the minibatch + * size. + *

              + * The input `SparseTensor` objects' indices are assumed ordered in + * standard lexicographic order. If this is not the case, after this + * step run `SparseReorder` to restore index ordering. + *

              + * For example, if the serialized input is a `[2 x 3]` matrix representing two + * original `SparseTensor` objects: + *

              + * index = [ 0] + * [10] + * [20] + * values = [1, 2, 3] + * shape = [50] + *

              + * and + *

              + * index = [ 2] + * [10] + * values = [4, 5] + * shape = [30] + *

              + * then the final deserialized `SparseTensor` will be: + *

              + * index = [0 0] + * [0 10] + * [0 20] + * [1 2] + * [1 10] + * values = [1, 2, 3, 4, 5] + * shape = [2 50] + * + * @param data type for {@code sparseValues()} output + */ +@Operator(group = "io") +public final class DeserializeManySparse extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeserializeManySparse operation. + * + * @param scope current scope + * @param serializedSparse 2-D, The `N` serialized `SparseTensor` objects. + * Must have 3 columns. + * @param dtype The `dtype` of the serialized `SparseTensor` objects. + * @return a new instance of DeserializeManySparse + */ + public static DeserializeManySparse create(Scope scope, Operand serializedSparse, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("DeserializeManySparse", scope.makeOpName("DeserializeManySparse")); + opBuilder.addInput(serializedSparse.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new DeserializeManySparse(opBuilder.build()); + } + + /** + */ + public Output sparseIndices() { + return sparseIndices; + } + + /** + */ + public Output sparseValues() { + return sparseValues; + } + + /** + */ + public Output sparseShape() { + return sparseShape; + } + + private Output sparseIndices; + private Output sparseValues; + private Output sparseShape; + + private DeserializeManySparse(Operation operation) { + super(operation); + int outputIdx = 0; + sparseIndices = operation.output(outputIdx++); + sparseValues = operation.output(outputIdx++); + sparseShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/EncodeBase64.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/EncodeBase64.java new file mode 100644 index 00000000000..535d8eaafe3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/EncodeBase64.java @@ -0,0 +1,108 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Encode strings into web-safe base64 format. + *

              + * Refer to the following article for more information on base64 format: + * en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the + * end so that the encoded has length multiple of 4. See Padding section of the + * link above. + *

              + * Web-safe means that the encoder uses - and _ instead of + and /. + */ +@Operator(group = "io") +public final class EncodeBase64 extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.EncodeBase64} + */ + public static class Options { + + /** + * @param pad Bool whether padding is applied at the ends. + */ + public Options pad(Boolean pad) { + this.pad = pad; + return this; + } + + private Boolean pad; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new EncodeBase64 operation. + * + * @param scope current scope + * @param input Strings to be encoded. + * @param options carries optional attributes values + * @return a new instance of EncodeBase64 + */ + public static EncodeBase64 create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("EncodeBase64", scope.makeOpName("EncodeBase64")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.pad != null) { + opBuilder.setAttr("pad", opts.pad); + } + } + } + return new EncodeBase64(opBuilder.build()); + } + + /** + * @param pad Bool whether padding is applied at the ends. + */ + public static Options pad(Boolean pad) { + return new Options().pad(pad); + } + + /** + * Input strings encoded in base64. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private EncodeBase64(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/FifoQueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/FifoQueue.java new file mode 100644 index 00000000000..1529c05eea2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/FifoQueue.java @@ -0,0 +1,182 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A queue that produces elements in first-in first-out order. + */ +@Operator(group = "io") +public final class FifoQueue extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.FifoQueue} + */ + public static class Options { + + /** + * @param shapes The shape of each component in a value. The length of this attr must + * be either 0 or the same as the length of component_types. If the length of + * this attr is 0, the shapes of queue elements are not constrained, and + * only one element may be dequeued at a time. + */ + public Options shapes(List shapes) { + this.shapes = shapes; + return this; + } + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private List shapes; + private Long capacity; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FifoQueue operation. + * + * @param scope current scope + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of FifoQueue + */ + public static FifoQueue create(Scope scope, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FIFOQueueV2", scope.makeOpName("FifoQueue")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.shapes != null) { + Shape[] shapesArray = new Shape[opts.shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = opts.shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + } + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new FifoQueue(opBuilder.build()); + } + + /** + * @param shapes The shape of each component in a value. The length of this attr must + * be either 0 or the same as the length of component_types. If the length of + * this attr is 0, the shapes of queue elements are not constrained, and + * only one element may be dequeued at a time. + */ + public static Options shapes(List shapes) { + return new Options().shapes(shapes); + } + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to the queue. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private FifoQueue(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/FixedLengthRecordReader.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/FixedLengthRecordReader.java new file mode 100644 index 00000000000..9463c62ad09 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/FixedLengthRecordReader.java @@ -0,0 +1,205 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A Reader that outputs fixed-length records from a file. + */ +@Operator(group = "io") +public final class FixedLengthRecordReader extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.FixedLengthRecordReader} + */ + public static class Options { + + /** + * @param headerBytes Number of bytes in the header, defaults to 0. + */ + public Options headerBytes(Long headerBytes) { + this.headerBytes = headerBytes; + return this; + } + + /** + * @param footerBytes Number of bytes in the footer, defaults to 0. + */ + public Options footerBytes(Long footerBytes) { + this.footerBytes = footerBytes; + return this; + } + + /** + * @param hopBytes Number of bytes to hop before each read. Default of 0 means using + * record_bytes. + */ + public Options hopBytes(Long hopBytes) { + this.hopBytes = hopBytes; + return this; + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param encoding The type of encoding for the file. Currently ZLIB and GZIP + * are supported. Defaults to none. + */ + public Options encoding(String encoding) { + this.encoding = encoding; + return this; + } + + private Long headerBytes; + private Long footerBytes; + private Long hopBytes; + private String container; + private String sharedName; + private String encoding; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FixedLengthRecordReader operation. + * + * @param scope current scope + * @param recordBytes Number of bytes in the record. + * @param options carries optional attributes values + * @return a new instance of FixedLengthRecordReader + */ + public static FixedLengthRecordReader create(Scope scope, Long recordBytes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FixedLengthRecordReaderV2", scope.makeOpName("FixedLengthRecordReader")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("record_bytes", recordBytes); + if (options != null) { + for (Options opts : options) { + if (opts.headerBytes != null) { + opBuilder.setAttr("header_bytes", opts.headerBytes); + } + if (opts.footerBytes != null) { + opBuilder.setAttr("footer_bytes", opts.footerBytes); + } + if (opts.hopBytes != null) { + opBuilder.setAttr("hop_bytes", opts.hopBytes); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.encoding != null) { + opBuilder.setAttr("encoding", opts.encoding); + } + } + } + return new FixedLengthRecordReader(opBuilder.build()); + } + + /** + * @param headerBytes Number of bytes in the header, defaults to 0. + */ + public static Options headerBytes(Long headerBytes) { + return new Options().headerBytes(headerBytes); + } + + /** + * @param footerBytes Number of bytes in the footer, defaults to 0. + */ + public static Options footerBytes(Long footerBytes) { + return new Options().footerBytes(footerBytes); + } + + /** + * @param hopBytes Number of bytes to hop before each read. Default of 0 means using + * record_bytes. + */ + public static Options hopBytes(Long hopBytes) { + return new Options().hopBytes(hopBytes); + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param encoding The type of encoding for the file. Currently ZLIB and GZIP + * are supported. Defaults to none. + */ + public static Options encoding(String encoding) { + return new Options().encoding(encoding); + } + + /** + * The handle to reference the Reader. + */ + public Output readerHandle() { + return readerHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) readerHandle; + } + + private Output readerHandle; + + private FixedLengthRecordReader(Operation operation) { + super(operation); + int outputIdx = 0; + readerHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/IdentityReader.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/IdentityReader.java new file mode 100644 index 00000000000..53d23fa6b92 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/IdentityReader.java @@ -0,0 +1,126 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A Reader that outputs the queued work as both the key and value. + *

              + * To use, enqueue strings in a Queue. ReaderRead will take the front + * work string and output (work, work). + */ +@Operator(group = "io") +public final class IdentityReader extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.IdentityReader} + */ + public static class Options { + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new IdentityReader operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of IdentityReader + */ + public static IdentityReader create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("IdentityReaderV2", scope.makeOpName("IdentityReader")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new IdentityReader(opBuilder.build()); + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to reference the Reader. + */ + public Output readerHandle() { + return readerHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) readerHandle; + } + + private Output readerHandle; + + private IdentityReader(Operation operation) { + super(operation); + int outputIdx = 0; + readerHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/LmdbReader.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/LmdbReader.java new file mode 100644 index 00000000000..ff75fd28ccf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/LmdbReader.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A Reader that outputs the records from a LMDB file. + */ +@Operator(group = "io") +public final class LmdbReader extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.LmdbReader} + */ + public static class Options { + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LmdbReader operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of LmdbReader + */ + public static LmdbReader create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LMDBReader", scope.makeOpName("LmdbReader")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new LmdbReader(opBuilder.build()); + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to reference the Reader. + */ + public Output readerHandle() { + return readerHandle; + } + + @Override + public Output asOutput() { + return readerHandle; + } + + private Output readerHandle; + + private LmdbReader(Operation operation) { + super(operation); + int outputIdx = 0; + readerHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/MatchingFiles.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/MatchingFiles.java new file mode 100644 index 00000000000..5bf2e9b28e2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/MatchingFiles.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the set of files matching one or more glob patterns. + *

              + * Note that this routine only supports wildcard characters in the + * basename portion of the pattern, not in the directory portion. + * Note also that the order of filenames returned is deterministic. + */ +@Operator(group = "io") +public final class MatchingFiles extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MatchingFiles operation. + * + * @param scope current scope + * @param pattern Shell wildcard pattern(s). Scalar or vector of type string. + * @return a new instance of MatchingFiles + */ + public static MatchingFiles create(Scope scope, Operand pattern) { + OperationBuilder opBuilder = scope.env().opBuilder("MatchingFiles", scope.makeOpName("MatchingFiles")); + opBuilder.addInput(pattern.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MatchingFiles(opBuilder.build()); + } + + /** + * A vector of matching filenames. + */ + public Output filenames() { + return filenames; + } + + @Override + public Output asOutput() { + return filenames; + } + + private Output filenames; + + private MatchingFiles(Operation operation) { + super(operation); + int outputIdx = 0; + filenames = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/PaddingFifoQueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/PaddingFifoQueue.java new file mode 100644 index 00000000000..6b46baece02 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/PaddingFifoQueue.java @@ -0,0 +1,194 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A queue that produces elements in first-in first-out order. + *

              + * Variable-size shapes are allowed by setting the corresponding shape dimensions + * to 0 in the shape attr. In this case DequeueMany will pad up to the maximum + * size of any given element in the minibatch. See below for details. + */ +@Operator(group = "io") +public final class PaddingFifoQueue extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.PaddingFifoQueue} + */ + public static class Options { + + /** + * @param shapes The shape of each component in a value. The length of this attr must + * be either 0 or the same as the length of component_types. + * Shapes of fixed rank but variable size are allowed by setting + * any shape dimension to -1. In this case, the inputs' shape may vary along + * the given dimension, and DequeueMany will pad the given dimension with + * zeros up to the maximum shape of all elements in the given batch. + * If the length of this attr is 0, different queue elements may have + * different ranks and shapes, but only one element may be dequeued at a time. + */ + public Options shapes(List shapes) { + this.shapes = shapes; + return this; + } + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private List shapes; + private Long capacity; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new PaddingFifoQueue operation. + * + * @param scope current scope + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of PaddingFifoQueue + */ + public static PaddingFifoQueue create(Scope scope, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("PaddingFIFOQueueV2", scope.makeOpName("PaddingFifoQueue")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.shapes != null) { + Shape[] shapesArray = new Shape[opts.shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = opts.shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + } + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new PaddingFifoQueue(opBuilder.build()); + } + + /** + * @param shapes The shape of each component in a value. The length of this attr must + * be either 0 or the same as the length of component_types. + * Shapes of fixed rank but variable size are allowed by setting + * any shape dimension to -1. In this case, the inputs' shape may vary along + * the given dimension, and DequeueMany will pad the given dimension with + * zeros up to the maximum shape of all elements in the given batch. + * If the length of this attr is 0, different queue elements may have + * different ranks and shapes, but only one element may be dequeued at a time. + */ + public static Options shapes(List shapes) { + return new Options().shapes(shapes); + } + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to the queue. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private PaddingFifoQueue(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseExample.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseExample.java new file mode 100644 index 00000000000..9b6a1cf38cc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseExample.java @@ -0,0 +1,151 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transforms a vector of brain.Example protos (as strings) into typed tensors. + */ +@Operator(group = "io") +public final class ParseExample extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ParseExample operation. + * + * @param scope current scope + * @param serialized A vector containing a batch of binary serialized Example protos. + * @param names A vector containing the names of the serialized protos. + * May contain, for example, table key (descriptive) names for the + * corresponding serialized protos. These are purely useful for debugging + * purposes, and the presence of values here has no effect on the output. + * May also be an empty vector if no names are available. + * If non-empty, this vector must be the same length as "serialized". + * @param sparseKeys A list of Nsparse string Tensors (scalars). + * The keys expected in the Examples' features associated with sparse values. + * @param denseKeys A list of Ndense string Tensors (scalars). + * The keys expected in the Examples' features associated with dense values. + * @param denseDefaults A list of Ndense Tensors (some may be empty). + * dense_defaults[j] provides default values + * when the example's feature_map lacks dense_key[j]. If an empty Tensor is + * provided for dense_defaults[j], then the Feature dense_keys[j] is required. + * The input type is inferred from dense_defaults[j], even when it's empty. + * If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, + * then the shape of dense_defaults[j] must match that of dense_shapes[j]. + * If dense_shapes[j] has an undefined major dimension (variable strides dense + * feature), dense_defaults[j] must contain a single element: + * the padding element. + * @param sparseTypes A list of Nsparse types; the data types of data in each Feature + * given in sparse_keys. + * Currently the ParseExample supports DT_FLOAT (FloatList), + * DT_INT64 (Int64List), and DT_STRING (BytesList). + * @param denseShapes A list of Ndense shapes; the shapes of data in each Feature + * given in dense_keys. + * The number of elements in the Feature corresponding to dense_key[j] + * must always equal dense_shapes[j].NumEntries(). + * If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output + * Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): + * The dense outputs are just the inputs row-stacked by batch. + * This works for dense_shapes[j] = (-1, D1, ..., DN). In this case + * the shape of the output Tensor dense_values[j] will be + * (|serialized|, M, D1, .., DN), where M is the maximum number of blocks + * of elements of length D1 * .... * DN, across all minibatch entries + * in the input. Any minibatch entry with less than M blocks of elements of + * length D1 * ... * DN will be padded with the corresponding default_value + * scalar element along the second dimension. + * @return a new instance of ParseExample + */ + public static ParseExample create(Scope scope, Operand serialized, Operand names, Iterable> sparseKeys, Iterable> denseKeys, Iterable> denseDefaults, List> sparseTypes, List denseShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ParseExample", scope.makeOpName("ParseExample")); + opBuilder.addInput(serialized.asOutput()); + opBuilder.addInput(names.asOutput()); + opBuilder.addInputList(Operands.asOutputs(sparseKeys)); + opBuilder.addInputList(Operands.asOutputs(denseKeys)); + opBuilder.addInputList(Operands.asOutputs(denseDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] sparseTypesArray = new DataType[sparseTypes.size()]; + for (int i = 0; i < sparseTypesArray.length; ++i) { + sparseTypesArray[i] = DataType.fromClass(sparseTypes.get(i)); + } + opBuilder.setAttr("sparse_types", sparseTypesArray); + Shape[] denseShapesArray = new Shape[denseShapes.size()]; + for (int i = 0; i < denseShapesArray.length; ++i) { + denseShapesArray[i] = denseShapes.get(i); + } + opBuilder.setAttr("dense_shapes", denseShapesArray); + return new ParseExample(opBuilder.build()); + } + + /** + */ + public List> sparseIndices() { + return sparseIndices; + } + + /** + */ + public List> sparseValues() { + return sparseValues; + } + + /** + */ + public List> sparseShapes() { + return sparseShapes; + } + + /** + */ + public List> denseValues() { + return denseValues; + } + + private List> sparseIndices; + private List> sparseValues; + private List> sparseShapes; + private List> denseValues; + + @SuppressWarnings("unchecked") + private ParseExample(Operation operation) { + super(operation); + int outputIdx = 0; + int sparseIndicesLength = operation.outputListLength("sparse_indices"); + sparseIndices = Arrays.asList((Output[])operation.outputList(outputIdx, sparseIndicesLength)); + outputIdx += sparseIndicesLength; + int sparseValuesLength = operation.outputListLength("sparse_values"); + sparseValues = Arrays.asList(operation.outputList(outputIdx, sparseValuesLength)); + outputIdx += sparseValuesLength; + int sparseShapesLength = operation.outputListLength("sparse_shapes"); + sparseShapes = Arrays.asList((Output[])operation.outputList(outputIdx, sparseShapesLength)); + outputIdx += sparseShapesLength; + int denseValuesLength = operation.outputListLength("dense_values"); + denseValues = Arrays.asList(operation.outputList(outputIdx, denseValuesLength)); + outputIdx += denseValuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSequenceExample.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSequenceExample.java new file mode 100644 index 00000000000..51a94226e10 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSequenceExample.java @@ -0,0 +1,382 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transforms a vector of brain.SequenceExample protos (as strings) into typed tensors. + */ +@Operator(group = "io") +public final class ParseSequenceExample extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.io.ParseSequenceExample} + */ + public static class Options { + + /** + * @param NcontextSparse + */ + public Options NcontextSparse(Long NcontextSparse) { + this.NcontextSparse = NcontextSparse; + return this; + } + + /** + * @param NcontextDense + */ + public Options NcontextDense(Long NcontextDense) { + this.NcontextDense = NcontextDense; + return this; + } + + /** + * @param NfeatureListSparse + */ + public Options NfeatureListSparse(Long NfeatureListSparse) { + this.NfeatureListSparse = NfeatureListSparse; + return this; + } + + /** + * @param NfeatureListDense + */ + public Options NfeatureListDense(Long NfeatureListDense) { + this.NfeatureListDense = NfeatureListDense; + return this; + } + + /** + * @param contextDenseShapes A list of Ncontext_dense shapes; the shapes of data in + * each context Feature given in context_dense_keys. + * The number of elements in the Feature corresponding to context_dense_key[j] + * must always equal context_dense_shapes[j].NumEntries(). + * The shape of context_dense_values[j] will match context_dense_shapes[j]. + */ + public Options contextDenseShapes(List contextDenseShapes) { + this.contextDenseShapes = contextDenseShapes; + return this; + } + + /** + * @param featureListDenseShapes A list of Nfeature_list_dense shapes; the shapes of + * data in each FeatureList given in feature_list_dense_keys. + * The shape of each Feature in the FeatureList corresponding to + * feature_list_dense_key[j] must always equal + * feature_list_dense_shapes[j].NumEntries(). + */ + public Options featureListDenseShapes(List featureListDenseShapes) { + this.featureListDenseShapes = featureListDenseShapes; + return this; + } + + private Long NcontextSparse; + private Long NcontextDense; + private Long NfeatureListSparse; + private Long NfeatureListDense; + private List contextDenseShapes; + private List featureListDenseShapes; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ParseSequenceExample operation. + * + * @param scope current scope + * @param serialized A vector containing binary serialized SequenceExample protos. + * @param debugName A vector containing the names of the serialized protos. + * May contain, for example, table key (descriptive) name for the + * corresponding serialized proto. This is purely useful for debugging + * purposes, and the presence of values here has no effect on the output. + * May also be an empty vector if no name is available. + * @param contextDenseDefaults A list of Ncontext_dense Tensors (some may be empty). + * context_dense_defaults[j] provides default values + * when the SequenceExample's context map lacks context_dense_key[j]. + * If an empty Tensor is provided for context_dense_defaults[j], + * then the Feature context_dense_keys[j] is required. + * The input type is inferred from context_dense_defaults[j], even when it's + * empty. If context_dense_defaults[j] is not empty, its shape must match + * context_dense_shapes[j]. + * @param featureListDenseMissingAssumedEmpty A vector listing the + * FeatureList keys which may be missing from the SequenceExamples. If the + * associated FeatureList is missing, it is treated as empty. By default, + * any FeatureList not listed in this vector must exist in the SequenceExamples. + * @param contextSparseKeys A list of Ncontext_sparse string Tensors (scalars). + * The keys expected in the Examples' features associated with context_sparse + * values. + * @param contextDenseKeys A list of Ncontext_dense string Tensors (scalars). + * The keys expected in the SequenceExamples' context features associated with + * dense values. + * @param featureListSparseKeys A list of Nfeature_list_sparse string Tensors + * (scalars). The keys expected in the FeatureLists associated with sparse + * values. + * @param featureListDenseKeys A list of Nfeature_list_dense string Tensors (scalars). + * The keys expected in the SequenceExamples' feature_lists associated + * with lists of dense values. + * @param contextSparseTypes A list of Ncontext_sparse types; the data types of data in + * each context Feature given in context_sparse_keys. + * Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + * DT_INT64 (Int64List), and DT_STRING (BytesList). + * @param featureListDenseTypes + * @param featureListSparseTypes A list of Nfeature_list_sparse types; the data types + * of data in each FeatureList given in feature_list_sparse_keys. + * Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + * DT_INT64 (Int64List), and DT_STRING (BytesList). + * @param options carries optional attributes values + * @return a new instance of ParseSequenceExample + */ + public static ParseSequenceExample create(Scope scope, Operand serialized, Operand debugName, Iterable> contextDenseDefaults, List featureListDenseMissingAssumedEmpty, List contextSparseKeys, List contextDenseKeys, List featureListSparseKeys, List featureListDenseKeys, List> contextSparseTypes, List> featureListDenseTypes, List> featureListSparseTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ParseSequenceExample", scope.makeOpName("ParseSequenceExample")); + opBuilder.addInput(serialized.asOutput()); + opBuilder.addInput(debugName.asOutput()); + opBuilder.addInputList(Operands.asOutputs(contextDenseDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + String[] featureListDenseMissingAssumedEmptyArray = new String[featureListDenseMissingAssumedEmpty.size()]; + for (int i = 0; i < featureListDenseMissingAssumedEmptyArray.length; ++i) { + featureListDenseMissingAssumedEmptyArray[i] = featureListDenseMissingAssumedEmpty.get(i); + } + opBuilder.setAttr("feature_list_dense_missing_assumed_empty", featureListDenseMissingAssumedEmptyArray); + String[] contextSparseKeysArray = new String[contextSparseKeys.size()]; + for (int i = 0; i < contextSparseKeysArray.length; ++i) { + contextSparseKeysArray[i] = contextSparseKeys.get(i); + } + opBuilder.setAttr("context_sparse_keys", contextSparseKeysArray); + String[] contextDenseKeysArray = new String[contextDenseKeys.size()]; + for (int i = 0; i < contextDenseKeysArray.length; ++i) { + contextDenseKeysArray[i] = contextDenseKeys.get(i); + } + opBuilder.setAttr("context_dense_keys", contextDenseKeysArray); + String[] featureListSparseKeysArray = new String[featureListSparseKeys.size()]; + for (int i = 0; i < featureListSparseKeysArray.length; ++i) { + featureListSparseKeysArray[i] = featureListSparseKeys.get(i); + } + opBuilder.setAttr("feature_list_sparse_keys", featureListSparseKeysArray); + String[] featureListDenseKeysArray = new String[featureListDenseKeys.size()]; + for (int i = 0; i < featureListDenseKeysArray.length; ++i) { + featureListDenseKeysArray[i] = featureListDenseKeys.get(i); + } + opBuilder.setAttr("feature_list_dense_keys", featureListDenseKeysArray); + DataType[] contextSparseTypesArray = new DataType[contextSparseTypes.size()]; + for (int i = 0; i < contextSparseTypesArray.length; ++i) { + contextSparseTypesArray[i] = DataType.fromClass(contextSparseTypes.get(i)); + } + opBuilder.setAttr("context_sparse_types", contextSparseTypesArray); + DataType[] featureListDenseTypesArray = new DataType[featureListDenseTypes.size()]; + for (int i = 0; i < featureListDenseTypesArray.length; ++i) { + featureListDenseTypesArray[i] = DataType.fromClass(featureListDenseTypes.get(i)); + } + opBuilder.setAttr("feature_list_dense_types", featureListDenseTypesArray); + DataType[] featureListSparseTypesArray = new DataType[featureListSparseTypes.size()]; + for (int i = 0; i < featureListSparseTypesArray.length; ++i) { + featureListSparseTypesArray[i] = DataType.fromClass(featureListSparseTypes.get(i)); + } + opBuilder.setAttr("feature_list_sparse_types", featureListSparseTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.NcontextSparse != null) { + opBuilder.setAttr("Ncontext_sparse", opts.NcontextSparse); + } + if (opts.NcontextDense != null) { + opBuilder.setAttr("Ncontext_dense", opts.NcontextDense); + } + if (opts.NfeatureListSparse != null) { + opBuilder.setAttr("Nfeature_list_sparse", opts.NfeatureListSparse); + } + if (opts.NfeatureListDense != null) { + opBuilder.setAttr("Nfeature_list_dense", opts.NfeatureListDense); + } + if (opts.contextDenseShapes != null) { + Shape[] contextDenseShapesArray = new Shape[opts.contextDenseShapes.size()]; + for (int i = 0; i < contextDenseShapesArray.length; ++i) { + contextDenseShapesArray[i] = opts.contextDenseShapes.get(i); + } + opBuilder.setAttr("context_dense_shapes", contextDenseShapesArray); + } + if (opts.featureListDenseShapes != null) { + Shape[] featureListDenseShapesArray = new Shape[opts.featureListDenseShapes.size()]; + for (int i = 0; i < featureListDenseShapesArray.length; ++i) { + featureListDenseShapesArray[i] = opts.featureListDenseShapes.get(i); + } + opBuilder.setAttr("feature_list_dense_shapes", featureListDenseShapesArray); + } + } + } + return new ParseSequenceExample(opBuilder.build()); + } + + /** + * @param NcontextSparse + */ + public static Options NcontextSparse(Long NcontextSparse) { + return new Options().NcontextSparse(NcontextSparse); + } + + /** + * @param NcontextDense + */ + public static Options NcontextDense(Long NcontextDense) { + return new Options().NcontextDense(NcontextDense); + } + + /** + * @param NfeatureListSparse + */ + public static Options NfeatureListSparse(Long NfeatureListSparse) { + return new Options().NfeatureListSparse(NfeatureListSparse); + } + + /** + * @param NfeatureListDense + */ + public static Options NfeatureListDense(Long NfeatureListDense) { + return new Options().NfeatureListDense(NfeatureListDense); + } + + /** + * @param contextDenseShapes A list of Ncontext_dense shapes; the shapes of data in + * each context Feature given in context_dense_keys. + * The number of elements in the Feature corresponding to context_dense_key[j] + * must always equal context_dense_shapes[j].NumEntries(). + * The shape of context_dense_values[j] will match context_dense_shapes[j]. + */ + public static Options contextDenseShapes(List contextDenseShapes) { + return new Options().contextDenseShapes(contextDenseShapes); + } + + /** + * @param featureListDenseShapes A list of Nfeature_list_dense shapes; the shapes of + * data in each FeatureList given in feature_list_dense_keys. + * The shape of each Feature in the FeatureList corresponding to + * feature_list_dense_key[j] must always equal + * feature_list_dense_shapes[j].NumEntries(). + */ + public static Options featureListDenseShapes(List featureListDenseShapes) { + return new Options().featureListDenseShapes(featureListDenseShapes); + } + + /** + */ + public List> contextSparseIndices() { + return contextSparseIndices; + } + + /** + */ + public List> contextSparseValues() { + return contextSparseValues; + } + + /** + */ + public List> contextSparseShapes() { + return contextSparseShapes; + } + + /** + */ + public List> contextDenseValues() { + return contextDenseValues; + } + + /** + */ + public List> featureListSparseIndices() { + return featureListSparseIndices; + } + + /** + */ + public List> featureListSparseValues() { + return featureListSparseValues; + } + + /** + */ + public List> featureListSparseShapes() { + return featureListSparseShapes; + } + + /** + */ + public List> featureListDenseValues() { + return featureListDenseValues; + } + + /** + */ + public List> featureListDenseLengths() { + return featureListDenseLengths; + } + + private List> contextSparseIndices; + private List> contextSparseValues; + private List> contextSparseShapes; + private List> contextDenseValues; + private List> featureListSparseIndices; + private List> featureListSparseValues; + private List> featureListSparseShapes; + private List> featureListDenseValues; + private List> featureListDenseLengths; + + @SuppressWarnings("unchecked") + private ParseSequenceExample(Operation operation) { + super(operation); + int outputIdx = 0; + int contextSparseIndicesLength = operation.outputListLength("context_sparse_indices"); + contextSparseIndices = Arrays.asList((Output[])operation.outputList(outputIdx, contextSparseIndicesLength)); + outputIdx += contextSparseIndicesLength; + int contextSparseValuesLength = operation.outputListLength("context_sparse_values"); + contextSparseValues = Arrays.asList(operation.outputList(outputIdx, contextSparseValuesLength)); + outputIdx += contextSparseValuesLength; + int contextSparseShapesLength = operation.outputListLength("context_sparse_shapes"); + contextSparseShapes = Arrays.asList((Output[])operation.outputList(outputIdx, contextSparseShapesLength)); + outputIdx += contextSparseShapesLength; + int contextDenseValuesLength = operation.outputListLength("context_dense_values"); + contextDenseValues = Arrays.asList(operation.outputList(outputIdx, contextDenseValuesLength)); + outputIdx += contextDenseValuesLength; + int featureListSparseIndicesLength = operation.outputListLength("feature_list_sparse_indices"); + featureListSparseIndices = Arrays.asList((Output[])operation.outputList(outputIdx, featureListSparseIndicesLength)); + outputIdx += featureListSparseIndicesLength; + int featureListSparseValuesLength = operation.outputListLength("feature_list_sparse_values"); + featureListSparseValues = Arrays.asList(operation.outputList(outputIdx, featureListSparseValuesLength)); + outputIdx += featureListSparseValuesLength; + int featureListSparseShapesLength = operation.outputListLength("feature_list_sparse_shapes"); + featureListSparseShapes = Arrays.asList((Output[])operation.outputList(outputIdx, featureListSparseShapesLength)); + outputIdx += featureListSparseShapesLength; + int featureListDenseValuesLength = operation.outputListLength("feature_list_dense_values"); + featureListDenseValues = Arrays.asList(operation.outputList(outputIdx, featureListDenseValuesLength)); + outputIdx += featureListDenseValuesLength; + int featureListDenseLengthsLength = operation.outputListLength("feature_list_dense_lengths"); + featureListDenseLengths = Arrays.asList((Output[])operation.outputList(outputIdx, featureListDenseLengthsLength)); + outputIdx += featureListDenseLengthsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSingleExample.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSingleExample.java new file mode 100644 index 00000000000..d1339f77d69 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSingleExample.java @@ -0,0 +1,150 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transforms a tf.Example proto (as a string) into typed tensors. + */ +@Operator(group = "io") +public final class ParseSingleExample extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ParseSingleExample operation. + * + * @param scope current scope + * @param serialized A vector containing a batch of binary serialized Example protos. + * @param denseDefaults A list of Tensors (some may be empty), whose length matches + * the length of `dense_keys`. dense_defaults[j] provides default values + * when the example's feature_map lacks dense_key[j]. If an empty Tensor is + * provided for dense_defaults[j], then the Feature dense_keys[j] is required. + * The input type is inferred from dense_defaults[j], even when it's empty. + * If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, + * then the shape of dense_defaults[j] must match that of dense_shapes[j]. + * If dense_shapes[j] has an undefined major dimension (variable strides dense + * feature), dense_defaults[j] must contain a single element: + * the padding element. + * @param numSparse The number of sparse features to be parsed from the example. This + * must match the lengths of `sparse_keys` and `sparse_types`. + * @param sparseKeys A list of `num_sparse` strings. + * The keys expected in the Examples' features associated with sparse values. + * @param denseKeys The keys expected in the Examples' features associated with dense + * values. + * @param sparseTypes A list of `num_sparse` types; the data types of data in each + * Feature given in sparse_keys. + * Currently the ParseSingleExample op supports DT_FLOAT (FloatList), + * DT_INT64 (Int64List), and DT_STRING (BytesList). + * @param denseShapes The shapes of data in each Feature given in dense_keys. + * The length of this list must match the length of `dense_keys`. The + * number of elements in the Feature corresponding to dense_key[j] must + * always equal dense_shapes[j].NumEntries(). If dense_shapes[j] == + * (D0, D1, ..., DN) then the shape of output Tensor dense_values[j] + * will be (D0, D1, ..., DN): In the case dense_shapes[j] = (-1, D1, + * ..., DN), the shape of the output Tensor dense_values[j] will be (M, + * D1, .., DN), where M is the number of blocks of elements of length + * D1 * .... * DN, in the input. + * @return a new instance of ParseSingleExample + */ + public static ParseSingleExample create(Scope scope, Operand serialized, Iterable> denseDefaults, Long numSparse, List sparseKeys, List denseKeys, List> sparseTypes, List denseShapes) { + OperationBuilder opBuilder = scope.env().opBuilder("ParseSingleExample", scope.makeOpName("ParseSingleExample")); + opBuilder.addInput(serialized.asOutput()); + opBuilder.addInputList(Operands.asOutputs(denseDefaults)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_sparse", numSparse); + String[] sparseKeysArray = new String[sparseKeys.size()]; + for (int i = 0; i < sparseKeysArray.length; ++i) { + sparseKeysArray[i] = sparseKeys.get(i); + } + opBuilder.setAttr("sparse_keys", sparseKeysArray); + String[] denseKeysArray = new String[denseKeys.size()]; + for (int i = 0; i < denseKeysArray.length; ++i) { + denseKeysArray[i] = denseKeys.get(i); + } + opBuilder.setAttr("dense_keys", denseKeysArray); + DataType[] sparseTypesArray = new DataType[sparseTypes.size()]; + for (int i = 0; i < sparseTypesArray.length; ++i) { + sparseTypesArray[i] = DataType.fromClass(sparseTypes.get(i)); + } + opBuilder.setAttr("sparse_types", sparseTypesArray); + Shape[] denseShapesArray = new Shape[denseShapes.size()]; + for (int i = 0; i < denseShapesArray.length; ++i) { + denseShapesArray[i] = denseShapes.get(i); + } + opBuilder.setAttr("dense_shapes", denseShapesArray); + return new ParseSingleExample(opBuilder.build()); + } + + /** + */ + public List> sparseIndices() { + return sparseIndices; + } + + /** + */ + public List> sparseValues() { + return sparseValues; + } + + /** + */ + public List> sparseShapes() { + return sparseShapes; + } + + /** + */ + public List> denseValues() { + return denseValues; + } + + private List> sparseIndices; + private List> sparseValues; + private List> sparseShapes; + private List> denseValues; + + @SuppressWarnings("unchecked") + private ParseSingleExample(Operation operation) { + super(operation); + int outputIdx = 0; + int sparseIndicesLength = operation.outputListLength("sparse_indices"); + sparseIndices = Arrays.asList((Output[])operation.outputList(outputIdx, sparseIndicesLength)); + outputIdx += sparseIndicesLength; + int sparseValuesLength = operation.outputListLength("sparse_values"); + sparseValues = Arrays.asList(operation.outputList(outputIdx, sparseValuesLength)); + outputIdx += sparseValuesLength; + int sparseShapesLength = operation.outputListLength("sparse_shapes"); + sparseShapes = Arrays.asList((Output[])operation.outputList(outputIdx, sparseShapesLength)); + outputIdx += sparseShapesLength; + int denseValuesLength = operation.outputListLength("dense_values"); + denseValues = Arrays.asList(operation.outputList(outputIdx, denseValuesLength)); + outputIdx += denseValuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSingleSequenceExample.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSingleSequenceExample.java new file mode 100644 index 00000000000..0abc798f9cc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseSingleSequenceExample.java @@ -0,0 +1,276 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transforms a scalar brain.SequenceExample proto (as strings) into typed tensors. + */ +@Operator(group = "io") +public final class ParseSingleSequenceExample extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.io.ParseSingleSequenceExample} + */ + public static class Options { + + /** + * @param contextDenseShapes A list of Ncontext_dense shapes; the shapes of data in + * each context Feature given in context_dense_keys. + * The number of elements in the Feature corresponding to context_dense_key[j] + * must always equal context_dense_shapes[j].NumEntries(). + * The shape of context_dense_values[j] will match context_dense_shapes[j]. + */ + public Options contextDenseShapes(List contextDenseShapes) { + this.contextDenseShapes = contextDenseShapes; + return this; + } + + /** + * @param featureListDenseShapes A list of Nfeature_list_dense shapes; the shapes of + * data in each FeatureList given in feature_list_dense_keys. + * The shape of each Feature in the FeatureList corresponding to + * feature_list_dense_key[j] must always equal + * feature_list_dense_shapes[j].NumEntries(). + */ + public Options featureListDenseShapes(List featureListDenseShapes) { + this.featureListDenseShapes = featureListDenseShapes; + return this; + } + + private List contextDenseShapes; + private List featureListDenseShapes; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ParseSingleSequenceExample operation. + * + * @param scope current scope + * @param serialized A scalar containing a binary serialized SequenceExample proto. + * @param featureListDenseMissingAssumedEmpty A vector listing the + * FeatureList keys which may be missing from the SequenceExample. If the + * associated FeatureList is missing, it is treated as empty. By default, + * any FeatureList not listed in this vector must exist in the SequenceExample. + * @param contextSparseKeys A list of Ncontext_sparse string Tensors (scalars). + * The keys expected in the Examples' features associated with context_sparse + * values. + * @param contextDenseKeys A list of Ncontext_dense string Tensors (scalars). + * The keys expected in the SequenceExamples' context features associated with + * dense values. + * @param featureListSparseKeys A list of Nfeature_list_sparse string Tensors + * (scalars). The keys expected in the FeatureLists associated with sparse + * values. + * @param featureListDenseKeys A list of Nfeature_list_dense string Tensors (scalars). + * The keys expected in the SequenceExamples' feature_lists associated + * with lists of dense values. + * @param contextDenseDefaults A list of Ncontext_dense Tensors (some may be empty). + * context_dense_defaults[j] provides default values + * when the SequenceExample's context map lacks context_dense_key[j]. + * If an empty Tensor is provided for context_dense_defaults[j], + * then the Feature context_dense_keys[j] is required. + * The input type is inferred from context_dense_defaults[j], even when it's + * empty. If context_dense_defaults[j] is not empty, its shape must match + * context_dense_shapes[j]. + * @param debugName A scalar containing the name of the serialized proto. + * May contain, for example, table key (descriptive) name for the + * corresponding serialized proto. This is purely useful for debugging + * purposes, and the presence of values here has no effect on the output. + * May also be an empty scalar if no name is available. + * @param contextSparseTypes A list of Ncontext_sparse types; the data types of data in + * each context Feature given in context_sparse_keys. + * Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + * DT_INT64 (Int64List), and DT_STRING (BytesList). + * @param featureListDenseTypes + * @param featureListSparseTypes A list of Nfeature_list_sparse types; the data types + * of data in each FeatureList given in feature_list_sparse_keys. + * Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + * DT_INT64 (Int64List), and DT_STRING (BytesList). + * @param options carries optional attributes values + * @return a new instance of ParseSingleSequenceExample + */ + public static ParseSingleSequenceExample create(Scope scope, Operand serialized, Operand featureListDenseMissingAssumedEmpty, Iterable> contextSparseKeys, Iterable> contextDenseKeys, Iterable> featureListSparseKeys, Iterable> featureListDenseKeys, Iterable> contextDenseDefaults, Operand debugName, List> contextSparseTypes, List> featureListDenseTypes, List> featureListSparseTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ParseSingleSequenceExample", scope.makeOpName("ParseSingleSequenceExample")); + opBuilder.addInput(serialized.asOutput()); + opBuilder.addInput(featureListDenseMissingAssumedEmpty.asOutput()); + opBuilder.addInputList(Operands.asOutputs(contextSparseKeys)); + opBuilder.addInputList(Operands.asOutputs(contextDenseKeys)); + opBuilder.addInputList(Operands.asOutputs(featureListSparseKeys)); + opBuilder.addInputList(Operands.asOutputs(featureListDenseKeys)); + opBuilder.addInputList(Operands.asOutputs(contextDenseDefaults)); + opBuilder.addInput(debugName.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] contextSparseTypesArray = new DataType[contextSparseTypes.size()]; + for (int i = 0; i < contextSparseTypesArray.length; ++i) { + contextSparseTypesArray[i] = DataType.fromClass(contextSparseTypes.get(i)); + } + opBuilder.setAttr("context_sparse_types", contextSparseTypesArray); + DataType[] featureListDenseTypesArray = new DataType[featureListDenseTypes.size()]; + for (int i = 0; i < featureListDenseTypesArray.length; ++i) { + featureListDenseTypesArray[i] = DataType.fromClass(featureListDenseTypes.get(i)); + } + opBuilder.setAttr("feature_list_dense_types", featureListDenseTypesArray); + DataType[] featureListSparseTypesArray = new DataType[featureListSparseTypes.size()]; + for (int i = 0; i < featureListSparseTypesArray.length; ++i) { + featureListSparseTypesArray[i] = DataType.fromClass(featureListSparseTypes.get(i)); + } + opBuilder.setAttr("feature_list_sparse_types", featureListSparseTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.contextDenseShapes != null) { + Shape[] contextDenseShapesArray = new Shape[opts.contextDenseShapes.size()]; + for (int i = 0; i < contextDenseShapesArray.length; ++i) { + contextDenseShapesArray[i] = opts.contextDenseShapes.get(i); + } + opBuilder.setAttr("context_dense_shapes", contextDenseShapesArray); + } + if (opts.featureListDenseShapes != null) { + Shape[] featureListDenseShapesArray = new Shape[opts.featureListDenseShapes.size()]; + for (int i = 0; i < featureListDenseShapesArray.length; ++i) { + featureListDenseShapesArray[i] = opts.featureListDenseShapes.get(i); + } + opBuilder.setAttr("feature_list_dense_shapes", featureListDenseShapesArray); + } + } + } + return new ParseSingleSequenceExample(opBuilder.build()); + } + + /** + * @param contextDenseShapes A list of Ncontext_dense shapes; the shapes of data in + * each context Feature given in context_dense_keys. + * The number of elements in the Feature corresponding to context_dense_key[j] + * must always equal context_dense_shapes[j].NumEntries(). + * The shape of context_dense_values[j] will match context_dense_shapes[j]. + */ + public static Options contextDenseShapes(List contextDenseShapes) { + return new Options().contextDenseShapes(contextDenseShapes); + } + + /** + * @param featureListDenseShapes A list of Nfeature_list_dense shapes; the shapes of + * data in each FeatureList given in feature_list_dense_keys. + * The shape of each Feature in the FeatureList corresponding to + * feature_list_dense_key[j] must always equal + * feature_list_dense_shapes[j].NumEntries(). + */ + public static Options featureListDenseShapes(List featureListDenseShapes) { + return new Options().featureListDenseShapes(featureListDenseShapes); + } + + /** + */ + public List> contextSparseIndices() { + return contextSparseIndices; + } + + /** + */ + public List> contextSparseValues() { + return contextSparseValues; + } + + /** + */ + public List> contextSparseShapes() { + return contextSparseShapes; + } + + /** + */ + public List> contextDenseValues() { + return contextDenseValues; + } + + /** + */ + public List> featureListSparseIndices() { + return featureListSparseIndices; + } + + /** + */ + public List> featureListSparseValues() { + return featureListSparseValues; + } + + /** + */ + public List> featureListSparseShapes() { + return featureListSparseShapes; + } + + /** + */ + public List> featureListDenseValues() { + return featureListDenseValues; + } + + private List> contextSparseIndices; + private List> contextSparseValues; + private List> contextSparseShapes; + private List> contextDenseValues; + private List> featureListSparseIndices; + private List> featureListSparseValues; + private List> featureListSparseShapes; + private List> featureListDenseValues; + + @SuppressWarnings("unchecked") + private ParseSingleSequenceExample(Operation operation) { + super(operation); + int outputIdx = 0; + int contextSparseIndicesLength = operation.outputListLength("context_sparse_indices"); + contextSparseIndices = Arrays.asList((Output[])operation.outputList(outputIdx, contextSparseIndicesLength)); + outputIdx += contextSparseIndicesLength; + int contextSparseValuesLength = operation.outputListLength("context_sparse_values"); + contextSparseValues = Arrays.asList(operation.outputList(outputIdx, contextSparseValuesLength)); + outputIdx += contextSparseValuesLength; + int contextSparseShapesLength = operation.outputListLength("context_sparse_shapes"); + contextSparseShapes = Arrays.asList((Output[])operation.outputList(outputIdx, contextSparseShapesLength)); + outputIdx += contextSparseShapesLength; + int contextDenseValuesLength = operation.outputListLength("context_dense_values"); + contextDenseValues = Arrays.asList(operation.outputList(outputIdx, contextDenseValuesLength)); + outputIdx += contextDenseValuesLength; + int featureListSparseIndicesLength = operation.outputListLength("feature_list_sparse_indices"); + featureListSparseIndices = Arrays.asList((Output[])operation.outputList(outputIdx, featureListSparseIndicesLength)); + outputIdx += featureListSparseIndicesLength; + int featureListSparseValuesLength = operation.outputListLength("feature_list_sparse_values"); + featureListSparseValues = Arrays.asList(operation.outputList(outputIdx, featureListSparseValuesLength)); + outputIdx += featureListSparseValuesLength; + int featureListSparseShapesLength = operation.outputListLength("feature_list_sparse_shapes"); + featureListSparseShapes = Arrays.asList((Output[])operation.outputList(outputIdx, featureListSparseShapesLength)); + outputIdx += featureListSparseShapesLength; + int featureListDenseValuesLength = operation.outputListLength("feature_list_dense_values"); + featureListDenseValues = Arrays.asList(operation.outputList(outputIdx, featureListDenseValuesLength)); + outputIdx += featureListDenseValuesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseTensor.java new file mode 100644 index 00000000000..93a596da2da --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ParseTensor.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transforms a serialized tensorflow.TensorProto proto into a Tensor. + * + * @param data type for {@code output()} output + */ +@Operator(group = "io") +public final class ParseTensor extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ParseTensor operation. + * + * @param scope current scope + * @param serialized A scalar string containing a serialized TensorProto proto. + * @param outType The type of the serialized tensor. The provided type must match the + * type of the serialized tensor and no implicit conversion will take place. + * @return a new instance of ParseTensor + */ + public static ParseTensor create(Scope scope, Operand serialized, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("ParseTensor", scope.makeOpName("ParseTensor")); + opBuilder.addInput(serialized.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new ParseTensor(opBuilder.build()); + } + + /** + * A Tensor of type `out_type`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ParseTensor(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/PriorityQueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/PriorityQueue.java new file mode 100644 index 00000000000..ef26f096128 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/PriorityQueue.java @@ -0,0 +1,168 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A queue that produces elements sorted by the first component value. + *

              + * Note that the PriorityQueue requires the first component of any element + * to be a scalar int64, in addition to the other elements declared by + * component_types. Therefore calls to Enqueue and EnqueueMany (resp. Dequeue + * and DequeueMany) on a PriorityQueue will all require (resp. output) one extra + * entry in their input (resp. output) lists. + */ +@Operator(group = "io") +public final class PriorityQueue extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.PriorityQueue} + */ + public static class Options { + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long capacity; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new PriorityQueue operation. + * + * @param scope current scope + * @param componentTypes The type of each component in a value. + * @param shapes The shape of each component in a value. The length of this attr must + * be either 0 or the same as the length of component_types. If the length of + * this attr is 0, the shapes of queue elements are not constrained, and + * only one element may be dequeued at a time. + * @param options carries optional attributes values + * @return a new instance of PriorityQueue + */ + public static PriorityQueue create(Scope scope, List> componentTypes, List shapes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("PriorityQueueV2", scope.makeOpName("PriorityQueue")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + Shape[] shapesArray = new Shape[shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + if (options != null) { + for (Options opts : options) { + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new PriorityQueue(opBuilder.build()); + } + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to the queue. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private PriorityQueue(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueClose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueClose.java new file mode 100644 index 00000000000..0b592e1d5ee --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueClose.java @@ -0,0 +1,93 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Closes the given queue. + *

              + * This operation signals that no more elements will be enqueued in the + * given queue. Subsequent Enqueue(Many) operations will fail. + * Subsequent Dequeue(Many) operations will continue to succeed if + * sufficient elements remain in the queue. Subsequent Dequeue(Many) + * operations that would block will fail immediately. + */ +@Operator(group = "io") +public final class QueueClose extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.io.QueueClose} + */ + public static class Options { + + /** + * @param cancelPendingEnqueues If true, all pending enqueue requests that are + * blocked on the given queue will be canceled. + */ + public Options cancelPendingEnqueues(Boolean cancelPendingEnqueues) { + this.cancelPendingEnqueues = cancelPendingEnqueues; + return this; + } + + private Boolean cancelPendingEnqueues; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QueueClose operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @param options carries optional attributes values + * @return a new instance of QueueClose + */ + public static QueueClose create(Scope scope, Operand handle, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueCloseV2", scope.makeOpName("QueueClose")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.cancelPendingEnqueues != null) { + opBuilder.setAttr("cancel_pending_enqueues", opts.cancelPendingEnqueues); + } + } + } + return new QueueClose(opBuilder.build()); + } + + /** + * @param cancelPendingEnqueues If true, all pending enqueue requests that are + * blocked on the given queue will be canceled. + */ + public static Options cancelPendingEnqueues(Boolean cancelPendingEnqueues) { + return new Options().cancelPendingEnqueues(cancelPendingEnqueues); + } + + + private QueueClose(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeue.java new file mode 100644 index 00000000000..872146f5846 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeue.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Dequeues a tuple of one or more tensors from the given queue. + *

              + * This operation has k outputs, where k is the number of components + * in the tuples stored in the given queue, and output i is the ith + * component of the dequeued tuple. + *

              + * N.B. If the queue is empty, this operation will block until an element + * has been dequeued (or 'timeout_ms' elapses, if specified). + */ +@Operator(group = "io") +public final class QueueDequeue extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.io.QueueDequeue} + */ + public static class Options { + + /** + * @param timeoutMs If the queue is empty, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public Options timeoutMs(Long timeoutMs) { + this.timeoutMs = timeoutMs; + return this; + } + + private Long timeoutMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QueueDequeue operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @param componentTypes The type of each component in a tuple. + * @param options carries optional attributes values + * @return a new instance of QueueDequeue + */ + public static QueueDequeue create(Scope scope, Operand handle, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueDequeueV2", scope.makeOpName("QueueDequeue")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.timeoutMs != null) { + opBuilder.setAttr("timeout_ms", opts.timeoutMs); + } + } + } + return new QueueDequeue(opBuilder.build()); + } + + /** + * @param timeoutMs If the queue is empty, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public static Options timeoutMs(Long timeoutMs) { + return new Options().timeoutMs(timeoutMs); + } + + /** + * One or more tensors that were dequeued as a tuple. + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private QueueDequeue(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeueMany.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeueMany.java new file mode 100644 index 00000000000..f65d007e41d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeueMany.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Dequeues `n` tuples of one or more tensors from the given queue. + *

              + * If the queue is closed and there are fewer than `n` elements, then an + * OutOfRange error is returned. + *

              + * This operation concatenates queue-element component tensors along the + * 0th dimension to make a single component tensor. All of the components + * in the dequeued tuple will have size `n` in the 0th dimension. + *

              + * This operation has `k` outputs, where `k` is the number of components in + * the tuples stored in the given queue, and output `i` is the ith + * component of the dequeued tuple. + *

              + * N.B. If the queue is empty, this operation will block until `n` elements + * have been dequeued (or 'timeout_ms' elapses, if specified). + */ +@Operator(group = "io") +public final class QueueDequeueMany extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.io.QueueDequeueMany} + */ + public static class Options { + + /** + * @param timeoutMs If the queue has fewer than n elements, this operation + * will block for up to timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public Options timeoutMs(Long timeoutMs) { + this.timeoutMs = timeoutMs; + return this; + } + + private Long timeoutMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QueueDequeueMany operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @param n The number of tuples to dequeue. + * @param componentTypes The type of each component in a tuple. + * @param options carries optional attributes values + * @return a new instance of QueueDequeueMany + */ + public static QueueDequeueMany create(Scope scope, Operand handle, Operand n, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueDequeueManyV2", scope.makeOpName("QueueDequeueMany")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(n.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.timeoutMs != null) { + opBuilder.setAttr("timeout_ms", opts.timeoutMs); + } + } + } + return new QueueDequeueMany(opBuilder.build()); + } + + /** + * @param timeoutMs If the queue has fewer than n elements, this operation + * will block for up to timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public static Options timeoutMs(Long timeoutMs) { + return new Options().timeoutMs(timeoutMs); + } + + /** + * One or more tensors that were dequeued as a tuple. + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private QueueDequeueMany(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeueUpTo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeueUpTo.java new file mode 100644 index 00000000000..7fe8da92f1d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueDequeueUpTo.java @@ -0,0 +1,138 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Dequeues `n` tuples of one or more tensors from the given queue. + *

              + * This operation is not supported by all queues. If a queue does not support + * DequeueUpTo, then an Unimplemented error is returned. + *

              + * If the queue is closed and there are more than 0 but less than `n` + * elements remaining, then instead of returning an OutOfRange error like + * QueueDequeueMany, less than `n` elements are returned immediately. If + * the queue is closed and there are 0 elements left in the queue, then + * an OutOfRange error is returned just like in QueueDequeueMany. + * Otherwise the behavior is identical to QueueDequeueMany: + *

              + * This operation concatenates queue-element component tensors along the + * 0th dimension to make a single component tensor. All of the components + * in the dequeued tuple will have size n in the 0th dimension. + *

              + * This operation has `k` outputs, where `k` is the number of components in + * the tuples stored in the given queue, and output `i` is the ith + * component of the dequeued tuple. + */ +@Operator(group = "io") +public final class QueueDequeueUpTo extends PrimitiveOp implements Iterable> { + + /** + * Optional attributes for {@link org.tensorflow.op.io.QueueDequeueUpTo} + */ + public static class Options { + + /** + * @param timeoutMs If the queue has fewer than n elements, this operation + * will block for up to timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public Options timeoutMs(Long timeoutMs) { + this.timeoutMs = timeoutMs; + return this; + } + + private Long timeoutMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QueueDequeueUpTo operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @param n The number of tuples to dequeue. + * @param componentTypes The type of each component in a tuple. + * @param options carries optional attributes values + * @return a new instance of QueueDequeueUpTo + */ + public static QueueDequeueUpTo create(Scope scope, Operand handle, Operand n, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueDequeueUpToV2", scope.makeOpName("QueueDequeueUpTo")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(n.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.timeoutMs != null) { + opBuilder.setAttr("timeout_ms", opts.timeoutMs); + } + } + } + return new QueueDequeueUpTo(opBuilder.build()); + } + + /** + * @param timeoutMs If the queue has fewer than n elements, this operation + * will block for up to timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public static Options timeoutMs(Long timeoutMs) { + return new Options().timeoutMs(timeoutMs); + } + + /** + * One or more tensors that were dequeued as a tuple. + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + private List> components; + + private QueueDequeueUpTo(Operation operation) { + super(operation); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueEnqueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueEnqueue.java new file mode 100644 index 00000000000..018ee5846de --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueEnqueue.java @@ -0,0 +1,98 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Enqueues a tuple of one or more tensors in the given queue. + *

              + * The components input has k elements, which correspond to the components of + * tuples stored in the given queue. + *

              + * N.B. If the queue is full, this operation will block until the given + * element has been enqueued (or 'timeout_ms' elapses, if specified). + */ +@Operator(group = "io") +public final class QueueEnqueue extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.io.QueueEnqueue} + */ + public static class Options { + + /** + * @param timeoutMs If the queue is full, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public Options timeoutMs(Long timeoutMs) { + this.timeoutMs = timeoutMs; + return this; + } + + private Long timeoutMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QueueEnqueue operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @param components One or more tensors from which the enqueued tensors should be taken. + * @param options carries optional attributes values + * @return a new instance of QueueEnqueue + */ + public static QueueEnqueue create(Scope scope, Operand handle, Iterable> components, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueEnqueueV2", scope.makeOpName("QueueEnqueue")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInputList(Operands.asOutputs(components)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.timeoutMs != null) { + opBuilder.setAttr("timeout_ms", opts.timeoutMs); + } + } + } + return new QueueEnqueue(opBuilder.build()); + } + + /** + * @param timeoutMs If the queue is full, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public static Options timeoutMs(Long timeoutMs) { + return new Options().timeoutMs(timeoutMs); + } + + + private QueueEnqueue(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueEnqueueMany.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueEnqueueMany.java new file mode 100644 index 00000000000..856c3127296 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueEnqueueMany.java @@ -0,0 +1,103 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Enqueues zero or more tuples of one or more tensors in the given queue. + *

              + * This operation slices each component tensor along the 0th dimension to + * make multiple queue elements. All of the tuple components must have the + * same size in the 0th dimension. + *

              + * The components input has k elements, which correspond to the components of + * tuples stored in the given queue. + *

              + * N.B. If the queue is full, this operation will block until the given + * elements have been enqueued (or 'timeout_ms' elapses, if specified). + */ +@Operator(group = "io") +public final class QueueEnqueueMany extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.io.QueueEnqueueMany} + */ + public static class Options { + + /** + * @param timeoutMs If the queue is too full, this operation will block for up + * to timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public Options timeoutMs(Long timeoutMs) { + this.timeoutMs = timeoutMs; + return this; + } + + private Long timeoutMs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QueueEnqueueMany operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @param components One or more tensors from which the enqueued tensors should + * be taken. + * @param options carries optional attributes values + * @return a new instance of QueueEnqueueMany + */ + public static QueueEnqueueMany create(Scope scope, Operand handle, Iterable> components, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueEnqueueManyV2", scope.makeOpName("QueueEnqueueMany")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInputList(Operands.asOutputs(components)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.timeoutMs != null) { + opBuilder.setAttr("timeout_ms", opts.timeoutMs); + } + } + } + return new QueueEnqueueMany(opBuilder.build()); + } + + /** + * @param timeoutMs If the queue is too full, this operation will block for up + * to timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public static Options timeoutMs(Long timeoutMs) { + return new Options().timeoutMs(timeoutMs); + } + + + private QueueEnqueueMany(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueIsClosed.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueIsClosed.java new file mode 100644 index 00000000000..49d2d8799c1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueIsClosed.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns true if queue is closed. + *

              + * This operation returns true if the queue is closed and false if the queue + * is open. + */ +@Operator(group = "io") +public final class QueueIsClosed extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new QueueIsClosed operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @return a new instance of QueueIsClosed + */ + public static QueueIsClosed create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueIsClosedV2", scope.makeOpName("QueueIsClosed")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new QueueIsClosed(opBuilder.build()); + } + + /** + */ + public Output isClosed() { + return isClosed; + } + + @Override + public Output asOutput() { + return isClosed; + } + + private Output isClosed; + + private QueueIsClosed(Operation operation) { + super(operation); + int outputIdx = 0; + isClosed = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueSize.java new file mode 100644 index 00000000000..de1bb35164f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/QueueSize.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the number of elements in the given queue. + */ +@Operator(group = "io") +public final class QueueSize extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new QueueSize operation. + * + * @param scope current scope + * @param handle The handle to a queue. + * @return a new instance of QueueSize + */ + public static QueueSize create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("QueueSizeV2", scope.makeOpName("QueueSize")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new QueueSize(opBuilder.build()); + } + + /** + * The number of elements in the given queue. + */ + public Output size() { + return size; + } + + @Override + public Output asOutput() { + return size; + } + + private Output size; + + private QueueSize(Operation operation) { + super(operation); + int outputIdx = 0; + size = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/RandomShuffleQueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/RandomShuffleQueue.java new file mode 100644 index 00000000000..142cf1048b0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/RandomShuffleQueue.java @@ -0,0 +1,245 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A queue that randomizes the order of elements. + */ +@Operator(group = "io") +public final class RandomShuffleQueue extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.RandomShuffleQueue} + */ + public static class Options { + + /** + * @param shapes The shape of each component in a value. The length of this attr must + * be either 0 or the same as the length of component_types. If the length of + * this attr is 0, the shapes of queue elements are not constrained, and + * only one element may be dequeued at a time. + */ + public Options shapes(List shapes) { + this.shapes = shapes; + return this; + } + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @param minAfterDequeue Dequeue will block unless there would be this + * many elements after the dequeue or the queue is closed. This + * ensures a minimum level of mixing of elements. + */ + public Options minAfterDequeue(Long minAfterDequeue) { + this.minAfterDequeue = minAfterDequeue; + return this; + } + + /** + * @param seed If either seed or seed2 is set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, a random seed is used. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private List shapes; + private Long capacity; + private Long minAfterDequeue; + private Long seed; + private Long seed2; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomShuffleQueue operation. + * + * @param scope current scope + * @param componentTypes The type of each component in a value. + * @param options carries optional attributes values + * @return a new instance of RandomShuffleQueue + */ + public static RandomShuffleQueue create(Scope scope, List> componentTypes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomShuffleQueueV2", scope.makeOpName("RandomShuffleQueue")); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] componentTypesArray = new DataType[componentTypes.size()]; + for (int i = 0; i < componentTypesArray.length; ++i) { + componentTypesArray[i] = DataType.fromClass(componentTypes.get(i)); + } + opBuilder.setAttr("component_types", componentTypesArray); + if (options != null) { + for (Options opts : options) { + if (opts.shapes != null) { + Shape[] shapesArray = new Shape[opts.shapes.size()]; + for (int i = 0; i < shapesArray.length; ++i) { + shapesArray[i] = opts.shapes.get(i); + } + opBuilder.setAttr("shapes", shapesArray); + } + if (opts.capacity != null) { + opBuilder.setAttr("capacity", opts.capacity); + } + if (opts.minAfterDequeue != null) { + opBuilder.setAttr("min_after_dequeue", opts.minAfterDequeue); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new RandomShuffleQueue(opBuilder.build()); + } + + /** + * @param shapes The shape of each component in a value. The length of this attr must + * be either 0 or the same as the length of component_types. If the length of + * this attr is 0, the shapes of queue elements are not constrained, and + * only one element may be dequeued at a time. + */ + public static Options shapes(List shapes) { + return new Options().shapes(shapes); + } + + /** + * @param capacity The upper bound on the number of elements in this queue. + * Negative numbers mean no limit. + */ + public static Options capacity(Long capacity) { + return new Options().capacity(capacity); + } + + /** + * @param minAfterDequeue Dequeue will block unless there would be this + * many elements after the dequeue or the queue is closed. This + * ensures a minimum level of mixing of elements. + */ + public static Options minAfterDequeue(Long minAfterDequeue) { + return new Options().minAfterDequeue(minAfterDequeue); + } + + /** + * @param seed If either seed or seed2 is set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, a random seed is used. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param container If non-empty, this queue is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this queue will be shared under the given name + * across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to the queue. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + private Output handle; + + private RandomShuffleQueue(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReadFile.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReadFile.java new file mode 100644 index 00000000000..ad82f5d350c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReadFile.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reads and outputs the entire contents of the input filename. + */ +@Operator(group = "io") +public final class ReadFile extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ReadFile operation. + * + * @param scope current scope + * @param filename + * @return a new instance of ReadFile + */ + public static ReadFile create(Scope scope, Operand filename) { + OperationBuilder opBuilder = scope.env().opBuilder("ReadFile", scope.makeOpName("ReadFile")); + opBuilder.addInput(filename.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReadFile(opBuilder.build()); + } + + /** + */ + public Output contents() { + return contents; + } + + @Override + public Output asOutput() { + return contents; + } + + private Output contents; + + private ReadFile(Operation operation) { + super(operation); + int outputIdx = 0; + contents = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderNumRecordsProduced.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderNumRecordsProduced.java new file mode 100644 index 00000000000..d52676c6497 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderNumRecordsProduced.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the number of records this Reader has produced. + *

              + * This is the same as the number of ReaderRead executions that have + * succeeded. + */ +@Operator(group = "io") +public final class ReaderNumRecordsProduced extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ReaderNumRecordsProduced operation. + * + * @param scope current scope + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderNumRecordsProduced + */ + public static ReaderNumRecordsProduced create(Scope scope, Operand readerHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("ReaderNumRecordsProducedV2", scope.makeOpName("ReaderNumRecordsProduced")); + opBuilder.addInput(readerHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReaderNumRecordsProduced(opBuilder.build()); + } + + /** + */ + public Output recordsProduced() { + return recordsProduced; + } + + @Override + public Output asOutput() { + return recordsProduced; + } + + private Output recordsProduced; + + private ReaderNumRecordsProduced(Operation operation) { + super(operation); + int outputIdx = 0; + recordsProduced = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderNumWorkUnitsCompleted.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderNumWorkUnitsCompleted.java new file mode 100644 index 00000000000..c937e48744f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderNumWorkUnitsCompleted.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the number of work units this Reader has finished processing. + */ +@Operator(group = "io") +public final class ReaderNumWorkUnitsCompleted extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ReaderNumWorkUnitsCompleted operation. + * + * @param scope current scope + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderNumWorkUnitsCompleted + */ + public static ReaderNumWorkUnitsCompleted create(Scope scope, Operand readerHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("ReaderNumWorkUnitsCompletedV2", scope.makeOpName("ReaderNumWorkUnitsCompleted")); + opBuilder.addInput(readerHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReaderNumWorkUnitsCompleted(opBuilder.build()); + } + + /** + */ + public Output unitsCompleted() { + return unitsCompleted; + } + + @Override + public Output asOutput() { + return unitsCompleted; + } + + private Output unitsCompleted; + + private ReaderNumWorkUnitsCompleted(Operation operation) { + super(operation); + int outputIdx = 0; + unitsCompleted = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderRead.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderRead.java new file mode 100644 index 00000000000..6e9cf97fec2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderRead.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the next record (key, value pair) produced by a Reader. + *

              + * Will dequeue from the input queue if necessary (e.g. when the + * Reader needs to start reading from a new file since it has finished + * with the previous file). + */ +@Operator(group = "io") +public final class ReaderRead extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ReaderRead operation. + * + * @param scope current scope + * @param readerHandle Handle to a Reader. + * @param queueHandle Handle to a Queue, with string work items. + * @return a new instance of ReaderRead + */ + public static ReaderRead create(Scope scope, Operand readerHandle, Operand queueHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("ReaderReadV2", scope.makeOpName("ReaderRead")); + opBuilder.addInput(readerHandle.asOutput()); + opBuilder.addInput(queueHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReaderRead(opBuilder.build()); + } + + /** + * A scalar. + */ + public Output key() { + return key; + } + + /** + * A scalar. + */ + public Output value() { + return value; + } + + private Output key; + private Output value; + + private ReaderRead(Operation operation) { + super(operation); + int outputIdx = 0; + key = operation.output(outputIdx++); + value = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderReadUpTo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderReadUpTo.java new file mode 100644 index 00000000000..0afbfcc587e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderReadUpTo.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns up to `num_records` (key, value) pairs produced by a Reader. + *

              + * Will dequeue from the input queue if necessary (e.g. when the + * Reader needs to start reading from a new file since it has finished + * with the previous file). + * It may return less than `num_records` even before the last batch. + */ +@Operator(group = "io") +public final class ReaderReadUpTo extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ReaderReadUpTo operation. + * + * @param scope current scope + * @param readerHandle Handle to a `Reader`. + * @param queueHandle Handle to a `Queue`, with string work items. + * @param numRecords number of records to read from `Reader`. + * @return a new instance of ReaderReadUpTo + */ + public static ReaderReadUpTo create(Scope scope, Operand readerHandle, Operand queueHandle, Operand numRecords) { + OperationBuilder opBuilder = scope.env().opBuilder("ReaderReadUpToV2", scope.makeOpName("ReaderReadUpTo")); + opBuilder.addInput(readerHandle.asOutput()); + opBuilder.addInput(queueHandle.asOutput()); + opBuilder.addInput(numRecords.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReaderReadUpTo(opBuilder.build()); + } + + /** + * A 1-D tensor. + */ + public Output keys() { + return keys; + } + + /** + * A 1-D tensor. + */ + public Output values() { + return values; + } + + private Output keys; + private Output values; + + private ReaderReadUpTo(Operation operation) { + super(operation); + int outputIdx = 0; + keys = operation.output(outputIdx++); + values = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderReset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderReset.java new file mode 100644 index 00000000000..01989cd2683 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderReset.java @@ -0,0 +1,51 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Restore a Reader to its initial clean state. + */ +@Operator(group = "io") +public final class ReaderReset extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ReaderReset operation. + * + * @param scope current scope + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderReset + */ + public static ReaderReset create(Scope scope, Operand readerHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("ReaderResetV2", scope.makeOpName("ReaderReset")); + opBuilder.addInput(readerHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReaderReset(opBuilder.build()); + } + + + private ReaderReset(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderRestoreState.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderRestoreState.java new file mode 100644 index 00000000000..fdd92070de1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderRestoreState.java @@ -0,0 +1,57 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Restore a reader to a previously saved state. + *

              + * Not all Readers support being restored, so this can produce an + * Unimplemented error. + */ +@Operator(group = "io") +public final class ReaderRestoreState extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ReaderRestoreState operation. + * + * @param scope current scope + * @param readerHandle Handle to a Reader. + * @param state Result of a ReaderSerializeState of a Reader with type + * matching reader_handle. + * @return a new instance of ReaderRestoreState + */ + public static ReaderRestoreState create(Scope scope, Operand readerHandle, Operand state) { + OperationBuilder opBuilder = scope.env().opBuilder("ReaderRestoreStateV2", scope.makeOpName("ReaderRestoreState")); + opBuilder.addInput(readerHandle.asOutput()); + opBuilder.addInput(state.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReaderRestoreState(opBuilder.build()); + } + + + private ReaderRestoreState(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderSerializeState.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderSerializeState.java new file mode 100644 index 00000000000..62db1b7c293 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ReaderSerializeState.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Produce a string tensor that encodes the state of a Reader. + *

              + * Not all Readers support being serialized, so this can produce an + * Unimplemented error. + */ +@Operator(group = "io") +public final class ReaderSerializeState extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ReaderSerializeState operation. + * + * @param scope current scope + * @param readerHandle Handle to a Reader. + * @return a new instance of ReaderSerializeState + */ + public static ReaderSerializeState create(Scope scope, Operand readerHandle) { + OperationBuilder opBuilder = scope.env().opBuilder("ReaderSerializeStateV2", scope.makeOpName("ReaderSerializeState")); + opBuilder.addInput(readerHandle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReaderSerializeState(opBuilder.build()); + } + + /** + */ + public Output state() { + return state; + } + + @Override + public Output asOutput() { + return state; + } + + private Output state; + + private ReaderSerializeState(Operation operation) { + super(operation); + int outputIdx = 0; + state = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeManySparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeManySparse.java new file mode 100644 index 00000000000..a9405ce22b3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeManySparse.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Serialize an `N`-minibatch `SparseTensor` into an `[N, 3]` `Tensor` object. + *

              + * The `SparseTensor` must have rank `R` greater than 1, and the first dimension + * is treated as the minibatch dimension. Elements of the `SparseTensor` + * must be sorted in increasing order of this first dimension. The serialized + * `SparseTensor` objects going into each row of `serialized_sparse` will have + * rank `R-1`. + *

              + * The minibatch size `N` is extracted from `sparse_shape[0]`. + * + * @param data type for {@code serializedSparse()} output + */ +@Operator(group = "io") +public final class SerializeManySparse extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SerializeManySparse operation. + * + * @param scope current scope + * @param sparseIndices 2-D. The `indices` of the minibatch `SparseTensor`. + * @param sparseValues 1-D. The `values` of the minibatch `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the minibatch `SparseTensor`. + * @param outType The `dtype` to use for serialization; the supported types are `string` + * (default) and `variant`. + * @return a new instance of SerializeManySparse + */ + public static SerializeManySparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("SerializeManySparse", scope.makeOpName("SerializeManySparse")); + opBuilder.addInput(sparseIndices.asOutput()); + opBuilder.addInput(sparseValues.asOutput()); + opBuilder.addInput(sparseShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new SerializeManySparse(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new SerializeManySparse operation using default output types. + * + * @param scope current scope + * @param sparseIndices 2-D. The `indices` of the minibatch `SparseTensor`. + * @param sparseValues 1-D. The `values` of the minibatch `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the minibatch `SparseTensor`. + * @return a new instance of SerializeManySparse + */ + public static SerializeManySparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape) { + return create(scope, sparseIndices, sparseValues, sparseShape, String.class); + } + + /** + */ + public Output serializedSparse() { + return serializedSparse; + } + + @Override + public Output asOutput() { + return serializedSparse; + } + + private Output serializedSparse; + + private SerializeManySparse(Operation operation) { + super(operation); + int outputIdx = 0; + serializedSparse = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeSparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeSparse.java new file mode 100644 index 00000000000..7b584715a48 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeSparse.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Serialize a `SparseTensor` into a `[3]` `Tensor` object. + * + * @param data type for {@code serializedSparse()} output + */ +@Operator(group = "io") +public final class SerializeSparse extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SerializeSparse operation. + * + * @param scope current scope + * @param sparseIndices 2-D. The `indices` of the `SparseTensor`. + * @param sparseValues 1-D. The `values` of the `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the `SparseTensor`. + * @param outType The `dtype` to use for serialization; the supported types are `string` + * (default) and `variant`. + * @return a new instance of SerializeSparse + */ + public static SerializeSparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("SerializeSparse", scope.makeOpName("SerializeSparse")); + opBuilder.addInput(sparseIndices.asOutput()); + opBuilder.addInput(sparseValues.asOutput()); + opBuilder.addInput(sparseShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new SerializeSparse(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new SerializeSparse operation using default output types. + * + * @param scope current scope + * @param sparseIndices 2-D. The `indices` of the `SparseTensor`. + * @param sparseValues 1-D. The `values` of the `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the `SparseTensor`. + * @return a new instance of SerializeSparse + */ + public static SerializeSparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape) { + return create(scope, sparseIndices, sparseValues, sparseShape, String.class); + } + + /** + */ + public Output serializedSparse() { + return serializedSparse; + } + + @Override + public Output asOutput() { + return serializedSparse; + } + + private Output serializedSparse; + + private SerializeSparse(Operation operation) { + super(operation); + int outputIdx = 0; + serializedSparse = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeTensor.java new file mode 100644 index 00000000000..490f338d6a5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeTensor.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transforms a Tensor into a serialized TensorProto proto. + */ +@Operator(group = "io") +public final class SerializeTensor extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SerializeTensor operation. + * + * @param scope current scope + * @param tensor A Tensor of type `T`. + * @return a new instance of SerializeTensor + */ + public static SerializeTensor create(Scope scope, Operand tensor) { + OperationBuilder opBuilder = scope.env().opBuilder("SerializeTensor", scope.makeOpName("SerializeTensor")); + opBuilder.addInput(tensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SerializeTensor(opBuilder.build()); + } + + /** + * A serialized TensorProto proto of the input tensor. + */ + public Output serialized() { + return serialized; + } + + @Override + public Output asOutput() { + return serialized; + } + + private Output serialized; + + private SerializeTensor(Operation operation) { + super(operation); + int outputIdx = 0; + serialized = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ShardedFilename.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ShardedFilename.java new file mode 100644 index 00000000000..d1629a79bdc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ShardedFilename.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generate a sharded filename. The filename is printf formatted as + *

              + * %s-%05d-of-%05d, basename, shard, num_shards. + */ +@Operator(group = "io") +public final class ShardedFilename extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ShardedFilename operation. + * + * @param scope current scope + * @param basename + * @param shard + * @param numShards + * @return a new instance of ShardedFilename + */ + public static ShardedFilename create(Scope scope, Operand basename, Operand shard, Operand numShards) { + OperationBuilder opBuilder = scope.env().opBuilder("ShardedFilename", scope.makeOpName("ShardedFilename")); + opBuilder.addInput(basename.asOutput()); + opBuilder.addInput(shard.asOutput()); + opBuilder.addInput(numShards.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ShardedFilename(opBuilder.build()); + } + + /** + */ + public Output filename() { + return filename; + } + + @Override + public Output asOutput() { + return filename; + } + + private Output filename; + + private ShardedFilename(Operation operation) { + super(operation); + int outputIdx = 0; + filename = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ShardedFilespec.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ShardedFilespec.java new file mode 100644 index 00000000000..da5d6d2c289 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/ShardedFilespec.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generate a glob pattern matching all sharded file names. + */ +@Operator(group = "io") +public final class ShardedFilespec extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ShardedFilespec operation. + * + * @param scope current scope + * @param basename + * @param numShards + * @return a new instance of ShardedFilespec + */ + public static ShardedFilespec create(Scope scope, Operand basename, Operand numShards) { + OperationBuilder opBuilder = scope.env().opBuilder("ShardedFilespec", scope.makeOpName("ShardedFilespec")); + opBuilder.addInput(basename.asOutput()); + opBuilder.addInput(numShards.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ShardedFilespec(opBuilder.build()); + } + + /** + */ + public Output filename() { + return filename; + } + + @Override + public Output asOutput() { + return filename; + } + + private Output filename; + + private ShardedFilespec(Operation operation) { + super(operation); + int outputIdx = 0; + filename = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/TextLineReader.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/TextLineReader.java new file mode 100644 index 00000000000..4aac8c653ae --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/TextLineReader.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A Reader that outputs the lines of a file delimited by '\n'. + */ +@Operator(group = "io") +public final class TextLineReader extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.TextLineReader} + */ + public static class Options { + + /** + * @param skipHeaderLines Number of lines to skip from the beginning of every file. + */ + public Options skipHeaderLines(Long skipHeaderLines) { + this.skipHeaderLines = skipHeaderLines; + return this; + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private Long skipHeaderLines; + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TextLineReader operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of TextLineReader + */ + public static TextLineReader create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TextLineReaderV2", scope.makeOpName("TextLineReader")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.skipHeaderLines != null) { + opBuilder.setAttr("skip_header_lines", opts.skipHeaderLines); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new TextLineReader(opBuilder.build()); + } + + /** + * @param skipHeaderLines Number of lines to skip from the beginning of every file. + */ + public static Options skipHeaderLines(Long skipHeaderLines) { + return new Options().skipHeaderLines(skipHeaderLines); + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to reference the Reader. + */ + public Output readerHandle() { + return readerHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) readerHandle; + } + + private Output readerHandle; + + private TextLineReader(Operation operation) { + super(operation); + int outputIdx = 0; + readerHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/TfRecordReader.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/TfRecordReader.java new file mode 100644 index 00000000000..694ab805a9f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/TfRecordReader.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A Reader that outputs the records from a TensorFlow Records file. + */ +@Operator(group = "io") +public final class TfRecordReader extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.TfRecordReader} + */ + public static class Options { + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param compressionType + */ + public Options compressionType(String compressionType) { + this.compressionType = compressionType; + return this; + } + + private String container; + private String sharedName; + private String compressionType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TfRecordReader operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of TfRecordReader + */ + public static TfRecordReader create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TFRecordReaderV2", scope.makeOpName("TfRecordReader")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.compressionType != null) { + opBuilder.setAttr("compression_type", opts.compressionType); + } + } + } + return new TfRecordReader(opBuilder.build()); + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param compressionType + */ + public static Options compressionType(String compressionType) { + return new Options().compressionType(compressionType); + } + + /** + * The handle to reference the Reader. + */ + public Output readerHandle() { + return readerHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) readerHandle; + } + + private Output readerHandle; + + private TfRecordReader(Operation operation) { + super(operation); + int outputIdx = 0; + readerHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/WholeFileReader.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/WholeFileReader.java new file mode 100644 index 00000000000..5b04001cec8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/WholeFileReader.java @@ -0,0 +1,126 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A Reader that outputs the entire contents of a file as a value. + *

              + * To use, enqueue filenames in a Queue. The output of ReaderRead will + * be a filename (key) and the contents of that file (value). + */ +@Operator(group = "io") +public final class WholeFileReader extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.io.WholeFileReader} + */ + public static class Options { + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new WholeFileReader operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of WholeFileReader + */ + public static WholeFileReader create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("WholeFileReaderV2", scope.makeOpName("WholeFileReader")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new WholeFileReader(opBuilder.build()); + } + + /** + * @param container If non-empty, this reader is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this reader is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * The handle to reference the Reader. + */ + public Output readerHandle() { + return readerHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) readerHandle; + } + + private Output readerHandle; + + private WholeFileReader(Operation operation) { + super(operation); + int outputIdx = 0; + readerHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/WriteFile.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/WriteFile.java new file mode 100644 index 00000000000..7d93e9b5cb4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/WriteFile.java @@ -0,0 +1,55 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.io; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Writes contents to the file at input filename. Creates file and recursively + *

              + * creates directory if not existing. + */ +@Operator(group = "io") +public final class WriteFile extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new WriteFile operation. + * + * @param scope current scope + * @param filename scalar. The name of the file to which we write the contents. + * @param contents scalar. The content to be written to the output file. + * @return a new instance of WriteFile + */ + public static WriteFile create(Scope scope, Operand filename, Operand contents) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteFile", scope.makeOpName("WriteFile")); + opBuilder.addInput(filename.asOutput()); + opBuilder.addInput(contents.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WriteFile(opBuilder.build()); + } + + + private WriteFile(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BandPart.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BandPart.java new file mode 100644 index 00000000000..59dc633cdb7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BandPart.java @@ -0,0 +1,113 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Copy a tensor setting everything outside a central band in each innermost matrix + *

              + * to zero. + *

              + * The `band` part is computed as follows: + * Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a + * tensor with the same shape where + *

              + * `band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`. + *

              + * The indicator function + *

              + * `in_band(m, n) = (num_lower < 0 || (m-n) <= num_lower)) && + * (num_upper < 0 || (n-m) <= num_upper)`. + *

              + * For example: + *

              {@code
              + * # if 'input' is [[ 0,  1,  2, 3]
              + *                  [-1,  0,  1, 2]
              + *                  [-2, -1,  0, 1]
              + *                  [-3, -2, -1, 0]],
              + * 
              + * tf.matrix_band_part(input, 1, -1) ==> [[ 0,  1,  2, 3]
              + *                                        [-1,  0,  1, 2]
              + *                                        [ 0, -1,  0, 1]
              + *                                        [ 0,  0, -1, 0]],
              + * 
              + * tf.matrix_band_part(input, 2, 1) ==> [[ 0,  1,  0, 0]
              + *                                       [-1,  0,  1, 0]
              + *                                       [-2, -1,  0, 1]
              + *                                       [ 0, -2, -1, 0]]
              + * }
              + * Useful special cases: + *
              {@code
              + *  tf.matrix_band_part(input, 0, -1) ==> Upper triangular part.
              + *  tf.matrix_band_part(input, -1, 0) ==> Lower triangular part.
              + *  tf.matrix_band_part(input, 0, 0) ==> Diagonal.
              + * }
              + * + * + * @param data type for {@code band()} output + */ +@Operator(group = "linalg") +public final class BandPart extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BandPart operation. + * + * @param scope current scope + * @param input Rank `k` tensor. + * @param numLower 0-D tensor. Number of subdiagonals to keep. If negative, keep entire + * lower triangle. + * @param numUpper 0-D tensor. Number of superdiagonals to keep. If negative, keep + * entire upper triangle. + * @return a new instance of BandPart + */ + public static BandPart create(Scope scope, Operand input, Operand numLower, Operand numUpper) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixBandPart", scope.makeOpName("BandPart")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(numLower.asOutput()); + opBuilder.addInput(numUpper.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BandPart(opBuilder.build()); + } + + /** + * Rank `k` tensor of the same shape as input. The extracted banded tensor. + */ + public Output band() { + return band; + } + + @Override + public Output asOutput() { + return band; + } + + private Output band; + + private BandPart(Operation operation) { + super(operation); + int outputIdx = 0; + band = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchCholesky.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchCholesky.java new file mode 100644 index 00000000000..e0751817605 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchCholesky.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchCholesky extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchCholesky operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchCholesky + */ + public static BatchCholesky create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchCholesky", scope.makeOpName("BatchCholesky")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchCholesky(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchCholesky(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchCholeskyGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchCholeskyGrad.java new file mode 100644 index 00000000000..a36f37ddc75 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchCholeskyGrad.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchCholeskyGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchCholeskyGrad operation. + * + * @param scope current scope + * @param l + * @param grad + * @return a new instance of BatchCholeskyGrad + */ + public static BatchCholeskyGrad create(Scope scope, Operand l, Operand grad) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchCholeskyGrad", scope.makeOpName("BatchCholeskyGrad")); + opBuilder.addInput(l.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchCholeskyGrad(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchCholeskyGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatMul.java new file mode 100644 index 00000000000..93192f31e4a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatMul.java @@ -0,0 +1,143 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Multiplies slices of two tensors in batches. + *

              + * Multiplies all slices of `Tensor` `x` and `y` (each slice can be + * viewed as an element of a batch), and arranges the individual results + * in a single output tensor of the same batch size. Each of the + * individual slices can optionally be adjointed (to adjoint a matrix + * means to transpose and conjugate it) before multiplication by setting + * the `adj_x` or `adj_y` flag to `True`, which are by default `False`. + *

              + * The input tensors `x` and `y` are 2-D or higher with shape `[..., r_x, c_x]` + * and `[..., r_y, c_y]`. + *

              + * The output tensor is 2-D or higher with shape `[..., r_o, c_o]`, where: + *

              + * r_o = c_x if adj_x else r_x + * c_o = r_y if adj_y else c_y + *

              + * It is computed as: + *

              + * output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :]) + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatMul extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.BatchMatMul} + */ + public static class Options { + + /** + * @param adjX If `True`, adjoint the slices of `x`. Defaults to `False`. + */ + public Options adjX(Boolean adjX) { + this.adjX = adjX; + return this; + } + + /** + * @param adjY If `True`, adjoint the slices of `y`. Defaults to `False`. + */ + public Options adjY(Boolean adjY) { + this.adjY = adjY; + return this; + } + + private Boolean adjX; + private Boolean adjY; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchMatMul operation. + * + * @param scope current scope + * @param x 2-D or higher with shape `[..., r_x, c_x]`. + * @param y 2-D or higher with shape `[..., r_y, c_y]`. + * @param options carries optional attributes values + * @return a new instance of BatchMatMul + */ + public static BatchMatMul create(Scope scope, Operand x, Operand y, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatMul", scope.makeOpName("BatchMatMul")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.adjX != null) { + opBuilder.setAttr("adj_x", opts.adjX); + } + if (opts.adjY != null) { + opBuilder.setAttr("adj_y", opts.adjY); + } + } + } + return new BatchMatMul(opBuilder.build()); + } + + /** + * @param adjX If `True`, adjoint the slices of `x`. Defaults to `False`. + */ + public static Options adjX(Boolean adjX) { + return new Options().adjX(adjX); + } + + /** + * @param adjY If `True`, adjoint the slices of `y`. Defaults to `False`. + */ + public static Options adjY(Boolean adjY) { + return new Options().adjY(adjY); + } + + /** + * 3-D or higher with shape `[..., r_o, c_o]` + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatMul(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixBandPart.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixBandPart.java new file mode 100644 index 00000000000..03cc5e2b45f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixBandPart.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code band()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixBandPart extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchMatrixBandPart operation. + * + * @param scope current scope + * @param input + * @param numLower + * @param numUpper + * @return a new instance of BatchMatrixBandPart + */ + public static BatchMatrixBandPart create(Scope scope, Operand input, Operand numLower, Operand numUpper) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixBandPart", scope.makeOpName("BatchMatrixBandPart")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(numLower.asOutput()); + opBuilder.addInput(numUpper.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchMatrixBandPart(opBuilder.build()); + } + + /** + */ + public Output band() { + return band; + } + + @Override + public Output asOutput() { + return band; + } + + private Output band; + + private BatchMatrixBandPart(Operation operation) { + super(operation); + int outputIdx = 0; + band = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDeterminant.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDeterminant.java new file mode 100644 index 00000000000..920ebcbd5ad --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDeterminant.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixDeterminant extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchMatrixDeterminant operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchMatrixDeterminant + */ + public static BatchMatrixDeterminant create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixDeterminant", scope.makeOpName("BatchMatrixDeterminant")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchMatrixDeterminant(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatrixDeterminant(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDiag.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDiag.java new file mode 100644 index 00000000000..6e1931fb278 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDiag.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixDiag extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchMatrixDiag operation. + * + * @param scope current scope + * @param diagonal + * @return a new instance of BatchMatrixDiag + */ + public static BatchMatrixDiag create(Scope scope, Operand diagonal) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixDiag", scope.makeOpName("BatchMatrixDiag")); + opBuilder.addInput(diagonal.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchMatrixDiag(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatrixDiag(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDiagPart.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDiagPart.java new file mode 100644 index 00000000000..73e684c5dcd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixDiagPart.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code diagonal()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixDiagPart extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchMatrixDiagPart operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchMatrixDiagPart + */ + public static BatchMatrixDiagPart create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixDiagPart", scope.makeOpName("BatchMatrixDiagPart")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchMatrixDiagPart(opBuilder.build()); + } + + /** + */ + public Output diagonal() { + return diagonal; + } + + @Override + public Output asOutput() { + return diagonal; + } + + private Output diagonal; + + private BatchMatrixDiagPart(Operation operation) { + super(operation); + int outputIdx = 0; + diagonal = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixInverse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixInverse.java new file mode 100644 index 00000000000..d89f765207d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixInverse.java @@ -0,0 +1,100 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixInverse extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.BatchMatrixInverse} + */ + public static class Options { + + /** + * @param adjoint + */ + public Options adjoint(Boolean adjoint) { + this.adjoint = adjoint; + return this; + } + + private Boolean adjoint; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchMatrixInverse operation. + * + * @param scope current scope + * @param input + * @param options carries optional attributes values + * @return a new instance of BatchMatrixInverse + */ + public static BatchMatrixInverse create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixInverse", scope.makeOpName("BatchMatrixInverse")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.adjoint != null) { + opBuilder.setAttr("adjoint", opts.adjoint); + } + } + } + return new BatchMatrixInverse(opBuilder.build()); + } + + /** + * @param adjoint + */ + public static Options adjoint(Boolean adjoint) { + return new Options().adjoint(adjoint); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatrixInverse(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSetDiag.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSetDiag.java new file mode 100644 index 00000000000..373e6f8ba0d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSetDiag.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixSetDiag extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchMatrixSetDiag operation. + * + * @param scope current scope + * @param input + * @param diagonal + * @return a new instance of BatchMatrixSetDiag + */ + public static BatchMatrixSetDiag create(Scope scope, Operand input, Operand diagonal) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixSetDiag", scope.makeOpName("BatchMatrixSetDiag")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(diagonal.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchMatrixSetDiag(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatrixSetDiag(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSolve.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSolve.java new file mode 100644 index 00000000000..ac76cf71c26 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSolve.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixSolve extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.BatchMatrixSolve} + */ + public static class Options { + + /** + * @param adjoint + */ + public Options adjoint(Boolean adjoint) { + this.adjoint = adjoint; + return this; + } + + private Boolean adjoint; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchMatrixSolve operation. + * + * @param scope current scope + * @param matrix + * @param rhs + * @param options carries optional attributes values + * @return a new instance of BatchMatrixSolve + */ + public static BatchMatrixSolve create(Scope scope, Operand matrix, Operand rhs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixSolve", scope.makeOpName("BatchMatrixSolve")); + opBuilder.addInput(matrix.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.adjoint != null) { + opBuilder.setAttr("adjoint", opts.adjoint); + } + } + } + return new BatchMatrixSolve(opBuilder.build()); + } + + /** + * @param adjoint + */ + public static Options adjoint(Boolean adjoint) { + return new Options().adjoint(adjoint); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatrixSolve(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSolveLs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSolveLs.java new file mode 100644 index 00000000000..c3003c67e8d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixSolveLs.java @@ -0,0 +1,104 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixSolveLs extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.BatchMatrixSolveLs} + */ + public static class Options { + + /** + * @param fast + */ + public Options fast(Boolean fast) { + this.fast = fast; + return this; + } + + private Boolean fast; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchMatrixSolveLs operation. + * + * @param scope current scope + * @param matrix + * @param rhs + * @param l2Regularizer + * @param options carries optional attributes values + * @return a new instance of BatchMatrixSolveLs + */ + public static BatchMatrixSolveLs create(Scope scope, Operand matrix, Operand rhs, Operand l2Regularizer, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixSolveLs", scope.makeOpName("BatchMatrixSolveLs")); + opBuilder.addInput(matrix.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder.addInput(l2Regularizer.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.fast != null) { + opBuilder.setAttr("fast", opts.fast); + } + } + } + return new BatchMatrixSolveLs(opBuilder.build()); + } + + /** + * @param fast + */ + public static Options fast(Boolean fast) { + return new Options().fast(fast); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatrixSolveLs(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixTriangularSolve.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixTriangularSolve.java new file mode 100644 index 00000000000..49d0ac3df43 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchMatrixTriangularSolve.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class BatchMatrixTriangularSolve extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.BatchMatrixTriangularSolve} + */ + public static class Options { + + /** + * @param lower + */ + public Options lower(Boolean lower) { + this.lower = lower; + return this; + } + + /** + * @param adjoint + */ + public Options adjoint(Boolean adjoint) { + this.adjoint = adjoint; + return this; + } + + private Boolean lower; + private Boolean adjoint; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchMatrixTriangularSolve operation. + * + * @param scope current scope + * @param matrix + * @param rhs + * @param options carries optional attributes values + * @return a new instance of BatchMatrixTriangularSolve + */ + public static BatchMatrixTriangularSolve create(Scope scope, Operand matrix, Operand rhs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchMatrixTriangularSolve", scope.makeOpName("BatchMatrixTriangularSolve")); + opBuilder.addInput(matrix.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.lower != null) { + opBuilder.setAttr("lower", opts.lower); + } + if (opts.adjoint != null) { + opBuilder.setAttr("adjoint", opts.adjoint); + } + } + } + return new BatchMatrixTriangularSolve(opBuilder.build()); + } + + /** + * @param lower + */ + public static Options lower(Boolean lower) { + return new Options().lower(lower); + } + + /** + * @param adjoint + */ + public static Options adjoint(Boolean adjoint) { + return new Options().adjoint(adjoint); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BatchMatrixTriangularSolve(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchSelfAdjointEig.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchSelfAdjointEig.java new file mode 100644 index 00000000000..2fedef05941 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchSelfAdjointEig.java @@ -0,0 +1,103 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code e()} output + */ +@Operator(group = "linalg") +public final class BatchSelfAdjointEig extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.BatchSelfAdjointEig} + */ + public static class Options { + + /** + * @param computeV + */ + public Options computeV(Boolean computeV) { + this.computeV = computeV; + return this; + } + + private Boolean computeV; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchSelfAdjointEig operation. + * + * @param scope current scope + * @param input + * @param options carries optional attributes values + * @return a new instance of BatchSelfAdjointEig + */ + public static BatchSelfAdjointEig create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchSelfAdjointEigV2", scope.makeOpName("BatchSelfAdjointEig")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.computeV != null) { + opBuilder.setAttr("compute_v", opts.computeV); + } + } + } + return new BatchSelfAdjointEig(opBuilder.build()); + } + + /** + * @param computeV + */ + public static Options computeV(Boolean computeV) { + return new Options().computeV(computeV); + } + + /** + */ + public Output e() { + return e; + } + + /** + */ + public Output v() { + return v; + } + + private Output e; + private Output v; + + private BatchSelfAdjointEig(Operation operation) { + super(operation); + int outputIdx = 0; + e = operation.output(outputIdx++); + v = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchSvd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchSvd.java new file mode 100644 index 00000000000..44f6f3ddd21 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/BatchSvd.java @@ -0,0 +1,130 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * @param data type for {@code s()} output + */ +@Operator(group = "linalg") +public final class BatchSvd extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.BatchSvd} + */ + public static class Options { + + /** + * @param computeUv + */ + public Options computeUv(Boolean computeUv) { + this.computeUv = computeUv; + return this; + } + + /** + * @param fullMatrices + */ + public Options fullMatrices(Boolean fullMatrices) { + this.fullMatrices = fullMatrices; + return this; + } + + private Boolean computeUv; + private Boolean fullMatrices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BatchSvd operation. + * + * @param scope current scope + * @param input + * @param options carries optional attributes values + * @return a new instance of BatchSvd + */ + public static BatchSvd create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchSvd", scope.makeOpName("BatchSvd")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.computeUv != null) { + opBuilder.setAttr("compute_uv", opts.computeUv); + } + if (opts.fullMatrices != null) { + opBuilder.setAttr("full_matrices", opts.fullMatrices); + } + } + } + return new BatchSvd(opBuilder.build()); + } + + /** + * @param computeUv + */ + public static Options computeUv(Boolean computeUv) { + return new Options().computeUv(computeUv); + } + + /** + * @param fullMatrices + */ + public static Options fullMatrices(Boolean fullMatrices) { + return new Options().fullMatrices(fullMatrices); + } + + /** + */ + public Output s() { + return s; + } + + /** + */ + public Output u() { + return u; + } + + /** + */ + public Output v() { + return v; + } + + private Output s; + private Output u; + private Output v; + + private BatchSvd(Operation operation) { + super(operation); + int outputIdx = 0; + s = operation.output(outputIdx++); + u = operation.output(outputIdx++); + v = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Cholesky.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Cholesky.java new file mode 100644 index 00000000000..a9dfac5eb9c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Cholesky.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the Cholesky decomposition of one or more square matrices. + *

              + * The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions + * form square matrices. + *

              + * The input has to be symmetric and positive definite. Only the lower-triangular + * part of the input will be used for this operation. The upper-triangular part + * will not be read. + *

              + * The output is a tensor of the same shape as the input + * containing the Cholesky decompositions for all input submatrices `[..., :, :]`. + *

              + * Note: The gradient computation on GPU is faster for large matrices but + * not for large batch dimensions when the submatrices are small. In this + * case it might be faster to use the CPU. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class Cholesky extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Cholesky operation. + * + * @param scope current scope + * @param input Shape is `[..., M, M]`. + * @return a new instance of Cholesky + */ + public static Cholesky create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("Cholesky", scope.makeOpName("Cholesky")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Cholesky(opBuilder.build()); + } + + /** + * Shape is `[..., M, M]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Cholesky(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/CholeskyGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/CholeskyGrad.java new file mode 100644 index 00000000000..1f979fd7186 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/CholeskyGrad.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the reverse mode backpropagated gradient of the Cholesky algorithm. + *

              + * For an explanation see "Differentiation of the Cholesky algorithm" by + * Iain Murray http://arxiv.org/abs/1602.07527. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class CholeskyGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CholeskyGrad operation. + * + * @param scope current scope + * @param l Output of batch Cholesky algorithm l = cholesky(A). Shape is `[..., M, M]`. + * Algorithm depends only on lower triangular part of the innermost matrices of + * this tensor. + * @param grad df/dl where f is some scalar function. Shape is `[..., M, M]`. + * Algorithm depends only on lower triangular part of the innermost matrices of + * this tensor. + * @return a new instance of CholeskyGrad + */ + public static CholeskyGrad create(Scope scope, Operand l, Operand grad) { + OperationBuilder opBuilder = scope.env().opBuilder("CholeskyGrad", scope.makeOpName("CholeskyGrad")); + opBuilder.addInput(l.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new CholeskyGrad(opBuilder.build()); + } + + /** + * Symmetrized version of df/dA . Shape is `[..., M, M]` + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CholeskyGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/ConjugateTranspose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/ConjugateTranspose.java new file mode 100644 index 00000000000..06565abc2e3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/ConjugateTranspose.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Shuffle dimensions of x according to a permutation and conjugate the result. + *

              + * The output `y` has the same rank as `x`. The shapes of `x` and `y` satisfy: + * `y.shape[i] == x.shape[perm[i]] for i in [0, 1, ..., rank(x) - 1]` + * `y[i,j,k,...,s,t,u] == conj(x[perm[i], perm[j], perm[k],...,perm[s], perm[t], perm[u]])` + * + * @param data type for {@code y()} output + */ +@Operator(group = "linalg") +public final class ConjugateTranspose extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ConjugateTranspose operation. + * + * @param scope current scope + * @param x + * @param perm + * @return a new instance of ConjugateTranspose + */ + public static ConjugateTranspose create(Scope scope, Operand x, Operand perm) { + OperationBuilder opBuilder = scope.env().opBuilder("ConjugateTranspose", scope.makeOpName("ConjugateTranspose")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(perm.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ConjugateTranspose(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private ConjugateTranspose(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Cross.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Cross.java new file mode 100644 index 00000000000..70cfeb6e7e9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Cross.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the pairwise cross product. + *

              + * `a` and `b` must be the same shape; they can either be simple 3-element vectors, + * or any shape where the innermost dimension is 3. In the latter case, each pair + * of corresponding 3-element vectors is cross-multiplied independently. + * + * @param data type for {@code product()} output + */ +@Operator(group = "linalg") +public final class Cross extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Cross operation. + * + * @param scope current scope + * @param a A tensor containing 3-element vectors. + * @param b Another tensor, of same type and shape as `a`. + * @return a new instance of Cross + */ + public static Cross create(Scope scope, Operand a, Operand b) { + OperationBuilder opBuilder = scope.env().opBuilder("Cross", scope.makeOpName("Cross")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Cross(opBuilder.build()); + } + + /** + * Pairwise cross product of the vectors in `a` and `b`. + */ + public Output product() { + return product; + } + + @Override + public Output asOutput() { + return product; + } + + private Output product; + + private Cross(Operation operation) { + super(operation); + int outputIdx = 0; + product = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Det.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Det.java new file mode 100644 index 00000000000..d0a60453e07 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Det.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the determinant of one or more square matrices. + *

              + * The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions + * form square matrices. The output is a tensor containing the determinants + * for all input submatrices `[..., :, :]`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class Det extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Det operation. + * + * @param scope current scope + * @param input Shape is `[..., M, M]`. + * @return a new instance of Det + */ + public static Det create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixDeterminant", scope.makeOpName("Det")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Det(opBuilder.build()); + } + + /** + * Shape is `[...]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Det(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Diag.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Diag.java new file mode 100644 index 00000000000..6159b185349 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Diag.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a batched diagonal tensor with a given batched diagonal values. + *

              + * Given a `diagonal`, this operation returns a tensor with the `diagonal` and + * everything else padded with zeros. The diagonal is computed as follows: + *

              + * Assume `diagonal` has `k` dimensions `[I, J, K, ..., N]`, then the output is a + * tensor of rank `k+1` with dimensions [I, J, K, ..., N, N]` where: + *

              + * `output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]`. + *

              + * For example: + *

              {@code
              + * # 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]]
              + * 
              + * and diagonal.shape = (2, 4)
              + * 
              + * tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0]
              + *                                      [0, 2, 0, 0]
              + *                                      [0, 0, 3, 0]
              + *                                      [0, 0, 0, 4]],
              + *                                     [[5, 0, 0, 0]
              + *                                      [0, 6, 0, 0]
              + *                                      [0, 0, 7, 0]
              + *                                      [0, 0, 0, 8]]]
              + * 
              + * which has shape (2, 4, 4)
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class Diag extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Diag operation. + * + * @param scope current scope + * @param diagonal Rank `k`, where `k >= 1`. + * @return a new instance of Diag + */ + public static Diag create(Scope scope, Operand diagonal) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixDiag", scope.makeOpName("Diag")); + opBuilder.addInput(diagonal.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Diag(opBuilder.build()); + } + + /** + * Rank `k+1`, with `output.shape = diagonal.shape + [diagonal.shape[-1]]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Diag(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/DiagPart.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/DiagPart.java new file mode 100644 index 00000000000..100dba246c4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/DiagPart.java @@ -0,0 +1,99 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the batched diagonal part of a batched tensor. + *

              + * This operation returns a tensor with the `diagonal` part + * of the batched `input`. The `diagonal` part is computed as follows: + *

              + * Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a + * tensor of rank `k - 1` with dimensions `[I, J, K, ..., min(M, N)]` where: + *

              + * `diagonal[i, j, k, ..., n] = input[i, j, k, ..., n, n]`. + *

              + * The input must be at least a matrix. + *

              + * For example: + *

              {@code
              + * # 'input' is [[[1, 0, 0, 0]
              + *                [0, 2, 0, 0]
              + *                [0, 0, 3, 0]
              + *                [0, 0, 0, 4]],
              + *               [[5, 0, 0, 0]
              + *                [0, 6, 0, 0]
              + *                [0, 0, 7, 0]
              + *                [0, 0, 0, 8]]]
              + * 
              + * and input.shape = (2, 4, 4)
              + * 
              + * tf.matrix_diag_part(input) ==> [[1, 2, 3, 4], [5, 6, 7, 8]]
              + * 
              + * which has shape (2, 4)
              + * }
              + * + * + * @param data type for {@code diagonal()} output + */ +@Operator(group = "linalg") +public final class DiagPart extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DiagPart operation. + * + * @param scope current scope + * @param input Rank `k` tensor where `k >= 2`. + * @return a new instance of DiagPart + */ + public static DiagPart create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixDiagPart", scope.makeOpName("DiagPart")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DiagPart(opBuilder.build()); + } + + /** + * The extracted diagonal(s) having shape + * `diagonal.shape = input.shape[:-2] + [min(input.shape[-2:])]`. + */ + public Output diagonal() { + return diagonal; + } + + @Override + public Output asOutput() { + return diagonal; + } + + private Output diagonal; + + private DiagPart(Operation operation) { + super(operation); + int outputIdx = 0; + diagonal = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Inv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Inv.java new file mode 100644 index 00000000000..6a8f751956c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Inv.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the inverse of one or more square invertible matrices or their + *

              + * adjoints (conjugate transposes). + *

              + * The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions + * form square matrices. The output is a tensor of the same shape as the input + * containing the inverse for all input submatrices `[..., :, :]`. + *

              + * The op uses LU decomposition with partial pivoting to compute the inverses. + *

              + * If a matrix is not invertible there is no guarantee what the op does. It + * may detect the condition and raise an exception or it may simply return a + * garbage result. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class Inv extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.Inv} + */ + public static class Options { + + /** + * @param adjoint + */ + public Options adjoint(Boolean adjoint) { + this.adjoint = adjoint; + return this; + } + + private Boolean adjoint; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Inv operation. + * + * @param scope current scope + * @param input Shape is `[..., M, M]`. + * @param options carries optional attributes values + * @return a new instance of Inv + */ + public static Inv create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixInverse", scope.makeOpName("Inv")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.adjoint != null) { + opBuilder.setAttr("adjoint", opts.adjoint); + } + } + } + return new Inv(opBuilder.build()); + } + + /** + * @param adjoint + */ + public static Options adjoint(Boolean adjoint) { + return new Options().adjoint(adjoint); + } + + /** + * Shape is `[..., M, M]`. + *

              + * @compatibility(numpy) + * Equivalent to np.linalg.inv + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Inv(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/LoadAndRemapMatrix.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/LoadAndRemapMatrix.java new file mode 100644 index 00000000000..6643022a7de --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/LoadAndRemapMatrix.java @@ -0,0 +1,167 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Loads a 2-D (matrix) `Tensor` with name `old_tensor_name` from the checkpoint + *

              + * at `ckpt_path` and potentially reorders its rows and columns using the + * specified remappings. + *

              + * Most users should use one of the wrapper initializers (such as + * `tf.contrib.framework.load_and_remap_matrix_initializer`) instead of this + * function directly. + *

              + * The remappings are 1-D tensors with the following properties: + *

                + *
              • + * `row_remapping` must have exactly `num_rows` entries. Row `i` of the output + * matrix will be initialized from the row corresponding to index + * `row_remapping[i]` in the old `Tensor` from the checkpoint. + *
              • + *
              • + * `col_remapping` must have either 0 entries (indicating that no column + * reordering is needed) or `num_cols` entries. If specified, column `j` of the + * output matrix will be initialized from the column corresponding to index + * `col_remapping[j]` in the old `Tensor` from the checkpoint. + *
              • + *
              • + * A value of -1 in either of the remappings signifies a "missing" entry. In that + * case, values from the `initializing_values` tensor will be used to fill that + * missing row or column. If `row_remapping` has `r` missing entries and + * `col_remapping` has `c` missing entries, then the following condition must be + * true: + *
              • + *
              + * `(r * num_cols) + (c * num_rows) - (r * c) == len(initializing_values)` + *

              + * The remapping tensors can be generated using the GenerateVocabRemapping op. + *

              + * As an example, with row_remapping = [1, 0, -1], col_remapping = [0, 2, -1], + * initializing_values = [0.5, -0.5, 0.25, -0.25, 42], and w(i, j) representing + * the value from row i, column j of the old tensor in the checkpoint, the output + * matrix will look like the following: + *

              + * [[w(1, 0), w(1, 2), 0.5], + * [w(0, 0), w(0, 2), -0.5], + * [0.25, -0.25, 42]] + */ +@Operator(group = "linalg") +public final class LoadAndRemapMatrix extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.LoadAndRemapMatrix} + */ + public static class Options { + + /** + * @param maxRowsInMemory The maximum number of rows to load from the checkpoint at + * once. If less than or equal to 0, the entire matrix will be loaded into + * memory. Setting this arg trades increased disk reads for lower memory usage. + */ + public Options maxRowsInMemory(Long maxRowsInMemory) { + this.maxRowsInMemory = maxRowsInMemory; + return this; + } + + private Long maxRowsInMemory; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LoadAndRemapMatrix operation. + * + * @param scope current scope + * @param ckptPath Path to the TensorFlow checkpoint (version 2, `TensorBundle`) from + * which the old matrix `Tensor` will be loaded. + * @param oldTensorName Name of the 2-D `Tensor` to load from checkpoint. + * @param rowRemapping An int `Tensor` of row remappings (generally created by + * `generate_vocab_remapping`). Even if no row remapping is needed, this must + * still be an index-valued Tensor (e.g. [0, 1, 2, ...]), or a shifted + * index-valued `Tensor` (e.g. [8, 9, 10, ...], for partitioned `Variables`). + * @param colRemapping An int `Tensor` of column remappings (generally created by + * `generate_vocab_remapping`). May be a size-0 `Tensor` if only row remapping + * is to be done (e.g. column ordering is the same). + * @param initializingValues A float `Tensor` containing values to fill in for cells + * in the output matrix that are not loaded from the checkpoint. Length must be + * exactly the same as the number of missing / new cells. + * @param numRows Number of rows (length of the 1st dimension) in the output matrix. + * @param numCols Number of columns (length of the 2nd dimension) in the output matrix. + * @param options carries optional attributes values + * @return a new instance of LoadAndRemapMatrix + */ + public static LoadAndRemapMatrix create(Scope scope, Operand ckptPath, Operand oldTensorName, Operand rowRemapping, Operand colRemapping, Operand initializingValues, Long numRows, Long numCols, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LoadAndRemapMatrix", scope.makeOpName("LoadAndRemapMatrix")); + opBuilder.addInput(ckptPath.asOutput()); + opBuilder.addInput(oldTensorName.asOutput()); + opBuilder.addInput(rowRemapping.asOutput()); + opBuilder.addInput(colRemapping.asOutput()); + opBuilder.addInput(initializingValues.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_rows", numRows); + opBuilder.setAttr("num_cols", numCols); + if (options != null) { + for (Options opts : options) { + if (opts.maxRowsInMemory != null) { + opBuilder.setAttr("max_rows_in_memory", opts.maxRowsInMemory); + } + } + } + return new LoadAndRemapMatrix(opBuilder.build()); + } + + /** + * @param maxRowsInMemory The maximum number of rows to load from the checkpoint at + * once. If less than or equal to 0, the entire matrix will be loaded into + * memory. Setting this arg trades increased disk reads for lower memory usage. + */ + public static Options maxRowsInMemory(Long maxRowsInMemory) { + return new Options().maxRowsInMemory(maxRowsInMemory); + } + + /** + * Output matrix containing existing values loaded from the + * checkpoint, and with any missing values filled in from initializing_values. + */ + public Output outputMatrix() { + return outputMatrix; + } + + @Override + public Output asOutput() { + return outputMatrix; + } + + private Output outputMatrix; + + private LoadAndRemapMatrix(Operation operation) { + super(operation); + int outputIdx = 0; + outputMatrix = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/LogMatrixDeterminant.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/LogMatrixDeterminant.java new file mode 100644 index 00000000000..c82abd696b5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/LogMatrixDeterminant.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sign and the log of the absolute value of the determinant of + *

              + * one or more square matrices. + *

              + * The input is a tensor of shape `[N, M, M]` whose inner-most 2 dimensions + * form square matrices. The outputs are two tensors containing the signs and + * absolute values of the log determinants for all N input submatrices + * `[..., :, :]` such that the determinant = sign*exp(log_abs_determinant). + * The log_abs_determinant is computed as det(P)*sum(log(diag(LU))) where LU + * is the LU decomposition of the input and P is the corresponding + * permutation matrix. + * + * @param data type for {@code sign()} output + */ +@Operator(group = "linalg") +public final class LogMatrixDeterminant extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new LogMatrixDeterminant operation. + * + * @param scope current scope + * @param input Shape is `[N, M, M]`. + * @return a new instance of LogMatrixDeterminant + */ + public static LogMatrixDeterminant create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("LogMatrixDeterminant", scope.makeOpName("LogMatrixDeterminant")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LogMatrixDeterminant(opBuilder.build()); + } + + /** + * The signs of the log determinants of the inputs. Shape is `[N]`. + */ + public Output sign() { + return sign; + } + + /** + * The logs of the absolute values of the determinants + * of the N input matrices. Shape is `[N]`. + */ + public Output logAbsDeterminant() { + return logAbsDeterminant; + } + + private Output sign; + private Output logAbsDeterminant; + + private LogMatrixDeterminant(Operation operation) { + super(operation); + int outputIdx = 0; + sign = operation.output(outputIdx++); + logAbsDeterminant = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatMul.java new file mode 100644 index 00000000000..fdf59686f39 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatMul.java @@ -0,0 +1,131 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Multiply the matrix "a" by the matrix "b". + *

              + * The inputs must be two-dimensional matrices and the inner dimension of + * "a" (after being transposed if transpose_a is true) must match the + * outer dimension of "b" (after being transposed if transposed_b is + * true). + *

              + * Note: The default kernel implementation for MatMul on GPUs uses + * cublas. + * + * @param data type for {@code product()} output + */ +@Operator(group = "linalg") +public final class MatMul extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.MatMul} + */ + public static class Options { + + /** + * @param transposeA If true, "a" is transposed before multiplication. + */ + public Options transposeA(Boolean transposeA) { + this.transposeA = transposeA; + return this; + } + + /** + * @param transposeB If true, "b" is transposed before multiplication. + */ + public Options transposeB(Boolean transposeB) { + this.transposeB = transposeB; + return this; + } + + private Boolean transposeA; + private Boolean transposeB; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MatMul operation. + * + * @param scope current scope + * @param a + * @param b + * @param options carries optional attributes values + * @return a new instance of MatMul + */ + public static MatMul create(Scope scope, Operand a, Operand b, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MatMul", scope.makeOpName("MatMul")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.transposeA != null) { + opBuilder.setAttr("transpose_a", opts.transposeA); + } + if (opts.transposeB != null) { + opBuilder.setAttr("transpose_b", opts.transposeB); + } + } + } + return new MatMul(opBuilder.build()); + } + + /** + * @param transposeA If true, "a" is transposed before multiplication. + */ + public static Options transposeA(Boolean transposeA) { + return new Options().transposeA(transposeA); + } + + /** + * @param transposeB If true, "b" is transposed before multiplication. + */ + public static Options transposeB(Boolean transposeB) { + return new Options().transposeB(transposeB); + } + + /** + */ + public Output product() { + return product; + } + + @Override + public Output asOutput() { + return product; + } + + private Output product; + + private MatMul(Operation operation) { + super(operation); + int outputIdx = 0; + product = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatrixLogarithm.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatrixLogarithm.java new file mode 100644 index 00000000000..9171c78147a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatrixLogarithm.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the matrix logarithm of one or more square matrices: + *

              + * + * \\(log(exp(A)) = A\\) + *

              + * This op is only defined for complex matrices. If A is positive-definite and + * real, then casting to a complex matrix, taking the logarithm and casting back + * to a real matrix will give the correct result. + *

              + * This function computes the matrix logarithm using the Schur-Parlett algorithm. + * Details of the algorithm can be found in Section 11.6.2 of: + * Nicholas J. Higham, Functions of Matrices: Theory and Computation, SIAM 2008. + * ISBN 978-0-898716-46-7. + *

              + * The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions + * form square matrices. The output is a tensor of the same shape as the input + * containing the exponential for all input submatrices `[..., :, :]`. + * + * @param data type for {@code output()} output + */ +public final class MatrixLogarithm extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MatrixLogarithm operation. + * + * @param scope current scope + * @param input Shape is `[..., M, M]`. + * @return a new instance of MatrixLogarithm + */ + public static MatrixLogarithm create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixLogarithm", scope.makeOpName("MatrixLogarithm")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MatrixLogarithm(opBuilder.build()); + } + + /** + * Shape is `[..., M, M]`. + *

              + * @compatibility(scipy) + * Equivalent to scipy.linalg.logm + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MatrixLogarithm(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatrixSolveLs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatrixSolveLs.java new file mode 100644 index 00000000000..10ed9f76b12 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/MatrixSolveLs.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Solves one or more linear least-squares problems. + *

              + * `matrix` is a tensor of shape `[..., M, N]` whose inner-most 2 dimensions + * form real or complex matrices of size `[M, N]`. `Rhs` is a tensor of the same + * type as `matrix` and shape `[..., M, K]`. + * The output is a tensor shape `[..., N, K]` where each output matrix solves + * each of the equations + * `matrix[..., :, :]` * `output[..., :, :]` = `rhs[..., :, :]` + * in the least squares sense. + *

              + * We use the following notation for (complex) matrix and right-hand sides + * in the batch: + *

              + * `matrix`=\\(A \in \mathbb{C}^{m \times n}\\), + * `rhs`=\\(B \in \mathbb{C}^{m \times k}\\), + * `output`=\\(X \in \mathbb{C}^{n \times k}\\), + * `l2_regularizer`=\\(\lambda \in \mathbb{R}\\). + *

              + * If `fast` is `True`, then the solution is computed by solving the normal + * equations using Cholesky decomposition. Specifically, if \\(m \ge n\\) then + * \\(X = (A^H A + \lambda I)^{-1} A^H B\\), which solves the least-squares + * problem \\(X = \mathrm{argmin}_{Z \in \Re^{n \times k} } ||A Z - B||_F^2 + \lambda ||Z||_F^2\\). + * If \\(m \lt n\\) then `output` is computed as + * \\(X = A^H (A A^H + \lambda I)^{-1} B\\), which (for \\(\lambda = 0\\)) is the + * minimum-norm solution to the under-determined linear system, i.e. + * \\(X = \mathrm{argmin}_{Z \in \mathbb{C}^{n \times k} } ||Z||_F^2 \\), + * subject to \\(A Z = B\\). Notice that the fast path is only numerically stable + * when \\(A\\) is numerically full rank and has a condition number + * \\(\mathrm{cond}(A) \lt \frac{1}{\sqrt{\epsilon_{mach} } }\\) or \\(\lambda\\) is + * sufficiently large. + *

              + * If `fast` is `False` an algorithm based on the numerically robust complete + * orthogonal decomposition is used. This computes the minimum-norm + * least-squares solution, even when \\(A\\) is rank deficient. This path is + * typically 6-7 times slower than the fast path. If `fast` is `False` then + * `l2_regularizer` is ignored. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class MatrixSolveLs extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.MatrixSolveLs} + */ + public static class Options { + + /** + * @param fast + */ + public Options fast(Boolean fast) { + this.fast = fast; + return this; + } + + private Boolean fast; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MatrixSolveLs operation. + * + * @param scope current scope + * @param matrix Shape is `[..., M, N]`. + * @param rhs Shape is `[..., M, K]`. + * @param l2Regularizer Scalar tensor. + *

              + * @compatibility(numpy) + * Equivalent to np.linalg.lstsq + * @end_compatibility + * @param options carries optional attributes values + * @return a new instance of MatrixSolveLs + */ + public static MatrixSolveLs create(Scope scope, Operand matrix, Operand rhs, Operand l2Regularizer, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixSolveLs", scope.makeOpName("MatrixSolveLs")); + opBuilder.addInput(matrix.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder.addInput(l2Regularizer.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.fast != null) { + opBuilder.setAttr("fast", opts.fast); + } + } + } + return new MatrixSolveLs(opBuilder.build()); + } + + /** + * @param fast + */ + public static Options fast(Boolean fast) { + return new Options().fast(fast); + } + + /** + * Shape is `[..., N, K]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MatrixSolveLs(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Qr.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Qr.java new file mode 100644 index 00000000000..6ca481b723c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Qr.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the QR decompositions of one or more matrices. + *

              + * Computes the QR decomposition of each inner matrix in `tensor` such that + * `tensor[..., :, :] = q[..., :, :] * r[..., :,:])` + *

              {@code
              + * # a is a tensor.
              + * # q is a tensor of orthonormal matrices.
              + * # r is a tensor of upper triangular matrices.
              + * q, r = qr(a)
              + * q_full, r_full = qr(a, full_matrices=True)
              + * }
              + * + * + * @param data type for {@code q()} output + */ +@Operator(group = "linalg") +public final class Qr extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.Qr} + */ + public static class Options { + + /** + * @param fullMatrices If true, compute full-sized `q` and `r`. If false + * (the default), compute only the leading `P` columns of `q`. + */ + public Options fullMatrices(Boolean fullMatrices) { + this.fullMatrices = fullMatrices; + return this; + } + + private Boolean fullMatrices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Qr operation. + * + * @param scope current scope + * @param input A tensor of shape `[..., M, N]` whose inner-most 2 dimensions + * form matrices of size `[M, N]`. Let `P` be the minimum of `M` and `N`. + * @param options carries optional attributes values + * @return a new instance of Qr + */ + public static Qr create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Qr", scope.makeOpName("Qr")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.fullMatrices != null) { + opBuilder.setAttr("full_matrices", opts.fullMatrices); + } + } + } + return new Qr(opBuilder.build()); + } + + /** + * @param fullMatrices If true, compute full-sized `q` and `r`. If false + * (the default), compute only the leading `P` columns of `q`. + */ + public static Options fullMatrices(Boolean fullMatrices) { + return new Options().fullMatrices(fullMatrices); + } + + /** + * Orthonormal basis for range of `a`. If `full_matrices` is `False` then + * shape is `[..., M, P]`; if `full_matrices` is `True` then shape is + * `[..., M, M]`. + */ + public Output q() { + return q; + } + + /** + * Triangular factor. If `full_matrices` is `False` then shape is + * `[..., P, N]`. If `full_matrices` is `True` then shape is `[..., M, N]`. + */ + public Output r() { + return r; + } + + private Output q; + private Output r; + + private Qr(Operation operation) { + super(operation); + int outputIdx = 0; + q = operation.output(outputIdx++); + r = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMul.java new file mode 100644 index 00000000000..753c4e48276 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMul.java @@ -0,0 +1,155 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Perform a quantized matrix multiplication of `a` by the matrix `b`. + *

              + * The inputs must be two-dimensional matrices and the inner dimension of + * `a` (after being transposed if `transpose_a` is non-zero) must match the + * outer dimension of `b` (after being transposed if `transposed_b` is + * non-zero). + * + * @param data type for {@code out()} output + */ +@Operator(group = "linalg") +public final class QuantizedMatMul extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.QuantizedMatMul} + */ + public static class Options { + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public Options transposeA(Boolean transposeA) { + this.transposeA = transposeA; + return this; + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public Options transposeB(Boolean transposeB) { + this.transposeB = transposeB; + return this; + } + + private Boolean transposeA; + private Boolean transposeB; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedMatMul operation. + * + * @param scope current scope + * @param a Must be a two-dimensional tensor. + * @param b Must be a two-dimensional tensor. + * @param minA The float value that the lowest quantized `a` value represents. + * @param maxA The float value that the highest quantized `a` value represents. + * @param minB The float value that the lowest quantized `b` value represents. + * @param maxB The float value that the highest quantized `b` value represents. + * @param Toutput + * @param Tactivation The type of output produced by activation function + * following this operation. + * @param options carries optional attributes values + * @return a new instance of QuantizedMatMul + */ + public static QuantizedMatMul create(Scope scope, Operand a, Operand b, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Class Tactivation, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMul", scope.makeOpName("QuantizedMatMul")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder.addInput(minA.asOutput()); + opBuilder.addInput(maxA.asOutput()); + opBuilder.addInput(minB.asOutput()); + opBuilder.addInput(maxB.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Toutput", DataType.fromClass(Toutput)); + opBuilder.setAttr("Tactivation", DataType.fromClass(Tactivation)); + if (options != null) { + for (Options opts : options) { + if (opts.transposeA != null) { + opBuilder.setAttr("transpose_a", opts.transposeA); + } + if (opts.transposeB != null) { + opBuilder.setAttr("transpose_b", opts.transposeB); + } + } + } + return new QuantizedMatMul(opBuilder.build()); + } + + /** + * @param transposeA If true, `a` is transposed before multiplication. + */ + public static Options transposeA(Boolean transposeA) { + return new Options().transposeA(transposeA); + } + + /** + * @param transposeB If true, `b` is transposed before multiplication. + */ + public static Options transposeB(Boolean transposeB) { + return new Options().transposeB(transposeB); + } + + /** + */ + public Output out() { + return out; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOut() { + return minOut; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOut() { + return maxOut; + } + + private Output out; + private Output minOut; + private Output maxOut; + + private QuantizedMatMul(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + minOut = operation.output(outputIdx++); + maxOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/SelfAdjointEig.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/SelfAdjointEig.java new file mode 100644 index 00000000000..6494ad579cc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/SelfAdjointEig.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the eigen decomposition of one or more square self-adjoint matrices. + *

              + * Computes the eigenvalues and (optionally) eigenvectors of each inner matrix in + * `input` such that `input[..., :, :] = v[..., :, :] * diag(e[..., :])`. The eigenvalues + * are sorted in non-decreasing order. + *

              {@code
              + * # a is a tensor.
              + * # e is a tensor of eigenvalues.
              + * # v is a tensor of eigenvectors.
              + * e, v = self_adjoint_eig(a)
              + * e = self_adjoint_eig(a, compute_v=False)
              + * }
              + * + * + * @param data type for {@code e()} output + */ +@Operator(group = "linalg") +public final class SelfAdjointEig extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.SelfAdjointEig} + */ + public static class Options { + + /** + * @param computeV If `True` then eigenvectors will be computed and returned in `v`. + * Otherwise, only the eigenvalues will be computed. + */ + public Options computeV(Boolean computeV) { + this.computeV = computeV; + return this; + } + + private Boolean computeV; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SelfAdjointEig operation. + * + * @param scope current scope + * @param input `Tensor` input of shape `[N, N]`. + * @param options carries optional attributes values + * @return a new instance of SelfAdjointEig + */ + public static SelfAdjointEig create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SelfAdjointEigV2", scope.makeOpName("SelfAdjointEig")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.computeV != null) { + opBuilder.setAttr("compute_v", opts.computeV); + } + } + } + return new SelfAdjointEig(opBuilder.build()); + } + + /** + * @param computeV If `True` then eigenvectors will be computed and returned in `v`. + * Otherwise, only the eigenvalues will be computed. + */ + public static Options computeV(Boolean computeV) { + return new Options().computeV(computeV); + } + + /** + * Eigenvalues. Shape is `[N]`. + */ + public Output e() { + return e; + } + + /** + * Eigenvectors. Shape is `[N, N]`. + */ + public Output v() { + return v; + } + + private Output e; + private Output v; + + private SelfAdjointEig(Operation operation) { + super(operation); + int outputIdx = 0; + e = operation.output(outputIdx++); + v = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/SetDiag.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/SetDiag.java new file mode 100644 index 00000000000..b3d6f494270 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/SetDiag.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a batched matrix tensor with new batched diagonal values. + *

              + * Given `input` and `diagonal`, this operation returns a tensor with the + * same shape and values as `input`, except for the main diagonal of the + * innermost matrices. These will be overwritten by the values in `diagonal`. + *

              + * The output is computed as follows: + *

              + * Assume `input` has `k+1` dimensions `[I, J, K, ..., M, N]` and `diagonal` has + * `k` dimensions `[I, J, K, ..., min(M, N)]`. Then the output is a + * tensor of rank `k+1` with dimensions `[I, J, K, ..., M, N]` where: + *

              + * * `output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]` for `m == n`. + * * `output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]` for `m != n`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class SetDiag extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SetDiag operation. + * + * @param scope current scope + * @param input Rank `k+1`, where `k >= 1`. + * @param diagonal Rank `k`, where `k >= 1`. + * @return a new instance of SetDiag + */ + public static SetDiag create(Scope scope, Operand input, Operand diagonal) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixSetDiag", scope.makeOpName("SetDiag")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(diagonal.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SetDiag(opBuilder.build()); + } + + /** + * Rank `k+1`, with `output.shape = input.shape`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SetDiag(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Solve.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Solve.java new file mode 100644 index 00000000000..0d4e2a2313e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Solve.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Solves systems of linear equations. + *

              + * `Matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions + * form square matrices. `Rhs` is a tensor of shape `[..., M, K]`. The `output` is + * a tensor shape `[..., M, K]`. If `adjoint` is `False` then each output matrix + * satisfies `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. + * If `adjoint` is `True` then each output matrix satisfies + * `adjoint(matrix[..., :, :]) * output[..., :, :] = rhs[..., :, :]`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class Solve extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.Solve} + */ + public static class Options { + + /** + * @param adjoint Boolean indicating whether to solve with `matrix` or its (block-wise) + * adjoint. + */ + public Options adjoint(Boolean adjoint) { + this.adjoint = adjoint; + return this; + } + + private Boolean adjoint; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Solve operation. + * + * @param scope current scope + * @param matrix Shape is `[..., M, M]`. + * @param rhs Shape is `[..., M, K]`. + * @param options carries optional attributes values + * @return a new instance of Solve + */ + public static Solve create(Scope scope, Operand matrix, Operand rhs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixSolve", scope.makeOpName("Solve")); + opBuilder.addInput(matrix.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.adjoint != null) { + opBuilder.setAttr("adjoint", opts.adjoint); + } + } + } + return new Solve(opBuilder.build()); + } + + /** + * @param adjoint Boolean indicating whether to solve with `matrix` or its (block-wise) + * adjoint. + */ + public static Options adjoint(Boolean adjoint) { + return new Options().adjoint(adjoint); + } + + /** + * Shape is `[..., M, K]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Solve(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Sqrtm.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Sqrtm.java new file mode 100644 index 00000000000..9aded4b6445 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Sqrtm.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the matrix square root of one or more square matrices: + *

              + * matmul(sqrtm(A), sqrtm(A)) = A + *

              + * The input matrix should be invertible. If the input matrix is real, it should + * have no eigenvalues which are real and negative (pairs of complex conjugate + * eigenvalues are allowed). + *

              + * The matrix square root is computed by first reducing the matrix to + * quasi-triangular form with the real Schur decomposition. The square root + * of the quasi-triangular matrix is then computed directly. Details of + * the algorithm can be found in: Nicholas J. Higham, "Computing real + * square roots of a real matrix", Linear Algebra Appl., 1987. + *

              + * The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions + * form square matrices. The output is a tensor of the same shape as the input + * containing the matrix square root for all input submatrices `[..., :, :]`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class Sqrtm extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Sqrtm operation. + * + * @param scope current scope + * @param input Shape is `[..., M, M]`. + * @return a new instance of Sqrtm + */ + public static Sqrtm create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixSquareRoot", scope.makeOpName("Sqrtm")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Sqrtm(opBuilder.build()); + } + + /** + * Shape is `[..., M, M]`. + *

              + * @compatibility(scipy) + * Equivalent to scipy.linalg.sqrtm + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Sqrtm(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Svd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Svd.java new file mode 100644 index 00000000000..0d33687fd06 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Svd.java @@ -0,0 +1,160 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the singular value decompositions of one or more matrices. + *

              + * Computes the SVD of each inner matrix in `input` such that + * `input[..., :, :] = u[..., :, :] * diag(s[..., :, :]) * transpose(v[..., :, :])` + *

              {@code
              + * # a is a tensor containing a batch of matrices.
              + * # s is a tensor of singular values for each matrix.
              + * # u is the tensor containing of left singular vectors for each matrix.
              + * # v is the tensor containing of right singular vectors for each matrix.
              + * s, u, v = svd(a)
              + * s, _, _ = svd(a, compute_uv=False)
              + * }
              + * + * + * @param data type for {@code s()} output + */ +@Operator(group = "linalg") +public final class Svd extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.Svd} + */ + public static class Options { + + /** + * @param computeUv If true, left and right singular vectors will be + * computed and returned in `u` and `v`, respectively. + * If false, `u` and `v` are not set and should never referenced. + */ + public Options computeUv(Boolean computeUv) { + this.computeUv = computeUv; + return this; + } + + /** + * @param fullMatrices If true, compute full-sized `u` and `v`. If false + * (the default), compute only the leading `P` singular vectors. + * Ignored if `compute_uv` is `False`. + */ + public Options fullMatrices(Boolean fullMatrices) { + this.fullMatrices = fullMatrices; + return this; + } + + private Boolean computeUv; + private Boolean fullMatrices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Svd operation. + * + * @param scope current scope + * @param input A tensor of shape `[..., M, N]` whose inner-most 2 dimensions + * form matrices of size `[M, N]`. Let `P` be the minimum of `M` and `N`. + * @param options carries optional attributes values + * @return a new instance of Svd + */ + public static Svd create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Svd", scope.makeOpName("Svd")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.computeUv != null) { + opBuilder.setAttr("compute_uv", opts.computeUv); + } + if (opts.fullMatrices != null) { + opBuilder.setAttr("full_matrices", opts.fullMatrices); + } + } + } + return new Svd(opBuilder.build()); + } + + /** + * @param computeUv If true, left and right singular vectors will be + * computed and returned in `u` and `v`, respectively. + * If false, `u` and `v` are not set and should never referenced. + */ + public static Options computeUv(Boolean computeUv) { + return new Options().computeUv(computeUv); + } + + /** + * @param fullMatrices If true, compute full-sized `u` and `v`. If false + * (the default), compute only the leading `P` singular vectors. + * Ignored if `compute_uv` is `False`. + */ + public static Options fullMatrices(Boolean fullMatrices) { + return new Options().fullMatrices(fullMatrices); + } + + /** + * Singular values. Shape is `[..., P]`. + */ + public Output s() { + return s; + } + + /** + * Left singular vectors. If `full_matrices` is `False` then shape is + * `[..., M, P]`; if `full_matrices` is `True` then shape is + * `[..., M, M]`. Undefined if `compute_uv` is `False`. + */ + public Output u() { + return u; + } + + /** + * Left singular vectors. If `full_matrices` is `False` then shape is + * `[..., N, P]`. If `full_matrices` is `True` then shape is `[..., N, N]`. + * Undefined if `compute_uv` is false. + */ + public Output v() { + return v; + } + + private Output s; + private Output u; + private Output v; + + private Svd(Operation operation) { + super(operation); + int outputIdx = 0; + s = operation.output(outputIdx++); + u = operation.output(outputIdx++); + v = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TensorDiag.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TensorDiag.java new file mode 100644 index 00000000000..0ab6267ee3e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TensorDiag.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns a diagonal tensor with a given diagonal values. + *

              + * Given a `diagonal`, this operation returns a tensor with the `diagonal` and + * everything else padded with zeros. The diagonal is computed as follows: + *

              + * Assume `diagonal` has dimensions [D1,..., Dk], then the output is a tensor of + * rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where: + *

              + * `output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]` and 0 everywhere else. + *

              + * For example: + *

              {@code
              + * # 'diagonal' is [1, 2, 3, 4]
              + * tf.diag(diagonal) ==> [[1, 0, 0, 0]
              + *                        [0, 2, 0, 0]
              + *                        [0, 0, 3, 0]
              + *                        [0, 0, 0, 4]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class TensorDiag extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorDiag operation. + * + * @param scope current scope + * @param diagonal Rank k tensor where k is at most 1. + * @return a new instance of TensorDiag + */ + public static TensorDiag create(Scope scope, Operand diagonal) { + OperationBuilder opBuilder = scope.env().opBuilder("Diag", scope.makeOpName("TensorDiag")); + opBuilder.addInput(diagonal.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorDiag(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TensorDiag(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TensorDiagPart.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TensorDiagPart.java new file mode 100644 index 00000000000..1f3923d1f34 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TensorDiagPart.java @@ -0,0 +1,88 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the diagonal part of the tensor. + *

              + * This operation returns a tensor with the `diagonal` part + * of the `input`. The `diagonal` part is computed as follows: + *

              + * Assume `input` has dimensions `[D1,..., Dk, D1,..., Dk]`, then the output is a + * tensor of rank `k` with dimensions `[D1,..., Dk]` where: + *

              + * `diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik]`. + *

              + * For example: + *

              {@code
              + * # 'input' is [[1, 0, 0, 0]
              + *               [0, 2, 0, 0]
              + *               [0, 0, 3, 0]
              + *               [0, 0, 0, 4]]
              + * 
              + * tf.diag_part(input) ==> [1, 2, 3, 4]
              + * }
              + * + * + * @param data type for {@code diagonal()} output + */ +@Operator(group = "linalg") +public final class TensorDiagPart extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorDiagPart operation. + * + * @param scope current scope + * @param input Rank k tensor where k is even and not zero. + * @return a new instance of TensorDiagPart + */ + public static TensorDiagPart create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("DiagPart", scope.makeOpName("TensorDiagPart")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorDiagPart(opBuilder.build()); + } + + /** + * The extracted diagonal. + */ + public Output diagonal() { + return diagonal; + } + + @Override + public Output asOutput() { + return diagonal; + } + + private Output diagonal; + + private TensorDiagPart(Operation operation) { + super(operation); + int outputIdx = 0; + diagonal = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Transpose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Transpose.java new file mode 100644 index 00000000000..6e13c6de679 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Transpose.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Shuffle dimensions of x according to a permutation. + *

              + * The output `y` has the same rank as `x`. The shapes of `x` and `y` satisfy: + * `y.shape[i] == x.shape[perm[i]] for i in [0, 1, ..., rank(x) - 1]` + * + * @param data type for {@code y()} output + */ +@Operator(group = "linalg") +public final class Transpose extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Transpose operation. + * + * @param scope current scope + * @param x + * @param perm + * @return a new instance of Transpose + */ + public static Transpose create(Scope scope, Operand x, Operand perm) { + OperationBuilder opBuilder = scope.env().opBuilder("Transpose", scope.makeOpName("Transpose")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(perm.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Transpose(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Transpose(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TriangularSolve.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TriangularSolve.java new file mode 100644 index 00000000000..0148449cd3f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/TriangularSolve.java @@ -0,0 +1,181 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.linalg; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Solves systems of linear equations with upper or lower triangular matrices by backsubstitution. + *

              + * + * `matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions form + * square matrices. If `lower` is `True` then the strictly upper triangular part + * of each inner-most matrix is assumed to be zero and not accessed. + * If `lower` is False then the strictly lower triangular part of each inner-most + * matrix is assumed to be zero and not accessed. + * `rhs` is a tensor of shape `[..., M, K]`. + *

              + * The output is a tensor of shape `[..., M, K]`. If `adjoint` is + * `True` then the innermost matrices in `output` satisfy matrix equations + * `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. + * If `adjoint` is `False` then the strictly then the innermost matrices in + * `output` satisfy matrix equations + * `adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j]`. + *

              + * Example: + *

              {@code
              + * a = tf.constant([[3,  0,  0,  0],
              + *                  [2,  1,  0,  0],
              + *                  [1,  0,  1,  0],
              + *                  [1,  1,  1,  1]], dtype=tf.float32)
              + * 
              + * b = tf.constant([[4],
              + *                  [2],
              + *                  [4],
              + *                  [2]], dtype=tf.float32)
              + * 
              + * x = tf.linalg.triangular_solve(a, b, lower=True)
              + * x
              + * # 
              + * 
              + * # in python3 one can use `a@x`
              + * tf.matmul(a, x)
              + * # 
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "linalg") +public final class TriangularSolve extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.linalg.TriangularSolve} + */ + public static class Options { + + /** + * @param lower Boolean indicating whether the innermost matrices in `matrix` are + * lower or upper triangular. + */ + public Options lower(Boolean lower) { + this.lower = lower; + return this; + } + + /** + * @param adjoint Boolean indicating whether to solve with `matrix` or its (block-wise) + * adjoint. + *

              + * @compatibility(numpy) + * Equivalent to scipy.linalg.solve_triangular + * @end_compatibility + */ + public Options adjoint(Boolean adjoint) { + this.adjoint = adjoint; + return this; + } + + private Boolean lower; + private Boolean adjoint; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TriangularSolve operation. + * + * @param scope current scope + * @param matrix Shape is `[..., M, M]`. + * @param rhs Shape is `[..., M, K]`. + * @param options carries optional attributes values + * @return a new instance of TriangularSolve + */ + public static TriangularSolve create(Scope scope, Operand matrix, Operand rhs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MatrixTriangularSolve", scope.makeOpName("TriangularSolve")); + opBuilder.addInput(matrix.asOutput()); + opBuilder.addInput(rhs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.lower != null) { + opBuilder.setAttr("lower", opts.lower); + } + if (opts.adjoint != null) { + opBuilder.setAttr("adjoint", opts.adjoint); + } + } + } + return new TriangularSolve(opBuilder.build()); + } + + /** + * @param lower Boolean indicating whether the innermost matrices in `matrix` are + * lower or upper triangular. + */ + public static Options lower(Boolean lower) { + return new Options().lower(lower); + } + + /** + * @param adjoint Boolean indicating whether to solve with `matrix` or its (block-wise) + * adjoint. + *

              + * @compatibility(numpy) + * Equivalent to scipy.linalg.solve_triangular + * @end_compatibility + */ + public static Options adjoint(Boolean adjoint) { + return new Options().adjoint(adjoint); + } + + /** + * Shape is `[..., M, K]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TriangularSolve(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Abs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Abs.java new file mode 100644 index 00000000000..3048c431d97 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Abs.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the absolute value of a tensor. + *

              + * Given a tensor `x`, this operation returns a tensor containing the absolute + * value of each element in `x`. For example, if x is an input element and y is + * an output element, this operation computes \\(y = |x|\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Abs extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Abs operation. + * + * @param scope current scope + * @param x + * @return a new instance of Abs + */ + public static Abs create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Abs", scope.makeOpName("Abs")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Abs(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Abs(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/AccumulateN.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/AccumulateN.java new file mode 100644 index 00000000000..b71f4c98bf6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/AccumulateN.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the element-wise sum of a list of tensors. + *

              + * `tf.accumulate_n_v2` performs the same operation as `tf.add_n`, but does not + * wait for all of its inputs to be ready before beginning to sum. This can + * save memory if inputs are ready at different times, since minimum temporary + * storage is proportional to the output size rather than the inputs size. + *

              + * Unlike the original `accumulate_n`, `accumulate_n_v2` is differentiable. + *

              + * Returns a `Tensor` of same shape and type as the elements of `inputs`. + * + * @param data type for {@code sum()} output + */ +@Operator(group = "math") +public final class AccumulateN extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AccumulateN operation. + * + * @param scope current scope + * @param inputs A list of `Tensor` objects, each with same shape and type. + * @param shape Shape of elements of `inputs`. + * @return a new instance of AccumulateN + */ + public static AccumulateN create(Scope scope, Iterable> inputs, Shape shape) { + OperationBuilder opBuilder = scope.env().opBuilder("AccumulateNV2", scope.makeOpName("AccumulateN")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("shape", shape); + return new AccumulateN(opBuilder.build()); + } + + /** + */ + public Output sum() { + return sum; + } + + @Override + public Output asOutput() { + return sum; + } + + private Output sum; + + private AccumulateN(Operation operation) { + super(operation); + int outputIdx = 0; + sum = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Acos.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Acos.java new file mode 100644 index 00000000000..719e884301c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Acos.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes acos of x element-wise. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Acos extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Acos operation. + * + * @param scope current scope + * @param x + * @return a new instance of Acos + */ + public static Acos create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Acos", scope.makeOpName("Acos")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Acos(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Acos(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Acosh.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Acosh.java new file mode 100644 index 00000000000..23df29ac673 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Acosh.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes inverse hyperbolic cosine of x element-wise. + *

              + * Given an input tensor, the function computes inverse hyperbolic cosine of every element. + * Input range is `[1, inf]`. It returns `nan` if the input lies outside the range. + *

              {@code
              + * x = tf.constant([-2, -0.5, 1, 1.2, 200, 10000, float("inf")])
              + * tf.math.acosh(x) ==> [nan nan 0. 0.62236255 5.9914584 9.903487 inf]
              + * }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Acosh extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Acosh operation. + * + * @param scope current scope + * @param x + * @return a new instance of Acosh + */ + public static Acosh create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Acosh", scope.makeOpName("Acosh")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Acosh(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Acosh(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Add.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Add.java new file mode 100644 index 00000000000..1bd5be56b53 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Add.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x + y element-wise. + *

              + * NOTE: `math.Add` supports broadcasting. `AddN` does not. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Add extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Add operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Add + */ + public static Add create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Add", scope.makeOpName("Add")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Add(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Add(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/AddN.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/AddN.java new file mode 100644 index 00000000000..550c988228d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/AddN.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Add all input tensors element wise. + *

              + * Inputs must be of same size and shape. + *

              + *

              {@code
              + *   x = [9, 7, 10]
              + *   tf.math.add_n(x) ==> 26
              + *   }
              + * + * + * @param data type for {@code sum()} output + */ +@Operator(group = "math") +public final class AddN extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AddN operation. + * + * @param scope current scope + * @param inputs + * @return a new instance of AddN + */ + public static AddN create(Scope scope, Iterable> inputs) { + OperationBuilder opBuilder = scope.env().opBuilder("AddN", scope.makeOpName("AddN")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AddN(opBuilder.build()); + } + + /** + */ + public Output sum() { + return sum; + } + + @Override + public Output asOutput() { + return sum; + } + + private Output sum; + + private AddN(Operation operation) { + super(operation); + int outputIdx = 0; + sum = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Angle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Angle.java new file mode 100644 index 00000000000..da69b651cb4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Angle.java @@ -0,0 +1,98 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the argument of a complex number. + *

              + * Given a tensor `input` of complex numbers, this operation returns a tensor of + * type `float` that is the argument of each element in `input`. All elements in + * `input` must be complex numbers of the form \\(a + bj\\), where a + * is the real part and b is the imaginary part. + *

              + * The argument returned by this operation is of the form \\(atan2(b, a)\\). + *

              + * For example: + *

              {@code
              + * # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
              + * tf.angle(input) ==> [2.0132, 1.056]
              + * }
              + * @compatibility(numpy) + * Equivalent to np.angle. + * @end_compatibility + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class Angle extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Angle operation. + * + * @param scope current scope + * @param input + * @param Tout + * @return a new instance of Angle + */ + public static Angle create(Scope scope, Operand input, Class Tout) { + OperationBuilder opBuilder = scope.env().opBuilder("Angle", scope.makeOpName("Angle")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Tout", DataType.fromClass(Tout)); + return new Angle(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Angle operation using default output types. + * + * @param scope current scope + * @param input + * @return a new instance of Angle + */ + public static Angle create(Scope scope, Operand input) { + return create(scope, input, Float.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Angle(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ApproximateEqual.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ApproximateEqual.java new file mode 100644 index 00000000000..afc6caa4630 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ApproximateEqual.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of abs(x-y) < tolerance element-wise. + */ +@Operator(group = "math") +public final class ApproximateEqual extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.math.ApproximateEqual} + */ + public static class Options { + + /** + * @param tolerance + */ + public Options tolerance(Float tolerance) { + this.tolerance = tolerance; + return this; + } + + private Float tolerance; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApproximateEqual operation. + * + * @param scope current scope + * @param x + * @param y + * @param options carries optional attributes values + * @return a new instance of ApproximateEqual + */ + public static ApproximateEqual create(Scope scope, Operand x, Operand y, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApproximateEqual", scope.makeOpName("ApproximateEqual")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.tolerance != null) { + opBuilder.setAttr("tolerance", opts.tolerance); + } + } + } + return new ApproximateEqual(opBuilder.build()); + } + + /** + * @param tolerance + */ + public static Options tolerance(Float tolerance) { + return new Options().tolerance(tolerance); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private ApproximateEqual(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMax.java new file mode 100644 index 00000000000..3f2243e7bd2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMax.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the index with the largest value across dimensions of a tensor. + *

              + * Note that in case of ties the identity of the return value is not guaranteed. + *

              + * Usage: + *

              {@code
              + *   import tensorflow as tf
              + *   a = [1, 10, 26.9, 2.8, 166.32, 62.3]
              + *   b = tf.math.argmax(input = a)
              + *   c = tf.keras.backend.eval(b)
              + *   # c = 4
              + *   # here a[4] = 166.32 which is the largest element of a across axis 0
              + *   }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class ArgMax extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ArgMax operation. + * + * @param scope current scope + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * Describes which dimension of the input Tensor to reduce across. For vectors, + * use dimension = 0. + * @param outputType + * @return a new instance of ArgMax + */ + public static ArgMax create(Scope scope, Operand input, Operand dimension, Class outputType) { + OperationBuilder opBuilder = scope.env().opBuilder("ArgMax", scope.makeOpName("ArgMax")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(dimension.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("output_type", DataType.fromClass(outputType)); + return new ArgMax(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new ArgMax operation using default output types. + * + * @param scope current scope + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * Describes which dimension of the input Tensor to reduce across. For vectors, + * use dimension = 0. + * @return a new instance of ArgMax + */ + public static ArgMax create(Scope scope, Operand input, Operand dimension) { + return create(scope, input, dimension, Long.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ArgMax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMin.java new file mode 100644 index 00000000000..e6ff7ce499d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMin.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the index with the smallest value across dimensions of a tensor. + *

              + * Note that in case of ties the identity of the return value is not guaranteed. + *

              + * Usage: + *

              {@code
              + *   import tensorflow as tf
              + *   a = [1, 10, 26.9, 2.8, 166.32, 62.3]
              + *   b = tf.math.argmin(input = a)
              + *   c = tf.keras.backend.eval(b)
              + *   # c = 0
              + *   # here a[0] = 1 which is the smallest element of a across axis 0
              + *   }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class ArgMin extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ArgMin operation. + * + * @param scope current scope + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * Describes which dimension of the input Tensor to reduce across. For vectors, + * use dimension = 0. + * @param outputType + * @return a new instance of ArgMin + */ + public static ArgMin create(Scope scope, Operand input, Operand dimension, Class outputType) { + OperationBuilder opBuilder = scope.env().opBuilder("ArgMin", scope.makeOpName("ArgMin")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(dimension.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("output_type", DataType.fromClass(outputType)); + return new ArgMin(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new ArgMin operation using default output types. + * + * @param scope current scope + * @param input + * @param dimension int32 or int64, must be in the range `[-rank(input), rank(input))`. + * Describes which dimension of the input Tensor to reduce across. For vectors, + * use dimension = 0. + * @return a new instance of ArgMin + */ + public static ArgMin create(Scope scope, Operand input, Operand dimension) { + return create(scope, input, dimension, Long.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ArgMin(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Asin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Asin.java new file mode 100644 index 00000000000..a4617921d53 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Asin.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the trignometric inverse sine of x element-wise. + *

              + * The `tf.math.asin` operation returns the inverse of `tf.math.sin`, such that + * if `y = tf.math.sin(x)` then, `x = tf.math.asin(y)`. + *

              + * Note: The output of `tf.math.asin` will lie within the invertible range + * of sine, i.e [-pi/2, pi/2]. + *

              + * For example: + *

              {@code
              + * # Note: [1.047, 0.785] ~= [(pi/3), (pi/4)]
              + * x = tf.constant([1.047, 0.785])
              + * y = tf.math.sin(x) # [0.8659266, 0.7068252]
              + * 
              + * tf.math.asin(y) # [1.047, 0.785] = x
              + * }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Asin extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Asin operation. + * + * @param scope current scope + * @param x + * @return a new instance of Asin + */ + public static Asin create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Asin", scope.makeOpName("Asin")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Asin(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Asin(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Asinh.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Asinh.java new file mode 100644 index 00000000000..c411950baba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Asinh.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes inverse hyperbolic sine of x element-wise. + *

              + * Given an input tensor, this function computes inverse hyperbolic sine + * for every element in the tensor. Both input and output has a range of + * `[-inf, inf]`. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -2, -0.5, 1, 1.2, 200, 10000, float("inf")])
              + *   tf.math.asinh(x) ==> [-inf -1.4436355 -0.4812118 0.8813736 1.0159732 5.991471 9.903487 inf]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Asinh extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Asinh operation. + * + * @param scope current scope + * @param x + * @return a new instance of Asinh + */ + public static Asinh create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Asinh", scope.makeOpName("Asinh")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Asinh(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Asinh(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atan.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atan.java new file mode 100644 index 00000000000..d5fb2730785 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atan.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the trignometric inverse tangent of x element-wise. + *

              + * The `tf.math.atan` operation returns the inverse of `tf.math.tan`, such that + * if `y = tf.math.tan(x)` then, `x = tf.math.atan(y)`. + *

              + * Note: The output of `tf.math.atan` will lie within the invertible range + * of tan, i.e (-pi/2, pi/2). + *

              + * For example: + *

              {@code
              + * # Note: [1.047, 0.785] ~= [(pi/3), (pi/4)]
              + * x = tf.constant([1.047, 0.785])
              + * y = tf.math.tan(x) # [1.731261, 0.99920404]
              + * 
              + * tf.math.atan(y) # [1.047, 0.785] = x
              + * }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Atan extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Atan operation. + * + * @param scope current scope + * @param x + * @return a new instance of Atan + */ + public static Atan create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Atan", scope.makeOpName("Atan")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Atan(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Atan(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atan2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atan2.java new file mode 100644 index 00000000000..8337341e4c2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atan2.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes arctangent of `y/x` element-wise, respecting signs of the arguments. + *

              + * This is the angle \( \theta \in [-\pi, \pi] \) such that + * \[ x = r \cos(\theta) \] + * and + * \[ y = r \sin(\theta) \] + * where \(r = \sqrt(x^2 + y^2) \). + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Atan2 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Atan2 operation. + * + * @param scope current scope + * @param y + * @param x + * @return a new instance of Atan2 + */ + public static Atan2 create(Scope scope, Operand y, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Atan2", scope.makeOpName("Atan2")); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Atan2(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Atan2(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atanh.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atanh.java new file mode 100644 index 00000000000..5f2b4a5e3e6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Atanh.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes inverse hyperbolic tangent of x element-wise. + *

              + * Given an input tensor, this function computes inverse hyperbolic tangent + * for every element in the tensor. Input range is `[-1,1]` and output range is + * `[-inf, inf]`. If input is `-1`, output will be `-inf` and if the + * input is `1`, output will be `inf`. Values outside the range will have + * `nan` as output. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -1, -0.5, 1, 0, 0.5, 10, float("inf")])
              + *   tf.math.atanh(x) ==> [nan -inf -0.54930615 inf  0. 0.54930615 nan nan]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Atanh extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Atanh operation. + * + * @param scope current scope + * @param x + * @return a new instance of Atanh + */ + public static Atanh create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Atanh", scope.makeOpName("Atanh")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Atanh(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Atanh(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/BesselI0e.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/BesselI0e.java new file mode 100644 index 00000000000..5777af1108d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/BesselI0e.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the Bessel i0e function of `x` element-wise. + *

              + * Exponentially scaled modified Bessel function of order 0 defined as + * `bessel_i0e(x) = exp(-abs(x)) bessel_i0(x)`. + *

              + * This function is faster and numerically stabler than `bessel_i0(x)`. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class BesselI0e extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BesselI0e operation. + * + * @param scope current scope + * @param x + * @return a new instance of BesselI0e + */ + public static BesselI0e create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("BesselI0e", scope.makeOpName("BesselI0e")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BesselI0e(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private BesselI0e(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/BesselI1e.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/BesselI1e.java new file mode 100644 index 00000000000..c119feb2b4d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/BesselI1e.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the Bessel i1e function of `x` element-wise. + *

              + * Exponentially scaled modified Bessel function of order 0 defined as + * `bessel_i1e(x) = exp(-abs(x)) bessel_i1(x)`. + *

              + * This function is faster and numerically stabler than `bessel_i1(x)`. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class BesselI1e extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BesselI1e operation. + * + * @param scope current scope + * @param x + * @return a new instance of BesselI1e + */ + public static BesselI1e create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("BesselI1e", scope.makeOpName("BesselI1e")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BesselI1e(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private BesselI1e(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Betainc.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Betainc.java new file mode 100644 index 00000000000..15a837233cb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Betainc.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the regularized incomplete beta integral \\(I_x(a, b)\\). + *

              + * The regularized incomplete beta integral is defined as: + *

              + * \\(I_x(a, b) = \frac{B(x; a, b)}{B(a, b)}\\) + *

              + * where + *

              + * \\(B(x; a, b) = \int_0^x t^{a-1} (1 - t)^{b-1} dt\\) + *

              + * is the incomplete beta function and \\(B(a, b)\\) is the complete + * beta function. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Betainc extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Betainc operation. + * + * @param scope current scope + * @param a + * @param b + * @param x + * @return a new instance of Betainc + */ + public static Betainc create(Scope scope, Operand a, Operand b, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Betainc", scope.makeOpName("Betainc")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Betainc(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Betainc(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Bincount.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Bincount.java new file mode 100644 index 00000000000..479b9685d3b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Bincount.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Counts the number of occurrences of each value in an integer array. + *

              + * Outputs a vector with length `size` and the same dtype as `weights`. If + * `weights` are empty, then index `i` stores the number of times the value `i` is + * counted in `arr`. If `weights` are non-empty, then index `i` stores the sum of + * the value in `weights` at each index where the corresponding value in `arr` is + * `i`. + *

              + * Values in `arr` outside of the range [0, size) are ignored. + * + * @param data type for {@code bins()} output + */ +@Operator(group = "math") +public final class Bincount extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Bincount operation. + * + * @param scope current scope + * @param arr int32 `Tensor`. + * @param size non-negative int32 scalar `Tensor`. + * @param weights is an int32, int64, float32, or float64 `Tensor` with the same + * shape as `arr`, or a length-0 `Tensor`, in which case it acts as all weights + * equal to 1. + * @return a new instance of Bincount + */ + public static Bincount create(Scope scope, Operand arr, Operand size, Operand weights) { + OperationBuilder opBuilder = scope.env().opBuilder("Bincount", scope.makeOpName("Bincount")); + opBuilder.addInput(arr.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder.addInput(weights.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Bincount(opBuilder.build()); + } + + /** + * 1D `Tensor` with length equal to `size`. The counts or summed weights for + * each value in the range [0, size). + */ + public Output bins() { + return bins; + } + + @Override + public Output asOutput() { + return bins; + } + + private Output bins; + + private Bincount(Operation operation) { + super(operation); + int outputIdx = 0; + bins = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Ceil.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Ceil.java new file mode 100644 index 00000000000..6deac52c312 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Ceil.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns element-wise smallest integer not less than x. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Ceil extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Ceil operation. + * + * @param scope current scope + * @param x + * @return a new instance of Ceil + */ + public static Ceil create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Ceil", scope.makeOpName("Ceil")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Ceil(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Ceil(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CheckNumerics.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CheckNumerics.java new file mode 100644 index 00000000000..edc6eb6fd57 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CheckNumerics.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Checks a tensor for NaN and Inf values. + *

              + * When run, reports an `InvalidArgument` error if `tensor` has any values + * that are not a number (NaN) or infinity (Inf). Otherwise, passes `tensor` as-is. + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class CheckNumerics extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CheckNumerics operation. + * + * @param scope current scope + * @param tensor + * @param message Prefix of the error message. + * @return a new instance of CheckNumerics + */ + public static CheckNumerics create(Scope scope, Operand tensor, String message) { + OperationBuilder opBuilder = scope.env().opBuilder("CheckNumerics", scope.makeOpName("CheckNumerics")); + opBuilder.addInput(tensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("message", message); + return new CheckNumerics(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CheckNumerics(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CompareAndBitpack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CompareAndBitpack.java new file mode 100644 index 00000000000..83388488113 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CompareAndBitpack.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Compare values of `input` to `threshold` and pack resulting bits into a `uint8`. + *

              + * Each comparison returns a boolean `true` (if `input_value > threshold`) + * or and `false` otherwise. + *

              + * This operation is useful for Locality-Sensitive-Hashing (LSH) and other + * algorithms that use hashing approximations of cosine and `L2` distances; + * codes can be generated from an input via: + *

              {@code
              + * codebook_size = 50
              + * codebook_bits = codebook_size * 32
              + * codebook = tf.get_variable('codebook', [x.shape[-1].value, codebook_bits],
              + *                            dtype=x.dtype,
              + *                            initializer=tf.orthogonal_initializer())
              + * codes = compare_and_threshold(tf.matmul(x, codebook), threshold=0.)
              + * codes = tf.bitcast(codes, tf.int32)  # go from uint8 to int32
              + * # now codes has shape x.shape[:-1] + [codebook_size]
              + * }
              + * NOTE: Currently, the innermost dimension of the tensor must be divisible + * by 8. + *

              + * Given an `input` shaped `[s0, s1, ..., s_n]`, the output is + * a `uint8` tensor shaped `[s0, s1, ..., s_n / 8]`. + */ +@Operator(group = "math") +public final class CompareAndBitpack extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new CompareAndBitpack operation. + * + * @param scope current scope + * @param input Values to compare against `threshold` and bitpack. + * @param threshold Threshold to compare against. + * @return a new instance of CompareAndBitpack + */ + public static CompareAndBitpack create(Scope scope, Operand input, Operand threshold) { + OperationBuilder opBuilder = scope.env().opBuilder("CompareAndBitpack", scope.makeOpName("CompareAndBitpack")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(threshold.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new CompareAndBitpack(opBuilder.build()); + } + + /** + * The bitpacked comparisons. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private CompareAndBitpack(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ComplexAbs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ComplexAbs.java new file mode 100644 index 00000000000..57b1c4c6ce3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ComplexAbs.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the complex absolute value of a tensor. + *

              + * Given a tensor `x` of complex numbers, this operation returns a tensor of type + * `float` or `double` that is the absolute value of each element in `x`. All + * elements in `x` must be complex numbers of the form \\(a + bj\\). The absolute + * value is computed as \\( \sqrt{a^2 + b^2}\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class ComplexAbs extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ComplexAbs operation. + * + * @param scope current scope + * @param x + * @param Tout + * @return a new instance of ComplexAbs + */ + public static ComplexAbs create(Scope scope, Operand x, Class Tout) { + OperationBuilder opBuilder = scope.env().opBuilder("ComplexAbs", scope.makeOpName("ComplexAbs")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Tout", DataType.fromClass(Tout)); + return new ComplexAbs(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new ComplexAbs operation using default output types. + * + * @param scope current scope + * @param x + * @return a new instance of ComplexAbs + */ + public static ComplexAbs create(Scope scope, Operand x) { + return create(scope, x, Float.class); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private ComplexAbs(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Conj.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Conj.java new file mode 100644 index 00000000000..7546f2b5eb5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Conj.java @@ -0,0 +1,82 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the complex conjugate of a complex number. + *

              + * Given a tensor `input` of complex numbers, this operation returns a tensor of + * complex numbers that are the complex conjugate of each element in `input`. The + * complex numbers in `input` must be of the form \\(a + bj\\), where a is the + * real part and b is the imaginary part. + *

              + * The complex conjugate returned by this operation is of the form \\(a - bj\\). + *

              + * For example: + *

              {@code
              + * # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
              + * tf.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class Conj extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Conj operation. + * + * @param scope current scope + * @param input + * @return a new instance of Conj + */ + public static Conj create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("Conj", scope.makeOpName("Conj")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Conj(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Conj(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cos.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cos.java new file mode 100644 index 00000000000..b242883a852 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cos.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes cos of x element-wise. + *

              + * Given an input tensor, this function computes cosine of every + * element in the tensor. Input range is `(-inf, inf)` and + * output range is `[-1,1]`. If input lies outside the boundary, `nan` + * is returned. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 200, 10000, float("inf")])
              + *   tf.math.cos(x) ==> [nan -0.91113025 0.87758255 0.5403023 0.36235774 0.48718765 -0.95215535 nan]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Cos extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Cos operation. + * + * @param scope current scope + * @param x + * @return a new instance of Cos + */ + public static Cos create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Cos", scope.makeOpName("Cos")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Cos(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Cos(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cosh.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cosh.java new file mode 100644 index 00000000000..11b7f4e10d7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cosh.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes hyperbolic cosine of x element-wise. + *

              + * Given an input tensor, this function computes hyperbolic cosine of every + * element in the tensor. Input range is `[-inf, inf]` and output range + * is `[1, inf]`. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 2, 10, float("inf")])
              + *   tf.math.cosh(x) ==> [inf 4.0515420e+03 1.1276259e+00 1.5430807e+00 1.8106556e+00 3.7621956e+00 1.1013233e+04 inf]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Cosh extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Cosh operation. + * + * @param scope current scope + * @param x + * @return a new instance of Cosh + */ + public static Cosh create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Cosh", scope.makeOpName("Cosh")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Cosh(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Cosh(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumprod.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumprod.java new file mode 100644 index 00000000000..7b43500d185 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumprod.java @@ -0,0 +1,149 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the cumulative product of the tensor `x` along `axis`. + *

              + * By default, this op performs an inclusive cumprod, which means that the first + * element of the input is identical to the first element of the output: + *

              {@code
              + * tf.cumprod([a, b, c])  # => [a, a * b, a * b * c]
              + * }
              + * By setting the `exclusive` kwarg to `True`, an exclusive cumprod is + * performed instead: + *
              {@code
              + * tf.cumprod([a, b, c], exclusive=True)  # => [1, a, a * b]
              + * }
              + * By setting the `reverse` kwarg to `True`, the cumprod is performed in the + * opposite direction: + *
              {@code
              + * tf.cumprod([a, b, c], reverse=True)  # => [a * b * c, b * c, c]
              + * }
              + * This is more efficient than using separate `tf.reverse` ops. + *

              + * The `reverse` and `exclusive` kwargs can also be combined: + *

              {@code
              + * tf.cumprod([a, b, c], exclusive=True, reverse=True)  # => [b * c, c, 1]
              + * }
              + * + * + * @param data type for {@code out()} output + */ +@Operator(group = "math") +public final class Cumprod extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.math.Cumprod} + */ + public static class Options { + + /** + * @param exclusive If `True`, perform exclusive cumprod. + */ + public Options exclusive(Boolean exclusive) { + this.exclusive = exclusive; + return this; + } + + /** + * @param reverse A `bool` (default: False). + */ + public Options reverse(Boolean reverse) { + this.reverse = reverse; + return this; + } + + private Boolean exclusive; + private Boolean reverse; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Cumprod operation. + * + * @param scope current scope + * @param x A `Tensor`. Must be one of the following types: `float32`, `float64`, + * `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, + * `complex128`, `qint8`, `quint8`, `qint32`, `half`. + * @param axis A `Tensor` of type `int32` (default: 0). Must be in the range + * `[-rank(x), rank(x))`. + * @param options carries optional attributes values + * @return a new instance of Cumprod + */ + public static Cumprod create(Scope scope, Operand x, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Cumprod", scope.makeOpName("Cumprod")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.exclusive != null) { + opBuilder.setAttr("exclusive", opts.exclusive); + } + if (opts.reverse != null) { + opBuilder.setAttr("reverse", opts.reverse); + } + } + } + return new Cumprod(opBuilder.build()); + } + + /** + * @param exclusive If `True`, perform exclusive cumprod. + */ + public static Options exclusive(Boolean exclusive) { + return new Options().exclusive(exclusive); + } + + /** + * @param reverse A `bool` (default: False). + */ + public static Options reverse(Boolean reverse) { + return new Options().reverse(reverse); + } + + /** + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private Cumprod(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java new file mode 100644 index 00000000000..fb52444a59e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java @@ -0,0 +1,149 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the cumulative sum of the tensor `x` along `axis`. + *

              + * By default, this op performs an inclusive cumsum, which means that the first + * element of the input is identical to the first element of the output: + *

              {@code
              + * tf.cumsum([a, b, c])  # => [a, a + b, a + b + c]
              + * }
              + * By setting the `exclusive` kwarg to `True`, an exclusive cumsum is + * performed instead: + *
              {@code
              + * tf.cumsum([a, b, c], exclusive=True)  # => [0, a, a + b]
              + * }
              + * By setting the `reverse` kwarg to `True`, the cumsum is performed in the + * opposite direction: + *
              {@code
              + * tf.cumsum([a, b, c], reverse=True)  # => [a + b + c, b + c, c]
              + * }
              + * This is more efficient than using separate `tf.reverse` ops. + *

              + * The `reverse` and `exclusive` kwargs can also be combined: + *

              {@code
              + * tf.cumsum([a, b, c], exclusive=True, reverse=True)  # => [b + c, c, 0]
              + * }
              + * + * + * @param data type for {@code out()} output + */ +@Operator(group = "math") +public final class Cumsum extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.math.Cumsum} + */ + public static class Options { + + /** + * @param exclusive If `True`, perform exclusive cumsum. + */ + public Options exclusive(Boolean exclusive) { + this.exclusive = exclusive; + return this; + } + + /** + * @param reverse A `bool` (default: False). + */ + public Options reverse(Boolean reverse) { + this.reverse = reverse; + return this; + } + + private Boolean exclusive; + private Boolean reverse; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Cumsum operation. + * + * @param scope current scope + * @param x A `Tensor`. Must be one of the following types: `float32`, `float64`, + * `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, + * `complex128`, `qint8`, `quint8`, `qint32`, `half`. + * @param axis A `Tensor` of type `int32` (default: 0). Must be in the range + * `[-rank(x), rank(x))`. + * @param options carries optional attributes values + * @return a new instance of Cumsum + */ + public static Cumsum create(Scope scope, Operand x, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Cumsum", scope.makeOpName("Cumsum")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.exclusive != null) { + opBuilder.setAttr("exclusive", opts.exclusive); + } + if (opts.reverse != null) { + opBuilder.setAttr("reverse", opts.reverse); + } + } + } + return new Cumsum(opBuilder.build()); + } + + /** + * @param exclusive If `True`, perform exclusive cumsum. + */ + public static Options exclusive(Boolean exclusive) { + return new Options().exclusive(exclusive); + } + + /** + * @param reverse A `bool` (default: False). + */ + public static Options reverse(Boolean reverse) { + return new Options().reverse(reverse); + } + + /** + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private Cumsum(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Digamma.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Digamma.java new file mode 100644 index 00000000000..e0b0eee777f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Digamma.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes Psi, the derivative of Lgamma (the log of the absolute value of + *

              + * `Gamma(x)`), element-wise. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Digamma extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Digamma operation. + * + * @param scope current scope + * @param x + * @return a new instance of Digamma + */ + public static Digamma create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Digamma", scope.makeOpName("Digamma")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Digamma(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Digamma(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Div.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Div.java new file mode 100644 index 00000000000..527595fc52b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Div.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x / y element-wise. + *

              + * NOTE: `math.Div` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Div extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Div operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Div + */ + public static Div create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Div", scope.makeOpName("Div")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Div(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Div(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/DivNoNan.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/DivNoNan.java new file mode 100644 index 00000000000..e742678da2e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/DivNoNan.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns 0 if the denominator is zero. + *

              + * + * NOTE: `math.DivNoNan` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class DivNoNan extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new DivNoNan operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of DivNoNan + */ + public static DivNoNan create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("DivNoNan", scope.makeOpName("DivNoNan")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new DivNoNan(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private DivNoNan(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Equal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Equal.java new file mode 100644 index 00000000000..e968606db84 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Equal.java @@ -0,0 +1,115 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of (x == y) element-wise. + *

              + * NOTE: `math.Equal` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + *

              {@code
              + * x = tf.constant([2, 4])
              + * y = tf.constant(2)
              + * tf.math.equal(x, y) ==> array([True, False])
              + * 
              + * x = tf.constant([2, 4])
              + * y = tf.constant([2, 4])
              + * tf.math.equal(x, y) ==> array([True,  True])
              + * }
              + * + */ +@Operator(group = "math") +public final class Equal extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.math.Equal} + */ + public static class Options { + + /** + * @param incompatibleShapeError + */ + public Options incompatibleShapeError(Boolean incompatibleShapeError) { + this.incompatibleShapeError = incompatibleShapeError; + return this; + } + + private Boolean incompatibleShapeError; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Equal operation. + * + * @param scope current scope + * @param x + * @param y + * @param options carries optional attributes values + * @return a new instance of Equal + */ + public static Equal create(Scope scope, Operand x, Operand y, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Equal", scope.makeOpName("Equal")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.incompatibleShapeError != null) { + opBuilder.setAttr("incompatible_shape_error", opts.incompatibleShapeError); + } + } + } + return new Equal(opBuilder.build()); + } + + /** + * @param incompatibleShapeError + */ + public static Options incompatibleShapeError(Boolean incompatibleShapeError) { + return new Options().incompatibleShapeError(incompatibleShapeError); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Equal(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Erf.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Erf.java new file mode 100644 index 00000000000..875b0186daf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Erf.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the Gauss error function of `x` element-wise. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Erf extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Erf operation. + * + * @param scope current scope + * @param x + * @return a new instance of Erf + */ + public static Erf create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Erf", scope.makeOpName("Erf")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Erf(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Erf(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Erfc.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Erfc.java new file mode 100644 index 00000000000..4c7d373d28d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Erfc.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the complementary error function of `x` element-wise. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Erfc extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Erfc operation. + * + * @param scope current scope + * @param x + * @return a new instance of Erfc + */ + public static Erfc create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Erfc", scope.makeOpName("Erfc")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Erfc(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Erfc(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Exp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Exp.java new file mode 100644 index 00000000000..dfd109d3aba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Exp.java @@ -0,0 +1,94 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes exponential of x element-wise. \\(y = e^x\\). + *

              + * This function computes the exponential of every element in the input tensor. + * i.e. `exp(x)` or `e^(x)`, where `x` is the input tensor. + * `e` denotes Euler's number and is approximately equal to 2.718281. + * Output is positive for any real input. + *

              + *

              {@code
              + *   x = tf.constant(2.0)
              + *   tf.math.exp(x) ==> 7.389056
              + * 
              + *   x = tf.constant([2.0, 8.0])
              + *   tf.math.exp(x) ==> array([7.389056, 2980.958], dtype=float32)
              + *   }
              + * For complex numbers, the exponential value is calculated as follows: + *

              + *

              {@code
              + *   e^(x+iy) = e^x * e^iy = e^x * (cos y + i sin y)
              + *   }
              + * Let's consider complex number 1+1j as an example. + * e^1 * (cos 1 + i sin 1) = 2.7182818284590 * (0.54030230586+0.8414709848j) + *

              + *

              {@code
              + *   x = tf.constant(1 + 1j)
              + *   tf.math.exp(x) ==> 1.4686939399158851+2.2873552871788423j
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Exp extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Exp operation. + * + * @param scope current scope + * @param x + * @return a new instance of Exp + */ + public static Exp create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Exp", scope.makeOpName("Exp")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Exp(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Exp(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Expm1.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Expm1.java new file mode 100644 index 00000000000..809b31ae614 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Expm1.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes `exp(x) - 1` element-wise. + *

              + * i.e. `exp(x) - 1` or `e^(x) - 1`, where `x` is the input tensor. + * `e` denotes Euler's number and is approximately equal to 2.718281. + *

              + *

              {@code
              + *   x = tf.constant(2.0)
              + *   tf.math.expm1(x) ==> 6.389056
              + * 
              + *   x = tf.constant([2.0, 8.0])
              + *   tf.math.expm1(x) ==> array([6.389056, 2979.958], dtype=float32)
              + * 
              + *   x = tf.constant(1 + 1j)
              + *   tf.math.expm1(x) ==> (0.46869393991588515+2.2873552871788423j)
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Expm1 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Expm1 operation. + * + * @param scope current scope + * @param x + * @return a new instance of Expm1 + */ + public static Expm1 create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Expm1", scope.makeOpName("Expm1")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Expm1(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Expm1(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Fact.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Fact.java new file mode 100644 index 00000000000..6938723bcd3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Fact.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Output a fact about factorials. + */ +@Operator(group = "math") +public final class Fact extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Fact operation. + * + * @param scope current scope + * @return a new instance of Fact + */ + public static Fact create(Scope scope) { + OperationBuilder opBuilder = scope.env().opBuilder("Fact", scope.makeOpName("Fact")); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Fact(opBuilder.build()); + } + + /** + */ + public Output fact() { + return fact; + } + + @Override + public Output asOutput() { + return fact; + } + + private Output fact; + + private Fact(Operation operation) { + super(operation); + int outputIdx = 0; + fact = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Floor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Floor.java new file mode 100644 index 00000000000..57a17cb89b9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Floor.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns element-wise largest integer not greater than x. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Floor extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Floor operation. + * + * @param scope current scope + * @param x + * @return a new instance of Floor + */ + public static Floor create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Floor", scope.makeOpName("Floor")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Floor(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Floor(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/FloorDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/FloorDiv.java new file mode 100644 index 00000000000..028d934f6c8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/FloorDiv.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x // y element-wise. + *

              + * NOTE: `math.FloorDiv` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class FloorDiv extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new FloorDiv operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of FloorDiv + */ + public static FloorDiv create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("FloorDiv", scope.makeOpName("FloorDiv")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new FloorDiv(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private FloorDiv(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/FloorMod.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/FloorMod.java new file mode 100644 index 00000000000..7e4d44ce1d6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/FloorMod.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns element-wise remainder of division. When `x < 0` xor `y < 0` is + *

              + * true, this follows Python semantics in that the result here is consistent + * with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. + *

              + * NOTE: `math.FloorMod` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class FloorMod extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new FloorMod operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of FloorMod + */ + public static FloorMod create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("FloorMod", scope.makeOpName("FloorMod")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new FloorMod(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private FloorMod(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Greater.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Greater.java new file mode 100644 index 00000000000..c24cb98efe7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Greater.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of (x > y) element-wise. + *

              + * NOTE: `math.Greater` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ +@Operator(group = "math") +public final class Greater extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Greater operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Greater + */ + public static Greater create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Greater", scope.makeOpName("Greater")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Greater(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Greater(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/GreaterEqual.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/GreaterEqual.java new file mode 100644 index 00000000000..ba6f5fd57d4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/GreaterEqual.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of (x >= y) element-wise. + *

              + * NOTE: `math.GreaterEqual` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ +@Operator(group = "math") +public final class GreaterEqual extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new GreaterEqual operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of GreaterEqual + */ + public static GreaterEqual create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("GreaterEqual", scope.makeOpName("GreaterEqual")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new GreaterEqual(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private GreaterEqual(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Igamma.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Igamma.java new file mode 100644 index 00000000000..24f878fb47f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Igamma.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the lower regularized incomplete Gamma function `P(a, x)`. + *

              + * The lower regularized incomplete Gamma function is defined as: + *

              + * \\(P(a, x) = gamma(a, x) / Gamma(a) = 1 - Q(a, x)\\) + *

              + * where + *

              + * \\(gamma(a, x) = \\int_{0}^{x} t^{a-1} exp(-t) dt\\) + *

              + * is the lower incomplete Gamma function. + *

              + * Note, above `Q(a, x)` (`Igammac`) is the upper regularized complete + * Gamma function. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Igamma extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Igamma operation. + * + * @param scope current scope + * @param a + * @param x + * @return a new instance of Igamma + */ + public static Igamma create(Scope scope, Operand a, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Igamma", scope.makeOpName("Igamma")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Igamma(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Igamma(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IgammaGradA.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IgammaGradA.java new file mode 100644 index 00000000000..613a514c5db --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IgammaGradA.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient of `igamma(a, x)` wrt `a`. + * + * @param data type for {@code z()} output + */ +public final class IgammaGradA extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IgammaGradA operation. + * + * @param scope current scope + * @param a + * @param x + * @return a new instance of IgammaGradA + */ + public static IgammaGradA create(Scope scope, Operand a, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("IgammaGradA", scope.makeOpName("IgammaGradA")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IgammaGradA(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private IgammaGradA(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Igammac.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Igammac.java new file mode 100644 index 00000000000..9111c9d6adc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Igammac.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the upper regularized incomplete Gamma function `Q(a, x)`. + *

              + * The upper regularized incomplete Gamma function is defined as: + *

              + * \\(Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x)\\) + *

              + * where + *

              + * \\(Gamma(a, x) = int_{x}^{\infty} t^{a-1} exp(-t) dt\\) + *

              + * is the upper incomplete Gama function. + *

              + * Note, above `P(a, x)` (`Igamma`) is the lower regularized complete + * Gamma function. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Igammac extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Igammac operation. + * + * @param scope current scope + * @param a + * @param x + * @return a new instance of Igammac + */ + public static Igammac create(Scope scope, Operand a, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Igammac", scope.makeOpName("Igammac")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Igammac(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Igammac(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Imag.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Imag.java new file mode 100644 index 00000000000..a23c17c783f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Imag.java @@ -0,0 +1,94 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the imaginary part of a complex number. + *

              + * Given a tensor `input` of complex numbers, this operation returns a tensor of + * type `float` that is the imaginary part of each element in `input`. All + * elements in `input` must be complex numbers of the form \\(a + bj\\), where a + * is the real part and b is the imaginary part returned by this operation. + *

              + * For example: + *

              {@code
              + * # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
              + * tf.imag(input) ==> [4.75, 5.75]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class Imag extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Imag operation. + * + * @param scope current scope + * @param input + * @param Tout + * @return a new instance of Imag + */ + public static Imag create(Scope scope, Operand input, Class Tout) { + OperationBuilder opBuilder = scope.env().opBuilder("Imag", scope.makeOpName("Imag")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Tout", DataType.fromClass(Tout)); + return new Imag(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Imag operation using default output types. + * + * @param scope current scope + * @param input + * @return a new instance of Imag + */ + public static Imag create(Scope scope, Operand input) { + return create(scope, input, Float.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Imag(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/InvertPermutation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/InvertPermutation.java new file mode 100644 index 00000000000..081ecb612c6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/InvertPermutation.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the inverse permutation of a tensor. + *

              + * This operation computes the inverse of an index permutation. It takes a 1-D + * integer tensor `x`, which represents the indices of a zero-based array, and + * swaps each value with its index position. In other words, for an output tensor + * `y` and an input tensor `x`, this operation computes the following: + *

              + * `y[x[i]] = i for i in [0, 1, ..., len(x) - 1]` + *

              + * The values must include 0. There can be no duplicate values or negative values. + *

              + * For example: + *

              {@code
              + * # tensor `x` is [3, 4, 0, 2, 1]
              + * invert_permutation(x) ==> [2, 4, 3, 0, 1]
              + * }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class InvertPermutation extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new InvertPermutation operation. + * + * @param scope current scope + * @param x 1-D. + * @return a new instance of InvertPermutation + */ + public static InvertPermutation create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("InvertPermutation", scope.makeOpName("InvertPermutation")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new InvertPermutation(opBuilder.build()); + } + + /** + * 1-D. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private InvertPermutation(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsFinite.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsFinite.java new file mode 100644 index 00000000000..e3dde1f009d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsFinite.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns which elements of x are finite. + *

              + * @compatibility(numpy) + * Equivalent to np.isfinite + * @end_compatibility + */ +@Operator(group = "math") +public final class IsFinite extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IsFinite operation. + * + * @param scope current scope + * @param x + * @return a new instance of IsFinite + */ + public static IsFinite create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("IsFinite", scope.makeOpName("IsFinite")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IsFinite(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private IsFinite(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsInf.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsInf.java new file mode 100644 index 00000000000..4be229c0eb5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsInf.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns which elements of x are Inf. + *

              + * @compatibility(numpy) + * Equivalent to np.isinf + * @end_compatibility + */ +@Operator(group = "math") +public final class IsInf extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IsInf operation. + * + * @param scope current scope + * @param x + * @return a new instance of IsInf + */ + public static IsInf create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("IsInf", scope.makeOpName("IsInf")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IsInf(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private IsInf(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsNan.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsNan.java new file mode 100644 index 00000000000..baff4c9f3a9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsNan.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns which elements of x are NaN. + *

              + * @compatibility(numpy) + * Equivalent to np.isnan + * @end_compatibility + */ +@Operator(group = "math") +public final class IsNan extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new IsNan operation. + * + * @param scope current scope + * @param x + * @return a new instance of IsNan + */ + public static IsNan create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("IsNan", scope.makeOpName("IsNan")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new IsNan(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private IsNan(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Less.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Less.java new file mode 100644 index 00000000000..32a65d8a274 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Less.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of (x < y) element-wise. + *

              + * NOTE: `math.Less` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ +@Operator(group = "math") +public final class Less extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Less operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Less + */ + public static Less create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Less", scope.makeOpName("Less")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Less(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Less(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LessEqual.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LessEqual.java new file mode 100644 index 00000000000..5d99ff74b7e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LessEqual.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of (x <= y) element-wise. + *

              + * NOTE: `math.LessEqual` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ +@Operator(group = "math") +public final class LessEqual extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LessEqual operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of LessEqual + */ + public static LessEqual create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("LessEqual", scope.makeOpName("LessEqual")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LessEqual(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private LessEqual(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Lgamma.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Lgamma.java new file mode 100644 index 00000000000..4d752eb5cbf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Lgamma.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the log of the absolute value of `Gamma(x)` element-wise. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Lgamma extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Lgamma operation. + * + * @param scope current scope + * @param x + * @return a new instance of Lgamma + */ + public static Lgamma create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Lgamma", scope.makeOpName("Lgamma")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Lgamma(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Lgamma(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Log.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Log.java new file mode 100644 index 00000000000..c70bb40e400 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Log.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes natural logarithm of x element-wise. + *

              + * I.e., \\(y = \log_e x\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Log extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Log operation. + * + * @param scope current scope + * @param x + * @return a new instance of Log + */ + public static Log create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Log", scope.makeOpName("Log")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Log(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Log(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Log1p.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Log1p.java new file mode 100644 index 00000000000..75e44900fc4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Log1p.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes natural logarithm of (1 + x) element-wise. + *

              + * I.e., \\(y = \log_e (1 + x)\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Log1p extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Log1p operation. + * + * @param scope current scope + * @param x + * @return a new instance of Log1p + */ + public static Log1p create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Log1p", scope.makeOpName("Log1p")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Log1p(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Log1p(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalAnd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalAnd.java new file mode 100644 index 00000000000..e51201aa7e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalAnd.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of x AND y element-wise. + *

              + * NOTE: `math.LogicalAnd` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ +@Operator(group = "math") +public final class LogicalAnd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LogicalAnd operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of LogicalAnd + */ + public static LogicalAnd create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("LogicalAnd", scope.makeOpName("LogicalAnd")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LogicalAnd(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private LogicalAnd(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalNot.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalNot.java new file mode 100644 index 00000000000..46db569f9bf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalNot.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of NOT x element-wise. + */ +@Operator(group = "math") +public final class LogicalNot extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LogicalNot operation. + * + * @param scope current scope + * @param x + * @return a new instance of LogicalNot + */ + public static LogicalNot create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("LogicalNot", scope.makeOpName("LogicalNot")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LogicalNot(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private LogicalNot(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalOr.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalOr.java new file mode 100644 index 00000000000..39b0faca333 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/LogicalOr.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of x OR y element-wise. + *

              + * NOTE: `math.LogicalOr` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ +@Operator(group = "math") +public final class LogicalOr extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LogicalOr operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of LogicalOr + */ + public static LogicalOr create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("LogicalOr", scope.makeOpName("LogicalOr")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LogicalOr(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private LogicalOr(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Maximum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Maximum.java new file mode 100644 index 00000000000..b2eb1cac94a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Maximum.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the max of x and y (i.e. x > y ? x : y) element-wise. + *

              + * NOTE: `math.Maximum` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Maximum extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Maximum operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Maximum + */ + public static Maximum create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Maximum", scope.makeOpName("Maximum")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Maximum(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Maximum(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mean.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mean.java new file mode 100644 index 00000000000..f35214a2e1b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mean.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the mean of elements across dimensions of a tensor. + *

              + * Reduces `input` along the dimensions given in `axis`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `axis`. If `keep_dims` is true, the reduced dimensions are + * retained with length 1. + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class Mean extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.math.Mean} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Mean operation. + * + * @param scope current scope + * @param input The tensor to reduce. + * @param axis The dimensions to reduce. Must be in the range + * `[-rank(input), rank(input))`. + * @param options carries optional attributes values + * @return a new instance of Mean + */ + public static Mean create(Scope scope, Operand input, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Mean", scope.makeOpName("Mean")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(axis.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new Mean(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * The reduced tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Mean(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Minimum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Minimum.java new file mode 100644 index 00000000000..f9ba8bf21fc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Minimum.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the min of x and y (i.e. x < y ? x : y) element-wise. + *

              + * NOTE: `math.Minimum` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Minimum extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Minimum operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Minimum + */ + public static Minimum create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Minimum", scope.makeOpName("Minimum")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Minimum(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Minimum(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mod.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mod.java new file mode 100644 index 00000000000..0279abf745b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mod.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns element-wise remainder of division. This emulates C semantics in that + *

              + * the result here is consistent with a truncating divide. E.g. + * `tf.truncatediv(x, y) * y + truncate_mod(x, y) = x`. + *

              + * NOTE: `math.Mod` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Mod extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Mod operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Mod + */ + public static Mod create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Mod", scope.makeOpName("Mod")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Mod(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Mod(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mul.java new file mode 100644 index 00000000000..e40a424bedf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mul.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x * y element-wise. + *

              + * NOTE: `math.Mul` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Mul extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Mul operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Mul + */ + public static Mul create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Mul", scope.makeOpName("Mul")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Mul(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Mul(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Neg.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Neg.java new file mode 100644 index 00000000000..c2afc5f455d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Neg.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes numerical negative value element-wise. + *

              + * I.e., \\(y = -x\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Neg extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Neg operation. + * + * @param scope current scope + * @param x + * @return a new instance of Neg + */ + public static Neg create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Neg", scope.makeOpName("Neg")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Neg(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Neg(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/NotEqual.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/NotEqual.java new file mode 100644 index 00000000000..a72ad63aea1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/NotEqual.java @@ -0,0 +1,105 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the truth value of (x != y) element-wise. + *

              + * NOTE: `math.NotEqual` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ +@Operator(group = "math") +public final class NotEqual extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.math.NotEqual} + */ + public static class Options { + + /** + * @param incompatibleShapeError + */ + public Options incompatibleShapeError(Boolean incompatibleShapeError) { + this.incompatibleShapeError = incompatibleShapeError; + return this; + } + + private Boolean incompatibleShapeError; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new NotEqual operation. + * + * @param scope current scope + * @param x + * @param y + * @param options carries optional attributes values + * @return a new instance of NotEqual + */ + public static NotEqual create(Scope scope, Operand x, Operand y, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("NotEqual", scope.makeOpName("NotEqual")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.incompatibleShapeError != null) { + opBuilder.setAttr("incompatible_shape_error", opts.incompatibleShapeError); + } + } + } + return new NotEqual(opBuilder.build()); + } + + /** + * @param incompatibleShapeError + */ + public static Options incompatibleShapeError(Boolean incompatibleShapeError) { + return new Options().incompatibleShapeError(incompatibleShapeError); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private NotEqual(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Polygamma.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Polygamma.java new file mode 100644 index 00000000000..f4d2001db96 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Polygamma.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the polygamma function \\(\psi^{(n)}(x)\\). + *

              + * The polygamma function is defined as: + *

              + * \\(\psi^{(a)}(x) = \frac{d^a}{dx^a} \psi(x)\\) + *

              + * where \\(\psi(x)\\) is the digamma function. + * The polygamma function is defined only for non-negative integer orders \\a\\. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Polygamma extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Polygamma operation. + * + * @param scope current scope + * @param a + * @param x + * @return a new instance of Polygamma + */ + public static Polygamma create(Scope scope, Operand a, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Polygamma", scope.makeOpName("Polygamma")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Polygamma(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Polygamma(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/PopulationCount.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/PopulationCount.java new file mode 100644 index 00000000000..576caac778b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/PopulationCount.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.UInt8; + +/** + * Computes element-wise population count (a.k.a. popcount, bitsum, bitcount). + *

              + * For each entry in `x`, calculates the number of `1` (on) bits in the binary + * representation of that entry. + *

              + * NOTE: It is more efficient to first `tf.bitcast` your tensors into + * `int32` or `int64` and perform the bitcount on the result, than to feed in + * 8- or 16-bit inputs and then aggregate the resulting counts. + */ +@Operator(group = "math") +public final class PopulationCount extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new PopulationCount operation. + * + * @param scope current scope + * @param x + * @return a new instance of PopulationCount + */ + public static PopulationCount create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("PopulationCount", scope.makeOpName("PopulationCount")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new PopulationCount(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private PopulationCount(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Pow.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Pow.java new file mode 100644 index 00000000000..dcbae705274 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Pow.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the power of one value to another. + *

              + * Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for + * corresponding elements in `x` and `y`. For example: + *

              {@code
              + * # tensor 'x' is [[2, 2]], [3, 3]]
              + * # tensor 'y' is [[8, 16], [2, 3]]
              + * tf.pow(x, y) ==> [[256, 65536], [9, 27]]
              + * }
              + * + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Pow extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Pow operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Pow + */ + public static Pow create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Pow", scope.makeOpName("Pow")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Pow(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Pow(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedAdd.java new file mode 100644 index 00000000000..fb3d17e44f3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedAdd.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x + y element-wise, working on quantized buffers. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class QuantizedAdd extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedAdd operation. + * + * @param scope current scope + * @param x + * @param y + * @param minX The float value that the lowest quantized `x` value represents. + * @param maxX The float value that the highest quantized `x` value represents. + * @param minY The float value that the lowest quantized `y` value represents. + * @param maxY The float value that the highest quantized `y` value represents. + * @param Toutput + * @return a new instance of QuantizedAdd + */ + public static QuantizedAdd create(Scope scope, Operand x, Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedAdd", scope.makeOpName("QuantizedAdd")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(minX.asOutput()); + opBuilder.addInput(maxX.asOutput()); + opBuilder.addInput(minY.asOutput()); + opBuilder.addInput(maxY.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Toutput", DataType.fromClass(Toutput)); + return new QuantizedAdd(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minZ() { + return minZ; + } + + /** + * The float value that the highest quantized output value represents. + *

              + * NOTE: `math.QuantizedAdd` supports limited forms of broadcasting. More about + * broadcasting [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ + public Output maxZ() { + return maxZ; + } + + private Output z; + private Output minZ; + private Output maxZ; + + private QuantizedAdd(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + minZ = operation.output(outputIdx++); + maxZ = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedMul.java new file mode 100644 index 00000000000..8a8ab0734d0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedMul.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x * y element-wise, working on quantized buffers. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class QuantizedMul extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedMul operation. + * + * @param scope current scope + * @param x + * @param y + * @param minX The float value that the lowest quantized `x` value represents. + * @param maxX The float value that the highest quantized `x` value represents. + * @param minY The float value that the lowest quantized `y` value represents. + * @param maxY The float value that the highest quantized `y` value represents. + * @param Toutput + * @return a new instance of QuantizedMul + */ + public static QuantizedMul create(Scope scope, Operand x, Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMul", scope.makeOpName("QuantizedMul")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(minX.asOutput()); + opBuilder.addInput(maxX.asOutput()); + opBuilder.addInput(minY.asOutput()); + opBuilder.addInput(maxY.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Toutput", DataType.fromClass(Toutput)); + return new QuantizedMul(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minZ() { + return minZ; + } + + /** + * The float value that the highest quantized output value represents. + *

              + * NOTE: `math.QuantizedMul` supports limited forms of broadcasting. More about + * broadcasting [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + */ + public Output maxZ() { + return maxZ; + } + + private Output z; + private Output minZ; + private Output maxZ; + + private QuantizedMul(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + minZ = operation.output(outputIdx++); + maxZ = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Real.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Real.java new file mode 100644 index 00000000000..1b8b79f1bd2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Real.java @@ -0,0 +1,94 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the real part of a complex number. + *

              + * Given a tensor `input` of complex numbers, this operation returns a tensor of + * type `float` that is the real part of each element in `input`. All elements in + * `input` must be complex numbers of the form \\(a + bj\\), where a is the real + * part returned by this operation and b is the imaginary part. + *

              + * For example: + *

              {@code
              + * # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
              + * tf.real(input) ==> [-2.25, 3.25]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class Real extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Real operation. + * + * @param scope current scope + * @param input + * @param Tout + * @return a new instance of Real + */ + public static Real create(Scope scope, Operand input, Class Tout) { + OperationBuilder opBuilder = scope.env().opBuilder("Real", scope.makeOpName("Real")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("Tout", DataType.fromClass(Tout)); + return new Real(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Real operation using default output types. + * + * @param scope current scope + * @param input + * @return a new instance of Real + */ + public static Real create(Scope scope, Operand input) { + return create(scope, input, Float.class); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Real(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RealDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RealDiv.java new file mode 100644 index 00000000000..8cb3fdd8c96 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RealDiv.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x / y element-wise for real types. + *

              + * If `x` and `y` are reals, this will return the floating-point division. + *

              + * NOTE: `Div` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class RealDiv extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RealDiv operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of RealDiv + */ + public static RealDiv create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("RealDiv", scope.makeOpName("RealDiv")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RealDiv(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private RealDiv(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Reciprocal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Reciprocal.java new file mode 100644 index 00000000000..d7c582911c8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Reciprocal.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the reciprocal of x element-wise. + *

              + * I.e., \\(y = 1 / x\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Reciprocal extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Reciprocal operation. + * + * @param scope current scope + * @param x + * @return a new instance of Reciprocal + */ + public static Reciprocal create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Reciprocal", scope.makeOpName("Reciprocal")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Reciprocal(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Reciprocal(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ReciprocalGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ReciprocalGrad.java new file mode 100644 index 00000000000..47eaf7ebc15 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ReciprocalGrad.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient for the inverse of `x` wrt its input. + *

              + * Specifically, `grad = -dy yy`, where `y = 1/x`, and `dy` + * is the corresponding input gradient. + * + * @param data type for {@code z()} output + */ +public final class ReciprocalGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ReciprocalGrad operation. + * + * @param scope current scope + * @param y + * @param dy + * @return a new instance of ReciprocalGrad + */ + public static ReciprocalGrad create(Scope scope, Operand y, Operand dy) { + OperationBuilder opBuilder = scope.env().opBuilder("ReciprocalGrad", scope.makeOpName("ReciprocalGrad")); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(dy.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReciprocalGrad(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private ReciprocalGrad(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Rint.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Rint.java new file mode 100644 index 00000000000..3449a6e8418 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Rint.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns element-wise integer closest to x. + *

              + * If the result is midway between two representable values, + * the even representable is chosen. + * For example: + *

              {@code
              + * rint(-1.5) ==> -2.0
              + * rint(0.5000001) ==> 1.0
              + * rint([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) ==> [-2., -2., -0., 0., 2., 2., 2.]
              + * }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Rint extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Rint operation. + * + * @param scope current scope + * @param x + * @return a new instance of Rint + */ + public static Rint create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Rint", scope.makeOpName("Rint")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Rint(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Rint(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Round.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Round.java new file mode 100644 index 00000000000..f0b30e5528a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Round.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Rounds the values of a tensor to the nearest integer, element-wise. + *

              + * Rounds half to even. Also known as bankers rounding. If you want to round + * according to the current system rounding mode use std::cint. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Round extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Round operation. + * + * @param scope current scope + * @param x + * @return a new instance of Round + */ + public static Round create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Round", scope.makeOpName("Round")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Round(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Round(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Rsqrt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Rsqrt.java new file mode 100644 index 00000000000..ad306c269a5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Rsqrt.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes reciprocal of square root of x element-wise. + *

              + * I.e., \\(y = 1 / \sqrt{x}\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Rsqrt extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Rsqrt operation. + * + * @param scope current scope + * @param x + * @return a new instance of Rsqrt + */ + public static Rsqrt create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Rsqrt", scope.makeOpName("Rsqrt")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Rsqrt(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Rsqrt(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RsqrtGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RsqrtGrad.java new file mode 100644 index 00000000000..e0fed0ce6e3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RsqrtGrad.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient for the rsqrt of `x` wrt its input. + *

              + * Specifically, `grad = dy * -0.5 * y^3`, where `y = rsqrt(x)`, and `dy` + * is the corresponding input gradient. + * + * @param data type for {@code z()} output + */ +public final class RsqrtGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RsqrtGrad operation. + * + * @param scope current scope + * @param y + * @param dy + * @return a new instance of RsqrtGrad + */ + public static RsqrtGrad create(Scope scope, Operand y, Operand dy) { + OperationBuilder opBuilder = scope.env().opBuilder("RsqrtGrad", scope.makeOpName("RsqrtGrad")); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(dy.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RsqrtGrad(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private RsqrtGrad(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMax.java new file mode 100644 index 00000000000..3b54dc4bf0f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMax.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the maximum along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * Computes a tensor such that + * \\(output_i = \max_j(data_j)\\) where `max` is over `j` such + * that `segment_ids[j] == i`. + *

              + * If the max is empty for a given segment ID `i`, `output[i] = 0`. + *

              + *

              + * + *
              + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]])
              + * tf.segment_max(c, tf.constant([0, 0, 1]))
              + * # ==> [[4, 3, 3, 4],
              + * #      [5, 6, 7, 8]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class SegmentMax extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SegmentMax operation. + * + * @param scope current scope + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * first dimension. Values should be sorted and can be repeated. + * @return a new instance of SegmentMax + */ + public static SegmentMax create(Scope scope, Operand data, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SegmentMax", scope.makeOpName("SegmentMax")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SegmentMax(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SegmentMax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMean.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMean.java new file mode 100644 index 00000000000..cb1e0cf3161 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMean.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the mean along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * Computes a tensor such that + * \\(output_i = \frac{\sum_j data_j}{N}\\) where `mean` is + * over `j` such that `segment_ids[j] == i` and `N` is the total number of + * values summed. + *

              + * If the mean is empty for a given segment ID `i`, `output[i] = 0`. + *

              + *

              + * + *
              + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1.0,2,3,4], [4, 3, 2, 1], [5,6,7,8]])
              + * tf.segment_mean(c, tf.constant([0, 0, 1]))
              + * # ==> [[2.5, 2.5, 2.5, 2.5],
              + * #      [5, 6, 7, 8]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class SegmentMean extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SegmentMean operation. + * + * @param scope current scope + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * first dimension. Values should be sorted and can be repeated. + * @return a new instance of SegmentMean + */ + public static SegmentMean create(Scope scope, Operand data, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SegmentMean", scope.makeOpName("SegmentMean")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SegmentMean(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SegmentMean(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMin.java new file mode 100644 index 00000000000..188bb13d1b3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMin.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the minimum along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * Computes a tensor such that + * \\(output_i = \min_j(data_j)\\) where `min` is over `j` such + * that `segment_ids[j] == i`. + *

              + * If the min is empty for a given segment ID `i`, `output[i] = 0`. + *

              + *

              + * + *
              + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]])
              + * tf.segment_min(c, tf.constant([0, 0, 1]))
              + * # ==> [[1, 2, 2, 1],
              + * #      [5, 6, 7, 8]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class SegmentMin extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SegmentMin operation. + * + * @param scope current scope + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * first dimension. Values should be sorted and can be repeated. + * @return a new instance of SegmentMin + */ + public static SegmentMin create(Scope scope, Operand data, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SegmentMin", scope.makeOpName("SegmentMin")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SegmentMin(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SegmentMin(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentProd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentProd.java new file mode 100644 index 00000000000..4ca79ac843a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentProd.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the product along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * Computes a tensor such that + * \\(output_i = \prod_j data_j\\) where the product is over `j` such + * that `segment_ids[j] == i`. + *

              + * If the product is empty for a given segment ID `i`, `output[i] = 1`. + *

              + *

              + * + *
              + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]])
              + * tf.segment_prod(c, tf.constant([0, 0, 1]))
              + * # ==> [[4, 6, 6, 4],
              + * #      [5, 6, 7, 8]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class SegmentProd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SegmentProd operation. + * + * @param scope current scope + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * first dimension. Values should be sorted and can be repeated. + * @return a new instance of SegmentProd + */ + public static SegmentProd create(Scope scope, Operand data, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SegmentProd", scope.makeOpName("SegmentProd")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SegmentProd(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SegmentProd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentSum.java new file mode 100644 index 00000000000..f9c71790e5f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentSum.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * Computes a tensor such that + * \\(output_i = \sum_j data_j\\) where sum is over `j` such + * that `segment_ids[j] == i`. + *

              + * If the sum is empty for a given segment ID `i`, `output[i] = 0`. + *

              + *

              + * + *
              + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [4, 3, 2, 1], [5,6,7,8]])
              + * tf.segment_sum(c, tf.constant([0, 0, 1]))
              + * # ==> [[5, 5, 5, 5],
              + * #      [5, 6, 7, 8]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class SegmentSum extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SegmentSum operation. + * + * @param scope current scope + * @param data + * @param segmentIds A 1-D tensor whose size is equal to the size of `data`'s + * first dimension. Values should be sorted and can be repeated. + * @return a new instance of SegmentSum + */ + public static SegmentSum create(Scope scope, Operand data, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SegmentSum", scope.makeOpName("SegmentSum")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SegmentSum(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SegmentSum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sigmoid.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sigmoid.java new file mode 100644 index 00000000000..542cab728f1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sigmoid.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes sigmoid of `x` element-wise. + *

              + * Specifically, `y = 1 / (1 + exp(-x))`. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Sigmoid extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Sigmoid operation. + * + * @param scope current scope + * @param x + * @return a new instance of Sigmoid + */ + public static Sigmoid create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Sigmoid", scope.makeOpName("Sigmoid")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Sigmoid(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Sigmoid(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SigmoidGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SigmoidGrad.java new file mode 100644 index 00000000000..dbc7782fd86 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SigmoidGrad.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient of the sigmoid of `x` wrt its input. + *

              + * Specifically, `grad = dy * y * (1 - y)`, where `y = sigmoid(x)`, and + * `dy` is the corresponding input gradient. + * + * @param data type for {@code z()} output + */ +public final class SigmoidGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SigmoidGrad operation. + * + * @param scope current scope + * @param y + * @param dy + * @return a new instance of SigmoidGrad + */ + public static SigmoidGrad create(Scope scope, Operand y, Operand dy) { + OperationBuilder opBuilder = scope.env().opBuilder("SigmoidGrad", scope.makeOpName("SigmoidGrad")); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(dy.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SigmoidGrad(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private SigmoidGrad(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sign.java new file mode 100644 index 00000000000..abf5b454117 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sign.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns an element-wise indication of the sign of a number. + *

              + * `y = sign(x) = -1` if `x < 0`; 0 if `x == 0`; 1 if `x > 0`. + *

              + * For complex numbers, `y = sign(x) = x / |x|` if `x != 0`, otherwise `y = 0`. + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Sign extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Sign operation. + * + * @param scope current scope + * @param x + * @return a new instance of Sign + */ + public static Sign create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Sign", scope.makeOpName("Sign")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Sign(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Sign(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sin.java new file mode 100644 index 00000000000..74905ac75c9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sin.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes sine of x element-wise. + *

              + * Given an input tensor, this function computes sine of every + * element in the tensor. Input range is `(-inf, inf)` and + * output range is `[-1,1]`. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 200, 10, float("inf")])
              + *   tf.math.sin(x) ==> [nan -0.4121185 -0.47942555 0.84147096 0.9320391 -0.87329733 -0.54402107 nan]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Sin extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Sin operation. + * + * @param scope current scope + * @param x + * @return a new instance of Sin + */ + public static Sin create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Sin", scope.makeOpName("Sin")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Sin(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Sin(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sinh.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sinh.java new file mode 100644 index 00000000000..c561c693852 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sinh.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes hyperbolic sine of x element-wise. + *

              + * Given an input tensor, this function computes hyperbolic sine of every + * element in the tensor. Input range is `[-inf,inf]` and output range + * is `[-inf,inf]`. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 2, 10, float("inf")])
              + *   tf.math.sinh(x) ==> [-inf -4.0515420e+03 -5.2109528e-01 1.1752012e+00 1.5094614e+00 3.6268604e+00 1.1013232e+04 inf]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Sinh extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Sinh operation. + * + * @param scope current scope + * @param x + * @return a new instance of Sinh + */ + public static Sinh create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Sinh", scope.makeOpName("Sinh")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Sinh(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Sinh(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Softplus.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Softplus.java new file mode 100644 index 00000000000..dbaba42df8b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Softplus.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes softplus: `log(exp(features) + 1)`. + * + * @param data type for {@code activations()} output + */ +@Operator(group = "math") +public final class Softplus extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Softplus operation. + * + * @param scope current scope + * @param features + * @return a new instance of Softplus + */ + public static Softplus create(Scope scope, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("Softplus", scope.makeOpName("Softplus")); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Softplus(opBuilder.build()); + } + + /** + */ + public Output activations() { + return activations; + } + + @Override + public Output asOutput() { + return activations; + } + + private Output activations; + + private Softplus(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SoftplusGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SoftplusGrad.java new file mode 100644 index 00000000000..675aad3567b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SoftplusGrad.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes softplus gradients for a softplus operation. + * + * @param data type for {@code backprops()} output + */ +public final class SoftplusGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SoftplusGrad operation. + * + * @param scope current scope + * @param gradients The backpropagated gradients to the corresponding softplus operation. + * @param features The features passed as input to the corresponding softplus operation. + * @return a new instance of SoftplusGrad + */ + public static SoftplusGrad create(Scope scope, Operand gradients, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("SoftplusGrad", scope.makeOpName("SoftplusGrad")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SoftplusGrad(opBuilder.build()); + } + + /** + * The gradients: `gradients / (1 + exp(-features))`. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private SoftplusGrad(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sqrt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sqrt.java new file mode 100644 index 00000000000..ec117ccedcb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sqrt.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes square root of x element-wise. + *

              + * I.e., \\(y = \sqrt{x} = x^{1/2}\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Sqrt extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Sqrt operation. + * + * @param scope current scope + * @param x + * @return a new instance of Sqrt + */ + public static Sqrt create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Sqrt", scope.makeOpName("Sqrt")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Sqrt(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Sqrt(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SqrtGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SqrtGrad.java new file mode 100644 index 00000000000..100db9173b4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SqrtGrad.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient for the sqrt of `x` wrt its input. + *

              + * Specifically, `grad = dy * 0.5 / y`, where `y = sqrt(x)`, and `dy` + * is the corresponding input gradient. + * + * @param data type for {@code z()} output + */ +public final class SqrtGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SqrtGrad operation. + * + * @param scope current scope + * @param y + * @param dy + * @return a new instance of SqrtGrad + */ + public static SqrtGrad create(Scope scope, Operand y, Operand dy) { + OperationBuilder opBuilder = scope.env().opBuilder("SqrtGrad", scope.makeOpName("SqrtGrad")); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(dy.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SqrtGrad(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private SqrtGrad(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Square.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Square.java new file mode 100644 index 00000000000..9bcdfb7749d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Square.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes square of x element-wise. + *

              + * I.e., \\(y = x * x = x^2\\). + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Square extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Square operation. + * + * @param scope current scope + * @param x + * @return a new instance of Square + */ + public static Square create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Square", scope.makeOpName("Square")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Square(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Square(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SquaredDifference.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SquaredDifference.java new file mode 100644 index 00000000000..c72b871eb41 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SquaredDifference.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns (x - y)(x - y) element-wise. + *

              + * NOTE: `math.SquaredDifference` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class SquaredDifference extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SquaredDifference operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of SquaredDifference + */ + public static SquaredDifference create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("SquaredDifference", scope.makeOpName("SquaredDifference")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SquaredDifference(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private SquaredDifference(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sub.java new file mode 100644 index 00000000000..0aed952fcd9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Sub.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x - y element-wise. + *

              + * NOTE: `math.Sub` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Sub extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Sub operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Sub + */ + public static Sub create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Sub", scope.makeOpName("Sub")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Sub(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Sub(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Tan.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Tan.java new file mode 100644 index 00000000000..ab4cd8fc789 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Tan.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes tan of x element-wise. + *

              + * Given an input tensor, this function computes tangent of every + * element in the tensor. Input range is `(-inf, inf)` and + * output range is `(-inf, inf)`. If input lies outside the boundary, `nan` + * is returned. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 200, 10000, float("inf")])
              + *   tf.math.tan(x) ==> [nan 0.45231566 -0.5463025 1.5574077 2.572152 -1.7925274 0.32097113 nan]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Tan extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Tan operation. + * + * @param scope current scope + * @param x + * @return a new instance of Tan + */ + public static Tan create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Tan", scope.makeOpName("Tan")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Tan(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Tan(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Tanh.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Tanh.java new file mode 100644 index 00000000000..d7eb23c20f2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Tanh.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes hyperbolic tangent of `x` element-wise. + *

              + * Given an input tensor, this function computes hyperbolic tangent of every + * element in the tensor. Input range is `[-inf, inf]` and + * output range is `[-1,1]`. + *

              + *

              {@code
              + *   x = tf.constant([-float("inf"), -5, -0.5, 1, 1.2, 2, 3, float("inf")])
              + *   tf.math.tanh(x) ==> [-1. -0.99990916 -0.46211717 0.7615942 0.8336547 0.9640276 0.9950547 1.]
              + *   }
              + * + * + * @param data type for {@code y()} output + */ +@Operator(group = "math") +public final class Tanh extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Tanh operation. + * + * @param scope current scope + * @param x + * @return a new instance of Tanh + */ + public static Tanh create(Scope scope, Operand x) { + OperationBuilder opBuilder = scope.env().opBuilder("Tanh", scope.makeOpName("Tanh")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Tanh(opBuilder.build()); + } + + /** + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private Tanh(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TanhGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TanhGrad.java new file mode 100644 index 00000000000..60d358b6ea3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TanhGrad.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient for the tanh of `x` wrt its input. + *

              + * Specifically, `grad = dy (1 - yy)`, where `y = tanh(x)`, and `dy` + * is the corresponding input gradient. + * + * @param data type for {@code z()} output + */ +public final class TanhGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TanhGrad operation. + * + * @param scope current scope + * @param y + * @param dy + * @return a new instance of TanhGrad + */ + public static TanhGrad create(Scope scope, Operand y, Operand dy) { + OperationBuilder opBuilder = scope.env().opBuilder("TanhGrad", scope.makeOpName("TanhGrad")); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(dy.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TanhGrad(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private TanhGrad(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TruncateDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TruncateDiv.java new file mode 100644 index 00000000000..2c02733a143 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TruncateDiv.java @@ -0,0 +1,78 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns x / y element-wise for integer types. + *

              + * Truncation designates that negative numbers will round fractional quantities + * toward zero. I.e. -7 / 5 = -1. This matches C semantics but it is different + * than Python semantics. See `FloorDiv` for a division function that matches + * Python Semantics. + *

              + * NOTE: `math.TruncateDiv` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class TruncateDiv extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TruncateDiv operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of TruncateDiv + */ + public static TruncateDiv create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("TruncateDiv", scope.makeOpName("TruncateDiv")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TruncateDiv(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private TruncateDiv(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TruncateMod.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TruncateMod.java new file mode 100644 index 00000000000..54fbb2032f7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/TruncateMod.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns element-wise remainder of division. This emulates C semantics in that + *

              + * the result here is consistent with a truncating divide. E.g. `truncate(x / y) * + * y + truncate_mod(x, y) = x`. + *

              + * NOTE: `math.TruncateMod` supports broadcasting. More about broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class TruncateMod extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TruncateMod operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of TruncateMod + */ + public static TruncateMod create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("TruncateMod", scope.makeOpName("TruncateMod")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TruncateMod(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private TruncateMod(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMax.java new file mode 100644 index 00000000000..e4acd147ac1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMax.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the maximum along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * This operator is similar to the unsorted segment sum operator found + * [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). + * Instead of computing the sum over segments, it computes the maximum such that: + *

              + * \\(output_i = \max_{j...} data[j...]\\) where max is over tuples `j...` such + * that `segment_ids[j...] == i`. + *

              + * If the maximum is empty for a given segment ID `i`, it outputs the smallest + * possible value for the specific numeric type, + * `output[i] = numeric_limits::lowest()`. + *

              + * If the given segment ID `i` is negative, then the corresponding value is + * dropped, and will not be included in the result. + *

              + *

              + * + *
              + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]])
              + * tf.unsorted_segment_max(c, tf.constant([0, 1, 0]), num_segments=2)
              + * # ==> [[ 4,  3, 3, 4],
              + * #       [5,  6, 7, 8]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class UnsortedSegmentMax extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnsortedSegmentMax operation. + * + * @param scope current scope + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentMax + */ + public static UnsortedSegmentMax create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentMax", scope.makeOpName("UnsortedSegmentMax")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new UnsortedSegmentMax(opBuilder.build()); + } + + /** + * Has same shape as data, except for the first `segment_ids.rank` + * dimensions, which are replaced with a single dimension which has size + * `num_segments`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnsortedSegmentMax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMin.java new file mode 100644 index 00000000000..a18a32b283d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMin.java @@ -0,0 +1,100 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the minimum along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * This operator is similar to the unsorted segment sum operator found + * [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). + * Instead of computing the sum over segments, it computes the minimum such that: + *

              + * \\(output_i = \min_{j...} data_[j...]\\) where min is over tuples `j...` such + * that `segment_ids[j...] == i`. + *

              + * If the minimum is empty for a given segment ID `i`, it outputs the largest + * possible value for the specific numeric type, + * `output[i] = numeric_limits::max()`. + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]])
              + * tf.unsorted_segment_min(c, tf.constant([0, 1, 0]), num_segments=2)
              + * # ==> [[ 1,  2, 2, 1],
              + * #       [5,  6, 7, 8]]
              + * }
              + * If the given segment ID `i` is negative, then the corresponding value is + * dropped, and will not be included in the result. + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class UnsortedSegmentMin extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnsortedSegmentMin operation. + * + * @param scope current scope + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentMin + */ + public static UnsortedSegmentMin create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentMin", scope.makeOpName("UnsortedSegmentMin")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new UnsortedSegmentMin(opBuilder.build()); + } + + /** + * Has same shape as data, except for the first `segment_ids.rank` + * dimensions, which are replaced with a single dimension which has size + * `num_segments`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnsortedSegmentMin(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentProd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentProd.java new file mode 100644 index 00000000000..52d5bb3e0a3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentProd.java @@ -0,0 +1,99 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the product along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * This operator is similar to the unsorted segment sum operator found + * [(here)](../../../api_docs/python/math_ops.md#UnsortedSegmentSum). + * Instead of computing the sum over segments, it computes the product of all + * entries belonging to a segment such that: + *

              + * \\(output_i = \prod_{j...} data[j...]\\) where the product is over tuples + * `j...` such that `segment_ids[j...] == i`. + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]])
              + * tf.unsorted_segment_prod(c, tf.constant([0, 1, 0]), num_segments=2)
              + * # ==> [[ 4,  6, 6, 4],
              + * #       [5,  6, 7, 8]]
              + * }
              + * If there is no entry for a given segment ID `i`, it outputs 1. + *

              + * If the given segment ID `i` is negative, then the corresponding value is + * dropped, and will not be included in the result. + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class UnsortedSegmentProd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnsortedSegmentProd operation. + * + * @param scope current scope + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentProd + */ + public static UnsortedSegmentProd create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentProd", scope.makeOpName("UnsortedSegmentProd")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new UnsortedSegmentProd(opBuilder.build()); + } + + /** + * Has same shape as data, except for the first `segment_ids.rank` + * dimensions, which are replaced with a single dimension which has size + * `num_segments`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnsortedSegmentProd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentSum.java new file mode 100644 index 00000000000..74a1bfe774c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentSum.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum along segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * Computes a tensor such that + * \\(output[i] = \sum_{j...} data[j...]\\) where the sum is over tuples `j...` such + * that `segment_ids[j...] == i`. Unlike `SegmentSum`, `segment_ids` + * need not be sorted and need not cover all values in the full + * range of valid values. + *

              + * If the sum is empty for a given segment ID `i`, `output[i] = 0`. + * If the given segment ID `i` is negative, the value is dropped and will not be + * added to the sum of the segment. + *

              + * `num_segments` should equal the number of distinct segment IDs. + *

              + *

              + * + *
              + *
              {@code
              + * c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]])
              + * tf.unsorted_segment_sum(c, tf.constant([0, 1, 0]), num_segments=2)
              + * # ==> [[ 5,  5, 5, 5],
              + * #       [5,  6, 7, 8]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "math") +public final class UnsortedSegmentSum extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnsortedSegmentSum operation. + * + * @param scope current scope + * @param data + * @param segmentIds A tensor whose shape is a prefix of `data.shape`. + * @param numSegments + * @return a new instance of UnsortedSegmentSum + */ + public static UnsortedSegmentSum create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentSum", scope.makeOpName("UnsortedSegmentSum")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new UnsortedSegmentSum(opBuilder.build()); + } + + /** + * Has same shape as data, except for the first `segment_ids.rank` + * dimensions, which are replaced with a single dimension which has size + * `num_segments`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnsortedSegmentSum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Xdivy.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Xdivy.java new file mode 100644 index 00000000000..56b788f1406 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Xdivy.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns 0 if x == 0, and x / y otherwise, elementwise. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Xdivy extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Xdivy operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Xdivy + */ + public static Xdivy create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Xdivy", scope.makeOpName("Xdivy")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Xdivy(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Xdivy(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Xlogy.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Xlogy.java new file mode 100644 index 00000000000..d689e62d504 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Xlogy.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns 0 if x == 0, and x * log(y) otherwise, elementwise. + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Xlogy extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Xlogy operation. + * + * @param scope current scope + * @param x + * @param y + * @return a new instance of Xlogy + */ + public static Xlogy create(Scope scope, Operand x, Operand y) { + OperationBuilder opBuilder = scope.env().opBuilder("Xlogy", scope.makeOpName("Xlogy")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(y.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Xlogy(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Xlogy(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Zeta.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Zeta.java new file mode 100644 index 00000000000..37531d72504 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Zeta.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.math; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute the Hurwitz zeta function \\(\zeta(x, q)\\). + *

              + * The Hurwitz zeta function is defined as: + *

              + * \\(\zeta(x, q) = \sum_{n=0}^{\infty} (q + n)^{-x}\\) + * + * @param data type for {@code z()} output + */ +@Operator(group = "math") +public final class Zeta extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Zeta operation. + * + * @param scope current scope + * @param x + * @param q + * @return a new instance of Zeta + */ + public static Zeta create(Scope scope, Operand x, Operand q) { + OperationBuilder opBuilder = scope.env().opBuilder("Zeta", scope.makeOpName("Zeta")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(q.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Zeta(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private Zeta(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool.java new file mode 100644 index 00000000000..b3c46193650 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool.java @@ -0,0 +1,129 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs average pooling on the input. + *

              + * Each entry in `output` is the mean of the corresponding size `ksize` + * window in `value`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class AvgPool extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.AvgPool} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AvgPool operation. + * + * @param scope current scope + * @param value 4-D with shape `[batch, height, width, channels]`. + * @param ksize The size of the sliding window for each dimension of `value`. + * @param strides The stride of the sliding window for each dimension of `value`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of AvgPool + */ + public static AvgPool create(Scope scope, Operand value, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AvgPool", scope.makeOpName("AvgPool")); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new AvgPool(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * The average pooled output tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AvgPool(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool3d.java new file mode 100644 index 00000000000..e77ac2b2adf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool3d.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs 3D average pooling on the input. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class AvgPool3d extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.AvgPool3d} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AvgPool3d operation. + * + * @param scope current scope + * @param input Shape `[batch, depth, rows, cols, channels]` tensor to pool over. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * the input tensor. Must have `ksize[0] = ksize[4] = 1`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of AvgPool3d + */ + public static AvgPool3d create(Scope scope, Operand input, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AvgPool3D", scope.makeOpName("AvgPool3d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new AvgPool3d(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * The average pooled output tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AvgPool3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool3dGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool3dGrad.java new file mode 100644 index 00000000000..89e95f9963e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPool3dGrad.java @@ -0,0 +1,130 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes gradients of average pooling function. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class AvgPool3dGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.AvgPool3dGrad} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AvgPool3dGrad operation. + * + * @param scope current scope + * @param origInputShape The original input dimensions. + * @param grad Output backprop of shape `[batch, depth, rows, cols, channels]`. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * the input tensor. Must have `ksize[0] = ksize[4] = 1`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of AvgPool3dGrad + */ + public static AvgPool3dGrad create(Scope scope, Operand origInputShape, Operand grad, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AvgPool3DGrad", scope.makeOpName("AvgPool3dGrad")); + opBuilder.addInput(origInputShape.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new AvgPool3dGrad(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * The backprop for input. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AvgPool3dGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPoolGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPoolGrad.java new file mode 100644 index 00000000000..e2d9bc5d359 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/AvgPoolGrad.java @@ -0,0 +1,127 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes gradients of the average pooling function. + * + * @param data type for {@code output()} output + */ +public final class AvgPoolGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.AvgPoolGrad} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AvgPoolGrad operation. + * + * @param scope current scope + * @param origInputShape 1-D. Shape of the original input to `avg_pool`. + * @param grad 4-D with shape `[batch, height, width, channels]`. Gradients w.r.t. + * the output of `avg_pool`. + * @param ksize The size of the sliding window for each dimension of the input. + * @param strides The stride of the sliding window for each dimension of the input. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of AvgPoolGrad + */ + public static AvgPoolGrad create(Scope scope, Operand origInputShape, Operand grad, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AvgPoolGrad", scope.makeOpName("AvgPoolGrad")); + opBuilder.addInput(origInputShape.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new AvgPoolGrad(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * 4-D. Gradients w.r.t. the input of `avg_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private AvgPoolGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BatchNormWithGlobalNormalization.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BatchNormWithGlobalNormalization.java new file mode 100644 index 00000000000..8dd759470dc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BatchNormWithGlobalNormalization.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Batch normalization. + *

              + * This op is deprecated. Prefer `tf.nn.batch_normalization`. + * + * @param data type for {@code result()} output + */ +@Operator(group = "nn") +public final class BatchNormWithGlobalNormalization extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchNormWithGlobalNormalization operation. + * + * @param scope current scope + * @param t A 4D input Tensor. + * @param m A 1D mean Tensor with size matching the last dimension of t. + * This is the first output from tf.nn.moments, + * or a saved moving average thereof. + * @param v A 1D variance Tensor with size matching the last dimension of t. + * This is the second output from tf.nn.moments, + * or a saved moving average thereof. + * @param beta A 1D beta Tensor with size matching the last dimension of t. + * An offset to be added to the normalized tensor. + * @param gamma A 1D gamma Tensor with size matching the last dimension of t. + * If "scale_after_normalization" is true, this tensor will be multiplied + * with the normalized tensor. + * @param varianceEpsilon A small float number to avoid dividing by 0. + * @param scaleAfterNormalization A bool indicating whether the resulted tensor + * needs to be multiplied with gamma. + * @return a new instance of BatchNormWithGlobalNormalization + */ + public static BatchNormWithGlobalNormalization create(Scope scope, Operand t, Operand m, Operand v, Operand beta, Operand gamma, Float varianceEpsilon, Boolean scaleAfterNormalization) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchNormWithGlobalNormalization", scope.makeOpName("BatchNormWithGlobalNormalization")); + opBuilder.addInput(t.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(beta.asOutput()); + opBuilder.addInput(gamma.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("variance_epsilon", varianceEpsilon); + opBuilder.setAttr("scale_after_normalization", scaleAfterNormalization); + return new BatchNormWithGlobalNormalization(opBuilder.build()); + } + + /** + */ + public Output result() { + return result; + } + + @Override + public Output asOutput() { + return result; + } + + private Output result; + + private BatchNormWithGlobalNormalization(Operation operation) { + super(operation); + int outputIdx = 0; + result = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BatchNormWithGlobalNormalizationGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BatchNormWithGlobalNormalizationGrad.java new file mode 100644 index 00000000000..0c1f29df260 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BatchNormWithGlobalNormalizationGrad.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gradients for batch normalization. + *

              + * This op is deprecated. See `tf.nn.batch_normalization`. + * + * @param data type for {@code dx()} output + */ +@Operator(group = "nn") +public final class BatchNormWithGlobalNormalizationGrad extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new BatchNormWithGlobalNormalizationGrad operation. + * + * @param scope current scope + * @param t A 4D input Tensor. + * @param m A 1D mean Tensor with size matching the last dimension of t. + * This is the first output from tf.nn.moments, + * or a saved moving average thereof. + * @param v A 1D variance Tensor with size matching the last dimension of t. + * This is the second output from tf.nn.moments, + * or a saved moving average thereof. + * @param gamma A 1D gamma Tensor with size matching the last dimension of t. + * If "scale_after_normalization" is true, this Tensor will be multiplied + * with the normalized Tensor. + * @param backprop 4D backprop Tensor. + * @param varianceEpsilon A small float number to avoid dividing by 0. + * @param scaleAfterNormalization A bool indicating whether the resulted tensor + * needs to be multiplied with gamma. + * @return a new instance of BatchNormWithGlobalNormalizationGrad + */ + public static BatchNormWithGlobalNormalizationGrad create(Scope scope, Operand t, Operand m, Operand v, Operand gamma, Operand backprop, Float varianceEpsilon, Boolean scaleAfterNormalization) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchNormWithGlobalNormalizationGrad", scope.makeOpName("BatchNormWithGlobalNormalizationGrad")); + opBuilder.addInput(t.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(gamma.asOutput()); + opBuilder.addInput(backprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("variance_epsilon", varianceEpsilon); + opBuilder.setAttr("scale_after_normalization", scaleAfterNormalization); + return new BatchNormWithGlobalNormalizationGrad(opBuilder.build()); + } + + /** + * 4D backprop tensor for input. + */ + public Output dx() { + return dx; + } + + /** + * 1D backprop tensor for mean. + */ + public Output dm() { + return dm; + } + + /** + * 1D backprop tensor for variance. + */ + public Output dv() { + return dv; + } + + /** + * 1D backprop tensor for beta. + */ + public Output db() { + return db; + } + + /** + * 1D backprop tensor for gamma. + */ + public Output dg() { + return dg; + } + + private Output dx; + private Output dm; + private Output dv; + private Output db; + private Output dg; + + private BatchNormWithGlobalNormalizationGrad(Operation operation) { + super(operation); + int outputIdx = 0; + dx = operation.output(outputIdx++); + dm = operation.output(outputIdx++); + dv = operation.output(outputIdx++); + db = operation.output(outputIdx++); + dg = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BiasAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BiasAdd.java new file mode 100644 index 00000000000..c0156b4dadb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BiasAdd.java @@ -0,0 +1,120 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds `bias` to `value`. + *

              + * This is a special case of `tf.add` where `bias` is restricted to be 1-D. + * Broadcasting is supported, so `value` may have any number of dimensions. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class BiasAdd extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.BiasAdd} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the bias tensor will be added to the last dimension + * of the value tensor. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + * The tensor will be added to "in_channels", the third-to-the-last + * dimension. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BiasAdd operation. + * + * @param scope current scope + * @param value Any number of dimensions. + * @param bias 1-D with size the last dimension of `value`. + * @param options carries optional attributes values + * @return a new instance of BiasAdd + */ + public static BiasAdd create(Scope scope, Operand value, Operand bias, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BiasAdd", scope.makeOpName("BiasAdd")); + opBuilder.addInput(value.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new BiasAdd(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the bias tensor will be added to the last dimension + * of the value tensor. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + * The tensor will be added to "in_channels", the third-to-the-last + * dimension. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * Broadcasted sum of `value` and `bias`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BiasAdd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BiasAddGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BiasAddGrad.java new file mode 100644 index 00000000000..1172dc6138a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/BiasAddGrad.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * The backward operation for "BiasAdd" on the "bias" tensor. + *

              + * It accumulates all the values from out_backprop into the feature dimension. + * For NHWC data format, the feature dimension is the last. For NCHW data format, + * the feature dimension is the third-to-last. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class BiasAddGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.BiasAddGrad} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the bias tensor will be added to the last dimension + * of the value tensor. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + * The tensor will be added to "in_channels", the third-to-the-last + * dimension. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new BiasAddGrad operation. + * + * @param scope current scope + * @param outBackprop Any number of dimensions. + * @param options carries optional attributes values + * @return a new instance of BiasAddGrad + */ + public static BiasAddGrad create(Scope scope, Operand outBackprop, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("BiasAddGrad", scope.makeOpName("BiasAddGrad")); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new BiasAddGrad(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the bias tensor will be added to the last dimension + * of the value tensor. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + * The tensor will be added to "in_channels", the third-to-the-last + * dimension. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * 1-D with size the feature dimension of `out_backprop`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private BiasAddGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/ComputeAccidentalHits.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/ComputeAccidentalHits.java new file mode 100644 index 00000000000..7023882c3c1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/ComputeAccidentalHits.java @@ -0,0 +1,148 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the ids of the positions in sampled_candidates that match true_labels. + *

              + * When doing log-odds NCE, the result of this op should be passed through a + * SparseToDense op, then added to the logits of the sampled candidates. This has + * the effect of 'removing' the sampled labels that match the true labels by + * making the classifier sure that they are sampled labels. + */ +@Operator(group = "nn") +public final class ComputeAccidentalHits extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.ComputeAccidentalHits} + */ + public static class Options { + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ComputeAccidentalHits operation. + * + * @param scope current scope + * @param trueClasses The true_classes output of UnpackSparseLabels. + * @param sampledCandidates The sampled_candidates output of CandidateSampler. + * @param numTrue Number of true labels per context. + * @param options carries optional attributes values + * @return a new instance of ComputeAccidentalHits + */ + public static ComputeAccidentalHits create(Scope scope, Operand trueClasses, Operand sampledCandidates, Long numTrue, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ComputeAccidentalHits", scope.makeOpName("ComputeAccidentalHits")); + opBuilder.addInput(trueClasses.asOutput()); + opBuilder.addInput(sampledCandidates.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_true", numTrue); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new ComputeAccidentalHits(opBuilder.build()); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A vector of indices corresponding to rows of true_candidates. + */ + public Output indices() { + return indices; + } + + /** + * A vector of IDs of positions in sampled_candidates that match a true_label + * for the row with the corresponding index in indices. + */ + public Output ids() { + return ids; + } + + /** + * A vector of the same length as indices and ids, in which each element + * is -FLOAT_MAX. + */ + public Output weights() { + return weights; + } + + private Output indices; + private Output ids; + private Output weights; + + private ComputeAccidentalHits(Operation operation) { + super(operation); + int outputIdx = 0; + indices = operation.output(outputIdx++); + ids = operation.output(outputIdx++); + weights = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2d.java new file mode 100644 index 00000000000..01174a742a2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2d.java @@ -0,0 +1,228 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes a 2-D convolution given 4-D `input` and `filter` tensors. + *

              + * Given an input tensor of shape `[batch, in_height, in_width, in_channels]` + * and a filter / kernel tensor of shape + * `[filter_height, filter_width, in_channels, out_channels]`, this op + * performs the following: + *

              + * 1. Flattens the filter to a 2-D matrix with shape + * `[filter_height * filter_width * in_channels, output_channels]`. + * 2. Extracts image patches from the input tensor to form a virtual + * tensor of shape `[batch, out_height, out_width, + * filter_height * filter_width * in_channels]`. + * 3. For each patch, right-multiplies the filter matrix and the image patch + * vector. + *

              + * In detail, with the default NHWC format, + *

              + * output[b, i, j, k] = + * sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] * + * filter[di, dj, q, k] + *

              + * Must have `strides[0] = strides[3] = 1`. For the most common case of the same + * horizontal and vertices strides, `strides = [1, stride, stride, 1]`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class Conv2d extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.Conv2d} + */ + public static class Options { + + /** + * @param useCudnnOnGpu + */ + public Options useCudnnOnGpu(Boolean useCudnnOnGpu) { + this.useCudnnOnGpu = useCudnnOnGpu; + return this; + } + + /** + * @param explicitPaddings If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith + * dimension, the amount of padding inserted before and after the dimension is + * `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If + * `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. + */ + public Options explicitPaddings(List explicitPaddings) { + this.explicitPaddings = explicitPaddings; + return this; + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private Boolean useCudnnOnGpu; + private List explicitPaddings; + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Conv2d operation. + * + * @param scope current scope + * @param input A 4-D tensor. The dimension order is interpreted according to the value + * of `data_format`, see below for details. + * @param filter A 4-D tensor of shape + * `[filter_height, filter_width, in_channels, out_channels]` + * @param strides 1-D tensor of length 4. The stride of the sliding window for each + * dimension of `input`. The dimension order is determined by the value of + * `data_format`, see below for details. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv2d + */ + public static Conv2d create(Scope scope, Operand input, Operand filter, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Conv2D", scope.makeOpName("Conv2d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.useCudnnOnGpu != null) { + opBuilder.setAttr("use_cudnn_on_gpu", opts.useCudnnOnGpu); + } + if (opts.explicitPaddings != null) { + long[] explicitPaddingsArray = new long[opts.explicitPaddings.size()]; + for (int i = 0; i < explicitPaddingsArray.length; ++i) { + explicitPaddingsArray[i] = opts.explicitPaddings.get(i); + } + opBuilder.setAttr("explicit_paddings", explicitPaddingsArray); + } + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new Conv2d(opBuilder.build()); + } + + /** + * @param useCudnnOnGpu + */ + public static Options useCudnnOnGpu(Boolean useCudnnOnGpu) { + return new Options().useCudnnOnGpu(useCudnnOnGpu); + } + + /** + * @param explicitPaddings If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith + * dimension, the amount of padding inserted before and after the dimension is + * `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If + * `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. + */ + public static Options explicitPaddings(List explicitPaddings) { + return new Options().explicitPaddings(explicitPaddings); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * A 4-D tensor. The dimension order is determined by the value of + * `data_format`, see below for details. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Conv2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2dBackpropFilter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2dBackpropFilter.java new file mode 100644 index 00000000000..b7f34c9014e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2dBackpropFilter.java @@ -0,0 +1,210 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradients of convolution with respect to the filter. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class Conv2dBackpropFilter extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.Conv2dBackpropFilter} + */ + public static class Options { + + /** + * @param useCudnnOnGpu + */ + public Options useCudnnOnGpu(Boolean useCudnnOnGpu) { + this.useCudnnOnGpu = useCudnnOnGpu; + return this; + } + + /** + * @param explicitPaddings If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith + * dimension, the amount of padding inserted before and after the dimension is + * `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If + * `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. + */ + public Options explicitPaddings(List explicitPaddings) { + this.explicitPaddings = explicitPaddings; + return this; + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private Boolean useCudnnOnGpu; + private List explicitPaddings; + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Conv2dBackpropFilter operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, in_height, in_width, in_channels]`. + * @param filterSizes An integer vector representing the tensor shape of `filter`, + * where `filter` is a 4-D + * `[filter_height, filter_width, in_channels, out_channels]` tensor. + * @param outBackprop 4-D with shape `[batch, out_height, out_width, out_channels]`. + * Gradients w.r.t. the output of the convolution. + * @param strides The stride of the sliding window for each dimension of the input + * of the convolution. Must be in the same order as the dimension specified with + * format. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv2dBackpropFilter + */ + public static Conv2dBackpropFilter create(Scope scope, Operand input, Operand filterSizes, Operand outBackprop, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Conv2DBackpropFilter", scope.makeOpName("Conv2dBackpropFilter")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filterSizes.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.useCudnnOnGpu != null) { + opBuilder.setAttr("use_cudnn_on_gpu", opts.useCudnnOnGpu); + } + if (opts.explicitPaddings != null) { + long[] explicitPaddingsArray = new long[opts.explicitPaddings.size()]; + for (int i = 0; i < explicitPaddingsArray.length; ++i) { + explicitPaddingsArray[i] = opts.explicitPaddings.get(i); + } + opBuilder.setAttr("explicit_paddings", explicitPaddingsArray); + } + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new Conv2dBackpropFilter(opBuilder.build()); + } + + /** + * @param useCudnnOnGpu + */ + public static Options useCudnnOnGpu(Boolean useCudnnOnGpu) { + return new Options().useCudnnOnGpu(useCudnnOnGpu); + } + + /** + * @param explicitPaddings If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith + * dimension, the amount of padding inserted before and after the dimension is + * `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If + * `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. + */ + public static Options explicitPaddings(List explicitPaddings) { + return new Options().explicitPaddings(explicitPaddings); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * 4-D with shape + * `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. + * the `filter` input of the convolution. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Conv2dBackpropFilter(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2dBackpropInput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2dBackpropInput.java new file mode 100644 index 00000000000..8b1bf33b786 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv2dBackpropInput.java @@ -0,0 +1,209 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradients of convolution with respect to the input. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class Conv2dBackpropInput extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.Conv2dBackpropInput} + */ + public static class Options { + + /** + * @param useCudnnOnGpu + */ + public Options useCudnnOnGpu(Boolean useCudnnOnGpu) { + this.useCudnnOnGpu = useCudnnOnGpu; + return this; + } + + /** + * @param explicitPaddings If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith + * dimension, the amount of padding inserted before and after the dimension is + * `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If + * `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. + */ + public Options explicitPaddings(List explicitPaddings) { + this.explicitPaddings = explicitPaddings; + return this; + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private Boolean useCudnnOnGpu; + private List explicitPaddings; + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Conv2dBackpropInput operation. + * + * @param scope current scope + * @param inputSizes An integer vector representing the shape of `input`, + * where `input` is a 4-D `[batch, height, width, channels]` tensor. + * @param filter 4-D with shape + * `[filter_height, filter_width, in_channels, out_channels]`. + * @param outBackprop 4-D with shape `[batch, out_height, out_width, out_channels]`. + * Gradients w.r.t. the output of the convolution. + * @param strides The stride of the sliding window for each dimension of the input + * of the convolution. Must be in the same order as the dimension specified with + * format. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv2dBackpropInput + */ + public static Conv2dBackpropInput create(Scope scope, Operand inputSizes, Operand filter, Operand outBackprop, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Conv2DBackpropInput", scope.makeOpName("Conv2dBackpropInput")); + opBuilder.addInput(inputSizes.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.useCudnnOnGpu != null) { + opBuilder.setAttr("use_cudnn_on_gpu", opts.useCudnnOnGpu); + } + if (opts.explicitPaddings != null) { + long[] explicitPaddingsArray = new long[opts.explicitPaddings.size()]; + for (int i = 0; i < explicitPaddingsArray.length; ++i) { + explicitPaddingsArray[i] = opts.explicitPaddings.get(i); + } + opBuilder.setAttr("explicit_paddings", explicitPaddingsArray); + } + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new Conv2dBackpropInput(opBuilder.build()); + } + + /** + * @param useCudnnOnGpu + */ + public static Options useCudnnOnGpu(Boolean useCudnnOnGpu) { + return new Options().useCudnnOnGpu(useCudnnOnGpu); + } + + /** + * @param explicitPaddings If `padding` is `"EXPLICIT"`, the list of explicit padding amounts. For the ith + * dimension, the amount of padding inserted before and after the dimension is + * `explicit_paddings[2 * i]` and `explicit_paddings[2 * i + 1]`, respectively. If + * `padding` is not `"EXPLICIT"`, `explicit_paddings` must be empty. + */ + public static Options explicitPaddings(List explicitPaddings) { + return new Options().explicitPaddings(explicitPaddings); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * 4-D with shape `[batch, in_height, in_width, in_channels]`. Gradient + * w.r.t. the input of the convolution. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Conv2dBackpropInput(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3d.java new file mode 100644 index 00000000000..ae258baa8cb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3d.java @@ -0,0 +1,160 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes a 3-D convolution given 5-D `input` and `filter` tensors. + *

              + * In signal processing, cross-correlation is a measure of similarity of + * two waveforms as a function of a time-lag applied to one of them. This + * is also known as a sliding dot product or sliding inner-product. + *

              + * Our Conv3D implements a form of cross-correlation. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class Conv3d extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.Conv3d} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 5. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Conv3d operation. + * + * @param scope current scope + * @param input Shape `[batch, in_depth, in_height, in_width, in_channels]`. + * @param filter Shape `[filter_depth, filter_height, filter_width, in_channels, + * out_channels]`. `in_channels` must match between `input` and `filter`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv3d + */ + public static Conv3d create(Scope scope, Operand input, Operand filter, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Conv3D", scope.makeOpName("Conv3d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new Conv3d(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 5. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Conv3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropFilter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropFilter.java new file mode 100644 index 00000000000..08a13e1f0bd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropFilter.java @@ -0,0 +1,159 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradients of 3-D convolution with respect to the filter. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class Conv3dBackpropFilter extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.Conv3dBackpropFilter} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 5. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Conv3dBackpropFilter operation. + * + * @param scope current scope + * @param input Shape `[batch, depth, rows, cols, in_channels]`. + * @param filterSizes An integer vector representing the tensor shape of `filter`, + * where `filter` is a 5-D + * `[filter_depth, filter_height, filter_width, in_channels, out_channels]` + * tensor. + * @param outBackprop Backprop signal of shape `[batch, out_depth, out_rows, out_cols, + * out_channels]`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv3dBackpropFilter + */ + public static Conv3dBackpropFilter create(Scope scope, Operand input, Operand filterSizes, Operand outBackprop, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Conv3DBackpropFilterV2", scope.makeOpName("Conv3dBackpropFilter")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filterSizes.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new Conv3dBackpropFilter(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 5. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Conv3dBackpropFilter(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropInput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropInput.java new file mode 100644 index 00000000000..2d1da92eb6b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropInput.java @@ -0,0 +1,159 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradients of 3-D convolution with respect to the input. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class Conv3dBackpropInput extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.Conv3dBackpropInput} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 5. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Conv3dBackpropInput operation. + * + * @param scope current scope + * @param inputSizes An integer vector representing the tensor shape of `input`, + * where `input` is a 5-D + * `[batch, depth, rows, cols, in_channels]` tensor. + * @param filter Shape `[depth, rows, cols, in_channels, out_channels]`. + * `in_channels` must match between `input` and `filter`. + * @param outBackprop Backprop signal of shape `[batch, out_depth, out_rows, out_cols, + * out_channels]`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of Conv3dBackpropInput + */ + public static Conv3dBackpropInput create(Scope scope, Operand inputSizes, Operand filter, Operand outBackprop, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Conv3DBackpropInputV2", scope.makeOpName("Conv3dBackpropInput")); + opBuilder.addInput(inputSizes.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new Conv3dBackpropInput(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 5. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Conv3dBackpropInput(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcBeamSearchDecoder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcBeamSearchDecoder.java new file mode 100644 index 00000000000..2f29f2c7f2d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcBeamSearchDecoder.java @@ -0,0 +1,151 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs beam search decoding on the logits given in input. + *

              + * A note about the attribute merge_repeated: For the beam search decoder, + * this means that if consecutive entries in a beam are the same, only + * the first of these is emitted. That is, when the top path is "A B B B B", + * "A B" is returned if merge_repeated = True but "A B B B B" is + * returned if merge_repeated = False. + */ +@Operator(group = "nn") +public final class CtcBeamSearchDecoder extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CtcBeamSearchDecoder} + */ + public static class Options { + + /** + * @param mergeRepeated If true, merge repeated classes in output. + */ + public Options mergeRepeated(Boolean mergeRepeated) { + this.mergeRepeated = mergeRepeated; + return this; + } + + private Boolean mergeRepeated; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CtcBeamSearchDecoder operation. + * + * @param scope current scope + * @param inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. + * @param sequenceLength A vector containing sequence lengths, size `(batch)`. + * @param beamWidth A scalar >= 0 (beam search beam width). + * @param topPaths A scalar >= 0, <= beam_width (controls output size). + * @param options carries optional attributes values + * @return a new instance of CtcBeamSearchDecoder + */ + public static CtcBeamSearchDecoder create(Scope scope, Operand inputs, Operand sequenceLength, Long beamWidth, Long topPaths, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CTCBeamSearchDecoder", scope.makeOpName("CtcBeamSearchDecoder")); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(sequenceLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("beam_width", beamWidth); + opBuilder.setAttr("top_paths", topPaths); + if (options != null) { + for (Options opts : options) { + if (opts.mergeRepeated != null) { + opBuilder.setAttr("merge_repeated", opts.mergeRepeated); + } + } + } + return new CtcBeamSearchDecoder(opBuilder.build()); + } + + /** + * @param mergeRepeated If true, merge repeated classes in output. + */ + public static Options mergeRepeated(Boolean mergeRepeated) { + return new Options().mergeRepeated(mergeRepeated); + } + + /** + * A list (length: top_paths) of indices matrices. Matrix j, + * size `(total_decoded_outputs[j] x 2)`, has indices of a + * `SparseTensor`. The rows store: [batch, time]. + */ + public List> decodedIndices() { + return decodedIndices; + } + + /** + * A list (length: top_paths) of values vectors. Vector j, + * size `(length total_decoded_outputs[j])`, has the values of a + * `SparseTensor`. The vector stores the decoded classes for beam j. + */ + public List> decodedValues() { + return decodedValues; + } + + /** + * A list (length: top_paths) of shape vector. Vector j, + * size `(2)`, stores the shape of the decoded `SparseTensor[j]`. + * Its values are: `[batch_size, max_decoded_length[j]]`. + */ + public List> decodedShape() { + return decodedShape; + } + + /** + * A matrix, shaped: `(batch_size x top_paths)`. The + * sequence log-probabilities. + */ + public Output logProbability() { + return logProbability; + } + + private List> decodedIndices; + private List> decodedValues; + private List> decodedShape; + private Output logProbability; + + @SuppressWarnings("unchecked") + private CtcBeamSearchDecoder(Operation operation) { + super(operation); + int outputIdx = 0; + int decodedIndicesLength = operation.outputListLength("decoded_indices"); + decodedIndices = Arrays.asList((Output[])operation.outputList(outputIdx, decodedIndicesLength)); + outputIdx += decodedIndicesLength; + int decodedValuesLength = operation.outputListLength("decoded_values"); + decodedValues = Arrays.asList((Output[])operation.outputList(outputIdx, decodedValuesLength)); + outputIdx += decodedValuesLength; + int decodedShapeLength = operation.outputListLength("decoded_shape"); + decodedShape = Arrays.asList((Output[])operation.outputList(outputIdx, decodedShapeLength)); + outputIdx += decodedShapeLength; + logProbability = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcGreedyDecoder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcGreedyDecoder.java new file mode 100644 index 00000000000..95de2b91e62 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcGreedyDecoder.java @@ -0,0 +1,139 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs greedy decoding on the logits given in inputs. + *

              + * A note about the attribute merge_repeated: if enabled, when + * consecutive logits' maximum indices are the same, only the first of + * these is emitted. Labeling the blank '*', the sequence "A B B * B B" + * becomes "A B B" if merge_repeated = True and "A B B B B" if + * merge_repeated = False. + *

              + * Regardless of the value of merge_repeated, if the maximum index of a given + * time and batch corresponds to the blank, index `(num_classes - 1)`, no new + * element is emitted. + */ +@Operator(group = "nn") +public final class CtcGreedyDecoder extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CtcGreedyDecoder} + */ + public static class Options { + + /** + * @param mergeRepeated If True, merge repeated classes in output. + */ + public Options mergeRepeated(Boolean mergeRepeated) { + this.mergeRepeated = mergeRepeated; + return this; + } + + private Boolean mergeRepeated; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CtcGreedyDecoder operation. + * + * @param scope current scope + * @param inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. + * @param sequenceLength A vector containing sequence lengths, size `(batch_size)`. + * @param options carries optional attributes values + * @return a new instance of CtcGreedyDecoder + */ + public static CtcGreedyDecoder create(Scope scope, Operand inputs, Operand sequenceLength, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CTCGreedyDecoder", scope.makeOpName("CtcGreedyDecoder")); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(sequenceLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.mergeRepeated != null) { + opBuilder.setAttr("merge_repeated", opts.mergeRepeated); + } + } + } + return new CtcGreedyDecoder(opBuilder.build()); + } + + /** + * @param mergeRepeated If True, merge repeated classes in output. + */ + public static Options mergeRepeated(Boolean mergeRepeated) { + return new Options().mergeRepeated(mergeRepeated); + } + + /** + * Indices matrix, size `(total_decoded_outputs x 2)`, + * of a `SparseTensor`. The rows store: [batch, time]. + */ + public Output decodedIndices() { + return decodedIndices; + } + + /** + * Values vector, size: `(total_decoded_outputs)`, + * of a `SparseTensor`. The vector stores the decoded classes. + */ + public Output decodedValues() { + return decodedValues; + } + + /** + * Shape vector, size `(2)`, of the decoded SparseTensor. + * Values are: `[batch_size, max_decoded_length]`. + */ + public Output decodedShape() { + return decodedShape; + } + + /** + * Matrix, size `(batch_size x 1)`, containing sequence + * log-probabilities. + */ + public Output logProbability() { + return logProbability; + } + + private Output decodedIndices; + private Output decodedValues; + private Output decodedShape; + private Output logProbability; + + private CtcGreedyDecoder(Operation operation) { + super(operation); + int outputIdx = 0; + decodedIndices = operation.output(outputIdx++); + decodedValues = operation.output(outputIdx++); + decodedShape = operation.output(outputIdx++); + logProbability = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcLoss.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcLoss.java new file mode 100644 index 00000000000..0b9d0a1c37b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CtcLoss.java @@ -0,0 +1,165 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Calculates the CTC Loss (log probability) for each batch entry. Also calculates + *

              + * the gradient. This class performs the softmax operation for you, so inputs + * should be e.g. linear projections of outputs by an LSTM. + */ +@Operator(group = "nn") +public final class CtcLoss extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CtcLoss} + */ + public static class Options { + + /** + * @param preprocessCollapseRepeated Scalar, if true then repeated labels are + * collapsed prior to the CTC calculation. + */ + public Options preprocessCollapseRepeated(Boolean preprocessCollapseRepeated) { + this.preprocessCollapseRepeated = preprocessCollapseRepeated; + return this; + } + + /** + * @param ctcMergeRepeated Scalar. If set to false, during CTC calculation + * repeated non-blank labels will not be merged and are interpreted as + * individual labels. This is a simplified version of CTC. + */ + public Options ctcMergeRepeated(Boolean ctcMergeRepeated) { + this.ctcMergeRepeated = ctcMergeRepeated; + return this; + } + + /** + * @param ignoreLongerOutputsThanInputs Scalar. If set to true, during CTC + * calculation, items that have longer output sequences than input sequences + * are skipped: they don't contribute to the loss term and have zero-gradient. + */ + public Options ignoreLongerOutputsThanInputs(Boolean ignoreLongerOutputsThanInputs) { + this.ignoreLongerOutputsThanInputs = ignoreLongerOutputsThanInputs; + return this; + } + + private Boolean preprocessCollapseRepeated; + private Boolean ctcMergeRepeated; + private Boolean ignoreLongerOutputsThanInputs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CtcLoss operation. + * + * @param scope current scope + * @param inputs 3-D, shape: `(max_time x batch_size x num_classes)`, the logits. + * @param labelsIndices The indices of a `SparseTensor`. + * `labels_indices(i, :) == [b, t]` means `labels_values(i)` stores the id for + * `(batch b, time t)`. + * @param labelsValues The values (labels) associated with the given batch and time. + * @param sequenceLength A vector containing sequence lengths (batch). + * @param options carries optional attributes values + * @return a new instance of CtcLoss + */ + public static CtcLoss create(Scope scope, Operand inputs, Operand labelsIndices, Operand labelsValues, Operand sequenceLength, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CTCLoss", scope.makeOpName("CtcLoss")); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(labelsIndices.asOutput()); + opBuilder.addInput(labelsValues.asOutput()); + opBuilder.addInput(sequenceLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.preprocessCollapseRepeated != null) { + opBuilder.setAttr("preprocess_collapse_repeated", opts.preprocessCollapseRepeated); + } + if (opts.ctcMergeRepeated != null) { + opBuilder.setAttr("ctc_merge_repeated", opts.ctcMergeRepeated); + } + if (opts.ignoreLongerOutputsThanInputs != null) { + opBuilder.setAttr("ignore_longer_outputs_than_inputs", opts.ignoreLongerOutputsThanInputs); + } + } + } + return new CtcLoss(opBuilder.build()); + } + + /** + * @param preprocessCollapseRepeated Scalar, if true then repeated labels are + * collapsed prior to the CTC calculation. + */ + public static Options preprocessCollapseRepeated(Boolean preprocessCollapseRepeated) { + return new Options().preprocessCollapseRepeated(preprocessCollapseRepeated); + } + + /** + * @param ctcMergeRepeated Scalar. If set to false, during CTC calculation + * repeated non-blank labels will not be merged and are interpreted as + * individual labels. This is a simplified version of CTC. + */ + public static Options ctcMergeRepeated(Boolean ctcMergeRepeated) { + return new Options().ctcMergeRepeated(ctcMergeRepeated); + } + + /** + * @param ignoreLongerOutputsThanInputs Scalar. If set to true, during CTC + * calculation, items that have longer output sequences than input sequences + * are skipped: they don't contribute to the loss term and have zero-gradient. + */ + public static Options ignoreLongerOutputsThanInputs(Boolean ignoreLongerOutputsThanInputs) { + return new Options().ignoreLongerOutputsThanInputs(ignoreLongerOutputsThanInputs); + } + + /** + * A vector (batch) containing log-probabilities. + */ + public Output loss() { + return loss; + } + + /** + * The gradient of `loss`. 3-D, shape: + * `(max_time x batch_size x num_classes)`. + */ + public Output gradient() { + return gradient; + } + + private Output loss; + private Output gradient; + + private CtcLoss(Operation operation) { + super(operation); + int outputIdx = 0; + loss = operation.output(outputIdx++); + gradient = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnn.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnn.java new file mode 100644 index 00000000000..6d58696078a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnn.java @@ -0,0 +1,281 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * A RNN backed by cuDNN. + *

              + * Computes the RNN from the input and initial states, with respect to the params + * buffer. Produces one extra output "host_reserved" than CudnnRNN. + *

              + * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicates whether there is a linear projection between the input and + * the actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. Should be + * "unidirectional" or "bidirectional". + * dropout: Dropout probability. When set to 0., dropout is disabled. + * seed: The 1st part of a seed to initialize dropout. + * seed2: The 2nd part of a seed to initialize dropout. + * input: A 3-D tensor with the shape of [seq_length, batch_size, input_size]. + * input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size, + * num_units]. + * input_c: For LSTM, a 3-D tensor with the shape of + * [num_layer * dir, batch, num_units]. For other models, it is ignored. + * params: A 1-D tensor that contains the weights and biases in an opaque layout. + * The size must be created through CudnnRNNParamsSize, and initialized + * separately. Note that they might not be compatible across different + * generations. So it is a good idea to save and restore + * output: A 3-D tensor with the shape of [seq_length, batch_size, + * dir * num_units]. + * output_h: The same shape has input_h. + * output_c: The same shape as input_c for LSTM. An empty tensor for other models. + * is_training: Indicates whether this operation is used for inferenece or + * training. + * reserve_space: An opaque tensor that can be used in backprop calculation. It + * is only produced if is_training is true. + * host_reserved: An opaque tensor that can be used in backprop calculation. It is + * only produced if is_training is true. It is output on host memory rather than + * device memory. + * + * @param data type for {@code output()} output + */ +public final class CudnnRnn extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CudnnRnn} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param isTraining + */ + public Options isTraining(Boolean isTraining) { + this.isTraining = isTraining; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + private Boolean isTraining; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRnn operation. + * + * @param scope current scope + * @param input + * @param inputH + * @param inputC + * @param params + * @param options carries optional attributes values + * @return a new instance of CudnnRnn + */ + public static CudnnRnn create(Scope scope, Operand input, Operand inputH, Operand inputC, Operand params, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNV2", scope.makeOpName("CudnnRnn")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputH.asOutput()); + opBuilder.addInput(inputC.asOutput()); + opBuilder.addInput(params.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.isTraining != null) { + opBuilder.setAttr("is_training", opts.isTraining); + } + } + } + return new CudnnRnn(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param isTraining + */ + public static Options isTraining(Boolean isTraining) { + return new Options().isTraining(isTraining); + } + + /** + */ + public Output output() { + return output; + } + + /** + */ + public Output outputH() { + return outputH; + } + + /** + */ + public Output outputC() { + return outputC; + } + + /** + */ + public Output reserveSpace() { + return reserveSpace; + } + + /** + */ + public Output hostReserved() { + return hostReserved; + } + + private Output output; + private Output outputH; + private Output outputC; + private Output reserveSpace; + private Output hostReserved; + + private CudnnRnn(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputH = operation.output(outputIdx++); + outputC = operation.output(outputIdx++); + reserveSpace = operation.output(outputIdx++); + hostReserved = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnBackprop.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnBackprop.java new file mode 100644 index 00000000000..2be481864d9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnBackprop.java @@ -0,0 +1,279 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Backprop step of CudnnRNN. + *

              + * Compute the backprop of both data and weights in a RNN. Takes an extra + * "host_reserved" inupt than CudnnRNNBackprop, which is used to determine RNN + * cudnnRNNAlgo_t and cudnnMathType_t. + *

              + * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicates whether there is a linear projection between the input and + * the actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. Should be + * "unidirectional" or "bidirectional". + * dropout: Dropout probability. When set to 0., dropout is disabled. + * seed: The 1st part of a seed to initialize dropout. + * seed2: The 2nd part of a seed to initialize dropout. + * input: A 3-D tensor with the shape of [seq_length, batch_size, input_size]. + * input_h: A 3-D tensor with the shape of [num_layer * dir, batch_size, + * num_units]. + * input_c: For LSTM, a 3-D tensor with the shape of + * [num_layer * dir, batch, num_units]. For other models, it is ignored. + * params: A 1-D tensor that contains the weights and biases in an opaque layout. + * The size must be created through CudnnRNNParamsSize, and initialized + * separately. Note that they might not be compatible across different + * generations. So it is a good idea to save and restore + * output: A 3-D tensor with the shape of [seq_length, batch_size, + * dir * num_units]. + * output_h: The same shape has input_h. + * output_c: The same shape as input_c for LSTM. An empty tensor for other models. + * output_backprop: A 3-D tensor with the same shape as output in the forward pass. + * output_h_backprop: A 3-D tensor with the same shape as output_h in the forward + * pass. + * output_c_backprop: A 3-D tensor with the same shape as output_c in the forward + * pass. + * reserve_space: The same reserve_space produced in the forward operation. + * host_reserved: The same host_reserved produced in the forward operation. + * input_backprop: The backprop to input in the forward pass. Has the same shape + * as input. + * input_h_backprop: The backprop to input_h in the forward pass. Has the same + * shape as input_h. + * input_c_backprop: The backprop to input_c in the forward pass. Has the same + * shape as input_c. + * params_backprop: The backprop to the params buffer in the forward pass. Has the + * same shape as params. + * + * @param data type for {@code inputBackprop()} output + */ +public final class CudnnRnnBackprop extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CudnnRnnBackprop} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRnnBackprop operation. + * + * @param scope current scope + * @param input + * @param inputH + * @param inputC + * @param params + * @param output + * @param outputH + * @param outputC + * @param outputBackprop + * @param outputHBackprop + * @param outputCBackprop + * @param reserveSpace + * @param hostReserved + * @param options carries optional attributes values + * @return a new instance of CudnnRnnBackprop + */ + public static CudnnRnnBackprop create(Scope scope, Operand input, Operand inputH, Operand inputC, Operand params, Operand output, Operand outputH, Operand outputC, Operand outputBackprop, Operand outputHBackprop, Operand outputCBackprop, Operand reserveSpace, Operand hostReserved, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNBackpropV2", scope.makeOpName("CudnnRnnBackprop")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputH.asOutput()); + opBuilder.addInput(inputC.asOutput()); + opBuilder.addInput(params.asOutput()); + opBuilder.addInput(output.asOutput()); + opBuilder.addInput(outputH.asOutput()); + opBuilder.addInput(outputC.asOutput()); + opBuilder.addInput(outputBackprop.asOutput()); + opBuilder.addInput(outputHBackprop.asOutput()); + opBuilder.addInput(outputCBackprop.asOutput()); + opBuilder.addInput(reserveSpace.asOutput()); + opBuilder.addInput(hostReserved.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new CudnnRnnBackprop(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + */ + public Output inputBackprop() { + return inputBackprop; + } + + /** + */ + public Output inputHBackprop() { + return inputHBackprop; + } + + /** + */ + public Output inputCBackprop() { + return inputCBackprop; + } + + /** + */ + public Output paramsBackprop() { + return paramsBackprop; + } + + private Output inputBackprop; + private Output inputHBackprop; + private Output inputCBackprop; + private Output paramsBackprop; + + private CudnnRnnBackprop(Operation operation) { + super(operation); + int outputIdx = 0; + inputBackprop = operation.output(outputIdx++); + inputHBackprop = operation.output(outputIdx++); + inputCBackprop = operation.output(outputIdx++); + paramsBackprop = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnCanonicalToParams.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnCanonicalToParams.java new file mode 100644 index 00000000000..65343be704e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnCanonicalToParams.java @@ -0,0 +1,236 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts CudnnRNN params from canonical form to usable form. + *

              + * Writes a set of weights into the opaque params buffer so they can be used in + * upcoming training or inferences. + *

              + * Note that the params buffer may not be compatible across different GPUs. So any + * save and restoration should be converted to and from the canonical weights and + * biases. + *

              + * num_layers: Specifies the number of layers in the RNN model. + * num_units: Specifies the size of the hidden state. + * input_size: Specifies the size of the input state. + * weights: the canonical form of weights that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * biases: the canonical form of biases that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * num_params: number of parameter sets for all layers. + * Each layer may contain multiple parameter sets, with each set consisting of + * a weight matrix and a bias vector. + * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicate whether there is a linear projection between the input and + * The actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. + * dir = (direction == bidirectional) ? 2 : 1 + * dropout: dropout probability. When set to 0., dropout is disabled. + * seed: the 1st part of a seed to initialize dropout. + * seed2: the 2nd part of a seed to initialize dropout. + * + * @param data type for {@code params()} output + */ +@Operator(group = "nn") +public final class CudnnRnnCanonicalToParams extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CudnnRnnCanonicalToParams} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRnnCanonicalToParams operation. + * + * @param scope current scope + * @param numLayers + * @param numUnits + * @param inputSize + * @param weights + * @param biases + * @param options carries optional attributes values + * @return a new instance of CudnnRnnCanonicalToParams + */ + public static CudnnRnnCanonicalToParams create(Scope scope, Operand numLayers, Operand numUnits, Operand inputSize, Iterable> weights, Iterable> biases, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNCanonicalToParams", scope.makeOpName("CudnnRnnCanonicalToParams")); + opBuilder.addInput(numLayers.asOutput()); + opBuilder.addInput(numUnits.asOutput()); + opBuilder.addInput(inputSize.asOutput()); + opBuilder.addInputList(Operands.asOutputs(weights)); + opBuilder.addInputList(Operands.asOutputs(biases)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new CudnnRnnCanonicalToParams(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + */ + public Output params() { + return params; + } + + @Override + public Output asOutput() { + return params; + } + + private Output params; + + private CudnnRnnCanonicalToParams(Operation operation) { + super(operation); + int outputIdx = 0; + params = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnParamsSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnParamsSize.java new file mode 100644 index 00000000000..8c3d6b2e772 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnParamsSize.java @@ -0,0 +1,247 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes size of weights that can be used by a Cudnn RNN model. + *

              + * Return the params size that can be used by the Cudnn RNN model. Subsequent + * weight allocation and initialization should use this size. + *

              + * num_layers: Specifies the number of layers in the RNN model. + * num_units: Specifies the size of the hidden state. + * input_size: Specifies the size of the input state. + * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicate whether there is a linear projection between the input and + * The actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. + * dir = (direction == bidirectional) ? 2 : 1 + * dropout: dropout probability. When set to 0., dropout is disabled. + * seed: the 1st part of a seed to initialize dropout. + * seed2: the 2nd part of a seed to initialize dropout. + * params_size: The size of the params buffer that should be allocated and + * initialized for this RNN model. Note that this params buffer may not be + * compatible across GPUs. Please use CudnnRNNParamsWeights and + * CudnnRNNParamsBiases to save and restore them in a way that is compatible + * across different runs. + * + * @param data type for {@code paramsSize()} output + */ +@Operator(group = "nn") +public final class CudnnRnnParamsSize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CudnnRnnParamsSize} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + /** + * @param numProj + */ + public Options numProj(Long numProj) { + this.numProj = numProj; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + private Long numProj; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRnnParamsSize operation. + * + * @param scope current scope + * @param numLayers + * @param numUnits + * @param inputSize + * @param T + * @param S + * @param options carries optional attributes values + * @return a new instance of CudnnRnnParamsSize + */ + public static CudnnRnnParamsSize create(Scope scope, Operand numLayers, Operand numUnits, Operand inputSize, Class T, Class S, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNParamsSize", scope.makeOpName("CudnnRnnParamsSize")); + opBuilder.addInput(numLayers.asOutput()); + opBuilder.addInput(numUnits.asOutput()); + opBuilder.addInput(inputSize.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("T", DataType.fromClass(T)); + opBuilder.setAttr("S", DataType.fromClass(S)); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + if (opts.numProj != null) { + opBuilder.setAttr("num_proj", opts.numProj); + } + } + } + return new CudnnRnnParamsSize(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * @param numProj + */ + public static Options numProj(Long numProj) { + return new Options().numProj(numProj); + } + + /** + */ + public Output paramsSize() { + return paramsSize; + } + + @Override + public Output asOutput() { + return paramsSize; + } + + private Output paramsSize; + + private CudnnRnnParamsSize(Operation operation) { + super(operation); + int outputIdx = 0; + paramsSize = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnParamsToCanonical.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnParamsToCanonical.java new file mode 100644 index 00000000000..f5e3407813a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/CudnnRnnParamsToCanonical.java @@ -0,0 +1,245 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Retrieves CudnnRNN params in canonical form. + *

              + * Retrieves a set of weights from the opaque params buffer that can be saved and + * restored in a way compatible with future runs. + *

              + * Note that the params buffer may not be compatible across different GPUs. So any + * save and restoration should be converted to and from the canonical weights and + * biases. + *

              + * num_layers: Specifies the number of layers in the RNN model. + * num_units: Specifies the size of the hidden state. + * input_size: Specifies the size of the input state. + * num_params: number of parameter sets for all layers. + * Each layer may contain multiple parameter sets, with each set consisting of + * a weight matrix and a bias vector. + * weights: the canonical form of weights that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * biases: the canonical form of biases that can be used for saving + * and restoration. They are more likely to be compatible across different + * generations. + * rnn_mode: Indicates the type of the RNN model. + * input_mode: Indicate whether there is a linear projection between the input and + * The actual computation before the first layer. 'skip_input' is only allowed + * when input_size == num_units; 'auto_select' implies 'skip_input' when + * input_size == num_units; otherwise, it implies 'linear_input'. + * direction: Indicates whether a bidirectional model will be used. + * dir = (direction == bidirectional) ? 2 : 1 + * dropout: dropout probability. When set to 0., dropout is disabled. + * seed: the 1st part of a seed to initialize dropout. + * seed2: the 2nd part of a seed to initialize dropout. + * + * @param data type for {@code weights()} output + */ +@Operator(group = "nn") +public final class CudnnRnnParamsToCanonical extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.CudnnRnnParamsToCanonical} + */ + public static class Options { + + /** + * @param rnnMode + */ + public Options rnnMode(String rnnMode) { + this.rnnMode = rnnMode; + return this; + } + + /** + * @param inputMode + */ + public Options inputMode(String inputMode) { + this.inputMode = inputMode; + return this; + } + + /** + * @param direction + */ + public Options direction(String direction) { + this.direction = direction; + return this; + } + + /** + * @param dropout + */ + public Options dropout(Float dropout) { + this.dropout = dropout; + return this; + } + + /** + * @param seed + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private String rnnMode; + private String inputMode; + private String direction; + private Float dropout; + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new CudnnRnnParamsToCanonical operation. + * + * @param scope current scope + * @param numLayers + * @param numUnits + * @param inputSize + * @param params + * @param numParams + * @param options carries optional attributes values + * @return a new instance of CudnnRnnParamsToCanonical + */ + public static CudnnRnnParamsToCanonical create(Scope scope, Operand numLayers, Operand numUnits, Operand inputSize, Operand params, Long numParams, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("CudnnRNNParamsToCanonical", scope.makeOpName("CudnnRnnParamsToCanonical")); + opBuilder.addInput(numLayers.asOutput()); + opBuilder.addInput(numUnits.asOutput()); + opBuilder.addInput(inputSize.asOutput()); + opBuilder.addInput(params.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_params", numParams); + if (options != null) { + for (Options opts : options) { + if (opts.rnnMode != null) { + opBuilder.setAttr("rnn_mode", opts.rnnMode); + } + if (opts.inputMode != null) { + opBuilder.setAttr("input_mode", opts.inputMode); + } + if (opts.direction != null) { + opBuilder.setAttr("direction", opts.direction); + } + if (opts.dropout != null) { + opBuilder.setAttr("dropout", opts.dropout); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new CudnnRnnParamsToCanonical(opBuilder.build()); + } + + /** + * @param rnnMode + */ + public static Options rnnMode(String rnnMode) { + return new Options().rnnMode(rnnMode); + } + + /** + * @param inputMode + */ + public static Options inputMode(String inputMode) { + return new Options().inputMode(inputMode); + } + + /** + * @param direction + */ + public static Options direction(String direction) { + return new Options().direction(direction); + } + + /** + * @param dropout + */ + public static Options dropout(Float dropout) { + return new Options().dropout(dropout); + } + + /** + * @param seed + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + */ + public List> weights() { + return weights; + } + + /** + */ + public List> biases() { + return biases; + } + + private List> weights; + private List> biases; + + @SuppressWarnings("unchecked") + private CudnnRnnParamsToCanonical(Operation operation) { + super(operation); + int outputIdx = 0; + int weightsLength = operation.outputListLength("weights"); + weights = Arrays.asList((Output[])operation.outputList(outputIdx, weightsLength)); + outputIdx += weightsLength; + int biasesLength = operation.outputListLength("biases"); + biases = Arrays.asList((Output[])operation.outputList(outputIdx, biasesLength)); + outputIdx += biasesLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DataFormatDimMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DataFormatDimMap.java new file mode 100644 index 00000000000..73fa180a1e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DataFormatDimMap.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the dimension index in the destination data format given the one in + *

              + * the source data format. + * + * @param data type for {@code y()} output + */ +@Operator(group = "nn") +public final class DataFormatDimMap extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.DataFormatDimMap} + */ + public static class Options { + + /** + * @param srcFormat source data format. + */ + public Options srcFormat(String srcFormat) { + this.srcFormat = srcFormat; + return this; + } + + /** + * @param dstFormat destination data format. + */ + public Options dstFormat(String dstFormat) { + this.dstFormat = dstFormat; + return this; + } + + private String srcFormat; + private String dstFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DataFormatDimMap operation. + * + * @param scope current scope + * @param x A Tensor with each element as a dimension index in source data format. + * Must be in the range [-4, 4). + * @param options carries optional attributes values + * @return a new instance of DataFormatDimMap + */ + public static DataFormatDimMap create(Scope scope, Operand x, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DataFormatDimMap", scope.makeOpName("DataFormatDimMap")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.srcFormat != null) { + opBuilder.setAttr("src_format", opts.srcFormat); + } + if (opts.dstFormat != null) { + opBuilder.setAttr("dst_format", opts.dstFormat); + } + } + } + return new DataFormatDimMap(opBuilder.build()); + } + + /** + * @param srcFormat source data format. + */ + public static Options srcFormat(String srcFormat) { + return new Options().srcFormat(srcFormat); + } + + /** + * @param dstFormat destination data format. + */ + public static Options dstFormat(String dstFormat) { + return new Options().dstFormat(dstFormat); + } + + /** + * A Tensor with each element as a dimension index in destination data format. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private DataFormatDimMap(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DataFormatVecPermute.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DataFormatVecPermute.java new file mode 100644 index 00000000000..2286c63bcf7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DataFormatVecPermute.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the permuted vector/tensor in the destination data format given the + *

              + * one in the source data format. + * + * @param data type for {@code y()} output + */ +@Operator(group = "nn") +public final class DataFormatVecPermute extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.DataFormatVecPermute} + */ + public static class Options { + + /** + * @param srcFormat source data format. + */ + public Options srcFormat(String srcFormat) { + this.srcFormat = srcFormat; + return this; + } + + /** + * @param dstFormat destination data format. + */ + public Options dstFormat(String dstFormat) { + this.dstFormat = dstFormat; + return this; + } + + private String srcFormat; + private String dstFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DataFormatVecPermute operation. + * + * @param scope current scope + * @param x Vector of size 4 or Tensor of shape (4, 2) in source data format. + * @param options carries optional attributes values + * @return a new instance of DataFormatVecPermute + */ + public static DataFormatVecPermute create(Scope scope, Operand x, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DataFormatVecPermute", scope.makeOpName("DataFormatVecPermute")); + opBuilder.addInput(x.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.srcFormat != null) { + opBuilder.setAttr("src_format", opts.srcFormat); + } + if (opts.dstFormat != null) { + opBuilder.setAttr("dst_format", opts.dstFormat); + } + } + } + return new DataFormatVecPermute(opBuilder.build()); + } + + /** + * @param srcFormat source data format. + */ + public static Options srcFormat(String srcFormat) { + return new Options().srcFormat(srcFormat); + } + + /** + * @param dstFormat destination data format. + */ + public static Options dstFormat(String dstFormat) { + return new Options().dstFormat(dstFormat); + } + + /** + * Vector of size 4 or Tensor of shape (4, 2) in destination data format. + */ + public Output y() { + return y; + } + + @Override + public Output asOutput() { + return y; + } + + private Output y; + + private DataFormatVecPermute(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthToSpace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthToSpace.java new file mode 100644 index 00000000000..f42f2077831 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthToSpace.java @@ -0,0 +1,184 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * DepthToSpace for tensors of type T. + *

              + * Rearranges data from depth into blocks of spatial data. + * This is the reverse transformation of SpaceToDepth. More specifically, + * this op outputs a copy of the input tensor where values from the `depth` + * dimension are moved in spatial blocks to the `height` and `width` dimensions. + * The attr `block_size` indicates the input block size and how the data is moved. + *

              + * * Chunks of data of size `block_size * block_size` from depth are rearranged + * into non-overlapping blocks of size `block_size x block_size` + * * The width the output tensor is `input_depth * block_size`, whereas the + * height is `input_height * block_size`. + * * The Y, X coordinates within each block of the output image are determined + * by the high order component of the input channel index. + * * The depth of the input tensor must be divisible by + * `block_size * block_size`. + *

              + * The `data_format` attr specifies the layout of the input and output tensors + * with the following options: + * "NHWC": `[ batch, height, width, channels ]` + * "NCHW": `[ batch, channels, height, width ]` + * "NCHW_VECT_C": + * `qint8 [ batch, channels / 4, height, width, 4 ]` + *

              + * It is useful to consider the operation as transforming a 6-D Tensor. + * e.g. for data_format = NHWC, + * Each element in the input tensor can be specified via 6 coordinates, + * ordered by decreasing memory layout significance as: + * n,iY,iX,bY,bX,oC (where n=batch index, iX, iY means X or Y coordinates + * within the input image, bX, bY means coordinates + * within the output block, oC means output channels). + * The output would be the input transposed to the following layout: + * n,iY,bY,iX,bX,oC + *

              + * This operation is useful for resizing the activations between convolutions + * (but keeping all data), e.g. instead of pooling. It is also useful for training + * purely convolutional models. + *

              + * For example, given an input of shape `[1, 1, 1, 4]`, data_format = "NHWC" and + * block_size = 2: + *

              {@code
              + * x = [[[[1, 2, 3, 4]]]]
              + * 
              + * }
              + * This operation will output a tensor of shape `[1, 2, 2, 1]`: + *
              {@code
              + *    [[[[1], [2]],
              + *      [[3], [4]]]]
              + * }
              + * Here, the input has a batch of 1 and each batch element has shape `[1, 1, 4]`, + * the corresponding output will have 2x2 elements and will have a depth of + * 1 channel (1 = `4 / (block_size * block_size)`). + * The output element shape is `[2, 2, 1]`. + *

              + * For an input tensor with larger depth, here of shape `[1, 1, 1, 12]`, e.g. + *

              {@code
              + * x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
              + * }
              + * This operation, for block size of 2, will return the following tensor of shape + * `[1, 2, 2, 3]` + *
              {@code
              + *    [[[[1, 2, 3], [4, 5, 6]],
              + *      [[7, 8, 9], [10, 11, 12]]]]
              + * 
              + * }
              + * Similarly, for the following input of shape `[1 2 2 4]`, and a block size of 2: + *
              {@code
              + * x =  [[[[1, 2, 3, 4],
              + *        [5, 6, 7, 8]],
              + *       [[9, 10, 11, 12],
              + *        [13, 14, 15, 16]]]]
              + * }
              + * the operator will return the following tensor of shape `[1 4 4 1]`: + *
              {@code
              + * x = [[[ [1],   [2],  [5],  [6]],
              + *       [ [3],   [4],  [7],  [8]],
              + *       [ [9],  [10], [13],  [14]],
              + *       [ [11], [12], [15],  [16]]]]
              + * 
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class DepthToSpace extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.DepthToSpace} + */ + public static class Options { + + /** + * @param dataFormat + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DepthToSpace operation. + * + * @param scope current scope + * @param input + * @param blockSize The size of the spatial block, same as in Space2Depth. + * @param options carries optional attributes values + * @return a new instance of DepthToSpace + */ + public static DepthToSpace create(Scope scope, Operand input, Long blockSize, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DepthToSpace", scope.makeOpName("DepthToSpace")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("block_size", blockSize); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new DepthToSpace(opBuilder.build()); + } + + /** + * @param dataFormat + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DepthToSpace(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNative.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNative.java new file mode 100644 index 00000000000..42bb7ee0ea7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNative.java @@ -0,0 +1,170 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes a 2-D depthwise convolution given 4-D `input` and `filter` tensors. + *

              + * Given an input tensor of shape `[batch, in_height, in_width, in_channels]` + * and a filter / kernel tensor of shape + * `[filter_height, filter_width, in_channels, channel_multiplier]`, containing + * `in_channels` convolutional filters of depth 1, `depthwise_conv2d` applies + * a different filter to each input channel (expanding from 1 channel to + * `channel_multiplier` channels for each), then concatenates the results + * together. Thus, the output has `in_channels * channel_multiplier` channels. + *

              {@code
              + * for k in 0..in_channels-1
              + *   for q in 0..channel_multiplier-1
              + *     output[b, i, j, k * channel_multiplier + q] =
              + *       sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] *
              + *                         filter[di, dj, k, q]
              + * }
              + * Must have `strides[0] = strides[3] = 1`. For the most common case of the same + * horizontal and vertices strides, `strides = [1, stride, stride, 1]`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class DepthwiseConv2dNative extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.DepthwiseConv2dNative} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DepthwiseConv2dNative operation. + * + * @param scope current scope + * @param input + * @param filter + * @param strides 1-D of length 4. The stride of the sliding window for each dimension + * of `input`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of DepthwiseConv2dNative + */ + public static DepthwiseConv2dNative create(Scope scope, Operand input, Operand filter, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DepthwiseConv2dNative", scope.makeOpName("DepthwiseConv2dNative")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new DepthwiseConv2dNative(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DepthwiseConv2dNative(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNativeBackpropFilter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNativeBackpropFilter.java new file mode 100644 index 00000000000..192bb0f8769 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNativeBackpropFilter.java @@ -0,0 +1,165 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradients of depthwise convolution with respect to the filter. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class DepthwiseConv2dNativeBackpropFilter extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.DepthwiseConv2dNativeBackpropFilter} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DepthwiseConv2dNativeBackpropFilter operation. + * + * @param scope current scope + * @param input 4-D with shape based on `data_format`. For example, if + * `data_format` is 'NHWC' then `input` is a 4-D `[batch, in_height, + * in_width, in_channels]` tensor. + * @param filterSizes An integer vector representing the tensor shape of `filter`, + * where `filter` is a 4-D + * `[filter_height, filter_width, in_channels, depthwise_multiplier]` tensor. + * @param outBackprop 4-D with shape based on `data_format`. + * For example, if `data_format` is 'NHWC' then + * out_backprop shape is `[batch, out_height, out_width, out_channels]`. + * Gradients w.r.t. the output of the convolution. + * @param strides The stride of the sliding window for each dimension of the input + * of the convolution. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of DepthwiseConv2dNativeBackpropFilter + */ + public static DepthwiseConv2dNativeBackpropFilter create(Scope scope, Operand input, Operand filterSizes, Operand outBackprop, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DepthwiseConv2dNativeBackpropFilter", scope.makeOpName("DepthwiseConv2dNativeBackpropFilter")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filterSizes.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new DepthwiseConv2dNativeBackpropFilter(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * 4-D with shape + * `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. + * the `filter` input of the convolution. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DepthwiseConv2dNativeBackpropFilter(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNativeBackpropInput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNativeBackpropInput.java new file mode 100644 index 00000000000..ee9198bc79e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/DepthwiseConv2dNativeBackpropInput.java @@ -0,0 +1,165 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradients of depthwise convolution with respect to the input. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class DepthwiseConv2dNativeBackpropInput extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.DepthwiseConv2dNativeBackpropInput} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private String dataFormat; + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DepthwiseConv2dNativeBackpropInput operation. + * + * @param scope current scope + * @param inputSizes An integer vector representing the shape of `input`, based + * on `data_format`. For example, if `data_format` is 'NHWC' then + * `input` is a 4-D `[batch, height, width, channels]` tensor. + * @param filter 4-D with shape + * `[filter_height, filter_width, in_channels, depthwise_multiplier]`. + * @param outBackprop 4-D with shape based on `data_format`. + * For example, if `data_format` is 'NHWC' then + * out_backprop shape is `[batch, out_height, out_width, out_channels]`. + * Gradients w.r.t. the output of the convolution. + * @param strides The stride of the sliding window for each dimension of the input + * of the convolution. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of DepthwiseConv2dNativeBackpropInput + */ + public static DepthwiseConv2dNativeBackpropInput create(Scope scope, Operand inputSizes, Operand filter, Operand outBackprop, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DepthwiseConv2dNativeBackpropInput", scope.makeOpName("DepthwiseConv2dNativeBackpropInput")); + opBuilder.addInput(inputSizes.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new DepthwiseConv2dNativeBackpropInput(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, height, width, channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, channels, height, width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each filter + * element on that dimension. The dimension order is determined by the value of + * `data_format`, see above for details. Dilations in the batch and depth + * dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + * 4-D with shape according to `data_format`. For example, if + * `data_format` is 'NHWC', output shape is `[batch, in_height, + * in_width, in_channels]`. Gradient w.r.t. the input of the + * convolution. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private DepthwiseConv2dNativeBackpropInput(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2d.java new file mode 100644 index 00000000000..716c14cd316 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2d.java @@ -0,0 +1,112 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the grayscale dilation of 4-D `input` and 3-D `filter` tensors. + *

              + * The `input` tensor has shape `[batch, in_height, in_width, depth]` and the + * `filter` tensor has shape `[filter_height, filter_width, depth]`, i.e., each + * input channel is processed independently of the others with its own structuring + * function. The `output` tensor has shape + * `[batch, out_height, out_width, depth]`. The spatial dimensions of the output + * tensor depend on the `padding` algorithm. We currently only support the default + * "NHWC" `data_format`. + *

              + * In detail, the grayscale morphological 2-D dilation is the max-sum correlation + * (for consistency with `conv2d`, we use unmirrored filters): + *

              + * output[b, y, x, c] = + * max_{dy, dx} input[b, + * strides[1] * y + rates[1] * dy, + * strides[2] * x + rates[2] * dx, + * c] + + * filter[dy, dx, c] + *

              + * Max-pooling is a special case when the filter has size equal to the pooling + * kernel size and contains all zeros. + *

              + * Note on duality: The dilation of `input` by the `filter` is equal to the + * negation of the erosion of `-input` by the reflected `filter`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class Dilation2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Dilation2d operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, in_height, in_width, depth]`. + * @param filter 3-D with shape `[filter_height, filter_width, depth]`. + * @param strides The stride of the sliding window for each dimension of the input + * tensor. Must be: `[1, stride_height, stride_width, 1]`. + * @param rates The input stride for atrous morphological dilation. Must be: + * `[1, rate_height, rate_width, 1]`. + * @param padding The type of padding algorithm to use. + * @return a new instance of Dilation2d + */ + public static Dilation2d create(Scope scope, Operand input, Operand filter, List strides, List rates, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("Dilation2D", scope.makeOpName("Dilation2d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + long[] ratesArray = new long[rates.size()]; + for (int i = 0; i < ratesArray.length; ++i) { + ratesArray[i] = rates.get(i); + } + opBuilder.setAttr("rates", ratesArray); + opBuilder.setAttr("padding", padding); + return new Dilation2d(opBuilder.build()); + } + + /** + * 4-D with shape `[batch, out_height, out_width, depth]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Dilation2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2dBackpropFilter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2dBackpropFilter.java new file mode 100644 index 00000000000..4b57a90c7a4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2dBackpropFilter.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradient of morphological 2-D dilation with respect to the filter. + * + * @param data type for {@code filterBackprop()} output + */ +@Operator(group = "nn") +public final class Dilation2dBackpropFilter extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Dilation2dBackpropFilter operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, in_height, in_width, depth]`. + * @param filter 3-D with shape `[filter_height, filter_width, depth]`. + * @param outBackprop 4-D with shape `[batch, out_height, out_width, depth]`. + * @param strides 1-D of length 4. The stride of the sliding window for each dimension of + * the input tensor. Must be: `[1, stride_height, stride_width, 1]`. + * @param rates 1-D of length 4. The input stride for atrous morphological dilation. + * Must be: `[1, rate_height, rate_width, 1]`. + * @param padding The type of padding algorithm to use. + * @return a new instance of Dilation2dBackpropFilter + */ + public static Dilation2dBackpropFilter create(Scope scope, Operand input, Operand filter, Operand outBackprop, List strides, List rates, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("Dilation2DBackpropFilter", scope.makeOpName("Dilation2dBackpropFilter")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + long[] ratesArray = new long[rates.size()]; + for (int i = 0; i < ratesArray.length; ++i) { + ratesArray[i] = rates.get(i); + } + opBuilder.setAttr("rates", ratesArray); + opBuilder.setAttr("padding", padding); + return new Dilation2dBackpropFilter(opBuilder.build()); + } + + /** + * 3-D with shape `[filter_height, filter_width, depth]`. + */ + public Output filterBackprop() { + return filterBackprop; + } + + @Override + public Output asOutput() { + return filterBackprop; + } + + private Output filterBackprop; + + private Dilation2dBackpropFilter(Operation operation) { + super(operation); + int outputIdx = 0; + filterBackprop = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2dBackpropInput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2dBackpropInput.java new file mode 100644 index 00000000000..dde8a1c3b3c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Dilation2dBackpropInput.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the gradient of morphological 2-D dilation with respect to the input. + * + * @param data type for {@code inBackprop()} output + */ +@Operator(group = "nn") +public final class Dilation2dBackpropInput extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Dilation2dBackpropInput operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, in_height, in_width, depth]`. + * @param filter 3-D with shape `[filter_height, filter_width, depth]`. + * @param outBackprop 4-D with shape `[batch, out_height, out_width, depth]`. + * @param strides 1-D of length 4. The stride of the sliding window for each dimension of + * the input tensor. Must be: `[1, stride_height, stride_width, 1]`. + * @param rates 1-D of length 4. The input stride for atrous morphological dilation. + * Must be: `[1, rate_height, rate_width, 1]`. + * @param padding The type of padding algorithm to use. + * @return a new instance of Dilation2dBackpropInput + */ + public static Dilation2dBackpropInput create(Scope scope, Operand input, Operand filter, Operand outBackprop, List strides, List rates, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("Dilation2DBackpropInput", scope.makeOpName("Dilation2dBackpropInput")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + long[] ratesArray = new long[rates.size()]; + for (int i = 0; i < ratesArray.length; ++i) { + ratesArray[i] = rates.get(i); + } + opBuilder.setAttr("rates", ratesArray); + opBuilder.setAttr("padding", padding); + return new Dilation2dBackpropInput(opBuilder.build()); + } + + /** + * 4-D with shape `[batch, in_height, in_width, depth]`. + */ + public Output inBackprop() { + return inBackprop; + } + + @Override + public Output asOutput() { + return inBackprop; + } + + private Output inBackprop; + + private Dilation2dBackpropInput(Operation operation) { + super(operation); + int outputIdx = 0; + inBackprop = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Elu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Elu.java new file mode 100644 index 00000000000..63b5796cfdd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Elu.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes exponential linear: `exp(features) - 1` if < 0, `features` otherwise. + *

              + * See [Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs) + * ](http://arxiv.org/abs/1511.07289) + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class Elu extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Elu operation. + * + * @param scope current scope + * @param features + * @return a new instance of Elu + */ + public static Elu create(Scope scope, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("Elu", scope.makeOpName("Elu")); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Elu(opBuilder.build()); + } + + /** + */ + public Output activations() { + return activations; + } + + @Override + public Output asOutput() { + return activations; + } + + private Output activations; + + private Elu(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/EluGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/EluGrad.java new file mode 100644 index 00000000000..c3f9bdd20db --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/EluGrad.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes gradients for the exponential linear (Elu) operation. + * + * @param data type for {@code backprops()} output + */ +public final class EluGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new EluGrad operation. + * + * @param scope current scope + * @param gradients The backpropagated gradients to the corresponding Elu operation. + * @param outputs The outputs of the corresponding Elu operation. + * @return a new instance of EluGrad + */ + public static EluGrad create(Scope scope, Operand gradients, Operand outputs) { + OperationBuilder opBuilder = scope.env().opBuilder("EluGrad", scope.makeOpName("EluGrad")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(outputs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new EluGrad(opBuilder.build()); + } + + /** + * The gradients: `gradients * (outputs + 1)` if outputs < 0, + * `gradients` otherwise. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private EluGrad(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FixedUnigramCandidateSampler.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FixedUnigramCandidateSampler.java new file mode 100644 index 00000000000..bef37316635 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FixedUnigramCandidateSampler.java @@ -0,0 +1,322 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generates labels for candidate sampling with a learned unigram distribution. + *

              + * A unigram sampler could use a fixed unigram distribution read from a + * file or passed in as an in-memory array instead of building up the distribution + * from data on the fly. There is also an option to skew the distribution by + * applying a distortion power to the weights. + *

              + * The vocabulary file should be in CSV-like format, with the last field + * being the weight associated with the word. + *

              + * For each batch, this op picks a single set of sampled candidate labels. + *

              + * The advantages of sampling candidates per-batch are simplicity and the + * possibility of efficient dense matrix multiplication. The disadvantage is that + * the sampled candidates must be chosen independently of the context and of the + * true labels. + */ +@Operator(group = "nn") +public final class FixedUnigramCandidateSampler extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FixedUnigramCandidateSampler} + */ + public static class Options { + + /** + * @param vocabFile Each valid line in this file (which should have a CSV-like format) + * corresponds to a valid word ID. IDs are in sequential order, starting from + * num_reserved_ids. The last entry in each line is expected to be a value + * corresponding to the count or relative probability. Exactly one of vocab_file + * and unigrams needs to be passed to this op. + */ + public Options vocabFile(String vocabFile) { + this.vocabFile = vocabFile; + return this; + } + + /** + * @param distortion The distortion is used to skew the unigram probability distribution. + * Each weight is first raised to the distortion's power before adding to the + * internal unigram distribution. As a result, distortion = 1.0 gives regular + * unigram sampling (as defined by the vocab file), and distortion = 0.0 gives + * a uniform distribution. + */ + public Options distortion(Float distortion) { + this.distortion = distortion; + return this; + } + + /** + * @param numReservedIds Optionally some reserved IDs can be added in the range [0, + * ..., num_reserved_ids) by the users. One use case is that a special unknown + * word token is used as ID 0. These IDs will have a sampling probability of 0. + */ + public Options numReservedIds(Long numReservedIds) { + this.numReservedIds = numReservedIds; + return this; + } + + /** + * @param numShards A sampler can be used to sample from a subset of the original range + * in order to speed up the whole computation through parallelism. This parameter + * (together with 'shard') indicates the number of partitions that are being + * used in the overall computation. + */ + public Options numShards(Long numShards) { + this.numShards = numShards; + return this; + } + + /** + * @param shard A sampler can be used to sample from a subset of the original range + * in order to speed up the whole computation through parallelism. This parameter + * (together with 'num_shards') indicates the particular partition number of a + * sampler op, when partitioning is being used. + */ + public Options shard(Long shard) { + this.shard = shard; + return this; + } + + /** + * @param unigrams A list of unigram counts or probabilities, one per ID in sequential + * order. Exactly one of vocab_file and unigrams should be passed to this op. + */ + public Options unigrams(List unigrams) { + this.unigrams = unigrams; + return this; + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private String vocabFile; + private Float distortion; + private Long numReservedIds; + private Long numShards; + private Long shard; + private List unigrams; + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FixedUnigramCandidateSampler operation. + * + * @param scope current scope + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * IDs of the num_true target_classes in the corresponding original label. + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * candidates in a batch are unique. This requires some approximation to + * estimate the post-rejection sampling probabilities. + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of FixedUnigramCandidateSampler + */ + public static FixedUnigramCandidateSampler create(Scope scope, Operand trueClasses, Long numTrue, Long numSampled, Boolean unique, Long rangeMax, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FixedUnigramCandidateSampler", scope.makeOpName("FixedUnigramCandidateSampler")); + opBuilder.addInput(trueClasses.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_true", numTrue); + opBuilder.setAttr("num_sampled", numSampled); + opBuilder.setAttr("unique", unique); + opBuilder.setAttr("range_max", rangeMax); + if (options != null) { + for (Options opts : options) { + if (opts.vocabFile != null) { + opBuilder.setAttr("vocab_file", opts.vocabFile); + } + if (opts.distortion != null) { + opBuilder.setAttr("distortion", opts.distortion); + } + if (opts.numReservedIds != null) { + opBuilder.setAttr("num_reserved_ids", opts.numReservedIds); + } + if (opts.numShards != null) { + opBuilder.setAttr("num_shards", opts.numShards); + } + if (opts.shard != null) { + opBuilder.setAttr("shard", opts.shard); + } + if (opts.unigrams != null) { + float[] unigramsArray = new float[opts.unigrams.size()]; + for (int i = 0; i < unigramsArray.length; ++i) { + unigramsArray[i] = opts.unigrams.get(i); + } + opBuilder.setAttr("unigrams", unigramsArray); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new FixedUnigramCandidateSampler(opBuilder.build()); + } + + /** + * @param vocabFile Each valid line in this file (which should have a CSV-like format) + * corresponds to a valid word ID. IDs are in sequential order, starting from + * num_reserved_ids. The last entry in each line is expected to be a value + * corresponding to the count or relative probability. Exactly one of vocab_file + * and unigrams needs to be passed to this op. + */ + public static Options vocabFile(String vocabFile) { + return new Options().vocabFile(vocabFile); + } + + /** + * @param distortion The distortion is used to skew the unigram probability distribution. + * Each weight is first raised to the distortion's power before adding to the + * internal unigram distribution. As a result, distortion = 1.0 gives regular + * unigram sampling (as defined by the vocab file), and distortion = 0.0 gives + * a uniform distribution. + */ + public static Options distortion(Float distortion) { + return new Options().distortion(distortion); + } + + /** + * @param numReservedIds Optionally some reserved IDs can be added in the range [0, + * ..., num_reserved_ids) by the users. One use case is that a special unknown + * word token is used as ID 0. These IDs will have a sampling probability of 0. + */ + public static Options numReservedIds(Long numReservedIds) { + return new Options().numReservedIds(numReservedIds); + } + + /** + * @param numShards A sampler can be used to sample from a subset of the original range + * in order to speed up the whole computation through parallelism. This parameter + * (together with 'shard') indicates the number of partitions that are being + * used in the overall computation. + */ + public static Options numShards(Long numShards) { + return new Options().numShards(numShards); + } + + /** + * @param shard A sampler can be used to sample from a subset of the original range + * in order to speed up the whole computation through parallelism. This parameter + * (together with 'num_shards') indicates the particular partition number of a + * sampler op, when partitioning is being used. + */ + public static Options shard(Long shard) { + return new Options().shard(shard); + } + + /** + * @param unigrams A list of unigram counts or probabilities, one per ID in sequential + * order. Exactly one of vocab_file and unigrams should be passed to this op. + */ + public static Options unigrams(List unigrams) { + return new Options().unigrams(unigrams); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A vector of length num_sampled, in which each element is + * the ID of a sampled candidate. + */ + public Output sampledCandidates() { + return sampledCandidates; + } + + /** + * A batch_size * num_true matrix, representing + * the number of times each candidate is expected to occur in a batch + * of sampled candidates. If unique=true, then this is a probability. + */ + public Output trueExpectedCount() { + return trueExpectedCount; + } + + /** + * A vector of length num_sampled, for each sampled + * candidate representing the number of times the candidate is expected + * to occur in a batch of sampled candidates. If unique=true, then this is a + * probability. + */ + public Output sampledExpectedCount() { + return sampledExpectedCount; + } + + private Output sampledCandidates; + private Output trueExpectedCount; + private Output sampledExpectedCount; + + private FixedUnigramCandidateSampler(Operation operation) { + super(operation); + int outputIdx = 0; + sampledCandidates = operation.output(outputIdx++); + trueExpectedCount = operation.output(outputIdx++); + sampledExpectedCount = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalAvgPool.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalAvgPool.java new file mode 100644 index 00000000000..6dbdeee7c0a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalAvgPool.java @@ -0,0 +1,239 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs fractional average pooling on the input. + *

              + * Fractional average pooling is similar to Fractional max pooling in the pooling + * region generation step. The only difference is that after pooling regions are + * generated, a mean operation is performed instead of a max operation in each + * pooling region. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class FractionalAvgPool extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FractionalAvgPool} + */ + public static class Options { + + /** + * @param pseudoRandom When set to True, generates the pooling sequence in a + * pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin + * Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for + * difference between pseudorandom and random. + */ + public Options pseudoRandom(Boolean pseudoRandom) { + this.pseudoRandom = pseudoRandom; + return this; + } + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [41/3, 26/3] for fractional avg pooling. + */ + public Options overlapping(Boolean overlapping) { + this.overlapping = overlapping; + return this; + } + + /** + * @param deterministic When set to True, a fixed pooling region will be used when + * iterating over a FractionalAvgPool node in the computation graph. Mainly used + * in unit test to make FractionalAvgPool deterministic. + */ + public Options deterministic(Boolean deterministic) { + this.deterministic = deterministic; + return this; + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Boolean pseudoRandom; + private Boolean overlapping; + private Boolean deterministic; + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FractionalAvgPool operation. + * + * @param scope current scope + * @param value 4-D with shape `[batch, height, width, channels]`. + * @param poolingRatio Pooling ratio for each dimension of `value`, currently only + * supports row and col dimension and should be >= 1.0. For example, a valid + * pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements + * must be 1.0 because we don't allow pooling on batch and channels + * dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions + * respectively. + * @param options carries optional attributes values + * @return a new instance of FractionalAvgPool + */ + public static FractionalAvgPool create(Scope scope, Operand value, List poolingRatio, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FractionalAvgPool", scope.makeOpName("FractionalAvgPool")); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + float[] poolingRatioArray = new float[poolingRatio.size()]; + for (int i = 0; i < poolingRatioArray.length; ++i) { + poolingRatioArray[i] = poolingRatio.get(i); + } + opBuilder.setAttr("pooling_ratio", poolingRatioArray); + if (options != null) { + for (Options opts : options) { + if (opts.pseudoRandom != null) { + opBuilder.setAttr("pseudo_random", opts.pseudoRandom); + } + if (opts.overlapping != null) { + opBuilder.setAttr("overlapping", opts.overlapping); + } + if (opts.deterministic != null) { + opBuilder.setAttr("deterministic", opts.deterministic); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new FractionalAvgPool(opBuilder.build()); + } + + /** + * @param pseudoRandom When set to True, generates the pooling sequence in a + * pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin + * Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for + * difference between pseudorandom and random. + */ + public static Options pseudoRandom(Boolean pseudoRandom) { + return new Options().pseudoRandom(pseudoRandom); + } + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [41/3, 26/3] for fractional avg pooling. + */ + public static Options overlapping(Boolean overlapping) { + return new Options().overlapping(overlapping); + } + + /** + * @param deterministic When set to True, a fixed pooling region will be used when + * iterating over a FractionalAvgPool node in the computation graph. Mainly used + * in unit test to make FractionalAvgPool deterministic. + */ + public static Options deterministic(Boolean deterministic) { + return new Options().deterministic(deterministic); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * output tensor after fractional avg pooling. + */ + public Output output() { + return output; + } + + /** + * row pooling sequence, needed to calculate gradient. + */ + public Output rowPoolingSequence() { + return rowPoolingSequence; + } + + /** + * column pooling sequence, needed to calculate gradient. + */ + public Output colPoolingSequence() { + return colPoolingSequence; + } + + private Output output; + private Output rowPoolingSequence; + private Output colPoolingSequence; + + private FractionalAvgPool(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + rowPoolingSequence = operation.output(outputIdx++); + colPoolingSequence = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalAvgPoolGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalAvgPoolGrad.java new file mode 100644 index 00000000000..3ae4f58eed2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalAvgPoolGrad.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes gradient of the FractionalAvgPool function. + *

              + * Unlike FractionalMaxPoolGrad, we don't need to find arg_max for + * FractionalAvgPoolGrad, we just need to evenly back-propagate each element of + * out_backprop to those indices that form the same pooling cell. Therefore, we + * just need to know the shape of original input tensor, instead of the whole + * tensor. + * + * @param data type for {@code output()} output + */ +public final class FractionalAvgPoolGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FractionalAvgPoolGrad} + */ + public static class Options { + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [41/3, 26/3] for fractional avg pooling. + */ + public Options overlapping(Boolean overlapping) { + this.overlapping = overlapping; + return this; + } + + private Boolean overlapping; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FractionalAvgPoolGrad operation. + * + * @param scope current scope + * @param origInputTensorShape Original input tensor shape for `fractional_avg_pool` + * @param outBackprop 4-D with shape `[batch, height, width, channels]`. Gradients + * w.r.t. the output of `fractional_avg_pool`. + * @param rowPoolingSequence row pooling sequence, form pooling region with + * col_pooling_sequence. + * @param colPoolingSequence column pooling sequence, form pooling region with + * row_pooling sequence. + * @param options carries optional attributes values + * @return a new instance of FractionalAvgPoolGrad + */ + public static FractionalAvgPoolGrad create(Scope scope, Operand origInputTensorShape, Operand outBackprop, Operand rowPoolingSequence, Operand colPoolingSequence, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FractionalAvgPoolGrad", scope.makeOpName("FractionalAvgPoolGrad")); + opBuilder.addInput(origInputTensorShape.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder.addInput(rowPoolingSequence.asOutput()); + opBuilder.addInput(colPoolingSequence.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.overlapping != null) { + opBuilder.setAttr("overlapping", opts.overlapping); + } + } + } + return new FractionalAvgPoolGrad(opBuilder.build()); + } + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [41/3, 26/3] for fractional avg pooling. + */ + public static Options overlapping(Boolean overlapping) { + return new Options().overlapping(overlapping); + } + + /** + * 4-D. Gradients w.r.t. the input of `fractional_avg_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private FractionalAvgPoolGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalMaxPool.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalMaxPool.java new file mode 100644 index 00000000000..b4be4d7cae0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalMaxPool.java @@ -0,0 +1,263 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs fractional max pooling on the input. + *

              + * Fractional max pooling is slightly different than regular max pooling. In + * regular max pooling, you downsize an input set by taking the maximum value of + * smaller N x N subsections of the set (often 2x2), and try to reduce the set by + * a factor of N, where N is an integer. Fractional max pooling, as you might + * expect from the word "fractional", means that the overall reduction ratio N + * does not have to be an integer. + *

              + * The sizes of the pooling regions are generated randomly but are fairly uniform. + * For example, let's look at the height dimension, and the constraints on the + * list of rows that will be pool boundaries. + *

              + * First we define the following: + *

              + * 1. input_row_length : the number of rows from the input set + * 2. output_row_length : which will be smaller than the input + * 3. alpha = input_row_length / output_row_length : our reduction ratio + * 4. K = floor(alpha) + * 5. row_pooling_sequence : this is the result list of pool boundary rows + *

              + * Then, row_pooling_sequence should satisfy: + *

              + * 1. a[0] = 0 : the first value of the sequence is 0 + * 2. a[end] = input_row_length : the last value of the sequence is the size + * 3. K <= (a[i+1] - a[i]) <= K+1 : all intervals are K or K+1 size + * 4. length(row_pooling_sequence) = output_row_length+1 + *

              + * For more details on fractional max pooling, see this paper: + * [Benjamin Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class FractionalMaxPool extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FractionalMaxPool} + */ + public static class Options { + + /** + * @param pseudoRandom When set to True, generates the pooling sequence in a + * pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin + * Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for + * difference between pseudorandom and random. + */ + public Options pseudoRandom(Boolean pseudoRandom) { + this.pseudoRandom = pseudoRandom; + return this; + } + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [20, 16] for fractional max pooling. + */ + public Options overlapping(Boolean overlapping) { + this.overlapping = overlapping; + return this; + } + + /** + * @param deterministic When set to True, a fixed pooling region will be used when + * iterating over a FractionalMaxPool node in the computation graph. Mainly used + * in unit test to make FractionalMaxPool deterministic. + */ + public Options deterministic(Boolean deterministic) { + this.deterministic = deterministic; + return this; + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Boolean pseudoRandom; + private Boolean overlapping; + private Boolean deterministic; + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FractionalMaxPool operation. + * + * @param scope current scope + * @param value 4-D with shape `[batch, height, width, channels]`. + * @param poolingRatio Pooling ratio for each dimension of `value`, currently only + * supports row and col dimension and should be >= 1.0. For example, a valid + * pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements + * must be 1.0 because we don't allow pooling on batch and channels + * dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions + * respectively. + * @param options carries optional attributes values + * @return a new instance of FractionalMaxPool + */ + public static FractionalMaxPool create(Scope scope, Operand value, List poolingRatio, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FractionalMaxPool", scope.makeOpName("FractionalMaxPool")); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + float[] poolingRatioArray = new float[poolingRatio.size()]; + for (int i = 0; i < poolingRatioArray.length; ++i) { + poolingRatioArray[i] = poolingRatio.get(i); + } + opBuilder.setAttr("pooling_ratio", poolingRatioArray); + if (options != null) { + for (Options opts : options) { + if (opts.pseudoRandom != null) { + opBuilder.setAttr("pseudo_random", opts.pseudoRandom); + } + if (opts.overlapping != null) { + opBuilder.setAttr("overlapping", opts.overlapping); + } + if (opts.deterministic != null) { + opBuilder.setAttr("deterministic", opts.deterministic); + } + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new FractionalMaxPool(opBuilder.build()); + } + + /** + * @param pseudoRandom When set to True, generates the pooling sequence in a + * pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin + * Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for + * difference between pseudorandom and random. + */ + public static Options pseudoRandom(Boolean pseudoRandom) { + return new Options().pseudoRandom(pseudoRandom); + } + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [20, 16] for fractional max pooling. + */ + public static Options overlapping(Boolean overlapping) { + return new Options().overlapping(overlapping); + } + + /** + * @param deterministic When set to True, a fixed pooling region will be used when + * iterating over a FractionalMaxPool node in the computation graph. Mainly used + * in unit test to make FractionalMaxPool deterministic. + */ + public static Options deterministic(Boolean deterministic) { + return new Options().deterministic(deterministic); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * output tensor after fractional max pooling. + */ + public Output output() { + return output; + } + + /** + * row pooling sequence, needed to calculate gradient. + */ + public Output rowPoolingSequence() { + return rowPoolingSequence; + } + + /** + * column pooling sequence, needed to calculate gradient. + */ + public Output colPoolingSequence() { + return colPoolingSequence; + } + + private Output output; + private Output rowPoolingSequence; + private Output colPoolingSequence; + + private FractionalMaxPool(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + rowPoolingSequence = operation.output(outputIdx++); + colPoolingSequence = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalMaxPoolGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalMaxPoolGrad.java new file mode 100644 index 00000000000..8fff60353c0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FractionalMaxPoolGrad.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes gradient of the FractionalMaxPool function. + * + * @param data type for {@code output()} output + */ +public final class FractionalMaxPoolGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FractionalMaxPoolGrad} + */ + public static class Options { + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [20, 16] for fractional max pooling. + */ + public Options overlapping(Boolean overlapping) { + this.overlapping = overlapping; + return this; + } + + private Boolean overlapping; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FractionalMaxPoolGrad operation. + * + * @param scope current scope + * @param origInput Original input for `fractional_max_pool` + * @param origOutput Original output for `fractional_max_pool` + * @param outBackprop 4-D with shape `[batch, height, width, channels]`. Gradients + * w.r.t. the output of `fractional_max_pool`. + * @param rowPoolingSequence row pooling sequence, form pooling region with + * col_pooling_sequence. + * @param colPoolingSequence column pooling sequence, form pooling region with + * row_pooling sequence. + * @param options carries optional attributes values + * @return a new instance of FractionalMaxPoolGrad + */ + public static FractionalMaxPoolGrad create(Scope scope, Operand origInput, Operand origOutput, Operand outBackprop, Operand rowPoolingSequence, Operand colPoolingSequence, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FractionalMaxPoolGrad", scope.makeOpName("FractionalMaxPoolGrad")); + opBuilder.addInput(origInput.asOutput()); + opBuilder.addInput(origOutput.asOutput()); + opBuilder.addInput(outBackprop.asOutput()); + opBuilder.addInput(rowPoolingSequence.asOutput()); + opBuilder.addInput(colPoolingSequence.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.overlapping != null) { + opBuilder.setAttr("overlapping", opts.overlapping); + } + } + } + return new FractionalMaxPoolGrad(opBuilder.build()); + } + + /** + * @param overlapping When set to True, it means when pooling, the values at the boundary + * of adjacent pooling cells are used by both cells. For example: + *

              + * `index 0 1 2 3 4` + *

              + * `value 20 5 16 3 7` + *

              + * If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. + * The result would be [20, 16] for fractional max pooling. + */ + public static Options overlapping(Boolean overlapping) { + return new Options().overlapping(overlapping); + } + + /** + * 4-D. Gradients w.r.t. the input of `fractional_max_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private FractionalMaxPoolGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedBatchNorm.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedBatchNorm.java new file mode 100644 index 00000000000..24747439ca5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedBatchNorm.java @@ -0,0 +1,192 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Batch normalization. + *

              + * Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". + * The size of 1D Tensors matches the dimension C of the 4D Tensors. + * + * @param data type for {@code y()} output + * @param data type for {@code batchMean()} output + */ +@Operator(group = "nn") +public final class FusedBatchNorm extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FusedBatchNorm} + */ + public static class Options { + + /** + * @param epsilon A small float number added to the variance of x. + */ + public Options epsilon(Float epsilon) { + this.epsilon = epsilon; + return this; + } + + /** + * @param dataFormat The data format for x and y. Either "NHWC" (default) or "NCHW". + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public Options isTraining(Boolean isTraining) { + this.isTraining = isTraining; + return this; + } + + private Float epsilon; + private String dataFormat; + private Boolean isTraining; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FusedBatchNorm operation. + * + * @param scope current scope + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param offset A 1D Tensor for offset, to shift to the normalized x. + * @param mean A 1D Tensor for population mean. Used for inference only; + * must be empty for training. + * @param variance A 1D Tensor for population variance. Used for inference only; + * must be empty for training. + * @param options carries optional attributes values + * @return a new instance of FusedBatchNorm + */ + public static FusedBatchNorm create(Scope scope, Operand x, Operand scale, Operand offset, Operand mean, Operand variance, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FusedBatchNormV2", scope.makeOpName("FusedBatchNorm")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(scale.asOutput()); + opBuilder.addInput(offset.asOutput()); + opBuilder.addInput(mean.asOutput()); + opBuilder.addInput(variance.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.epsilon != null) { + opBuilder.setAttr("epsilon", opts.epsilon); + } + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.isTraining != null) { + opBuilder.setAttr("is_training", opts.isTraining); + } + } + } + return new FusedBatchNorm(opBuilder.build()); + } + + /** + * @param epsilon A small float number added to the variance of x. + */ + public static Options epsilon(Float epsilon) { + return new Options().epsilon(epsilon); + } + + /** + * @param dataFormat The data format for x and y. Either "NHWC" (default) or "NCHW". + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public static Options isTraining(Boolean isTraining) { + return new Options().isTraining(isTraining); + } + + /** + * A 4D Tensor for output data. + */ + public Output y() { + return y; + } + + /** + * A 1D Tensor for the computed batch mean, to be used by TensorFlow + * to compute the running mean. + */ + public Output batchMean() { + return batchMean; + } + + /** + * A 1D Tensor for the computed batch variance, to be used by + * TensorFlow to compute the running variance. + */ + public Output batchVariance() { + return batchVariance; + } + + /** + * A 1D Tensor for the computed batch mean, to be reused + * in the gradient computation. + */ + public Output reserveSpace1() { + return reserveSpace1; + } + + /** + * A 1D Tensor for the computed batch variance (inverted variance + * in the cuDNN case), to be reused in the gradient computation. + */ + public Output reserveSpace2() { + return reserveSpace2; + } + + private Output y; + private Output batchMean; + private Output batchVariance; + private Output reserveSpace1; + private Output reserveSpace2; + + private FusedBatchNorm(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + batchMean = operation.output(outputIdx++); + batchVariance = operation.output(outputIdx++); + reserveSpace1 = operation.output(outputIdx++); + reserveSpace2 = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedBatchNormGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedBatchNormGrad.java new file mode 100644 index 00000000000..add23a2f2c4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedBatchNormGrad.java @@ -0,0 +1,196 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Gradient for batch normalization. + *

              + * Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". + * The size of 1D Tensors matches the dimension C of the 4D Tensors. + * + * @param data type for {@code xBackprop()} output + * @param data type for {@code scaleBackprop()} output + */ +@Operator(group = "nn") +public final class FusedBatchNormGrad extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FusedBatchNormGrad} + */ + public static class Options { + + /** + * @param epsilon A small float number added to the variance of x. + */ + public Options epsilon(Float epsilon) { + this.epsilon = epsilon; + return this; + } + + /** + * @param dataFormat The data format for y_backprop, x, x_backprop. + * Either "NHWC" (default) or "NCHW". + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public Options isTraining(Boolean isTraining) { + this.isTraining = isTraining; + return this; + } + + private Float epsilon; + private String dataFormat; + private Boolean isTraining; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FusedBatchNormGrad operation. + * + * @param scope current scope + * @param yBackprop A 4D Tensor for the gradient with respect to y. + * @param x A 4D Tensor for input data. + * @param scale A 1D Tensor for scaling factor, to scale the normalized x. + * @param reserveSpace1 When is_training is True, a 1D Tensor for the computed batch + * mean to be reused in gradient computation. When is_training is + * False, a 1D Tensor for the population mean to be reused in both + * 1st and 2nd order gradient computation. + * @param reserveSpace2 When is_training is True, a 1D Tensor for the computed batch + * variance (inverted variance in the cuDNN case) to be reused in + * gradient computation. When is_training is False, a 1D Tensor + * for the population variance to be reused in both 1st and 2nd + * order gradient computation. + * @param options carries optional attributes values + * @return a new instance of FusedBatchNormGrad + */ + public static FusedBatchNormGrad create(Scope scope, Operand yBackprop, Operand x, Operand scale, Operand reserveSpace1, Operand reserveSpace2, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FusedBatchNormGradV2", scope.makeOpName("FusedBatchNormGrad")); + opBuilder.addInput(yBackprop.asOutput()); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(scale.asOutput()); + opBuilder.addInput(reserveSpace1.asOutput()); + opBuilder.addInput(reserveSpace2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.epsilon != null) { + opBuilder.setAttr("epsilon", opts.epsilon); + } + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + if (opts.isTraining != null) { + opBuilder.setAttr("is_training", opts.isTraining); + } + } + } + return new FusedBatchNormGrad(opBuilder.build()); + } + + /** + * @param epsilon A small float number added to the variance of x. + */ + public static Options epsilon(Float epsilon) { + return new Options().epsilon(epsilon); + } + + /** + * @param dataFormat The data format for y_backprop, x, x_backprop. + * Either "NHWC" (default) or "NCHW". + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * @param isTraining A bool value to indicate the operation is for training (default) + * or inference. + */ + public static Options isTraining(Boolean isTraining) { + return new Options().isTraining(isTraining); + } + + /** + * A 4D Tensor for the gradient with respect to x. + */ + public Output xBackprop() { + return xBackprop; + } + + /** + * A 1D Tensor for the gradient with respect to scale. + */ + public Output scaleBackprop() { + return scaleBackprop; + } + + /** + * A 1D Tensor for the gradient with respect to offset. + */ + public Output offsetBackprop() { + return offsetBackprop; + } + + /** + * Unused placeholder to match the mean input in FusedBatchNorm. + */ + public Output reserveSpace3() { + return reserveSpace3; + } + + /** + * Unused placeholder to match the variance input + * in FusedBatchNorm. + */ + public Output reserveSpace4() { + return reserveSpace4; + } + + private Output xBackprop; + private Output scaleBackprop; + private Output offsetBackprop; + private Output reserveSpace3; + private Output reserveSpace4; + + private FusedBatchNormGrad(Operation operation) { + super(operation); + int outputIdx = 0; + xBackprop = operation.output(outputIdx++); + scaleBackprop = operation.output(outputIdx++); + offsetBackprop = operation.output(outputIdx++); + reserveSpace3 = operation.output(outputIdx++); + reserveSpace4 = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedPadConv2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedPadConv2d.java new file mode 100644 index 00000000000..ea395403fac --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedPadConv2d.java @@ -0,0 +1,98 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs a padding as a preprocess during a convolution. + *

              + * Similar to FusedResizeAndPadConv2d, this op allows for an optimized + * implementation where the spatial padding transformation stage is fused with the + * im2col lookup, but in this case without the bilinear filtering required for + * resizing. Fusing the padding prevents the need to write out the intermediate + * results as whole tensors, reducing memory pressure, and we can get some latency + * gains by merging the transformation calculations. + * The data_format attribute for Conv2D isn't supported by this op, and 'NHWC' + * order is used instead. + * Internally this op uses a single per-graph scratch buffer, which means that it + * will block if multiple versions are being run in parallel. This is because this + * operator is primarily an optimization to minimize memory usage. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class FusedPadConv2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new FusedPadConv2d operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, in_height, in_width, in_channels]`. + * @param paddings A two-column matrix specifying the padding sizes. The number of + * rows must be the same as the rank of `input`. + * @param filter 4-D with shape + * `[filter_height, filter_width, in_channels, out_channels]`. + * @param mode + * @param strides 1-D of length 4. The stride of the sliding window for each dimension + * of `input`. Must be in the same order as the dimension specified with format. + * @param padding The type of padding algorithm to use. + * @return a new instance of FusedPadConv2d + */ + public static FusedPadConv2d create(Scope scope, Operand input, Operand paddings, Operand filter, String mode, List strides, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("FusedPadConv2D", scope.makeOpName("FusedPadConv2d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(paddings.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("mode", mode); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + return new FusedPadConv2d(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private FusedPadConv2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedResizeAndPadConv2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedResizeAndPadConv2d.java new file mode 100644 index 00000000000..90924370c38 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/FusedResizeAndPadConv2d.java @@ -0,0 +1,136 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs a resize and padding as a preprocess during a convolution. + *

              + * It's often possible to do spatial transformations more efficiently as part of + * the packing stage of a convolution, so this op allows for an optimized + * implementation where these stages are fused together. This prevents the need to + * write out the intermediate results as whole tensors, reducing memory pressure, + * and we can get some latency gains by merging the transformation calculations. + * The data_format attribute for Conv2D isn't supported by this op, and defaults to + * 'NHWC' order. + * Internally this op uses a single per-graph scratch buffer, which means that it + * will block if multiple versions are being run in parallel. This is because this + * operator is primarily an optimization to minimize memory usage. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class FusedResizeAndPadConv2d extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.FusedResizeAndPadConv2d} + */ + public static class Options { + + /** + * @param resizeAlignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public Options resizeAlignCorners(Boolean resizeAlignCorners) { + this.resizeAlignCorners = resizeAlignCorners; + return this; + } + + private Boolean resizeAlignCorners; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FusedResizeAndPadConv2d operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, in_height, in_width, in_channels]`. + * @param size A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The + * new size for the images. + * @param paddings A two-column matrix specifying the padding sizes. The number of + * rows must be the same as the rank of `input`. + * @param filter 4-D with shape + * `[filter_height, filter_width, in_channels, out_channels]`. + * @param mode + * @param strides 1-D of length 4. The stride of the sliding window for each dimension + * of `input`. Must be in the same order as the dimension specified with format. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of FusedResizeAndPadConv2d + */ + public static FusedResizeAndPadConv2d create(Scope scope, Operand input, Operand size, Operand paddings, Operand filter, String mode, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FusedResizeAndPadConv2D", scope.makeOpName("FusedResizeAndPadConv2d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder.addInput(paddings.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("mode", mode); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.resizeAlignCorners != null) { + opBuilder.setAttr("resize_align_corners", opts.resizeAlignCorners); + } + } + } + return new FusedResizeAndPadConv2d(opBuilder.build()); + } + + /** + * @param resizeAlignCorners If true, the centers of the 4 corner pixels of the input and output tensors are + * aligned, preserving the values at the corner pixels. Defaults to false. + */ + public static Options resizeAlignCorners(Boolean resizeAlignCorners) { + return new Options().resizeAlignCorners(resizeAlignCorners); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private FusedResizeAndPadConv2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/InTopK.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/InTopK.java new file mode 100644 index 00000000000..0e46ec56ecb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/InTopK.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Says whether the targets are in the top `K` predictions. + *

              + * This outputs a `batch_size` bool array, an entry `out[i]` is `true` if the + * prediction for the target class is among the top `k` predictions among + * all predictions for example `i`. Note that the behavior of `InTopK` differs + * from the `TopK` op in its handling of ties; if multiple classes have the + * same prediction value and straddle the top-`k` boundary, all of those + * classes are considered to be in the top `k`. + *

              + * More formally, let + *

              + * \\(predictions_i\\) be the predictions for all classes for example `i`, + * \\(targets_i\\) be the target class for example `i`, + * \\(out_i\\) be the output for example `i`, + *

              + * $$out_i = predictions_{i, targets_i} \in TopKIncludingTies(predictions_i)$$ + */ +@Operator(group = "nn") +public final class InTopK extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new InTopK operation. + * + * @param scope current scope + * @param predictions A `batch_size` x `classes` tensor. + * @param targets A `batch_size` vector of class ids. + * @param k Number of top elements to look at for computing precision. + * @return a new instance of InTopK + */ + public static InTopK create(Scope scope, Operand predictions, Operand targets, Operand k) { + OperationBuilder opBuilder = scope.env().opBuilder("InTopKV2", scope.makeOpName("InTopK")); + opBuilder.addInput(predictions.asOutput()); + opBuilder.addInput(targets.asOutput()); + opBuilder.addInput(k.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new InTopK(opBuilder.build()); + } + + /** + * Computed precision at `k` as a `bool Tensor`. + */ + public Output precision() { + return precision; + } + + @Override + public Output asOutput() { + return precision; + } + + private Output precision; + + private InTopK(Operation operation) { + super(operation); + int outputIdx = 0; + precision = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/InvGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/InvGrad.java new file mode 100644 index 00000000000..c71f385d7ba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/InvGrad.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the gradient for the inverse of `x` wrt its input. + *

              + * Specifically, `grad = -dy yy`, where `y = 1/x`, and `dy` + * is the corresponding input gradient. + * + * @param data type for {@code z()} output + */ +public final class InvGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new InvGrad operation. + * + * @param scope current scope + * @param y + * @param dy + * @return a new instance of InvGrad + */ + public static InvGrad create(Scope scope, Operand y, Operand dy) { + OperationBuilder opBuilder = scope.env().opBuilder("InvGrad", scope.makeOpName("InvGrad")); + opBuilder.addInput(y.asOutput()); + opBuilder.addInput(dy.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new InvGrad(opBuilder.build()); + } + + /** + */ + public Output z() { + return z; + } + + @Override + public Output asOutput() { + return z; + } + + private Output z; + + private InvGrad(Operation operation) { + super(operation); + int outputIdx = 0; + z = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/L2Loss.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/L2Loss.java new file mode 100644 index 00000000000..4544788a34a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/L2Loss.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * L2 Loss. + *

              + * Computes half the L2 norm of a tensor without the `sqrt`: + *

              + * output = sum(t ** 2) / 2 + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class L2Loss extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new L2Loss operation. + * + * @param scope current scope + * @param t Typically 2-D, but may have any dimensions. + * @return a new instance of L2Loss + */ + public static L2Loss create(Scope scope, Operand t) { + OperationBuilder opBuilder = scope.env().opBuilder("L2Loss", scope.makeOpName("L2Loss")); + opBuilder.addInput(t.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new L2Loss(opBuilder.build()); + } + + /** + * 0-D. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private L2Loss(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LeakyRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LeakyRelu.java new file mode 100644 index 00000000000..8888c986d9f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LeakyRelu.java @@ -0,0 +1,100 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes rectified linear: `max(features, features * alpha)`. + * + * @param data type for {@code activations()} output + */ +public final class LeakyRelu extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.LeakyRelu} + */ + public static class Options { + + /** + * @param alpha + */ + public Options alpha(Float alpha) { + this.alpha = alpha; + return this; + } + + private Float alpha; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LeakyRelu operation. + * + * @param scope current scope + * @param features + * @param options carries optional attributes values + * @return a new instance of LeakyRelu + */ + public static LeakyRelu create(Scope scope, Operand features, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LeakyRelu", scope.makeOpName("LeakyRelu")); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.alpha != null) { + opBuilder.setAttr("alpha", opts.alpha); + } + } + } + return new LeakyRelu(opBuilder.build()); + } + + /** + * @param alpha + */ + public static Options alpha(Float alpha) { + return new Options().alpha(alpha); + } + + /** + */ + public Output activations() { + return activations; + } + + @Override + public Output asOutput() { + return activations; + } + + private Output activations; + + private LeakyRelu(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LearnedUnigramCandidateSampler.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LearnedUnigramCandidateSampler.java new file mode 100644 index 00000000000..c179f222a5f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LearnedUnigramCandidateSampler.java @@ -0,0 +1,164 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generates labels for candidate sampling with a learned unigram distribution. + *

              + * See explanations of candidate sampling and the data formats at + * go/candidate-sampling. + *

              + * For each batch, this op picks a single set of sampled candidate labels. + *

              + * The advantages of sampling candidates per-batch are simplicity and the + * possibility of efficient dense matrix multiplication. The disadvantage is that + * the sampled candidates must be chosen independently of the context and of the + * true labels. + */ +@Operator(group = "nn") +public final class LearnedUnigramCandidateSampler extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.LearnedUnigramCandidateSampler} + */ + public static class Options { + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LearnedUnigramCandidateSampler operation. + * + * @param scope current scope + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * IDs of the num_true target_classes in the corresponding original label. + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * candidates in a batch are unique. This requires some approximation to + * estimate the post-rejection sampling probabilities. + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of LearnedUnigramCandidateSampler + */ + public static LearnedUnigramCandidateSampler create(Scope scope, Operand trueClasses, Long numTrue, Long numSampled, Boolean unique, Long rangeMax, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LearnedUnigramCandidateSampler", scope.makeOpName("LearnedUnigramCandidateSampler")); + opBuilder.addInput(trueClasses.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_true", numTrue); + opBuilder.setAttr("num_sampled", numSampled); + opBuilder.setAttr("unique", unique); + opBuilder.setAttr("range_max", rangeMax); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new LearnedUnigramCandidateSampler(opBuilder.build()); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A vector of length num_sampled, in which each element is + * the ID of a sampled candidate. + */ + public Output sampledCandidates() { + return sampledCandidates; + } + + /** + * A batch_size * num_true matrix, representing + * the number of times each candidate is expected to occur in a batch + * of sampled candidates. If unique=true, then this is a probability. + */ + public Output trueExpectedCount() { + return trueExpectedCount; + } + + /** + * A vector of length num_sampled, for each sampled + * candidate representing the number of times the candidate is expected + * to occur in a batch of sampled candidates. If unique=true, then this is a + * probability. + */ + public Output sampledExpectedCount() { + return sampledExpectedCount; + } + + private Output sampledCandidates; + private Output trueExpectedCount; + private Output sampledExpectedCount; + + private LearnedUnigramCandidateSampler(Operation operation) { + super(operation); + int outputIdx = 0; + sampledCandidates = operation.output(outputIdx++); + trueExpectedCount = operation.output(outputIdx++); + sampledExpectedCount = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LocalResponseNormalization.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LocalResponseNormalization.java new file mode 100644 index 00000000000..67195a10aff --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LocalResponseNormalization.java @@ -0,0 +1,171 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Local Response Normalization. + *

              + * The 4-D `input` tensor is treated as a 3-D array of 1-D vectors (along the last + * dimension), and each vector is normalized independently. Within a given vector, + * each component is divided by the weighted, squared sum of inputs within + * `depth_radius`. In detail, + *

              + * sqr_sum[a, b, c, d] = + * sum(input[a, b, c, d - depth_radius : d + depth_radius + 1] ** 2) + * output = input / (bias + alpha * sqr_sum) ** beta + *

              + * For details, see [Krizhevsky et al., ImageNet classification with deep + * convolutional neural networks (NIPS 2012)](http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks). + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class LocalResponseNormalization extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.LocalResponseNormalization} + */ + public static class Options { + + /** + * @param depthRadius 0-D. Half-width of the 1-D normalization window. + */ + public Options depthRadius(Long depthRadius) { + this.depthRadius = depthRadius; + return this; + } + + /** + * @param bias An offset (usually positive to avoid dividing by 0). + */ + public Options bias(Float bias) { + this.bias = bias; + return this; + } + + /** + * @param alpha A scale factor, usually positive. + */ + public Options alpha(Float alpha) { + this.alpha = alpha; + return this; + } + + /** + * @param beta An exponent. + */ + public Options beta(Float beta) { + this.beta = beta; + return this; + } + + private Long depthRadius; + private Float bias; + private Float alpha; + private Float beta; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LocalResponseNormalization operation. + * + * @param scope current scope + * @param input 4-D. + * @param options carries optional attributes values + * @return a new instance of LocalResponseNormalization + */ + public static LocalResponseNormalization create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LRN", scope.makeOpName("LocalResponseNormalization")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.depthRadius != null) { + opBuilder.setAttr("depth_radius", opts.depthRadius); + } + if (opts.bias != null) { + opBuilder.setAttr("bias", opts.bias); + } + if (opts.alpha != null) { + opBuilder.setAttr("alpha", opts.alpha); + } + if (opts.beta != null) { + opBuilder.setAttr("beta", opts.beta); + } + } + } + return new LocalResponseNormalization(opBuilder.build()); + } + + /** + * @param depthRadius 0-D. Half-width of the 1-D normalization window. + */ + public static Options depthRadius(Long depthRadius) { + return new Options().depthRadius(depthRadius); + } + + /** + * @param bias An offset (usually positive to avoid dividing by 0). + */ + public static Options bias(Float bias) { + return new Options().bias(bias); + } + + /** + * @param alpha A scale factor, usually positive. + */ + public static Options alpha(Float alpha) { + return new Options().alpha(alpha); + } + + /** + * @param beta An exponent. + */ + public static Options beta(Float beta) { + return new Options().beta(beta); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private LocalResponseNormalization(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LocalResponseNormalizationGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LocalResponseNormalizationGrad.java new file mode 100644 index 00000000000..18aa2082b83 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LocalResponseNormalizationGrad.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Gradients for Local Response Normalization. + * + * @param data type for {@code output()} output + */ +public final class LocalResponseNormalizationGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.LocalResponseNormalizationGrad} + */ + public static class Options { + + /** + * @param depthRadius A depth radius. + */ + public Options depthRadius(Long depthRadius) { + this.depthRadius = depthRadius; + return this; + } + + /** + * @param bias An offset (usually > 0 to avoid dividing by 0). + */ + public Options bias(Float bias) { + this.bias = bias; + return this; + } + + /** + * @param alpha A scale factor, usually positive. + */ + public Options alpha(Float alpha) { + this.alpha = alpha; + return this; + } + + /** + * @param beta An exponent. + */ + public Options beta(Float beta) { + this.beta = beta; + return this; + } + + private Long depthRadius; + private Float bias; + private Float alpha; + private Float beta; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LocalResponseNormalizationGrad operation. + * + * @param scope current scope + * @param inputGrads 4-D with shape `[batch, height, width, channels]`. + * @param inputImage 4-D with shape `[batch, height, width, channels]`. + * @param outputImage 4-D with shape `[batch, height, width, channels]`. + * @param options carries optional attributes values + * @return a new instance of LocalResponseNormalizationGrad + */ + public static LocalResponseNormalizationGrad create(Scope scope, Operand inputGrads, Operand inputImage, Operand outputImage, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LRNGrad", scope.makeOpName("LocalResponseNormalizationGrad")); + opBuilder.addInput(inputGrads.asOutput()); + opBuilder.addInput(inputImage.asOutput()); + opBuilder.addInput(outputImage.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.depthRadius != null) { + opBuilder.setAttr("depth_radius", opts.depthRadius); + } + if (opts.bias != null) { + opBuilder.setAttr("bias", opts.bias); + } + if (opts.alpha != null) { + opBuilder.setAttr("alpha", opts.alpha); + } + if (opts.beta != null) { + opBuilder.setAttr("beta", opts.beta); + } + } + } + return new LocalResponseNormalizationGrad(opBuilder.build()); + } + + /** + * @param depthRadius A depth radius. + */ + public static Options depthRadius(Long depthRadius) { + return new Options().depthRadius(depthRadius); + } + + /** + * @param bias An offset (usually > 0 to avoid dividing by 0). + */ + public static Options bias(Float bias) { + return new Options().bias(bias); + } + + /** + * @param alpha A scale factor, usually positive. + */ + public static Options alpha(Float alpha) { + return new Options().alpha(alpha); + } + + /** + * @param beta An exponent. + */ + public static Options beta(Float beta) { + return new Options().beta(beta); + } + + /** + * The gradients for LRN. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private LocalResponseNormalizationGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LogSoftmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LogSoftmax.java new file mode 100644 index 00000000000..ca74c354ba0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/LogSoftmax.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes log softmax activations. + *

              + * For each batch `i` and class `j` we have + *

              + * logsoftmax[i, j] = logits[i, j] - log(sum(exp(logits[i]))) + * + * @param data type for {@code logsoftmax()} output + */ +@Operator(group = "nn") +public final class LogSoftmax extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new LogSoftmax operation. + * + * @param scope current scope + * @param logits 2-D with shape `[batch_size, num_classes]`. + * @return a new instance of LogSoftmax + */ + public static LogSoftmax create(Scope scope, Operand logits) { + OperationBuilder opBuilder = scope.env().opBuilder("LogSoftmax", scope.makeOpName("LogSoftmax")); + opBuilder.addInput(logits.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new LogSoftmax(opBuilder.build()); + } + + /** + * Same shape as `logits`. + */ + public Output logsoftmax() { + return logsoftmax; + } + + @Override + public Output asOutput() { + return logsoftmax; + } + + private Output logsoftmax; + + private LogSoftmax(Operation operation) { + super(operation); + int outputIdx = 0; + logsoftmax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool.java new file mode 100644 index 00000000000..28e645dd8f5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool.java @@ -0,0 +1,118 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs max pooling on the input. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class MaxPool extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPool} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPool operation. + * + * @param scope current scope + * @param input 4-D input to pool over. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * input tensor. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool + */ + public static MaxPool create(Scope scope, Operand input, Operand ksize, Operand strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolV2", scope.makeOpName("MaxPool")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(ksize.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new MaxPool(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * The max pooled output tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPool(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3d.java new file mode 100644 index 00000000000..30f7c8e0743 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3d.java @@ -0,0 +1,128 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs 3D max pooling on the input. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class MaxPool3d extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPool3d} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPool3d operation. + * + * @param scope current scope + * @param input Shape `[batch, depth, rows, cols, channels]` tensor to pool over. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * the input tensor. Must have `ksize[0] = ksize[4] = 1`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool3d + */ + public static MaxPool3d create(Scope scope, Operand input, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPool3D", scope.makeOpName("MaxPool3d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new MaxPool3d(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * The max pooled output tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPool3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3dGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3dGrad.java new file mode 100644 index 00000000000..d4d1f97c7a7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3dGrad.java @@ -0,0 +1,131 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes gradients of max pooling function. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class MaxPool3dGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPool3dGrad} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPool3dGrad operation. + * + * @param scope current scope + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad Output backprop of shape `[batch, depth, rows, cols, channels]`. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * the input tensor. Must have `ksize[0] = ksize[4] = 1`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool3dGrad + */ + public static MaxPool3dGrad create(Scope scope, Operand origInput, Operand origOutput, Operand grad, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPool3DGrad", scope.makeOpName("MaxPool3dGrad")); + opBuilder.addInput(origInput.asOutput()); + opBuilder.addInput(origOutput.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new MaxPool3dGrad(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPool3dGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3dGradGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3dGradGrad.java new file mode 100644 index 00000000000..90dbaf29876 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3dGradGrad.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes second-order gradients of the maxpooling function. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class MaxPool3dGradGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPool3dGradGrad} + */ + public static class Options { + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPool3dGradGrad operation. + * + * @param scope current scope + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad Output backprop of shape `[batch, depth, rows, cols, channels]`. + * @param ksize 1-D tensor of length 5. The size of the window for each dimension of + * the input tensor. Must have `ksize[0] = ksize[4] = 1`. + * @param strides 1-D tensor of length 5. The stride of the sliding window for each + * dimension of `input`. Must have `strides[0] = strides[4] = 1`. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPool3dGradGrad + */ + public static MaxPool3dGradGrad create(Scope scope, Operand origInput, Operand origOutput, Operand grad, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPool3DGradGrad", scope.makeOpName("MaxPool3dGradGrad")); + opBuilder.addInput(origInput.asOutput()); + opBuilder.addInput(origOutput.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new MaxPool3dGradGrad(opBuilder.build()); + } + + /** + * @param dataFormat The data format of the input and output data. With the + * default format "NDHWC", the data is stored in the order of: + * [batch, in_depth, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCDHW", the data storage order is: + * [batch, in_channels, in_depth, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * Gradients of gradients w.r.t. the input to `max_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPool3dGradGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGrad.java new file mode 100644 index 00000000000..4122d18236a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGrad.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes gradients of the maxpooling function. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class MaxPoolGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPoolGrad} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPoolGrad operation. + * + * @param scope current scope + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad 4-D. Gradients w.r.t. the output of `max_pool`. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * input tensor. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolGrad + */ + public static MaxPoolGrad create(Scope scope, Operand origInput, Operand origOutput, Operand grad, Operand ksize, Operand strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolGradV2", scope.makeOpName("MaxPoolGrad")); + opBuilder.addInput(origInput.asOutput()); + opBuilder.addInput(origOutput.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(ksize.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new MaxPoolGrad(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * Gradients w.r.t. the input to `max_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPoolGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGrad.java new file mode 100644 index 00000000000..89b400f5d47 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGrad.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes second-order gradients of the maxpooling function. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class MaxPoolGradGrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPoolGradGrad} + */ + public static class Options { + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPoolGradGrad operation. + * + * @param scope current scope + * @param origInput The original input tensor. + * @param origOutput The original output tensor. + * @param grad 4-D. Gradients of gradients w.r.t. the input of `max_pool`. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * input tensor. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolGradGrad + */ + public static MaxPoolGradGrad create(Scope scope, Operand origInput, Operand origOutput, Operand grad, Operand ksize, Operand strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolGradGradV2", scope.makeOpName("MaxPoolGradGrad")); + opBuilder.addInput(origInput.asOutput()); + opBuilder.addInput(origOutput.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(ksize.asOutput()); + opBuilder.addInput(strides.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new MaxPoolGradGrad(opBuilder.build()); + } + + /** + * @param dataFormat Specify the data format of the input and output data. With the + * default format "NHWC", the data is stored in the order of: + * [batch, in_height, in_width, in_channels]. + * Alternatively, the format could be "NCHW", the data storage order of: + * [batch, in_channels, in_height, in_width]. + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + * Gradients of gradients w.r.t. the input to `max_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPoolGradGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGradWithArgmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGradWithArgmax.java new file mode 100644 index 00000000000..79f691e6a3c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGradWithArgmax.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes second-order gradients of the maxpooling function. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class MaxPoolGradGradWithArgmax extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPoolGradGradWithArgmax} + */ + public static class Options { + + /** + * @param includeBatchInIndex Whether to include batch dimension in flattened index of `argmax`. + */ + public Options includeBatchInIndex(Boolean includeBatchInIndex) { + this.includeBatchInIndex = includeBatchInIndex; + return this; + } + + private Boolean includeBatchInIndex; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPoolGradGradWithArgmax operation. + * + * @param scope current scope + * @param input The original input. + * @param grad 4-D with shape `[batch, height, width, channels]`. Gradients w.r.t. the + * input of `max_pool`. + * @param argmax The indices of the maximum values chosen for each output of `max_pool`. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * input tensor. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolGradGradWithArgmax + */ + public static MaxPoolGradGradWithArgmax create(Scope scope, Operand input, Operand grad, Operand argmax, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolGradGradWithArgmax", scope.makeOpName("MaxPoolGradGradWithArgmax")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(argmax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.includeBatchInIndex != null) { + opBuilder.setAttr("include_batch_in_index", opts.includeBatchInIndex); + } + } + } + return new MaxPoolGradGradWithArgmax(opBuilder.build()); + } + + /** + * @param includeBatchInIndex Whether to include batch dimension in flattened index of `argmax`. + */ + public static Options includeBatchInIndex(Boolean includeBatchInIndex) { + return new Options().includeBatchInIndex(includeBatchInIndex); + } + + /** + * Gradients of gradients w.r.t. the input of `max_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPoolGradGradWithArgmax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradWithArgmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradWithArgmax.java new file mode 100644 index 00000000000..dca992e3390 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradWithArgmax.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes gradients of the maxpooling function. + * + * @param data type for {@code output()} output + */ +public final class MaxPoolGradWithArgmax extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPoolGradWithArgmax} + */ + public static class Options { + + /** + * @param includeBatchInIndex Whether to include batch dimension in flattened index of `argmax`. + */ + public Options includeBatchInIndex(Boolean includeBatchInIndex) { + this.includeBatchInIndex = includeBatchInIndex; + return this; + } + + private Boolean includeBatchInIndex; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPoolGradWithArgmax operation. + * + * @param scope current scope + * @param input The original input. + * @param grad 4-D with shape `[batch, height, width, channels]`. Gradients w.r.t. the + * output of `max_pool`. + * @param argmax The indices of the maximum values chosen for each output of `max_pool`. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * input tensor. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolGradWithArgmax + */ + public static MaxPoolGradWithArgmax create(Scope scope, Operand input, Operand grad, Operand argmax, List ksize, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolGradWithArgmax", scope.makeOpName("MaxPoolGradWithArgmax")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(argmax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.includeBatchInIndex != null) { + opBuilder.setAttr("include_batch_in_index", opts.includeBatchInIndex); + } + } + } + return new MaxPoolGradWithArgmax(opBuilder.build()); + } + + /** + * @param includeBatchInIndex Whether to include batch dimension in flattened index of `argmax`. + */ + public static Options includeBatchInIndex(Boolean includeBatchInIndex) { + return new Options().includeBatchInIndex(includeBatchInIndex); + } + + /** + * Gradients w.r.t. the input of `max_pool`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private MaxPoolGradWithArgmax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolWithArgmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolWithArgmax.java new file mode 100644 index 00000000000..db7130685d2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolWithArgmax.java @@ -0,0 +1,153 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Performs max pooling on the input and outputs both max values and indices. + *

              + * The indices in `argmax` are flattened, so that a maximum value at position + * `[b, y, x, c]` becomes flattened index: + * `(y * width + x) * channels + c` if `include_batch_in_index` is False; + * `((b * height + y) * width + x) * channels + c` if `include_batch_in_index` is True. + *

              + * The indices returned are always in `[0, height) x [0, width)` before flattening, + * even if padding is involved and the mathematically correct answer is outside + * (either negative or too large). This is a bug, but fixing it is difficult to do + * in a safe backwards compatible way, especially due to flattening. + * + * @param data type for {@code output()} output + * @param data type for {@code argmax()} output + */ +@Operator(group = "nn") +public final class MaxPoolWithArgmax extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.MaxPoolWithArgmax} + */ + public static class Options { + + /** + * @param includeBatchInIndex Whether to include batch dimension in flattened index of `argmax`. + */ + public Options includeBatchInIndex(Boolean includeBatchInIndex) { + this.includeBatchInIndex = includeBatchInIndex; + return this; + } + + private Boolean includeBatchInIndex; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MaxPoolWithArgmax operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, height, width, channels]`. Input to pool over. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * input tensor. + * @param Targmax + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolWithArgmax + */ + public static MaxPoolWithArgmax create(Scope scope, Operand input, List ksize, List strides, Class Targmax, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolWithArgmax", scope.makeOpName("MaxPoolWithArgmax")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("Targmax", DataType.fromClass(Targmax)); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.includeBatchInIndex != null) { + opBuilder.setAttr("include_batch_in_index", opts.includeBatchInIndex); + } + } + } + return new MaxPoolWithArgmax(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new MaxPoolWithArgmax operation using default output types. + * + * @param scope current scope + * @param input 4-D with shape `[batch, height, width, channels]`. Input to pool over. + * @param ksize The size of the window for each dimension of the input tensor. + * @param strides The stride of the sliding window for each dimension of the + * input tensor. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of MaxPoolWithArgmax + */ + public static MaxPoolWithArgmax create(Scope scope, Operand input, List ksize, List strides, String padding, Options... options) { + return create(scope, input, ksize, strides, Long.class, padding, options); + } + + /** + * @param includeBatchInIndex Whether to include batch dimension in flattened index of `argmax`. + */ + public static Options includeBatchInIndex(Boolean includeBatchInIndex) { + return new Options().includeBatchInIndex(includeBatchInIndex); + } + + /** + * The max pooled output tensor. + */ + public Output output() { + return output; + } + + /** + * 4-D. The flattened indices of the max values chosen for each output. + */ + public Output argmax() { + return argmax; + } + + private Output output; + private Output argmax; + + private MaxPoolWithArgmax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + argmax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/NthElement.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/NthElement.java new file mode 100644 index 00000000000..9dd0eba2023 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/NthElement.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Finds values of the `n`-th order statistic for the last dimension. + *

              + * If the input is a vector (rank-1), finds the entries which is the nth-smallest + * value in the vector and outputs their values as scalar tensor. + *

              + * For matrices (resp. higher rank input), computes the entries which is the + * nth-smallest value in each row (resp. vector along the last dimension). Thus, + *

              + * values.shape = input.shape[:-1] + * + * @param data type for {@code values()} output + */ +@Operator(group = "nn") +public final class NthElement extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.NthElement} + */ + public static class Options { + + /** + * @param reverse When set to True, find the nth-largest value in the vector and vice + * versa. + */ + public Options reverse(Boolean reverse) { + this.reverse = reverse; + return this; + } + + private Boolean reverse; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new NthElement operation. + * + * @param scope current scope + * @param input 1-D or higher with last dimension at least `n+1`. + * @param n 0-D. Position of sorted vector to select along the last dimension (along + * each row for matrices). Valid range of n is `[0, input.shape[:-1])` + * @param options carries optional attributes values + * @return a new instance of NthElement + */ + public static NthElement create(Scope scope, Operand input, Operand n, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("NthElement", scope.makeOpName("NthElement")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(n.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.reverse != null) { + opBuilder.setAttr("reverse", opts.reverse); + } + } + } + return new NthElement(opBuilder.build()); + } + + /** + * @param reverse When set to True, find the nth-largest value in the vector and vice + * versa. + */ + public static Options reverse(Boolean reverse) { + return new Options().reverse(reverse); + } + + /** + * The `n`-th order statistic along each last dimensional slice. + */ + public Output values() { + return values; + } + + @Override + public Output asOutput() { + return values; + } + + private Output values; + + private NthElement(Operation operation) { + super(operation); + int outputIdx = 0; + values = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedAvgPool.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedAvgPool.java new file mode 100644 index 00000000000..f9109f6dd37 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedAvgPool.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Produces the average pool of the input tensor for quantized types. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class QuantizedAvgPool extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedAvgPool operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, height, width, channels]`. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param ksize The size of the window for each dimension of the input tensor. + * The length must be 4 to match the number of dimensions of the input. + * @param strides The stride of the sliding window for each dimension of the input + * tensor. The length must be 4 to match the number of dimensions of the input. + * @param padding The type of padding algorithm to use. + * @return a new instance of QuantizedAvgPool + */ + public static QuantizedAvgPool create(Scope scope, Operand input, Operand minInput, Operand maxInput, List ksize, List strides, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedAvgPool", scope.makeOpName("QuantizedAvgPool")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + return new QuantizedAvgPool(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedAvgPool(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBatchNormWithGlobalNormalization.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBatchNormWithGlobalNormalization.java new file mode 100644 index 00000000000..2fa73c36f23 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBatchNormWithGlobalNormalization.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Quantized Batch normalization. + *

              + * This op is deprecated and will be removed in the future. Prefer + * `tf.nn.batch_normalization`. + * + * @param data type for {@code result()} output + */ +@Operator(group = "nn") +public final class QuantizedBatchNormWithGlobalNormalization extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedBatchNormWithGlobalNormalization operation. + * + * @param scope current scope + * @param t A 4D input Tensor. + * @param tMin The value represented by the lowest quantized input. + * @param tMax The value represented by the highest quantized input. + * @param m A 1D mean Tensor with size matching the last dimension of t. + * This is the first output from tf.nn.moments, + * or a saved moving average thereof. + * @param mMin The value represented by the lowest quantized mean. + * @param mMax The value represented by the highest quantized mean. + * @param v A 1D variance Tensor with size matching the last dimension of t. + * This is the second output from tf.nn.moments, + * or a saved moving average thereof. + * @param vMin The value represented by the lowest quantized variance. + * @param vMax The value represented by the highest quantized variance. + * @param beta A 1D beta Tensor with size matching the last dimension of t. + * An offset to be added to the normalized tensor. + * @param betaMin The value represented by the lowest quantized offset. + * @param betaMax The value represented by the highest quantized offset. + * @param gamma A 1D gamma Tensor with size matching the last dimension of t. + * If "scale_after_normalization" is true, this tensor will be multiplied + * with the normalized tensor. + * @param gammaMin The value represented by the lowest quantized gamma. + * @param gammaMax The value represented by the highest quantized gamma. + * @param outType + * @param varianceEpsilon A small float number to avoid dividing by 0. + * @param scaleAfterNormalization A bool indicating whether the resulted tensor + * needs to be multiplied with gamma. + * @return a new instance of QuantizedBatchNormWithGlobalNormalization + */ + public static QuantizedBatchNormWithGlobalNormalization create(Scope scope, Operand t, Operand tMin, Operand tMax, Operand m, Operand mMin, Operand mMax, Operand v, Operand vMin, Operand vMax, Operand beta, Operand betaMin, Operand betaMax, Operand gamma, Operand gammaMin, Operand gammaMax, Class outType, Float varianceEpsilon, Boolean scaleAfterNormalization) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedBatchNormWithGlobalNormalization", scope.makeOpName("QuantizedBatchNormWithGlobalNormalization")); + opBuilder.addInput(t.asOutput()); + opBuilder.addInput(tMin.asOutput()); + opBuilder.addInput(tMax.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(mMin.asOutput()); + opBuilder.addInput(mMax.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(vMin.asOutput()); + opBuilder.addInput(vMax.asOutput()); + opBuilder.addInput(beta.asOutput()); + opBuilder.addInput(betaMin.asOutput()); + opBuilder.addInput(betaMax.asOutput()); + opBuilder.addInput(gamma.asOutput()); + opBuilder.addInput(gammaMin.asOutput()); + opBuilder.addInput(gammaMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + opBuilder.setAttr("variance_epsilon", varianceEpsilon); + opBuilder.setAttr("scale_after_normalization", scaleAfterNormalization); + return new QuantizedBatchNormWithGlobalNormalization(opBuilder.build()); + } + + /** + */ + public Output result() { + return result; + } + + /** + */ + public Output resultMin() { + return resultMin; + } + + /** + */ + public Output resultMax() { + return resultMax; + } + + private Output result; + private Output resultMin; + private Output resultMax; + + private QuantizedBatchNormWithGlobalNormalization(Operation operation) { + super(operation); + int outputIdx = 0; + result = operation.output(outputIdx++); + resultMin = operation.output(outputIdx++); + resultMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBiasAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBiasAdd.java new file mode 100644 index 00000000000..85a258ca8f8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBiasAdd.java @@ -0,0 +1,96 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds Tensor 'bias' to Tensor 'input' for Quantized types. + *

              + * Broadcasts the values of bias on dimensions 0..N-2 of 'input'. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class QuantizedBiasAdd extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedBiasAdd operation. + * + * @param scope current scope + * @param input + * @param bias A 1D bias Tensor with size matching the last dimension of 'input'. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param minBias The float value that the lowest quantized bias value represents. + * @param maxBias The float value that the highest quantized bias value represents. + * @param outType + * @return a new instance of QuantizedBiasAdd + */ + public static QuantizedBiasAdd create(Scope scope, Operand input, Operand bias, Operand minInput, Operand maxInput, Operand minBias, Operand maxBias, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedBiasAdd", scope.makeOpName("QuantizedBiasAdd")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(bias.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minBias.asOutput()); + opBuilder.addInput(maxBias.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new QuantizedBiasAdd(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOut() { + return minOut; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOut() { + return maxOut; + } + + private Output output; + private Output minOut; + private Output maxOut; + + private QuantizedBiasAdd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOut = operation.output(outputIdx++); + maxOut = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2d.java new file mode 100644 index 00000000000..b74526baedf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2d.java @@ -0,0 +1,155 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes a 2D convolution given quantized 4D input and filter tensors. + *

              + * The inputs are quantized tensors where the lowest value represents the real + * number of the associated minimum, and the highest represents the maximum. + * This means that you can only interpret the quantized output in the same way, by + * taking the returned minimum and maximum values into account. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class QuantizedConv2d extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.QuantizedConv2d} + */ + public static class Options { + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public Options dilations(List dilations) { + this.dilations = dilations; + return this; + } + + private List dilations; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedConv2d operation. + * + * @param scope current scope + * @param input + * @param filter filter's input_depth dimension must match input's depth dimensions. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param minFilter The float value that the lowest quantized filter value represents. + * @param maxFilter The float value that the highest quantized filter value represents. + * @param outType + * @param strides The stride of the sliding window for each dimension of the input + * tensor. + * @param padding The type of padding algorithm to use. + * @param options carries optional attributes values + * @return a new instance of QuantizedConv2d + */ + public static QuantizedConv2d create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2D", scope.makeOpName("QuantizedConv2d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(filter.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder.addInput(minFilter.asOutput()); + opBuilder.addInput(maxFilter.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + if (options != null) { + for (Options opts : options) { + if (opts.dilations != null) { + long[] dilationsArray = new long[opts.dilations.size()]; + for (int i = 0; i < dilationsArray.length; ++i) { + dilationsArray[i] = opts.dilations.get(i); + } + opBuilder.setAttr("dilations", dilationsArray); + } + } + } + return new QuantizedConv2d(opBuilder.build()); + } + + /** + * @param dilations 1-D tensor of length 4. The dilation factor for each dimension of + * `input`. If set to k > 1, there will be k-1 skipped cells between each + * filter element on that dimension. The dimension order is determined by the + * value of `data_format`, see above for details. Dilations in the batch and + * depth dimensions must be 1. + */ + public static Options dilations(List dilations) { + return new Options().dilations(dilations); + } + + /** + */ + public Output output() { + return output; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedConv2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedInstanceNorm.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedInstanceNorm.java new file mode 100644 index 00000000000..bec6ef0d238 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedInstanceNorm.java @@ -0,0 +1,200 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Quantized Instance normalization. + * + * @param data type for {@code y()} output + */ +@Operator(group = "nn") +public final class QuantizedInstanceNorm extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.QuantizedInstanceNorm} + */ + public static class Options { + + /** + * @param outputRangeGiven If True, `given_y_min` and `given_y_min` + * and `given_y_max` are used as the output range. Otherwise, + * the implementation computes the output range. + */ + public Options outputRangeGiven(Boolean outputRangeGiven) { + this.outputRangeGiven = outputRangeGiven; + return this; + } + + /** + * @param givenYMin Output in `y_min` if `output_range_given` is True. + */ + public Options givenYMin(Float givenYMin) { + this.givenYMin = givenYMin; + return this; + } + + /** + * @param givenYMax Output in `y_max` if `output_range_given` is True. + */ + public Options givenYMax(Float givenYMax) { + this.givenYMax = givenYMax; + return this; + } + + /** + * @param varianceEpsilon A small float number to avoid dividing by 0. + */ + public Options varianceEpsilon(Float varianceEpsilon) { + this.varianceEpsilon = varianceEpsilon; + return this; + } + + /** + * @param minSeparation Minimum value of `y_max - y_min` + */ + public Options minSeparation(Float minSeparation) { + this.minSeparation = minSeparation; + return this; + } + + private Boolean outputRangeGiven; + private Float givenYMin; + private Float givenYMax; + private Float varianceEpsilon; + private Float minSeparation; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizedInstanceNorm operation. + * + * @param scope current scope + * @param x A 4D input Tensor. + * @param xMin The value represented by the lowest quantized input. + * @param xMax The value represented by the highest quantized input. + * @param options carries optional attributes values + * @return a new instance of QuantizedInstanceNorm + */ + public static QuantizedInstanceNorm create(Scope scope, Operand x, Operand xMin, Operand xMax, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedInstanceNorm", scope.makeOpName("QuantizedInstanceNorm")); + opBuilder.addInput(x.asOutput()); + opBuilder.addInput(xMin.asOutput()); + opBuilder.addInput(xMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.outputRangeGiven != null) { + opBuilder.setAttr("output_range_given", opts.outputRangeGiven); + } + if (opts.givenYMin != null) { + opBuilder.setAttr("given_y_min", opts.givenYMin); + } + if (opts.givenYMax != null) { + opBuilder.setAttr("given_y_max", opts.givenYMax); + } + if (opts.varianceEpsilon != null) { + opBuilder.setAttr("variance_epsilon", opts.varianceEpsilon); + } + if (opts.minSeparation != null) { + opBuilder.setAttr("min_separation", opts.minSeparation); + } + } + } + return new QuantizedInstanceNorm(opBuilder.build()); + } + + /** + * @param outputRangeGiven If True, `given_y_min` and `given_y_min` + * and `given_y_max` are used as the output range. Otherwise, + * the implementation computes the output range. + */ + public static Options outputRangeGiven(Boolean outputRangeGiven) { + return new Options().outputRangeGiven(outputRangeGiven); + } + + /** + * @param givenYMin Output in `y_min` if `output_range_given` is True. + */ + public static Options givenYMin(Float givenYMin) { + return new Options().givenYMin(givenYMin); + } + + /** + * @param givenYMax Output in `y_max` if `output_range_given` is True. + */ + public static Options givenYMax(Float givenYMax) { + return new Options().givenYMax(givenYMax); + } + + /** + * @param varianceEpsilon A small float number to avoid dividing by 0. + */ + public static Options varianceEpsilon(Float varianceEpsilon) { + return new Options().varianceEpsilon(varianceEpsilon); + } + + /** + * @param minSeparation Minimum value of `y_max - y_min` + */ + public static Options minSeparation(Float minSeparation) { + return new Options().minSeparation(minSeparation); + } + + /** + * A 4D Tensor. + */ + public Output y() { + return y; + } + + /** + * The value represented by the lowest quantized output. + */ + public Output yMin() { + return yMin; + } + + /** + * The value represented by the highest quantized output. + */ + public Output yMax() { + return yMax; + } + + private Output y; + private Output yMin; + private Output yMax; + + private QuantizedInstanceNorm(Operation operation) { + super(operation); + int outputIdx = 0; + y = operation.output(outputIdx++); + yMin = operation.output(outputIdx++); + yMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedMaxPool.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedMaxPool.java new file mode 100644 index 00000000000..9af1dd479b0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedMaxPool.java @@ -0,0 +1,102 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Produces the max pool of the input tensor for quantized types. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class QuantizedMaxPool extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedMaxPool operation. + * + * @param scope current scope + * @param input The 4D (batch x rows x cols x depth) Tensor to MaxReduce over. + * @param minInput The float value that the lowest quantized input value represents. + * @param maxInput The float value that the highest quantized input value represents. + * @param ksize The size of the window for each dimension of the input tensor. + * The length must be 4 to match the number of dimensions of the input. + * @param strides The stride of the sliding window for each dimension of the input + * tensor. The length must be 4 to match the number of dimensions of the input. + * @param padding The type of padding algorithm to use. + * @return a new instance of QuantizedMaxPool + */ + public static QuantizedMaxPool create(Scope scope, Operand input, Operand minInput, Operand maxInput, List ksize, List strides, String padding) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMaxPool", scope.makeOpName("QuantizedMaxPool")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(minInput.asOutput()); + opBuilder.addInput(maxInput.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] ksizeArray = new long[ksize.size()]; + for (int i = 0; i < ksizeArray.length; ++i) { + ksizeArray[i] = ksize.get(i); + } + opBuilder.setAttr("ksize", ksizeArray); + long[] stridesArray = new long[strides.size()]; + for (int i = 0; i < stridesArray.length; ++i) { + stridesArray[i] = strides.get(i); + } + opBuilder.setAttr("strides", stridesArray); + opBuilder.setAttr("padding", padding); + return new QuantizedMaxPool(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + /** + * The float value that the lowest quantized output value represents. + */ + public Output minOutput() { + return minOutput; + } + + /** + * The float value that the highest quantized output value represents. + */ + public Output maxOutput() { + return maxOutput; + } + + private Output output; + private Output minOutput; + private Output maxOutput; + + private QuantizedMaxPool(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + minOutput = operation.output(outputIdx++); + maxOutput = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu.java new file mode 100644 index 00000000000..396d4b5a9ba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes Quantized Rectified Linear: `max(features, 0)` + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class QuantizedRelu extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedRelu operation. + * + * @param scope current scope + * @param features + * @param minFeatures The float value that the lowest quantized value represents. + * @param maxFeatures The float value that the highest quantized value represents. + * @param outType + * @return a new instance of QuantizedRelu + */ + public static QuantizedRelu create(Scope scope, Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedRelu", scope.makeOpName("QuantizedRelu")); + opBuilder.addInput(features.asOutput()); + opBuilder.addInput(minFeatures.asOutput()); + opBuilder.addInput(maxFeatures.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new QuantizedRelu(opBuilder.build()); + } + + /** + * Has the same output shape as "features". + */ + public Output activations() { + return activations; + } + + /** + * The float value that the lowest quantized value represents. + */ + public Output minActivations() { + return minActivations; + } + + /** + * The float value that the highest quantized value represents. + */ + public Output maxActivations() { + return maxActivations; + } + + private Output activations; + private Output minActivations; + private Output maxActivations; + + private QuantizedRelu(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + minActivations = operation.output(outputIdx++); + maxActivations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu6.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu6.java new file mode 100644 index 00000000000..7845874980a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu6.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes Quantized Rectified Linear 6: `min(max(features, 0), 6)` + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class QuantizedRelu6 extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedRelu6 operation. + * + * @param scope current scope + * @param features + * @param minFeatures The float value that the lowest quantized value represents. + * @param maxFeatures The float value that the highest quantized value represents. + * @param outType + * @return a new instance of QuantizedRelu6 + */ + public static QuantizedRelu6 create(Scope scope, Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedRelu6", scope.makeOpName("QuantizedRelu6")); + opBuilder.addInput(features.asOutput()); + opBuilder.addInput(minFeatures.asOutput()); + opBuilder.addInput(maxFeatures.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new QuantizedRelu6(opBuilder.build()); + } + + /** + * Has the same output shape as "features". + */ + public Output activations() { + return activations; + } + + /** + * The float value that the lowest quantized value represents. + */ + public Output minActivations() { + return minActivations; + } + + /** + * The float value that the highest quantized value represents. + */ + public Output maxActivations() { + return maxActivations; + } + + private Output activations; + private Output minActivations; + private Output maxActivations; + + private QuantizedRelu6(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + minActivations = operation.output(outputIdx++); + maxActivations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedReluX.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedReluX.java new file mode 100644 index 00000000000..233a5037b68 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedReluX.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes Quantized Rectified Linear X: `min(max(features, 0), max_value)` + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class QuantizedReluX extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizedReluX operation. + * + * @param scope current scope + * @param features + * @param maxValue + * @param minFeatures The float value that the lowest quantized value represents. + * @param maxFeatures The float value that the highest quantized value represents. + * @param outType + * @return a new instance of QuantizedReluX + */ + public static QuantizedReluX create(Scope scope, Operand features, Operand maxValue, Operand minFeatures, Operand maxFeatures, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizedReluX", scope.makeOpName("QuantizedReluX")); + opBuilder.addInput(features.asOutput()); + opBuilder.addInput(maxValue.asOutput()); + opBuilder.addInput(minFeatures.asOutput()); + opBuilder.addInput(maxFeatures.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new QuantizedReluX(opBuilder.build()); + } + + /** + * Has the same output shape as "features". + */ + public Output activations() { + return activations; + } + + /** + * The float value that the lowest quantized value represents. + */ + public Output minActivations() { + return minActivations; + } + + /** + * The float value that the highest quantized value represents. + */ + public Output maxActivations() { + return maxActivations; + } + + private Output activations; + private Output minActivations; + private Output maxActivations; + + private QuantizedReluX(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + minActivations = operation.output(outputIdx++); + maxActivations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu.java new file mode 100644 index 00000000000..f7477259958 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes rectified linear: `max(features, 0)`. + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class Relu extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Relu operation. + * + * @param scope current scope + * @param features + * @return a new instance of Relu + */ + public static Relu create(Scope scope, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("Relu", scope.makeOpName("Relu")); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Relu(opBuilder.build()); + } + + /** + */ + public Output activations() { + return activations; + } + + @Override + public Output asOutput() { + return activations; + } + + private Output activations; + + private Relu(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu6.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu6.java new file mode 100644 index 00000000000..69a1d302470 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu6.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes rectified linear 6: `min(max(features, 0), 6)`. + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class Relu6 extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Relu6 operation. + * + * @param scope current scope + * @param features + * @return a new instance of Relu6 + */ + public static Relu6 create(Scope scope, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("Relu6", scope.makeOpName("Relu6")); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Relu6(opBuilder.build()); + } + + /** + */ + public Output activations() { + return activations; + } + + @Override + public Output asOutput() { + return activations; + } + + private Output activations; + + private Relu6(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu6Grad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu6Grad.java new file mode 100644 index 00000000000..eb50a72e769 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Relu6Grad.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes rectified linear 6 gradients for a Relu6 operation. + * + * @param data type for {@code backprops()} output + */ +public final class Relu6Grad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Relu6Grad operation. + * + * @param scope current scope + * @param gradients The backpropagated gradients to the corresponding Relu6 operation. + * @param features The features passed as input to the corresponding Relu6 operation, or + * its output; using either one produces the same result. + * @return a new instance of Relu6Grad + */ + public static Relu6Grad create(Scope scope, Operand gradients, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("Relu6Grad", scope.makeOpName("Relu6Grad")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Relu6Grad(opBuilder.build()); + } + + /** + * The gradients: + * `gradients * (features > 0) * (features < 6)`. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private Relu6Grad(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/ReluGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/ReluGrad.java new file mode 100644 index 00000000000..b68a8cc0a22 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/ReluGrad.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes rectified linear gradients for a Relu operation. + * + * @param data type for {@code backprops()} output + */ +public final class ReluGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ReluGrad operation. + * + * @param scope current scope + * @param gradients The backpropagated gradients to the corresponding Relu operation. + * @param features The features passed as input to the corresponding Relu operation, OR + * the outputs of that operation (both work equivalently). + * @return a new instance of ReluGrad + */ + public static ReluGrad create(Scope scope, Operand gradients, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("ReluGrad", scope.makeOpName("ReluGrad")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ReluGrad(opBuilder.build()); + } + + /** + * `gradients * (features > 0)`. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private ReluGrad(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Selu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Selu.java new file mode 100644 index 00000000000..c1597e2a1d3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Selu.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes scaled exponential linear: `scale * alpha * (exp(features) - 1)` + *

              + * if < 0, `scale * features` otherwise. + *

              + * To be used together with + * `initializer = tf.variance_scaling_initializer(factor=1.0, mode='FAN_IN')`. + * For correct dropout, use `tf.contrib.nn.alpha_dropout`. + *

              + * See [Self-Normalizing Neural Networks](https://arxiv.org/abs/1706.02515) + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class Selu extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Selu operation. + * + * @param scope current scope + * @param features + * @return a new instance of Selu + */ + public static Selu create(Scope scope, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("Selu", scope.makeOpName("Selu")); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Selu(opBuilder.build()); + } + + /** + */ + public Output activations() { + return activations; + } + + @Override + public Output asOutput() { + return activations; + } + + private Output activations; + + private Selu(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SeluGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SeluGrad.java new file mode 100644 index 00000000000..92b9f5b5c8c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SeluGrad.java @@ -0,0 +1,70 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes gradients for the scaled exponential linear (Selu) operation. + * + * @param data type for {@code backprops()} output + */ +public final class SeluGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SeluGrad operation. + * + * @param scope current scope + * @param gradients The backpropagated gradients to the corresponding Selu operation. + * @param outputs The outputs of the corresponding Selu operation. + * @return a new instance of SeluGrad + */ + public static SeluGrad create(Scope scope, Operand gradients, Operand outputs) { + OperationBuilder opBuilder = scope.env().opBuilder("SeluGrad", scope.makeOpName("SeluGrad")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(outputs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SeluGrad(opBuilder.build()); + } + + /** + * The gradients: `gradients * (outputs + scale * alpha)` + * if outputs < 0, `scale * gradients` otherwise. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private SeluGrad(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Softmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Softmax.java new file mode 100644 index 00000000000..da261adedc3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Softmax.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes softmax activations. + *

              + * For each batch `i` and class `j` we have + *

              + * $$softmax[i, j] = exp(logits[i, j]) / sum_j(exp(logits[i, j]))$$ + * + * @param data type for {@code softmax()} output + */ +@Operator(group = "nn") +public final class Softmax extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Softmax operation. + * + * @param scope current scope + * @param logits 2-D with shape `[batch_size, num_classes]`. + * @return a new instance of Softmax + */ + public static Softmax create(Scope scope, Operand logits) { + OperationBuilder opBuilder = scope.env().opBuilder("Softmax", scope.makeOpName("Softmax")); + opBuilder.addInput(logits.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Softmax(opBuilder.build()); + } + + /** + * Same shape as `logits`. + */ + public Output softmax() { + return softmax; + } + + @Override + public Output asOutput() { + return softmax; + } + + private Output softmax; + + private Softmax(Operation operation) { + super(operation); + int outputIdx = 0; + softmax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SoftmaxCrossEntropyWithLogits.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SoftmaxCrossEntropyWithLogits.java new file mode 100644 index 00000000000..ece8b8ac2a6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SoftmaxCrossEntropyWithLogits.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes softmax cross entropy cost and gradients to backpropagate. + *

              + * Inputs are the logits, not probabilities. + * + * @param data type for {@code loss()} output + */ +@Operator(group = "nn") +public final class SoftmaxCrossEntropyWithLogits extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SoftmaxCrossEntropyWithLogits operation. + * + * @param scope current scope + * @param features batch_size x num_classes matrix + * @param labels batch_size x num_classes matrix + * The caller must ensure that each batch of labels represents a valid + * probability distribution. + * @return a new instance of SoftmaxCrossEntropyWithLogits + */ + public static SoftmaxCrossEntropyWithLogits create(Scope scope, Operand features, Operand labels) { + OperationBuilder opBuilder = scope.env().opBuilder("SoftmaxCrossEntropyWithLogits", scope.makeOpName("SoftmaxCrossEntropyWithLogits")); + opBuilder.addInput(features.asOutput()); + opBuilder.addInput(labels.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SoftmaxCrossEntropyWithLogits(opBuilder.build()); + } + + /** + * Per example loss (batch_size vector). + */ + public Output loss() { + return loss; + } + + /** + * backpropagated gradients (batch_size x num_classes matrix). + */ + public Output backprop() { + return backprop; + } + + private Output loss; + private Output backprop; + + private SoftmaxCrossEntropyWithLogits(Operation operation) { + super(operation); + int outputIdx = 0; + loss = operation.output(outputIdx++); + backprop = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Softsign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Softsign.java new file mode 100644 index 00000000000..db48ffe4119 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Softsign.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes softsign: `features / (abs(features) + 1)`. + * + * @param data type for {@code activations()} output + */ +@Operator(group = "nn") +public final class Softsign extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Softsign operation. + * + * @param scope current scope + * @param features + * @return a new instance of Softsign + */ + public static Softsign create(Scope scope, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("Softsign", scope.makeOpName("Softsign")); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Softsign(opBuilder.build()); + } + + /** + */ + public Output activations() { + return activations; + } + + @Override + public Output asOutput() { + return activations; + } + + private Output activations; + + private Softsign(Operation operation) { + super(operation); + int outputIdx = 0; + activations = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SoftsignGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SoftsignGrad.java new file mode 100644 index 00000000000..dea4aaca7e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SoftsignGrad.java @@ -0,0 +1,69 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes softsign gradients for a softsign operation. + * + * @param data type for {@code backprops()} output + */ +public final class SoftsignGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SoftsignGrad operation. + * + * @param scope current scope + * @param gradients The backpropagated gradients to the corresponding softsign operation. + * @param features The features passed as input to the corresponding softsign operation. + * @return a new instance of SoftsignGrad + */ + public static SoftsignGrad create(Scope scope, Operand gradients, Operand features) { + OperationBuilder opBuilder = scope.env().opBuilder("SoftsignGrad", scope.makeOpName("SoftsignGrad")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(features.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SoftsignGrad(opBuilder.build()); + } + + /** + * The gradients: `gradients / (1 + abs(features)) ** 2`. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private SoftsignGrad(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToBatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToBatch.java new file mode 100644 index 00000000000..bfe3fcca9cd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToBatch.java @@ -0,0 +1,148 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * SpaceToBatch for 4-D tensors of type T. + *

              + * This is a legacy version of the more general SpaceToBatchND. + *

              + * Zero-pads and then rearranges (permutes) blocks of spatial data into batch. + * More specifically, this op outputs a copy of the input tensor where values from + * the `height` and `width` dimensions are moved to the `batch` dimension. After + * the zero-padding, both `height` and `width` of the input must be divisible by the + * block size. + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class SpaceToBatch extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SpaceToBatch operation. + * + * @param scope current scope + * @param input 4-D with shape `[batch, height, width, depth]`. + * @param paddings 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies + * the padding of the input with zeros across the spatial dimensions as follows: + *

              + * paddings = [[pad_top, pad_bottom], [pad_left, pad_right]] + *

              + * The effective spatial dimensions of the zero-padded input tensor will be: + *

              + * height_pad = pad_top + height + pad_bottom + * width_pad = pad_left + width + pad_right + *

              + * The attr `block_size` must be greater than one. It indicates the block size. + *

              + * * Non-overlapping blocks of size `block_size x block size` in the height and + * width dimensions are rearranged into the batch dimension at each location. + * * The batch of the output tensor is `batch * block_size * block_size`. + * * Both height_pad and width_pad must be divisible by block_size. + *

              + * The shape of the output will be: + *

              + * [batchblock_sizeblock_size, height_pad/block_size, width_pad/block_size, + * depth] + *

              + * Some examples: + *

              + * (1) For the following input of shape `[1, 2, 2, 1]` and block_size of 2: + *

              {@code
              +   * x = [[[[1], [2]], [[3], [4]]]]
              +   * }
              + * The output tensor has shape `[4, 1, 1, 1]` and value: + *
              {@code
              +   * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
              +   * }
              + * (2) For the following input of shape `[1, 2, 2, 3]` and block_size of 2: + *
              {@code
              +   * x = [[[[1, 2, 3], [4, 5, 6]],
              +   *       [[7, 8, 9], [10, 11, 12]]]]
              +   * }
              + * The output tensor has shape `[4, 1, 1, 3]` and value: + *
              {@code
              +   * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
              +   * }
              + * (3) For the following input of shape `[1, 4, 4, 1]` and block_size of 2: + *
              {@code
              +   * x = [[[[1],   [2],  [3],  [4]],
              +   *       [[5],   [6],  [7],  [8]],
              +   *       [[9],  [10], [11],  [12]],
              +   *       [[13], [14], [15],  [16]]]]
              +   * }
              + * The output tensor has shape `[4, 2, 2, 1]` and value: + *
              {@code
              +   * x = [[[[1], [3]], [[9], [11]]],
              +   *      [[[2], [4]], [[10], [12]]],
              +   *      [[[5], [7]], [[13], [15]]],
              +   *      [[[6], [8]], [[14], [16]]]]
              +   * }
              + * (4) For the following input of shape `[2, 2, 4, 1]` and block_size of 2: + *
              {@code
              +   * x = [[[[1],   [2],  [3],  [4]],
              +   *       [[5],   [6],  [7],  [8]]],
              +   *      [[[9],  [10], [11],  [12]],
              +   *       [[13], [14], [15],  [16]]]]
              +   * }
              + * The output tensor has shape `[8, 1, 2, 1]` and value: + *
              {@code
              +   * x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],
              +   *      [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]
              +   * }
              + * Among others, this operation is useful for reducing atrous convolution into + * regular convolution. + * @param blockSize + * @return a new instance of SpaceToBatch + */ + public static SpaceToBatch create(Scope scope, Operand input, Operand paddings, Long blockSize) { + OperationBuilder opBuilder = scope.env().opBuilder("SpaceToBatch", scope.makeOpName("SpaceToBatch")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(paddings.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("block_size", blockSize); + return new SpaceToBatch(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SpaceToBatch(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToDepth.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToDepth.java new file mode 100644 index 00000000000..2ad167375c6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToDepth.java @@ -0,0 +1,178 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * SpaceToDepth for tensors of type T. + *

              + * Rearranges blocks of spatial data, into depth. More specifically, + * this op outputs a copy of the input tensor where values from the `height` + * and `width` dimensions are moved to the `depth` dimension. + * The attr `block_size` indicates the input block size. + *

              + * * Non-overlapping blocks of size `block_size x block size` are rearranged + * into depth at each location. + * * The depth of the output tensor is `block_size * block_size * input_depth`. + * * The Y, X coordinates within each block of the input become the high order + * component of the output channel index. + * * The input tensor's height and width must be divisible by block_size. + *

              + * The `data_format` attr specifies the layout of the input and output tensors + * with the following options: + * "NHWC": `[ batch, height, width, channels ]` + * "NCHW": `[ batch, channels, height, width ]` + * "NCHW_VECT_C": + * `qint8 [ batch, channels / 4, height, width, 4 ]` + *

              + * It is useful to consider the operation as transforming a 6-D Tensor. + * e.g. for data_format = NHWC, + * Each element in the input tensor can be specified via 6 coordinates, + * ordered by decreasing memory layout significance as: + * n,oY,bY,oX,bX,iC (where n=batch index, oX, oY means X or Y coordinates + * within the output image, bX, bY means coordinates + * within the input block, iC means input channels). + * The output would be a transpose to the following layout: + * n,oY,oX,bY,bX,iC + *

              + * This operation is useful for resizing the activations between convolutions + * (but keeping all data), e.g. instead of pooling. It is also useful for training + * purely convolutional models. + *

              + * For example, given an input of shape `[1, 2, 2, 1]`, data_format = "NHWC" and + * block_size = 2: + *

              {@code
              + * x = [[[[1], [2]],
              + *       [[3], [4]]]]
              + * }
              + * This operation will output a tensor of shape `[1, 1, 1, 4]`: + *
              {@code
              + * [[[[1, 2, 3, 4]]]]
              + * }
              + * Here, the input has a batch of 1 and each batch element has shape `[2, 2, 1]`, + * the corresponding output will have a single element (i.e. width and height are + * both 1) and will have a depth of 4 channels (1 * block_size * block_size). + * The output element shape is `[1, 1, 4]`. + *

              + * For an input tensor with larger depth, here of shape `[1, 2, 2, 3]`, e.g. + *

              {@code
              + * x = [[[[1, 2, 3], [4, 5, 6]],
              + *       [[7, 8, 9], [10, 11, 12]]]]
              + * }
              + * This operation, for block_size of 2, will return the following tensor of shape + * `[1, 1, 1, 12]` + *
              {@code
              + * [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
              + * }
              + * Similarly, for the following input of shape `[1 4 4 1]`, and a block size of 2: + *
              {@code
              + * x = [[[[1],   [2],  [5],  [6]],
              + *       [[3],   [4],  [7],  [8]],
              + *       [[9],  [10], [13],  [14]],
              + *       [[11], [12], [15],  [16]]]]
              + * }
              + * the operator will return the following tensor of shape `[1 2 2 4]`: + *
              {@code
              + * x = [[[[1, 2, 3, 4],
              + *        [5, 6, 7, 8]],
              + *       [[9, 10, 11, 12],
              + *        [13, 14, 15, 16]]]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "nn") +public final class SpaceToDepth extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.SpaceToDepth} + */ + public static class Options { + + /** + * @param dataFormat + */ + public Options dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + private String dataFormat; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SpaceToDepth operation. + * + * @param scope current scope + * @param input + * @param blockSize The size of the spatial block. + * @param options carries optional attributes values + * @return a new instance of SpaceToDepth + */ + public static SpaceToDepth create(Scope scope, Operand input, Long blockSize, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SpaceToDepth", scope.makeOpName("SpaceToDepth")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("block_size", blockSize); + if (options != null) { + for (Options opts : options) { + if (opts.dataFormat != null) { + opBuilder.setAttr("data_format", opts.dataFormat); + } + } + } + return new SpaceToDepth(opBuilder.build()); + } + + /** + * @param dataFormat + */ + public static Options dataFormat(String dataFormat) { + return new Options().dataFormat(dataFormat); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SpaceToDepth(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SparseSoftmaxCrossEntropyWithLogits.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SparseSoftmaxCrossEntropyWithLogits.java new file mode 100644 index 00000000000..fd45de33ac1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SparseSoftmaxCrossEntropyWithLogits.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes softmax cross entropy cost and gradients to backpropagate. + *

              + * Unlike `SoftmaxCrossEntropyWithLogits`, this operation does not accept + * a matrix of label probabilities, but rather a single label per row + * of features. This label is considered to have probability 1.0 for the + * given row. + *

              + * Inputs are the logits, not probabilities. + * + * @param data type for {@code loss()} output + */ +@Operator(group = "nn") +public final class SparseSoftmaxCrossEntropyWithLogits extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseSoftmaxCrossEntropyWithLogits operation. + * + * @param scope current scope + * @param features batch_size x num_classes matrix + * @param labels batch_size vector with values in [0, num_classes). + * This is the label for the given minibatch entry. + * @return a new instance of SparseSoftmaxCrossEntropyWithLogits + */ + public static SparseSoftmaxCrossEntropyWithLogits create(Scope scope, Operand features, Operand labels) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSoftmaxCrossEntropyWithLogits", scope.makeOpName("SparseSoftmaxCrossEntropyWithLogits")); + opBuilder.addInput(features.asOutput()); + opBuilder.addInput(labels.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSoftmaxCrossEntropyWithLogits(opBuilder.build()); + } + + /** + * Per example loss (batch_size vector). + */ + public Output loss() { + return loss; + } + + /** + * backpropagated gradients (batch_size x num_classes matrix). + */ + public Output backprop() { + return backprop; + } + + private Output loss; + private Output backprop; + + private SparseSoftmaxCrossEntropyWithLogits(Operation operation) { + super(operation); + int outputIdx = 0; + loss = operation.output(outputIdx++); + backprop = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/TopK.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/TopK.java new file mode 100644 index 00000000000..6d4eab1b9b4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/TopK.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.nn; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Finds values and indices of the `k` largest elements for the last dimension. + *

              + * If the input is a vector (rank-1), finds the `k` largest entries in the vector + * and outputs their values and indices as vectors. Thus `values[j]` is the + * `j`-th largest entry in `input`, and its index is `indices[j]`. + *

              + * For matrices (resp. higher rank input), computes the top `k` entries in each + * row (resp. vector along the last dimension). Thus, + *

              + * values.shape = indices.shape = input.shape[:-1] + [k] + *

              + * If two elements are equal, the lower-index element appears first. + * + * @param data type for {@code values()} output + */ +@Operator(group = "nn") +public final class TopK extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.nn.TopK} + */ + public static class Options { + + /** + * @param sorted If true the resulting `k` elements will be sorted by the values in + * descending order. + */ + public Options sorted(Boolean sorted) { + this.sorted = sorted; + return this; + } + + private Boolean sorted; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TopK operation. + * + * @param scope current scope + * @param input 1-D or higher with last dimension at least `k`. + * @param k 0-D. Number of top elements to look for along the last dimension (along each + * row for matrices). + * @param options carries optional attributes values + * @return a new instance of TopK + */ + public static TopK create(Scope scope, Operand input, Operand k, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TopKV2", scope.makeOpName("TopK")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(k.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.sorted != null) { + opBuilder.setAttr("sorted", opts.sorted); + } + } + } + return new TopK(opBuilder.build()); + } + + /** + * @param sorted If true the resulting `k` elements will be sorted by the values in + * descending order. + */ + public static Options sorted(Boolean sorted) { + return new Options().sorted(sorted); + } + + /** + * The `k` largest elements along each last dimensional slice. + */ + public Output values() { + return values; + } + + /** + * The indices of `values` within the last dimension of `input`. + */ + public Output indices() { + return indices; + } + + private Output values; + private Output indices; + + private TopK(Operation operation) { + super(operation); + int outputIdx = 0; + values = operation.output(outputIdx++); + indices = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Dequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Dequantize.java new file mode 100644 index 00000000000..1d68f254080 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Dequantize.java @@ -0,0 +1,172 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Dequantize the 'input' tensor into a float Tensor. + *

              + * [min_range, max_range] are scalar floats that specify the range for + * the 'input' data. The 'mode' attribute controls exactly which calculations are + * used to convert the float values to their quantized equivalents. + *

              + * In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: + *

              {@code
              + * if T == qint8: in[i] += (range(T) + 1)/ 2.0
              + * out[i] = min_range + (in[i]* (max_range - min_range) / range(T))
              + * }
              + * here `range(T) = numeric_limits::max() - numeric_limits::min()` + *

              + * MIN_COMBINED Mode Example + *

              + * If the input comes from a QuantizedRelu6, the output type is + * quint8 (range of 0-255) but the possible range of QuantizedRelu6 is + * 0-6. The min_range and max_range values are therefore 0.0 and 6.0. + * Dequantize on quint8 will take each value, cast to float, and multiply + * by 6 / 255. + * Note that if quantizedtype is qint8, the operation will additionally add + * each value by 128 prior to casting. + *

              + * If the mode is 'MIN_FIRST', then this approach is used: + *

              {@code
              + * num_discrete_values = 1 << (# of bits in T)
              + * range_adjust = num_discrete_values / (num_discrete_values - 1)
              + * range = (range_max - range_min) * range_adjust
              + * range_scale = range / num_discrete_values
              + * const double offset_input = static_cast(input) - lowest_quantized;
              + * result = range_min + ((input - numeric_limits::min()) * range_scale)
              + * }
              + * SCALED mode Example + *

              + * `SCALED` mode matches the quantization approach used in + * `QuantizeAndDequantize{V2|V3}`. + *

              + * If the mode is `SCALED`, we do not use the full range of the output type, + * choosing to elide the lowest possible value for symmetry (e.g., output range is + * -127 to 127, not -128 to 127 for signed 8 bit quantization), so that 0.0 maps to + * 0. + *

              + * We first find the range of values in our tensor. The + * range we use is always centered on 0, so we find m such that + *

              {@code
              + *   m = max(abs(input_min), abs(input_max))
              + * }
              + * Our input tensor range is then `[-m, m]`. + *

              + * Next, we choose our fixed-point quantization buckets, `[min_fixed, max_fixed]`. + * If T is signed, this is + *

              {@code
              + *   num_bits = sizeof(T) * 8
              + *   [min_fixed, max_fixed] =
              + *       [-(1 << (num_bits - 1) - 1), (1 << (num_bits - 1)) - 1]
              + * }
              + * Otherwise, if T is unsigned, the fixed-point range is + *
              {@code
              + *   [min_fixed, max_fixed] = [0, (1 << num_bits) - 1]
              + * }
              + * From this we compute our scaling factor, s: + *
              {@code
              + *   s = (2 * m) / (max_fixed - min_fixed)
              + * }
              + * Now we can dequantize the elements of our tensor: + *
              {@code
              + * result = input * s
              + * }
              + * + */ +@Operator(group = "quantization") +public final class Dequantize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.Dequantize} + */ + public static class Options { + + /** + * @param mode + */ + public Options mode(String mode) { + this.mode = mode; + return this; + } + + private String mode; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Dequantize operation. + * + * @param scope current scope + * @param input + * @param minRange The minimum scalar value possibly produced for the input. + * @param maxRange The maximum scalar value possibly produced for the input. + * @param options carries optional attributes values + * @return a new instance of Dequantize + */ + public static Dequantize create(Scope scope, Operand input, Operand minRange, Operand maxRange, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Dequantize", scope.makeOpName("Dequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(minRange.asOutput()); + opBuilder.addInput(maxRange.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.mode != null) { + opBuilder.setAttr("mode", opts.mode); + } + } + } + return new Dequantize(opBuilder.build()); + } + + /** + * @param mode + */ + public static Options mode(String mode) { + return new Options().mode(mode); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Dequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxArgs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxArgs.java new file mode 100644 index 00000000000..1a0311441b7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxArgs.java @@ -0,0 +1,174 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type. + *

              + * Attributes `[min; max]` define the clamping range for the `inputs` data. + * `inputs` values are quantized into the quantization range (`[0; 2^num_bits - 1]` + * when `narrow_range` is false and `[1; 2^num_bits - 1]` when it is true) and + * then de-quantized and output as floats in `[min; max]` interval. + * `num_bits` is the bitwidth of the quantization; between 2 and 16, inclusive. + *

              + * Before quantization, `min` and `max` values are adjusted with the following + * logic. + * It is suggested to have `min <= 0 <= max`. If `0` is not in the range of values, + * the behavior can be unexpected: + * If `0 < min < max`: `min_adj = 0` and `max_adj = max - min`. + * If `min < max < 0`: `min_adj = min - max` and `max_adj = 0`. + * If `min <= 0 <= max`: `scale = (max - min) / (2^num_bits - 1) `, + * `min_adj = scale * round(min / scale)` and `max_adj = max + min_adj - min`. + *

              + * Quantization is called fake since the output is still in floating point. + */ +@Operator(group = "quantization") +public final class FakeQuantWithMinMaxArgs extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.FakeQuantWithMinMaxArgs} + */ + public static class Options { + + /** + * @param min + */ + public Options min(Float min) { + this.min = min; + return this; + } + + /** + * @param max + */ + public Options max(Float max) { + this.max = max; + return this; + } + + /** + * @param numBits + */ + public Options numBits(Long numBits) { + this.numBits = numBits; + return this; + } + + /** + * @param narrowRange + */ + public Options narrowRange(Boolean narrowRange) { + this.narrowRange = narrowRange; + return this; + } + + private Float min; + private Float max; + private Long numBits; + private Boolean narrowRange; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FakeQuantWithMinMaxArgs operation. + * + * @param scope current scope + * @param inputs + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxArgs + */ + public static FakeQuantWithMinMaxArgs create(Scope scope, Operand inputs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FakeQuantWithMinMaxArgs", scope.makeOpName("FakeQuantWithMinMaxArgs")); + opBuilder.addInput(inputs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.min != null) { + opBuilder.setAttr("min", opts.min); + } + if (opts.max != null) { + opBuilder.setAttr("max", opts.max); + } + if (opts.numBits != null) { + opBuilder.setAttr("num_bits", opts.numBits); + } + if (opts.narrowRange != null) { + opBuilder.setAttr("narrow_range", opts.narrowRange); + } + } + } + return new FakeQuantWithMinMaxArgs(opBuilder.build()); + } + + /** + * @param min + */ + public static Options min(Float min) { + return new Options().min(min); + } + + /** + * @param max + */ + public static Options max(Float max) { + return new Options().max(max); + } + + /** + * @param numBits + */ + public static Options numBits(Long numBits) { + return new Options().numBits(numBits); + } + + /** + * @param narrowRange + */ + public static Options narrowRange(Boolean narrowRange) { + return new Options().narrowRange(narrowRange); + } + + /** + */ + public Output outputs() { + return outputs; + } + + @Override + public Output asOutput() { + return outputs; + } + + private Output outputs; + + private FakeQuantWithMinMaxArgs(Operation operation) { + super(operation); + int outputIdx = 0; + outputs = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxArgsGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxArgsGradient.java new file mode 100644 index 00000000000..bdb51a899f0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxArgsGradient.java @@ -0,0 +1,161 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute gradients for a FakeQuantWithMinMaxArgs operation. + */ +@Operator(group = "quantization") +public final class FakeQuantWithMinMaxArgsGradient extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.FakeQuantWithMinMaxArgsGradient} + */ + public static class Options { + + /** + * @param min + */ + public Options min(Float min) { + this.min = min; + return this; + } + + /** + * @param max + */ + public Options max(Float max) { + this.max = max; + return this; + } + + /** + * @param numBits + */ + public Options numBits(Long numBits) { + this.numBits = numBits; + return this; + } + + /** + * @param narrowRange + */ + public Options narrowRange(Boolean narrowRange) { + this.narrowRange = narrowRange; + return this; + } + + private Float min; + private Float max; + private Long numBits; + private Boolean narrowRange; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FakeQuantWithMinMaxArgsGradient operation. + * + * @param scope current scope + * @param gradients Backpropagated gradients above the FakeQuantWithMinMaxArgs operation. + * @param inputs Values passed as inputs to the FakeQuantWithMinMaxArgs operation. + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxArgsGradient + */ + public static FakeQuantWithMinMaxArgsGradient create(Scope scope, Operand gradients, Operand inputs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FakeQuantWithMinMaxArgsGradient", scope.makeOpName("FakeQuantWithMinMaxArgsGradient")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(inputs.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.min != null) { + opBuilder.setAttr("min", opts.min); + } + if (opts.max != null) { + opBuilder.setAttr("max", opts.max); + } + if (opts.numBits != null) { + opBuilder.setAttr("num_bits", opts.numBits); + } + if (opts.narrowRange != null) { + opBuilder.setAttr("narrow_range", opts.narrowRange); + } + } + } + return new FakeQuantWithMinMaxArgsGradient(opBuilder.build()); + } + + /** + * @param min + */ + public static Options min(Float min) { + return new Options().min(min); + } + + /** + * @param max + */ + public static Options max(Float max) { + return new Options().max(max); + } + + /** + * @param numBits + */ + public static Options numBits(Long numBits) { + return new Options().numBits(numBits); + } + + /** + * @param narrowRange + */ + public static Options narrowRange(Boolean narrowRange) { + return new Options().narrowRange(narrowRange); + } + + /** + * Backpropagated gradients below the FakeQuantWithMinMaxArgs operation: + * `gradients * (inputs >= min && inputs <= max)`. + */ + public Output backprops() { + return backprops; + } + + @Override + public Output asOutput() { + return backprops; + } + + private Output backprops; + + private FakeQuantWithMinMaxArgsGradient(Operation operation) { + super(operation); + int outputIdx = 0; + backprops = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVars.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVars.java new file mode 100644 index 00000000000..ee6f4fd53e5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVars.java @@ -0,0 +1,143 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Fake-quantize the 'inputs' tensor of type float via global float scalars `min` + *

              + * and `max` to 'outputs' tensor of same shape as `inputs`. + *

              + * `[min; max]` define the clamping range for the `inputs` data. + * `inputs` values are quantized into the quantization range (`[0; 2^num_bits - 1]` + * when `narrow_range` is false and `[1; 2^num_bits - 1]` when it is true) and + * then de-quantized and output as floats in `[min; max]` interval. + * `num_bits` is the bitwidth of the quantization; between 2 and 16, inclusive. + *

              + * Before quantization, `min` and `max` values are adjusted with the following + * logic. + * It is suggested to have `min <= 0 <= max`. If `0` is not in the range of values, + * the behavior can be unexpected: + * If `0 < min < max`: `min_adj = 0` and `max_adj = max - min`. + * If `min < max < 0`: `min_adj = min - max` and `max_adj = 0`. + * If `min <= 0 <= max`: `scale = (max - min) / (2^num_bits - 1) `, + * `min_adj = scale * round(min / scale)` and `max_adj = max + min_adj - min`. + *

              + * This operation has a gradient and thus allows for training `min` and `max` + * values. + */ +@Operator(group = "quantization") +public final class FakeQuantWithMinMaxVars extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.FakeQuantWithMinMaxVars} + */ + public static class Options { + + /** + * @param numBits + */ + public Options numBits(Long numBits) { + this.numBits = numBits; + return this; + } + + /** + * @param narrowRange + */ + public Options narrowRange(Boolean narrowRange) { + this.narrowRange = narrowRange; + return this; + } + + private Long numBits; + private Boolean narrowRange; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FakeQuantWithMinMaxVars operation. + * + * @param scope current scope + * @param inputs + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVars + */ + public static FakeQuantWithMinMaxVars create(Scope scope, Operand inputs, Operand min, Operand max, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FakeQuantWithMinMaxVars", scope.makeOpName("FakeQuantWithMinMaxVars")); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(min.asOutput()); + opBuilder.addInput(max.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.numBits != null) { + opBuilder.setAttr("num_bits", opts.numBits); + } + if (opts.narrowRange != null) { + opBuilder.setAttr("narrow_range", opts.narrowRange); + } + } + } + return new FakeQuantWithMinMaxVars(opBuilder.build()); + } + + /** + * @param numBits + */ + public static Options numBits(Long numBits) { + return new Options().numBits(numBits); + } + + /** + * @param narrowRange + */ + public static Options narrowRange(Boolean narrowRange) { + return new Options().narrowRange(narrowRange); + } + + /** + */ + public Output outputs() { + return outputs; + } + + @Override + public Output asOutput() { + return outputs; + } + + private Output outputs; + + private FakeQuantWithMinMaxVars(Operation operation) { + super(operation); + int outputIdx = 0; + outputs = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsGradient.java new file mode 100644 index 00000000000..e5b721b2fec --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsGradient.java @@ -0,0 +1,143 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute gradients for a FakeQuantWithMinMaxVars operation. + */ +@Operator(group = "quantization") +public final class FakeQuantWithMinMaxVarsGradient extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsGradient} + */ + public static class Options { + + /** + * @param numBits The bitwidth of the quantization; between 2 and 8, inclusive. + */ + public Options numBits(Long numBits) { + this.numBits = numBits; + return this; + } + + /** + * @param narrowRange Whether to quantize into 2^num_bits - 1 distinct values. + */ + public Options narrowRange(Boolean narrowRange) { + this.narrowRange = narrowRange; + return this; + } + + private Long numBits; + private Boolean narrowRange; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FakeQuantWithMinMaxVarsGradient operation. + * + * @param scope current scope + * @param gradients Backpropagated gradients above the FakeQuantWithMinMaxVars operation. + * @param inputs Values passed as inputs to the FakeQuantWithMinMaxVars operation. + * min, max: Quantization interval, scalar floats. + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVarsGradient + */ + public static FakeQuantWithMinMaxVarsGradient create(Scope scope, Operand gradients, Operand inputs, Operand min, Operand max, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FakeQuantWithMinMaxVarsGradient", scope.makeOpName("FakeQuantWithMinMaxVarsGradient")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(min.asOutput()); + opBuilder.addInput(max.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.numBits != null) { + opBuilder.setAttr("num_bits", opts.numBits); + } + if (opts.narrowRange != null) { + opBuilder.setAttr("narrow_range", opts.narrowRange); + } + } + } + return new FakeQuantWithMinMaxVarsGradient(opBuilder.build()); + } + + /** + * @param numBits The bitwidth of the quantization; between 2 and 8, inclusive. + */ + public static Options numBits(Long numBits) { + return new Options().numBits(numBits); + } + + /** + * @param narrowRange Whether to quantize into 2^num_bits - 1 distinct values. + */ + public static Options narrowRange(Boolean narrowRange) { + return new Options().narrowRange(narrowRange); + } + + /** + * Backpropagated gradients w.r.t. inputs: + * `gradients * (inputs >= min && inputs <= max)`. + */ + public Output backpropsWrtInput() { + return backpropsWrtInput; + } + + /** + * Backpropagated gradients w.r.t. min parameter: + * `sum(gradients * (inputs < min))`. + */ + public Output backpropWrtMin() { + return backpropWrtMin; + } + + /** + * Backpropagated gradients w.r.t. max parameter: + * `sum(gradients * (inputs > max))`. + */ + public Output backpropWrtMax() { + return backpropWrtMax; + } + + private Output backpropsWrtInput; + private Output backpropWrtMin; + private Output backpropWrtMax; + + private FakeQuantWithMinMaxVarsGradient(Operation operation) { + super(operation); + int outputIdx = 0; + backpropsWrtInput = operation.output(outputIdx++); + backpropWrtMin = operation.output(outputIdx++); + backpropWrtMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsPerChannel.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsPerChannel.java new file mode 100644 index 00000000000..1e8b3851075 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsPerChannel.java @@ -0,0 +1,144 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Fake-quantize the 'inputs' tensor of type float and one of the shapes: `[d]`, + *

              + * `[b, d]` `[b, h, w, d]` via per-channel floats `min` and `max` of shape `[d]` + * to 'outputs' tensor of same shape as `inputs`. + *

              + * `[min; max]` define the clamping range for the `inputs` data. + * `inputs` values are quantized into the quantization range (`[0; 2^num_bits - 1]` + * when `narrow_range` is false and `[1; 2^num_bits - 1]` when it is true) and + * then de-quantized and output as floats in `[min; max]` interval. + * `num_bits` is the bitwidth of the quantization; between 2 and 16, inclusive. + *

              + * Before quantization, `min` and `max` values are adjusted with the following + * logic. + * It is suggested to have `min <= 0 <= max`. If `0` is not in the range of values, + * the behavior can be unexpected: + * If `0 < min < max`: `min_adj = 0` and `max_adj = max - min`. + * If `min < max < 0`: `min_adj = min - max` and `max_adj = 0`. + * If `min <= 0 <= max`: `scale = (max - min) / (2^num_bits - 1) `, + * `min_adj = scale * round(min / scale)` and `max_adj = max + min_adj - min`. + *

              + * This operation has a gradient and thus allows for training `min` and `max` + * values. + */ +@Operator(group = "quantization") +public final class FakeQuantWithMinMaxVarsPerChannel extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsPerChannel} + */ + public static class Options { + + /** + * @param numBits + */ + public Options numBits(Long numBits) { + this.numBits = numBits; + return this; + } + + /** + * @param narrowRange + */ + public Options narrowRange(Boolean narrowRange) { + this.narrowRange = narrowRange; + return this; + } + + private Long numBits; + private Boolean narrowRange; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FakeQuantWithMinMaxVarsPerChannel operation. + * + * @param scope current scope + * @param inputs + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVarsPerChannel + */ + public static FakeQuantWithMinMaxVarsPerChannel create(Scope scope, Operand inputs, Operand min, Operand max, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FakeQuantWithMinMaxVarsPerChannel", scope.makeOpName("FakeQuantWithMinMaxVarsPerChannel")); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(min.asOutput()); + opBuilder.addInput(max.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.numBits != null) { + opBuilder.setAttr("num_bits", opts.numBits); + } + if (opts.narrowRange != null) { + opBuilder.setAttr("narrow_range", opts.narrowRange); + } + } + } + return new FakeQuantWithMinMaxVarsPerChannel(opBuilder.build()); + } + + /** + * @param numBits + */ + public static Options numBits(Long numBits) { + return new Options().numBits(numBits); + } + + /** + * @param narrowRange + */ + public static Options narrowRange(Boolean narrowRange) { + return new Options().narrowRange(narrowRange); + } + + /** + */ + public Output outputs() { + return outputs; + } + + @Override + public Output asOutput() { + return outputs; + } + + private Output outputs; + + private FakeQuantWithMinMaxVarsPerChannel(Operation operation) { + super(operation); + int outputIdx = 0; + outputs = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsPerChannelGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsPerChannelGradient.java new file mode 100644 index 00000000000..2b45b700de3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/FakeQuantWithMinMaxVarsPerChannelGradient.java @@ -0,0 +1,146 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation. + */ +@Operator(group = "quantization") +public final class FakeQuantWithMinMaxVarsPerChannelGradient extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsPerChannelGradient} + */ + public static class Options { + + /** + * @param numBits The bitwidth of the quantization; between 2 and 16, inclusive. + */ + public Options numBits(Long numBits) { + this.numBits = numBits; + return this; + } + + /** + * @param narrowRange Whether to quantize into 2^num_bits - 1 distinct values. + */ + public Options narrowRange(Boolean narrowRange) { + this.narrowRange = narrowRange; + return this; + } + + private Long numBits; + private Boolean narrowRange; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new FakeQuantWithMinMaxVarsPerChannelGradient operation. + * + * @param scope current scope + * @param gradients Backpropagated gradients above the FakeQuantWithMinMaxVars operation, + * shape one of: `[d]`, `[b, d]`, `[b, h, w, d]`. + * @param inputs Values passed as inputs to the FakeQuantWithMinMaxVars operation, shape + * same as `gradients`. + * min, max: Quantization interval, floats of shape `[d]`. + * @param min + * @param max + * @param options carries optional attributes values + * @return a new instance of FakeQuantWithMinMaxVarsPerChannelGradient + */ + public static FakeQuantWithMinMaxVarsPerChannelGradient create(Scope scope, Operand gradients, Operand inputs, Operand min, Operand max, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("FakeQuantWithMinMaxVarsPerChannelGradient", scope.makeOpName("FakeQuantWithMinMaxVarsPerChannelGradient")); + opBuilder.addInput(gradients.asOutput()); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(min.asOutput()); + opBuilder.addInput(max.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.numBits != null) { + opBuilder.setAttr("num_bits", opts.numBits); + } + if (opts.narrowRange != null) { + opBuilder.setAttr("narrow_range", opts.narrowRange); + } + } + } + return new FakeQuantWithMinMaxVarsPerChannelGradient(opBuilder.build()); + } + + /** + * @param numBits The bitwidth of the quantization; between 2 and 16, inclusive. + */ + public static Options numBits(Long numBits) { + return new Options().numBits(numBits); + } + + /** + * @param narrowRange Whether to quantize into 2^num_bits - 1 distinct values. + */ + public static Options narrowRange(Boolean narrowRange) { + return new Options().narrowRange(narrowRange); + } + + /** + * Backpropagated gradients w.r.t. inputs, shape same as + * `inputs`: + * `gradients * (inputs >= min && inputs <= max)`. + */ + public Output backpropsWrtInput() { + return backpropsWrtInput; + } + + /** + * Backpropagated gradients w.r.t. min parameter, shape `[d]`: + * `sum_per_d(gradients * (inputs < min))`. + */ + public Output backpropWrtMin() { + return backpropWrtMin; + } + + /** + * Backpropagated gradients w.r.t. max parameter, shape `[d]`: + * `sum_per_d(gradients * (inputs > max))`. + */ + public Output backpropWrtMax() { + return backpropWrtMax; + } + + private Output backpropsWrtInput; + private Output backpropWrtMin; + private Output backpropWrtMax; + + private FakeQuantWithMinMaxVarsPerChannelGradient(Operation operation) { + super(operation); + int outputIdx = 0; + backpropsWrtInput = operation.output(outputIdx++); + backpropWrtMin = operation.output(outputIdx++); + backpropWrtMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Quantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Quantize.java new file mode 100644 index 00000000000..652ec6892fb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Quantize.java @@ -0,0 +1,227 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Quantize the 'input' tensor of type float to 'output' tensor of type 'T'. + *

              + * [min_range, max_range] are scalar floats that specify the range for + * the 'input' data. The 'mode' attribute controls exactly which calculations are + * used to convert the float values to their quantized equivalents. The + * 'round_mode' attribute controls which rounding tie-breaking algorithm is used + * when rounding float values to their quantized equivalents. + *

              + * In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: + *

              {@code
              + * out[i] = (in[i] - min_range) * range(T) / (max_range - min_range)
              + * if T == qint8: out[i] -= (range(T) + 1) / 2.0
              + * }
              + * here `range(T) = numeric_limits::max() - numeric_limits::min()` + *

              + * MIN_COMBINED Mode Example + *

              + * Assume the input is type float and has a possible range of [0.0, 6.0] and the + * output type is quint8 ([0, 255]). The min_range and max_range values should be + * specified as 0.0 and 6.0. Quantizing from float to quint8 will multiply each + * value of the input by 255/6 and cast to quint8. + *

              + * If the output type was qint8 ([-128, 127]), the operation will additionally + * subtract each value by 128 prior to casting, so that the range of values aligns + * with the range of qint8. + *

              + * If the mode is 'MIN_FIRST', then this approach is used: + *

              {@code
              + * num_discrete_values = 1 << (# of bits in T)
              + * range_adjust = num_discrete_values / (num_discrete_values - 1)
              + * range = (range_max - range_min) * range_adjust
              + * range_scale = num_discrete_values / range
              + * quantized = round(input * range_scale) - round(range_min * range_scale) +
              + *   numeric_limits::min()
              + * quantized = max(quantized, numeric_limits::min())
              + * quantized = min(quantized, numeric_limits::max())
              + * }
              + * The biggest difference between this and MIN_COMBINED is that the minimum range + * is rounded first, before it's subtracted from the rounded value. With + * MIN_COMBINED, a small bias is introduced where repeated iterations of quantizing + * and dequantizing will introduce a larger and larger error. + *

              + * SCALED mode Example + *

              + * `SCALED` mode matches the quantization approach used in + * `QuantizeAndDequantize{V2|V3}`. + *

              + * If the mode is `SCALED`, we do not use the full range of the output type, + * choosing to elide the lowest possible value for symmetry (e.g., output range is + * -127 to 127, not -128 to 127 for signed 8 bit quantization), so that 0.0 maps to + * 0. + *

              + * We first find the range of values in our tensor. The + * range we use is always centered on 0, so we find m such that + *

              {@code
              + *   m = max(abs(input_min), abs(input_max))
              + * }
              + * Our input tensor range is then `[-m, m]`. + *

              + * Next, we choose our fixed-point quantization buckets, `[min_fixed, max_fixed]`. + * If T is signed, this is + *

              {@code
              + *   num_bits = sizeof(T) * 8
              + *   [min_fixed, max_fixed] =
              + *       [-(1 << (num_bits - 1) - 1), (1 << (num_bits - 1)) - 1]
              + * }
              + * Otherwise, if T is unsigned, the fixed-point range is + *
              {@code
              + *   [min_fixed, max_fixed] = [0, (1 << num_bits) - 1]
              + * }
              + * From this we compute our scaling factor, s: + *
              {@code
              + *   s = (max_fixed - min_fixed) / (2 * m)
              + * }
              + * Now we can quantize the elements of our tensor: + *
              {@code
              + * result = round(input * s)
              + * }
              + * One thing to watch out for is that the operator may choose to adjust the + * requested minimum and maximum values slightly during the quantization process, + * so you should always use the output ports as the range for further calculations. + * For example, if the requested minimum and maximum values are close to equal, + * they will be separated by a small epsilon value to prevent ill-formed quantized + * buffers from being created. Otherwise, you can end up with buffers where all the + * quantized values map to the same float value, which causes problems for + * operations that have to perform further calculations on them. + * + * @param data type for {@code output()} output + */ +@Operator(group = "quantization") +public final class Quantize extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.Quantize} + */ + public static class Options { + + /** + * @param mode + */ + public Options mode(String mode) { + this.mode = mode; + return this; + } + + /** + * @param roundMode + */ + public Options roundMode(String roundMode) { + this.roundMode = roundMode; + return this; + } + + private String mode; + private String roundMode; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Quantize operation. + * + * @param scope current scope + * @param input + * @param minRange The minimum scalar value possibly produced for the input. + * @param maxRange The maximum scalar value possibly produced for the input. + * @param T + * @param options carries optional attributes values + * @return a new instance of Quantize + */ + public static Quantize create(Scope scope, Operand input, Operand minRange, Operand maxRange, Class T, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizeV2", scope.makeOpName("Quantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(minRange.asOutput()); + opBuilder.addInput(maxRange.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("T", DataType.fromClass(T)); + if (options != null) { + for (Options opts : options) { + if (opts.mode != null) { + opBuilder.setAttr("mode", opts.mode); + } + if (opts.roundMode != null) { + opBuilder.setAttr("round_mode", opts.roundMode); + } + } + } + return new Quantize(opBuilder.build()); + } + + /** + * @param mode + */ + public static Options mode(String mode) { + return new Options().mode(mode); + } + + /** + * @param roundMode + */ + public static Options roundMode(String roundMode) { + return new Options().roundMode(roundMode); + } + + /** + * The quantized data produced from the float input. + */ + public Output output() { + return output; + } + + /** + * The actual minimum scalar value used for the output. + */ + public Output outputMin() { + return outputMin; + } + + /** + * The actual maximum scalar value used for the output. + */ + public Output outputMax() { + return outputMax; + } + + private Output output; + private Output outputMin; + private Output outputMax; + + private Quantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeAndDequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeAndDequantize.java new file mode 100644 index 00000000000..b30c73db39e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeAndDequantize.java @@ -0,0 +1,149 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Quantizes then dequantizes a tensor. + *

              + * This is almost identical to QuantizeAndDequantizeV2, except that num_bits is a + * tensor, so its value can change during training. + * + * @param data type for {@code output()} output + */ +@Operator(group = "quantization") +public final class QuantizeAndDequantize extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.quantization.QuantizeAndDequantize} + */ + public static class Options { + + /** + * @param signedInput + */ + public Options signedInput(Boolean signedInput) { + this.signedInput = signedInput; + return this; + } + + /** + * @param rangeGiven + */ + public Options rangeGiven(Boolean rangeGiven) { + this.rangeGiven = rangeGiven; + return this; + } + + /** + * @param narrowRange + */ + public Options narrowRange(Boolean narrowRange) { + this.narrowRange = narrowRange; + return this; + } + + private Boolean signedInput; + private Boolean rangeGiven; + private Boolean narrowRange; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new QuantizeAndDequantize operation. + * + * @param scope current scope + * @param input + * @param inputMin + * @param inputMax + * @param numBits + * @param options carries optional attributes values + * @return a new instance of QuantizeAndDequantize + */ + public static QuantizeAndDequantize create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Operand numBits, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizeAndDequantizeV3", scope.makeOpName("QuantizeAndDequantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputMin.asOutput()); + opBuilder.addInput(inputMax.asOutput()); + opBuilder.addInput(numBits.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.signedInput != null) { + opBuilder.setAttr("signed_input", opts.signedInput); + } + if (opts.rangeGiven != null) { + opBuilder.setAttr("range_given", opts.rangeGiven); + } + if (opts.narrowRange != null) { + opBuilder.setAttr("narrow_range", opts.narrowRange); + } + } + } + return new QuantizeAndDequantize(opBuilder.build()); + } + + /** + * @param signedInput + */ + public static Options signedInput(Boolean signedInput) { + return new Options().signedInput(signedInput); + } + + /** + * @param rangeGiven + */ + public static Options rangeGiven(Boolean rangeGiven) { + return new Options().rangeGiven(rangeGiven); + } + + /** + * @param narrowRange + */ + public static Options narrowRange(Boolean narrowRange) { + return new Options().narrowRange(narrowRange); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private QuantizeAndDequantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeDownAndShrinkRange.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeDownAndShrinkRange.java new file mode 100644 index 00000000000..15bd1a9b32d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeDownAndShrinkRange.java @@ -0,0 +1,111 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Convert the quantized 'input' tensor into a lower-precision 'output', using the + *

              + * actual distribution of the values to maximize the usage of the lower bit depth + * and adjusting the output min and max ranges accordingly. + *

              + * [input_min, input_max] are scalar floats that specify the range for the float + * interpretation of the 'input' data. For example, if input_min is -1.0f and + * input_max is 1.0f, and we are dealing with quint16 quantized data, then a 0 + * value in the 16-bit data should be interpreted as -1.0f, and a 65535 means 1.0f. + *

              + * This operator tries to squeeze as much precision as possible into an output with + * a lower bit depth by calculating the actual min and max values found in the + * data. For example, maybe that quint16 input has no values lower than 16,384 and + * none higher than 49,152. That means only half the range is actually needed, all + * the float interpretations are between -0.5f and 0.5f, so if we want to compress + * the data into a quint8 output, we can use that range rather than the theoretical + * -1.0f to 1.0f that is suggested by the input min and max. + *

              + * In practice, this is most useful for taking output from operations like + * QuantizedMatMul that can produce higher bit-depth outputs than their inputs and + * may have large potential output ranges, but in practice have a distribution of + * input values that only uses a small fraction of the possible range. By feeding + * that output into this operator, we can reduce it from 32 bits down to 8 with + * minimal loss of accuracy. + * + * @param data type for {@code output()} output + */ +@Operator(group = "quantization") +public final class QuantizeDownAndShrinkRange extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new QuantizeDownAndShrinkRange operation. + * + * @param scope current scope + * @param input + * @param inputMin The float value that the minimum quantized input value represents. + * @param inputMax The float value that the maximum quantized input value represents. + * @param outType The type of the output. Should be a lower bit depth than Tinput. + * @return a new instance of QuantizeDownAndShrinkRange + */ + public static QuantizeDownAndShrinkRange create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("QuantizeDownAndShrinkRange", scope.makeOpName("QuantizeDownAndShrinkRange")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputMin.asOutput()); + opBuilder.addInput(inputMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new QuantizeDownAndShrinkRange(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + /** + * The float value that the minimum quantized output value represents. + */ + public Output outputMin() { + return outputMin; + } + + /** + * The float value that the maximum quantized output value represents. + */ + public Output outputMax() { + return outputMax; + } + + private Output output; + private Output outputMin; + private Output outputMax; + + private QuantizeDownAndShrinkRange(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/RequantizationRange.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/RequantizationRange.java new file mode 100644 index 00000000000..7bc74021a7b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/RequantizationRange.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes a range that covers the actual values present in a quantized tensor. + *

              + * Given a quantized tensor described by `(input, input_min, input_max)`, outputs a + * range that covers the actual values present in that tensor. This op is typically + * used to produce the `requested_output_min` and `requested_output_max` for + * `Requantize`. + */ +@Operator(group = "quantization") +public final class RequantizationRange extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new RequantizationRange operation. + * + * @param scope current scope + * @param input + * @param inputMin The float value that the minimum quantized input value represents. + * @param inputMax The float value that the maximum quantized input value represents. + * @return a new instance of RequantizationRange + */ + public static RequantizationRange create(Scope scope, Operand input, Operand inputMin, Operand inputMax) { + OperationBuilder opBuilder = scope.env().opBuilder("RequantizationRange", scope.makeOpName("RequantizationRange")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputMin.asOutput()); + opBuilder.addInput(inputMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RequantizationRange(opBuilder.build()); + } + + /** + * The computed min output. + */ + public Output outputMin() { + return outputMin; + } + + /** + * the computed max output. + */ + public Output outputMax() { + return outputMax; + } + + private Output outputMin; + private Output outputMax; + + private RequantizationRange(Operation operation) { + super(operation); + int outputIdx = 0; + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Requantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Requantize.java new file mode 100644 index 00000000000..ff32f7d3305 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Requantize.java @@ -0,0 +1,100 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.quantization; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts the quantized `input` tensor into a lower-precision `output`. + *

              + * Converts the quantized `input` tensor into a lower-precision `output`, using the + * output range specified with `requested_output_min` and `requested_output_max`. + *

              + * `[input_min, input_max]` are scalar floats that specify the range for the float + * interpretation of the `input` data. For example, if `input_min` is -1.0f and + * `input_max` is 1.0f, and we are dealing with `quint16` quantized data, then a 0 + * value in the 16-bit data should be interpreted as -1.0f, and a 65535 means 1.0f. + * + * @param data type for {@code output()} output + */ +@Operator(group = "quantization") +public final class Requantize extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new Requantize operation. + * + * @param scope current scope + * @param input + * @param inputMin The float value that the minimum quantized input value represents. + * @param inputMax The float value that the maximum quantized input value represents. + * @param requestedOutputMin The float value that the minimum quantized output value represents. + * @param requestedOutputMax The float value that the maximum quantized output value represents. + * @param outType The type of the output. Should be a lower bit depth than Tinput. + * @return a new instance of Requantize + */ + public static Requantize create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("Requantize", scope.makeOpName("Requantize")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(inputMin.asOutput()); + opBuilder.addInput(inputMax.asOutput()); + opBuilder.addInput(requestedOutputMin.asOutput()); + opBuilder.addInput(requestedOutputMax.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new Requantize(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + /** + * The requested_output_min value is copied into this output. + */ + public Output outputMin() { + return outputMin; + } + + /** + * The requested_output_max value is copied into this output. + */ + public Output outputMax() { + return outputMax; + } + + private Output output; + private Output outputMin; + private Output outputMax; + + private Requantize(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/AllCandidateSampler.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/AllCandidateSampler.java new file mode 100644 index 00000000000..20a6c7236fb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/AllCandidateSampler.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generates labels for candidate sampling with a learned unigram distribution. + *

              + * See explanations of candidate sampling and the data formats at + * go/candidate-sampling. + *

              + * For each batch, this op picks a single set of sampled candidate labels. + *

              + * The advantages of sampling candidates per-batch are simplicity and the + * possibility of efficient dense matrix multiplication. The disadvantage is that + * the sampled candidates must be chosen independently of the context and of the + * true labels. + */ +@Operator(group = "random") +public final class AllCandidateSampler extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.random.AllCandidateSampler} + */ + public static class Options { + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AllCandidateSampler operation. + * + * @param scope current scope + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * IDs of the num_true target_classes in the corresponding original label. + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to produce. + * @param unique If unique is true, we sample with rejection, so that all sampled + * candidates in a batch are unique. This requires some approximation to + * estimate the post-rejection sampling probabilities. + * @param options carries optional attributes values + * @return a new instance of AllCandidateSampler + */ + public static AllCandidateSampler create(Scope scope, Operand trueClasses, Long numTrue, Long numSampled, Boolean unique, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AllCandidateSampler", scope.makeOpName("AllCandidateSampler")); + opBuilder.addInput(trueClasses.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_true", numTrue); + opBuilder.setAttr("num_sampled", numSampled); + opBuilder.setAttr("unique", unique); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new AllCandidateSampler(opBuilder.build()); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A vector of length num_sampled, in which each element is + * the ID of a sampled candidate. + */ + public Output sampledCandidates() { + return sampledCandidates; + } + + /** + * A batch_size * num_true matrix, representing + * the number of times each candidate is expected to occur in a batch + * of sampled candidates. If unique=true, then this is a probability. + */ + public Output trueExpectedCount() { + return trueExpectedCount; + } + + /** + * A vector of length num_sampled, for each sampled + * candidate representing the number of times the candidate is expected + * to occur in a batch of sampled candidates. If unique=true, then this is a + * probability. + */ + public Output sampledExpectedCount() { + return sampledExpectedCount; + } + + private Output sampledCandidates; + private Output trueExpectedCount; + private Output sampledExpectedCount; + + private AllCandidateSampler(Operation operation) { + super(operation); + int outputIdx = 0; + sampledCandidates = operation.output(outputIdx++); + trueExpectedCount = operation.output(outputIdx++); + sampledExpectedCount = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/LogUniformCandidateSampler.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/LogUniformCandidateSampler.java new file mode 100644 index 00000000000..2c29adc26a4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/LogUniformCandidateSampler.java @@ -0,0 +1,164 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generates labels for candidate sampling with a log-uniform distribution. + *

              + * See explanations of candidate sampling and the data formats at + * go/candidate-sampling. + *

              + * For each batch, this op picks a single set of sampled candidate labels. + *

              + * The advantages of sampling candidates per-batch are simplicity and the + * possibility of efficient dense matrix multiplication. The disadvantage is that + * the sampled candidates must be chosen independently of the context and of the + * true labels. + */ +@Operator(group = "random") +public final class LogUniformCandidateSampler extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.random.LogUniformCandidateSampler} + */ + public static class Options { + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new LogUniformCandidateSampler operation. + * + * @param scope current scope + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * IDs of the num_true target_classes in the corresponding original label. + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * candidates in a batch are unique. This requires some approximation to + * estimate the post-rejection sampling probabilities. + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of LogUniformCandidateSampler + */ + public static LogUniformCandidateSampler create(Scope scope, Operand trueClasses, Long numTrue, Long numSampled, Boolean unique, Long rangeMax, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("LogUniformCandidateSampler", scope.makeOpName("LogUniformCandidateSampler")); + opBuilder.addInput(trueClasses.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_true", numTrue); + opBuilder.setAttr("num_sampled", numSampled); + opBuilder.setAttr("unique", unique); + opBuilder.setAttr("range_max", rangeMax); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new LogUniformCandidateSampler(opBuilder.build()); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A vector of length num_sampled, in which each element is + * the ID of a sampled candidate. + */ + public Output sampledCandidates() { + return sampledCandidates; + } + + /** + * A batch_size * num_true matrix, representing + * the number of times each candidate is expected to occur in a batch + * of sampled candidates. If unique=true, then this is a probability. + */ + public Output trueExpectedCount() { + return trueExpectedCount; + } + + /** + * A vector of length num_sampled, for each sampled + * candidate representing the number of times the candidate is expected + * to occur in a batch of sampled candidates. If unique=true, then this is a + * probability. + */ + public Output sampledExpectedCount() { + return sampledExpectedCount; + } + + private Output sampledCandidates; + private Output trueExpectedCount; + private Output sampledExpectedCount; + + private LogUniformCandidateSampler(Operation operation) { + super(operation); + int outputIdx = 0; + sampledCandidates = operation.output(outputIdx++); + trueExpectedCount = operation.output(outputIdx++); + sampledExpectedCount = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/Multinomial.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/Multinomial.java new file mode 100644 index 00000000000..15b05300e00 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/Multinomial.java @@ -0,0 +1,145 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Draws samples from a multinomial distribution. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class Multinomial extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.Multinomial} + */ + public static class Options { + + /** + * @param seed If either seed or seed2 is set to be non-zero, the internal random number + * generator is seeded by the given seed. Otherwise, a random seed is used. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Multinomial operation. + * + * @param scope current scope + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * represents the unnormalized log probabilities for all classes. + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param outputDtype + * @param options carries optional attributes values + * @return a new instance of Multinomial + */ + public static Multinomial create(Scope scope, Operand logits, Operand numSamples, Class outputDtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Multinomial", scope.makeOpName("Multinomial")); + opBuilder.addInput(logits.asOutput()); + opBuilder.addInput(numSamples.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("output_dtype", DataType.fromClass(outputDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new Multinomial(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new Multinomial operation using default output types. + * + * @param scope current scope + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * represents the unnormalized log probabilities for all classes. + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param options carries optional attributes values + * @return a new instance of Multinomial + */ + public static Multinomial create(Scope scope, Operand logits, Operand numSamples, Options... options) { + return create(scope, logits, numSamples, Long.class, options); + } + + /** + * @param seed If either seed or seed2 is set to be non-zero, the internal random number + * generator is seeded by the given seed. Otherwise, a random seed is used. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * 2-D Tensor with shape `[batch_size, num_samples]`. Each slice `[i, :]` + * contains the drawn class labels with range `[0, num_classes)`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Multinomial(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/ParameterizedTruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/ParameterizedTruncatedNormal.java new file mode 100644 index 00000000000..03b91c7435e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/ParameterizedTruncatedNormal.java @@ -0,0 +1,139 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from a normal distribution. The parameters may each be a + *

              + * scalar which applies to the entire output, or a vector of length shape[0] which + * stores the parameters for each batch. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class ParameterizedTruncatedNormal extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.ParameterizedTruncatedNormal} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ParameterizedTruncatedNormal operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. Batches are indexed by the 0th dimension. + * @param means The mean parameter of each batch. + * @param stdevs The standard deviation parameter of each batch. Must be greater than 0. + * @param minvals The minimum cutoff. May be -infinity. + * @param maxvals The maximum cutoff. May be +infinity, and must be more than the minval + * for each batch. + * @param options carries optional attributes values + * @return a new instance of ParameterizedTruncatedNormal + */ + public static ParameterizedTruncatedNormal create(Scope scope, Operand shape, Operand means, Operand stdevs, Operand minvals, Operand maxvals, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ParameterizedTruncatedNormal", scope.makeOpName("ParameterizedTruncatedNormal")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(means.asOutput()); + opBuilder.addInput(stdevs.asOutput()); + opBuilder.addInput(minvals.asOutput()); + opBuilder.addInput(maxvals.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new ParameterizedTruncatedNormal(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A matrix of shape num_batches x samples_per_batch, filled with random + * truncated normal values using the parameters for each row. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ParameterizedTruncatedNormal(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGamma.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGamma.java new file mode 100644 index 00000000000..bbb073aa4cb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGamma.java @@ -0,0 +1,136 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from the Gamma distribution(s) described by alpha. + *

              + * This op uses the algorithm by Marsaglia et al. to acquire samples via + * transformation-rejection from pairs of uniform and normal random variables. + * See http://dl.acm.org/citation.cfm?id=358414 + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class RandomGamma extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.RandomGamma} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomGamma operation. + * + * @param scope current scope + * @param shape 1-D integer tensor. Shape of independent samples to draw from each + * distribution described by the shape parameters given in alpha. + * @param alpha A tensor in which each scalar is a "shape" parameter describing the + * associated gamma distribution. + * @param options carries optional attributes values + * @return a new instance of RandomGamma + */ + public static RandomGamma create(Scope scope, Operand shape, Operand alpha, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomGamma", scope.makeOpName("RandomGamma")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new RandomGamma(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A tensor with shape `shape + shape(alpha)`. Each slice + * `[:, ..., :, i0, i1, ...iN]` contains the samples drawn for + * `alpha[i0, i1, ...iN]`. The dtype of the output matches the dtype of alpha. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomGamma(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGammaGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGammaGrad.java new file mode 100644 index 00000000000..37aa663268c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGammaGrad.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Computes the derivative of a Gamma random sample w.r.t. `alpha`. + * + * @param data type for {@code output()} output + */ +public final class RandomGammaGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RandomGammaGrad operation. + * + * @param scope current scope + * @param alpha + * @param sample + * @return a new instance of RandomGammaGrad + */ + public static RandomGammaGrad create(Scope scope, Operand alpha, Operand sample) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomGammaGrad", scope.makeOpName("RandomGammaGrad")); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(sample.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RandomGammaGrad(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomGammaGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomPoisson.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomPoisson.java new file mode 100644 index 00000000000..f6a0cf8b093 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomPoisson.java @@ -0,0 +1,160 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from the Poisson distribution(s) described by rate. + *

              + * This op uses two algorithms, depending on rate. If rate >= 10, then + * the algorithm by Hormann is used to acquire samples via + * transformation-rejection. + * See http://www.sciencedirect.com/science/article/pii/0167668793909974. + *

              + * Otherwise, Knuth's algorithm is used to acquire samples via multiplying uniform + * random variables. + * See Donald E. Knuth (1969). Seminumerical Algorithms. The Art of Computer + * Programming, Volume 2. Addison Wesley + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class RandomPoisson extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.RandomPoisson} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomPoisson operation. + * + * @param scope current scope + * @param shape 1-D integer tensor. Shape of independent samples to draw from each + * distribution described by the shape parameters given in rate. + * @param rate A tensor in which each scalar is a "rate" parameter describing the + * associated poisson distribution. + * @param dtype + * @param options carries optional attributes values + * @return a new instance of RandomPoisson + */ + public static RandomPoisson create(Scope scope, Operand shape, Operand rate, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomPoissonV2", scope.makeOpName("RandomPoisson")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(rate.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new RandomPoisson(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new RandomPoisson operation using default output types. + * + * @param scope current scope + * @param shape 1-D integer tensor. Shape of independent samples to draw from each + * distribution described by the shape parameters given in rate. + * @param rate A tensor in which each scalar is a "rate" parameter describing the + * associated poisson distribution. + * @param options carries optional attributes values + * @return a new instance of RandomPoisson + */ + public static RandomPoisson create(Scope scope, Operand shape, Operand rate, Options... options) { + return create(scope, shape, rate, Long.class, options); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A tensor with shape `shape + shape(rate)`. Each slice + * `[:, ..., :, i0, i1, ...iN]` contains the samples drawn for + * `rate[i0, i1, ...iN]`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomPoisson(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomShuffle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomShuffle.java new file mode 100644 index 00000000000..6895aa03c46 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomShuffle.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Randomly shuffles a tensor along its first dimension. + *

              + * The tensor is shuffled along dimension 0, such that each `value[j]` is mapped + * to one and only one `output[i]`. For example, a mapping that might occur for a + * 3x2 tensor is: + *

              {@code
              + * [[1, 2],       [[5, 6],
              + *  [3, 4],  ==>   [1, 2],
              + *  [5, 6]]        [3, 4]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class RandomShuffle extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.RandomShuffle} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomShuffle operation. + * + * @param scope current scope + * @param value The tensor to be shuffled. + * @param options carries optional attributes values + * @return a new instance of RandomShuffle + */ + public static RandomShuffle create(Scope scope, Operand value, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomShuffle", scope.makeOpName("RandomShuffle")); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new RandomShuffle(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A tensor of same shape and type as `value`, shuffled along its first + * dimension. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomShuffle(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomStandardNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomStandardNormal.java new file mode 100644 index 00000000000..d9d226193f2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomStandardNormal.java @@ -0,0 +1,131 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from a normal distribution. + *

              + * The generated values will have mean 0 and standard deviation 1. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class RandomStandardNormal extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.RandomStandardNormal} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomStandardNormal operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @param options carries optional attributes values + * @return a new instance of RandomStandardNormal + */ + public static RandomStandardNormal create(Scope scope, Operand shape, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomStandardNormal", scope.makeOpName("RandomStandardNormal")); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new RandomStandardNormal(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A tensor of the specified shape filled with random normal values. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomStandardNormal(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniform.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniform.java new file mode 100644 index 00000000000..25df799cc73 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniform.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from a uniform distribution. + *

              + * The generated values follow a uniform distribution in the range `[0, 1)`. The + * lower bound 0 is included in the range, while the upper bound 1 is excluded. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class RandomUniform extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.RandomUniform} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomUniform operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @param options carries optional attributes values + * @return a new instance of RandomUniform + */ + public static RandomUniform create(Scope scope, Operand shape, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomUniform", scope.makeOpName("RandomUniform")); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new RandomUniform(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A tensor of the specified shape filled with uniform random values. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomUniform(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniformInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniformInt.java new file mode 100644 index 00000000000..07044d19575 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniformInt.java @@ -0,0 +1,138 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random integers from a uniform distribution. + *

              + * The generated values are uniform integers in the range `[minval, maxval)`. + * The lower bound `minval` is included in the range, while the upper bound + * `maxval` is excluded. + *

              + * The random integers are slightly biased unless `maxval - minval` is an exact + * power of two. The bias is small for values of `maxval - minval` significantly + * smaller than the range of the output (either `2^32` or `2^64`). + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class RandomUniformInt extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.RandomUniformInt} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RandomUniformInt operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param minval 0-D. Inclusive lower bound on the generated integers. + * @param maxval 0-D. Exclusive upper bound on the generated integers. + * @param options carries optional attributes values + * @return a new instance of RandomUniformInt + */ + public static RandomUniformInt create(Scope scope, Operand shape, Operand minval, Operand maxval, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RandomUniformInt", scope.makeOpName("RandomUniformInt")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(minval.asOutput()); + opBuilder.addInput(maxval.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new RandomUniformInt(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A tensor of the specified shape filled with uniform random integers. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RandomUniformInt(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RecordInput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RecordInput.java new file mode 100644 index 00000000000..f114a2a0f84 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RecordInput.java @@ -0,0 +1,200 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Emits randomized records. + */ +@Operator(group = "random") +public final class RecordInput extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.RecordInput} + */ + public static class Options { + + /** + * @param fileRandomSeed Random seeds used to produce randomized records. + */ + public Options fileRandomSeed(Long fileRandomSeed) { + this.fileRandomSeed = fileRandomSeed; + return this; + } + + /** + * @param fileShuffleShiftRatio Shifts the list of files after the list is randomly + * shuffled. + */ + public Options fileShuffleShiftRatio(Float fileShuffleShiftRatio) { + this.fileShuffleShiftRatio = fileShuffleShiftRatio; + return this; + } + + /** + * @param fileBufferSize The randomization shuffling buffer. + */ + public Options fileBufferSize(Long fileBufferSize) { + this.fileBufferSize = fileBufferSize; + return this; + } + + /** + * @param fileParallelism How many sstables are opened and concurrently iterated over. + */ + public Options fileParallelism(Long fileParallelism) { + this.fileParallelism = fileParallelism; + return this; + } + + /** + * @param batchSize The batch size. + */ + public Options batchSize(Long batchSize) { + this.batchSize = batchSize; + return this; + } + + /** + * @param compressionType The type of compression for the file. Currently ZLIB and + * GZIP are supported. Defaults to none. + */ + public Options compressionType(String compressionType) { + this.compressionType = compressionType; + return this; + } + + private Long fileRandomSeed; + private Float fileShuffleShiftRatio; + private Long fileBufferSize; + private Long fileParallelism; + private Long batchSize; + private String compressionType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RecordInput operation. + * + * @param scope current scope + * @param filePattern Glob pattern for the data files. + * @param options carries optional attributes values + * @return a new instance of RecordInput + */ + public static RecordInput create(Scope scope, String filePattern, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RecordInput", scope.makeOpName("RecordInput")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("file_pattern", filePattern); + if (options != null) { + for (Options opts : options) { + if (opts.fileRandomSeed != null) { + opBuilder.setAttr("file_random_seed", opts.fileRandomSeed); + } + if (opts.fileShuffleShiftRatio != null) { + opBuilder.setAttr("file_shuffle_shift_ratio", opts.fileShuffleShiftRatio); + } + if (opts.fileBufferSize != null) { + opBuilder.setAttr("file_buffer_size", opts.fileBufferSize); + } + if (opts.fileParallelism != null) { + opBuilder.setAttr("file_parallelism", opts.fileParallelism); + } + if (opts.batchSize != null) { + opBuilder.setAttr("batch_size", opts.batchSize); + } + if (opts.compressionType != null) { + opBuilder.setAttr("compression_type", opts.compressionType); + } + } + } + return new RecordInput(opBuilder.build()); + } + + /** + * @param fileRandomSeed Random seeds used to produce randomized records. + */ + public static Options fileRandomSeed(Long fileRandomSeed) { + return new Options().fileRandomSeed(fileRandomSeed); + } + + /** + * @param fileShuffleShiftRatio Shifts the list of files after the list is randomly + * shuffled. + */ + public static Options fileShuffleShiftRatio(Float fileShuffleShiftRatio) { + return new Options().fileShuffleShiftRatio(fileShuffleShiftRatio); + } + + /** + * @param fileBufferSize The randomization shuffling buffer. + */ + public static Options fileBufferSize(Long fileBufferSize) { + return new Options().fileBufferSize(fileBufferSize); + } + + /** + * @param fileParallelism How many sstables are opened and concurrently iterated over. + */ + public static Options fileParallelism(Long fileParallelism) { + return new Options().fileParallelism(fileParallelism); + } + + /** + * @param batchSize The batch size. + */ + public static Options batchSize(Long batchSize) { + return new Options().batchSize(batchSize); + } + + /** + * @param compressionType The type of compression for the file. Currently ZLIB and + * GZIP are supported. Defaults to none. + */ + public static Options compressionType(String compressionType) { + return new Options().compressionType(compressionType); + } + + /** + * A tensor of shape [batch_size]. + */ + public Output records() { + return records; + } + + @Override + public Output asOutput() { + return records; + } + + private Output records; + + private RecordInput(Operation operation) { + super(operation); + int outputIdx = 0; + records = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessMultinomial.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessMultinomial.java new file mode 100644 index 00000000000..1bdf6b9343c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessMultinomial.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Draws samples from a multinomial distribution. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class StatelessMultinomial extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatelessMultinomial operation. + * + * @param scope current scope + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * represents the unnormalized log probabilities for all classes. + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param seed 2 seeds (shape [2]). + * @param outputDtype + * @return a new instance of StatelessMultinomial + */ + public static StatelessMultinomial create(Scope scope, Operand logits, Operand numSamples, Operand seed, Class outputDtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatelessMultinomial", scope.makeOpName("StatelessMultinomial")); + opBuilder.addInput(logits.asOutput()); + opBuilder.addInput(numSamples.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("output_dtype", DataType.fromClass(outputDtype)); + return new StatelessMultinomial(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatelessMultinomial operation using default output types. + * + * @param scope current scope + * @param logits 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` + * represents the unnormalized log probabilities for all classes. + * @param numSamples 0-D. Number of independent samples to draw for each row slice. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessMultinomial + */ + public static StatelessMultinomial create(Scope scope, Operand logits, Operand numSamples, Operand seed) { + return create(scope, logits, numSamples, seed, Long.class); + } + + /** + * 2-D Tensor with shape `[batch_size, num_samples]`. Each slice `[i, :]` + * contains the drawn class labels with range `[0, num_classes)`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatelessMultinomial(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomNormal.java new file mode 100644 index 00000000000..0df4d6ea355 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomNormal.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs deterministic pseudorandom values from a normal distribution. + *

              + * The generated values will have mean 0 and standard deviation 1. + *

              + * The outputs are a deterministic function of `shape` and `seed`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class StatelessRandomNormal extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatelessRandomNormal operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @param dtype The type of the output. + * @return a new instance of StatelessRandomNormal + */ + public static StatelessRandomNormal create(Scope scope, Operand shape, Operand seed, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomNormal", scope.makeOpName("StatelessRandomNormal")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatelessRandomNormal(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatelessRandomNormal operation using default output types. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessRandomNormal + */ + public static StatelessRandomNormal create(Scope scope, Operand shape, Operand seed) { + return create(scope, shape, seed, Float.class); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatelessRandomNormal(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniform.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniform.java new file mode 100644 index 00000000000..95ff7c62786 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniform.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs deterministic pseudorandom random values from a uniform distribution. + *

              + * The generated values follow a uniform distribution in the range `[0, 1)`. The + * lower bound 0 is included in the range, while the upper bound 1 is excluded. + *

              + * The outputs are a deterministic function of `shape` and `seed`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class StatelessRandomUniform extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatelessRandomUniform operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @param dtype The type of the output. + * @return a new instance of StatelessRandomUniform + */ + public static StatelessRandomUniform create(Scope scope, Operand shape, Operand seed, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomUniform", scope.makeOpName("StatelessRandomUniform")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatelessRandomUniform(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatelessRandomUniform operation using default output types. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessRandomUniform + */ + public static StatelessRandomUniform create(Scope scope, Operand shape, Operand seed) { + return create(scope, shape, seed, Float.class); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatelessRandomUniform(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformInt.java new file mode 100644 index 00000000000..5a77fed170a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformInt.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Outputs deterministic pseudorandom random integers from a uniform distribution. + *

              + * The generated values follow a uniform distribution in the range `[minval, maxval)`. + *

              + * The outputs are a deterministic function of `shape`, `seed`, `minval`, and `maxval`. + * + * @param data type for {@code output()} output + */ +public final class StatelessRandomUniformInt extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatelessRandomUniformInt operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @param minval Minimum value (inclusive, scalar). + * @param maxval Maximum value (exclusive, scalar). + * @return a new instance of StatelessRandomUniformInt + */ + public static StatelessRandomUniformInt create(Scope scope, Operand shape, Operand seed, Operand minval, Operand maxval) { + OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomUniformInt", scope.makeOpName("StatelessRandomUniformInt")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(minval.asOutput()); + opBuilder.addInput(maxval.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new StatelessRandomUniformInt(opBuilder.build()); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatelessRandomUniformInt(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessTruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessTruncatedNormal.java new file mode 100644 index 00000000000..bd0003ff606 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessTruncatedNormal.java @@ -0,0 +1,92 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs deterministic pseudorandom values from a truncated normal distribution. + *

              + * The generated values follow a normal distribution with mean 0 and standard + * deviation 1, except that values whose magnitude is more than 2 standard + * deviations from the mean are dropped and re-picked. + *

              + * The outputs are a deterministic function of `shape` and `seed`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class StatelessTruncatedNormal extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatelessTruncatedNormal operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @param dtype The type of the output. + * @return a new instance of StatelessTruncatedNormal + */ + public static StatelessTruncatedNormal create(Scope scope, Operand shape, Operand seed, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("StatelessTruncatedNormal", scope.makeOpName("StatelessTruncatedNormal")); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new StatelessTruncatedNormal(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new StatelessTruncatedNormal operation using default output types. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param seed 2 seeds (shape [2]). + * @return a new instance of StatelessTruncatedNormal + */ + public static StatelessTruncatedNormal create(Scope scope, Operand shape, Operand seed) { + return create(scope, shape, seed, Float.class); + } + + /** + * Random values with specified shape. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StatelessTruncatedNormal(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/TruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/TruncatedNormal.java new file mode 100644 index 00000000000..a34b1b25c2e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/TruncatedNormal.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs random values from a truncated normal distribution. + *

              + * The generated values follow a normal distribution with mean 0 and standard + * deviation 1, except that values whose magnitude is more than 2 standard + * deviations from the mean are dropped and re-picked. + * + * @param data type for {@code output()} output + */ +@Operator(group = "random") +public final class TruncatedNormal extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.random.TruncatedNormal} + */ + public static class Options { + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TruncatedNormal operation. + * + * @param scope current scope + * @param shape The shape of the output tensor. + * @param dtype The type of the output. + * @param options carries optional attributes values + * @return a new instance of TruncatedNormal + */ + public static TruncatedNormal create(Scope scope, Operand shape, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TruncatedNormal", scope.makeOpName("TruncatedNormal")); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new TruncatedNormal(opBuilder.build()); + } + + /** + * @param seed If either `seed` or `seed2` are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 A second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A tensor of the specified shape filled with random truncated normal + * values. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TruncatedNormal(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/UniformCandidateSampler.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/UniformCandidateSampler.java new file mode 100644 index 00000000000..077eee151f6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/UniformCandidateSampler.java @@ -0,0 +1,164 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.random; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generates labels for candidate sampling with a uniform distribution. + *

              + * See explanations of candidate sampling and the data formats at + * go/candidate-sampling. + *

              + * For each batch, this op picks a single set of sampled candidate labels. + *

              + * The advantages of sampling candidates per-batch are simplicity and the + * possibility of efficient dense matrix multiplication. The disadvantage is that + * the sampled candidates must be chosen independently of the context and of the + * true labels. + */ +@Operator(group = "random") +public final class UniformCandidateSampler extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.random.UniformCandidateSampler} + */ + public static class Options { + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public Options seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public Options seed2(Long seed2) { + this.seed2 = seed2; + return this; + } + + private Long seed; + private Long seed2; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new UniformCandidateSampler operation. + * + * @param scope current scope + * @param trueClasses A batch_size * num_true matrix, in which each row contains the + * IDs of the num_true target_classes in the corresponding original label. + * @param numTrue Number of true labels per context. + * @param numSampled Number of candidates to randomly sample. + * @param unique If unique is true, we sample with rejection, so that all sampled + * candidates in a batch are unique. This requires some approximation to + * estimate the post-rejection sampling probabilities. + * @param rangeMax The sampler will sample integers from the interval [0, range_max). + * @param options carries optional attributes values + * @return a new instance of UniformCandidateSampler + */ + public static UniformCandidateSampler create(Scope scope, Operand trueClasses, Long numTrue, Long numSampled, Boolean unique, Long rangeMax, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("UniformCandidateSampler", scope.makeOpName("UniformCandidateSampler")); + opBuilder.addInput(trueClasses.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_true", numTrue); + opBuilder.setAttr("num_sampled", numSampled); + opBuilder.setAttr("unique", unique); + opBuilder.setAttr("range_max", rangeMax); + if (options != null) { + for (Options opts : options) { + if (opts.seed != null) { + opBuilder.setAttr("seed", opts.seed); + } + if (opts.seed2 != null) { + opBuilder.setAttr("seed2", opts.seed2); + } + } + } + return new UniformCandidateSampler(opBuilder.build()); + } + + /** + * @param seed If either seed or seed2 are set to be non-zero, the random number + * generator is seeded by the given seed. Otherwise, it is seeded by a + * random seed. + */ + public static Options seed(Long seed) { + return new Options().seed(seed); + } + + /** + * @param seed2 An second seed to avoid seed collision. + */ + public static Options seed2(Long seed2) { + return new Options().seed2(seed2); + } + + /** + * A vector of length num_sampled, in which each element is + * the ID of a sampled candidate. + */ + public Output sampledCandidates() { + return sampledCandidates; + } + + /** + * A batch_size * num_true matrix, representing + * the number of times each candidate is expected to occur in a batch + * of sampled candidates. If unique=true, then this is a probability. + */ + public Output trueExpectedCount() { + return trueExpectedCount; + } + + /** + * A vector of length num_sampled, for each sampled + * candidate representing the number of times the candidate is expected + * to occur in a batch of sampled candidates. If unique=true, then this is a + * probability. + */ + public Output sampledExpectedCount() { + return sampledExpectedCount; + } + + private Output sampledCandidates; + private Output trueExpectedCount; + private Output sampledExpectedCount; + + private UniformCandidateSampler(Operation operation) { + super(operation); + int outputIdx = 0; + sampledCandidates = operation.output(outputIdx++); + trueExpectedCount = operation.output(outputIdx++); + sampledExpectedCount = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft.java new file mode 100644 index 00000000000..7b5159580c2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator(group = "signal") +public final class BatchFft extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchFft operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchFft + */ + public static BatchFft create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchFFT", scope.makeOpName("BatchFft")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchFft(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private BatchFft(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft2d.java new file mode 100644 index 00000000000..01c0903ab22 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft2d.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator(group = "signal") +public final class BatchFft2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchFft2d operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchFft2d + */ + public static BatchFft2d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchFFT2D", scope.makeOpName("BatchFft2d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchFft2d(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private BatchFft2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft3d.java new file mode 100644 index 00000000000..79a880ea712 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchFft3d.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator(group = "signal") +public final class BatchFft3d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchFft3d operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchFft3d + */ + public static BatchFft3d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchFFT3D", scope.makeOpName("BatchFft3d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchFft3d(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private BatchFft3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft.java new file mode 100644 index 00000000000..e5509c4dcd9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator(group = "signal") +public final class BatchIfft extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchIfft operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchIfft + */ + public static BatchIfft create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchIFFT", scope.makeOpName("BatchIfft")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchIfft(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private BatchIfft(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft2d.java new file mode 100644 index 00000000000..4cea9f4cb4a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft2d.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator(group = "signal") +public final class BatchIfft2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchIfft2d operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchIfft2d + */ + public static BatchIfft2d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchIFFT2D", scope.makeOpName("BatchIfft2d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchIfft2d(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private BatchIfft2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft3d.java new file mode 100644 index 00000000000..070629b1327 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/BatchIfft3d.java @@ -0,0 +1,66 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + */ +@Operator(group = "signal") +public final class BatchIfft3d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new BatchIfft3d operation. + * + * @param scope current scope + * @param input + * @return a new instance of BatchIfft3d + */ + public static BatchIfft3d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("BatchIFFT3D", scope.makeOpName("BatchIfft3d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new BatchIfft3d(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private BatchIfft3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft.java new file mode 100644 index 00000000000..bf2745b0708 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Fast Fourier transform. + *

              + * Computes the 1-dimensional discrete Fourier transform over the inner-most + * dimension of `input`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "signal") +public final class Fft extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Fft operation. + * + * @param scope current scope + * @param input A complex tensor. + * @return a new instance of Fft + */ + public static Fft create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("FFT", scope.makeOpName("Fft")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Fft(opBuilder.build()); + } + + /** + * A complex tensor of the same shape as `input`. The inner-most + * dimension of `input` is replaced with its 1D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.fft + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Fft(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft2d.java new file mode 100644 index 00000000000..e7140c8bc85 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft2d.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * 2D fast Fourier transform. + *

              + * Computes the 2-dimensional discrete Fourier transform over the inner-most + * 2 dimensions of `input`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "signal") +public final class Fft2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Fft2d operation. + * + * @param scope current scope + * @param input A complex tensor. + * @return a new instance of Fft2d + */ + public static Fft2d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("FFT2D", scope.makeOpName("Fft2d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Fft2d(opBuilder.build()); + } + + /** + * A complex tensor of the same shape as `input`. The inner-most 2 + * dimensions of `input` are replaced with their 2D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.fft2 + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Fft2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft3d.java new file mode 100644 index 00000000000..158390d6766 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Fft3d.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * 3D fast Fourier transform. + *

              + * Computes the 3-dimensional discrete Fourier transform over the inner-most 3 + * dimensions of `input`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "signal") +public final class Fft3d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Fft3d operation. + * + * @param scope current scope + * @param input A complex64 tensor. + * @return a new instance of Fft3d + */ + public static Fft3d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("FFT3D", scope.makeOpName("Fft3d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Fft3d(opBuilder.build()); + } + + /** + * A complex64 tensor of the same shape as `input`. The inner-most 3 + * dimensions of `input` are replaced with their 3D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.fftn with 3 dimensions. + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Fft3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft.java new file mode 100644 index 00000000000..d8e1032af09 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Inverse fast Fourier transform. + *

              + * Computes the inverse 1-dimensional discrete Fourier transform over the + * inner-most dimension of `input`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "signal") +public final class Ifft extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Ifft operation. + * + * @param scope current scope + * @param input A complex tensor. + * @return a new instance of Ifft + */ + public static Ifft create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("IFFT", scope.makeOpName("Ifft")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Ifft(opBuilder.build()); + } + + /** + * A complex tensor of the same shape as `input`. The inner-most + * dimension of `input` is replaced with its inverse 1D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.ifft + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Ifft(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft2d.java new file mode 100644 index 00000000000..226b96a46ca --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft2d.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Inverse 2D fast Fourier transform. + *

              + * Computes the inverse 2-dimensional discrete Fourier transform over the + * inner-most 2 dimensions of `input`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "signal") +public final class Ifft2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Ifft2d operation. + * + * @param scope current scope + * @param input A complex tensor. + * @return a new instance of Ifft2d + */ + public static Ifft2d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("IFFT2D", scope.makeOpName("Ifft2d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Ifft2d(opBuilder.build()); + } + + /** + * A complex tensor of the same shape as `input`. The inner-most 2 + * dimensions of `input` are replaced with their inverse 2D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.ifft2 + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Ifft2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft3d.java new file mode 100644 index 00000000000..69bde0f2d55 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Ifft3d.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Inverse 3D fast Fourier transform. + *

              + * Computes the inverse 3-dimensional discrete Fourier transform over the + * inner-most 3 dimensions of `input`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "signal") +public final class Ifft3d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Ifft3d operation. + * + * @param scope current scope + * @param input A complex64 tensor. + * @return a new instance of Ifft3d + */ + public static Ifft3d create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("IFFT3D", scope.makeOpName("Ifft3d")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Ifft3d(opBuilder.build()); + } + + /** + * A complex64 tensor of the same shape as `input`. The inner-most 3 + * dimensions of `input` are replaced with their inverse 3D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.ifftn with 3 dimensions. + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Ifft3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft.java new file mode 100644 index 00000000000..8e9d2918b1a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Inverse real-valued fast Fourier transform. + *

              + * Computes the inverse 1-dimensional discrete Fourier transform of a real-valued + * signal over the inner-most dimension of `input`. + *

              + * The inner-most dimension of `input` is assumed to be the result of `RFFT`: the + * `fft_length / 2 + 1` unique components of the DFT of a real-valued signal. If + * `fft_length` is not provided, it is computed from the size of the inner-most + * dimension of `input` (`fft_length = 2 * (inner - 1)`). If the FFT length used to + * compute `input` is odd, it should be provided since it cannot be inferred + * properly. + *

              + * Along the axis `signal.Irfft` is computed on, if `fft_length / 2 + 1` is smaller + * than the corresponding dimension of `input`, the dimension is cropped. If it is + * larger, the dimension is padded with zeros. + */ +@Operator(group = "signal") +public final class Irfft extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Irfft operation. + * + * @param scope current scope + * @param input A complex64 tensor. + * @param fftLength An int32 tensor of shape [1]. The FFT length. + * @return a new instance of Irfft + */ + public static Irfft create(Scope scope, Operand input, Operand fftLength) { + OperationBuilder opBuilder = scope.env().opBuilder("IRFFT", scope.makeOpName("Irfft")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(fftLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Irfft(opBuilder.build()); + } + + /** + * A float32 tensor of the same rank as `input`. The inner-most + * dimension of `input` is replaced with the `fft_length` samples of its inverse + * 1D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.irfft + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Irfft(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft2d.java new file mode 100644 index 00000000000..ffa6b995432 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft2d.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Inverse 2D real-valued fast Fourier transform. + *

              + * Computes the inverse 2-dimensional discrete Fourier transform of a real-valued + * signal over the inner-most 2 dimensions of `input`. + *

              + * The inner-most 2 dimensions of `input` are assumed to be the result of `RFFT2D`: + * The inner-most dimension contains the `fft_length / 2 + 1` unique components of + * the DFT of a real-valued signal. If `fft_length` is not provided, it is computed + * from the size of the inner-most 2 dimensions of `input`. If the FFT length used + * to compute `input` is odd, it should be provided since it cannot be inferred + * properly. + *

              + * Along each axis `signal.Irfft2d` is computed on, if `fft_length` (or + * `fft_length / 2 + 1` for the inner-most dimension) is smaller than the + * corresponding dimension of `input`, the dimension is cropped. If it is larger, + * the dimension is padded with zeros. + */ +@Operator(group = "signal") +public final class Irfft2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Irfft2d operation. + * + * @param scope current scope + * @param input A complex64 tensor. + * @param fftLength An int32 tensor of shape [2]. The FFT length for each dimension. + * @return a new instance of Irfft2d + */ + public static Irfft2d create(Scope scope, Operand input, Operand fftLength) { + OperationBuilder opBuilder = scope.env().opBuilder("IRFFT2D", scope.makeOpName("Irfft2d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(fftLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Irfft2d(opBuilder.build()); + } + + /** + * A float32 tensor of the same rank as `input`. The inner-most 2 + * dimensions of `input` are replaced with the `fft_length` samples of their + * inverse 2D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.irfft2 + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Irfft2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft3d.java new file mode 100644 index 00000000000..3baf6e8d714 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft3d.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Inverse 3D real-valued fast Fourier transform. + *

              + * Computes the inverse 3-dimensional discrete Fourier transform of a real-valued + * signal over the inner-most 3 dimensions of `input`. + *

              + * The inner-most 3 dimensions of `input` are assumed to be the result of `RFFT3D`: + * The inner-most dimension contains the `fft_length / 2 + 1` unique components of + * the DFT of a real-valued signal. If `fft_length` is not provided, it is computed + * from the size of the inner-most 3 dimensions of `input`. If the FFT length used + * to compute `input` is odd, it should be provided since it cannot be inferred + * properly. + *

              + * Along each axis `signal.Irfft3d` is computed on, if `fft_length` (or + * `fft_length / 2 + 1` for the inner-most dimension) is smaller than the + * corresponding dimension of `input`, the dimension is cropped. If it is larger, + * the dimension is padded with zeros. + */ +@Operator(group = "signal") +public final class Irfft3d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Irfft3d operation. + * + * @param scope current scope + * @param input A complex64 tensor. + * @param fftLength An int32 tensor of shape [3]. The FFT length for each dimension. + * @return a new instance of Irfft3d + */ + public static Irfft3d create(Scope scope, Operand input, Operand fftLength) { + OperationBuilder opBuilder = scope.env().opBuilder("IRFFT3D", scope.makeOpName("Irfft3d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(fftLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Irfft3d(opBuilder.build()); + } + + /** + * A float32 tensor of the same rank as `input`. The inner-most 3 + * dimensions of `input` are replaced with the `fft_length` samples of their + * inverse 3D real Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.irfftn with 3 dimensions. + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Irfft3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft.java new file mode 100644 index 00000000000..2f0fec0dfd4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft.java @@ -0,0 +1,87 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Real-valued fast Fourier transform. + *

              + * Computes the 1-dimensional discrete Fourier transform of a real-valued signal + * over the inner-most dimension of `input`. + *

              + * Since the DFT of a real signal is Hermitian-symmetric, `signal.Rfft` only returns the + * `fft_length / 2 + 1` unique components of the FFT: the zero-frequency term, + * followed by the `fft_length / 2` positive-frequency terms. + *

              + * Along the axis `signal.Rfft` is computed on, if `fft_length` is smaller than the + * corresponding dimension of `input`, the dimension is cropped. If it is larger, + * the dimension is padded with zeros. + */ +@Operator(group = "signal") +public final class Rfft extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Rfft operation. + * + * @param scope current scope + * @param input A float32 tensor. + * @param fftLength An int32 tensor of shape [1]. The FFT length. + * @return a new instance of Rfft + */ + public static Rfft create(Scope scope, Operand input, Operand fftLength) { + OperationBuilder opBuilder = scope.env().opBuilder("RFFT", scope.makeOpName("Rfft")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(fftLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Rfft(opBuilder.build()); + } + + /** + * A complex64 tensor of the same rank as `input`. The inner-most + * dimension of `input` is replaced with the `fft_length / 2 + 1` unique + * frequency components of its 1D Fourier transform. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.rfft + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private Rfft(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft2d.java new file mode 100644 index 00000000000..bd45b327979 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft2d.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * 2D real-valued fast Fourier transform. + *

              + * Computes the 2-dimensional discrete Fourier transform of a real-valued signal + * over the inner-most 2 dimensions of `input`. + *

              + * Since the DFT of a real signal is Hermitian-symmetric, `signal.Rfft2d` only returns the + * `fft_length / 2 + 1` unique components of the FFT for the inner-most dimension + * of `output`: the zero-frequency term, followed by the `fft_length / 2` + * positive-frequency terms. + *

              + * Along each axis `signal.Rfft2d` is computed on, if `fft_length` is smaller than the + * corresponding dimension of `input`, the dimension is cropped. If it is larger, + * the dimension is padded with zeros. + */ +@Operator(group = "signal") +public final class Rfft2d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Rfft2d operation. + * + * @param scope current scope + * @param input A float32 tensor. + * @param fftLength An int32 tensor of shape [2]. The FFT length for each dimension. + * @return a new instance of Rfft2d + */ + public static Rfft2d create(Scope scope, Operand input, Operand fftLength) { + OperationBuilder opBuilder = scope.env().opBuilder("RFFT2D", scope.makeOpName("Rfft2d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(fftLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Rfft2d(opBuilder.build()); + } + + /** + * A complex64 tensor of the same rank as `input`. The inner-most 2 + * dimensions of `input` are replaced with their 2D Fourier transform. The + * inner-most dimension contains `fft_length / 2 + 1` unique frequency + * components. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.rfft2 + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private Rfft2d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft3d.java new file mode 100644 index 00000000000..d734057433a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft3d.java @@ -0,0 +1,89 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.signal; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * 3D real-valued fast Fourier transform. + *

              + * Computes the 3-dimensional discrete Fourier transform of a real-valued signal + * over the inner-most 3 dimensions of `input`. + *

              + * Since the DFT of a real signal is Hermitian-symmetric, `signal.Rfft3d` only returns the + * `fft_length / 2 + 1` unique components of the FFT for the inner-most dimension + * of `output`: the zero-frequency term, followed by the `fft_length / 2` + * positive-frequency terms. + *

              + * Along each axis `signal.Rfft3d` is computed on, if `fft_length` is smaller than the + * corresponding dimension of `input`, the dimension is cropped. If it is larger, + * the dimension is padded with zeros. + */ +@Operator(group = "signal") +public final class Rfft3d extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Rfft3d operation. + * + * @param scope current scope + * @param input A float32 tensor. + * @param fftLength An int32 tensor of shape [3]. The FFT length for each dimension. + * @return a new instance of Rfft3d + */ + public static Rfft3d create(Scope scope, Operand input, Operand fftLength) { + OperationBuilder opBuilder = scope.env().opBuilder("RFFT3D", scope.makeOpName("Rfft3d")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(fftLength.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Rfft3d(opBuilder.build()); + } + + /** + * A complex64 tensor of the same rank as `input`. The inner-most 3 + * dimensions of `input` are replaced with the their 3D Fourier transform. The + * inner-most dimension contains `fft_length / 2 + 1` unique frequency + * components. + *

              + * @compatibility(numpy) + * Equivalent to np.fft.rfftn with 3 dimensions. + * @end_compatibility + */ + public Output output() { + return output; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) output; + } + + private Output output; + + private Rfft3d(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddManySparseToTensorsMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddManySparseToTensorsMap.java new file mode 100644 index 00000000000..2c41eca4baa --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddManySparseToTensorsMap.java @@ -0,0 +1,151 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Add an `N`-minibatch `SparseTensor` to a `SparseTensorsMap`, return `N` handles. + *

              + * A `SparseTensor` of rank `R` is represented by three tensors: `sparse_indices`, + * `sparse_values`, and `sparse_shape`, where + *

              {@code
              + * sparse_indices.shape[1] == sparse_shape.shape[0] == R}
              + * An `N`-minibatch of `SparseTensor` objects is represented as a `SparseTensor` + * having a first `sparse_indices` column taking values between `[0, N)`, where + * the minibatch size `N == sparse_shape[0]`. + *

              + * The input `SparseTensor` must have rank `R` greater than 1, and the first + * dimension is treated as the minibatch dimension. Elements of the `SparseTensor` + * must be sorted in increasing order of this first dimension. The stored + * `SparseTensor` objects pointed to by each row of the output `sparse_handles` + * will have rank `R-1`. + *

              + * The `SparseTensor` values can then be read out as part of a minibatch by passing + * the given keys as vector elements to `TakeManySparseFromTensorsMap`. To ensure + * the correct `SparseTensorsMap` is accessed, ensure that the same + * `container` and `shared_name` are passed to that Op. If no `shared_name` + * is provided here, instead use the name of the Operation created by calling + * `sparse.AddManySparseToTensorsMap` as the `shared_name` passed to + * `TakeManySparseFromTensorsMap`. Ensure the Operations are colocated. + */ +@Operator(group = "sparse") +public final class AddManySparseToTensorsMap extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.AddManySparseToTensorsMap} + */ + public static class Options { + + /** + * @param container The container name for the `SparseTensorsMap` created by this op. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName The shared name for the `SparseTensorsMap` created by this op. + * If blank, the new Operation's unique name is used. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AddManySparseToTensorsMap operation. + * + * @param scope current scope + * @param sparseIndices 2-D. The `indices` of the minibatch `SparseTensor`. + * `sparse_indices[:, 0]` must be ordered values in `[0, N)`. + * @param sparseValues 1-D. The `values` of the minibatch `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the minibatch `SparseTensor`. + * The minibatch size `N == sparse_shape[0]`. + * @param options carries optional attributes values + * @return a new instance of AddManySparseToTensorsMap + */ + public static AddManySparseToTensorsMap create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AddManySparseToTensorsMap", scope.makeOpName("AddManySparseToTensorsMap")); + opBuilder.addInput(sparseIndices.asOutput()); + opBuilder.addInput(sparseValues.asOutput()); + opBuilder.addInput(sparseShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new AddManySparseToTensorsMap(opBuilder.build()); + } + + /** + * @param container The container name for the `SparseTensorsMap` created by this op. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName The shared name for the `SparseTensorsMap` created by this op. + * If blank, the new Operation's unique name is used. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * 1-D. The handles of the `SparseTensor` now stored in the + * `SparseTensorsMap`. Shape: `[N]`. + */ + public Output sparseHandles() { + return sparseHandles; + } + + @Override + public Output asOutput() { + return sparseHandles; + } + + private Output sparseHandles; + + private AddManySparseToTensorsMap(Operation operation) { + super(operation); + int outputIdx = 0; + sparseHandles = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddSparseToTensorsMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddSparseToTensorsMap.java new file mode 100644 index 00000000000..7019a26e120 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddSparseToTensorsMap.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Add a `SparseTensor` to a `SparseTensorsMap` return its handle. + *

              + * A `SparseTensor` is represented by three tensors: `sparse_indices`, + * `sparse_values`, and `sparse_shape`. + *

              + * This operator takes the given `SparseTensor` and adds it to a container + * object (a `SparseTensorsMap`). A unique key within this container is generated + * in the form of an `int64`, and this is the value that is returned. + *

              + * The `SparseTensor` can then be read out as part of a minibatch by passing + * the key as a vector element to `TakeManySparseFromTensorsMap`. To ensure + * the correct `SparseTensorsMap` is accessed, ensure that the same + * `container` and `shared_name` are passed to that Op. If no `shared_name` + * is provided here, instead use the name of the Operation created by calling + * `sparse.AddSparseToTensorsMap` as the `shared_name` passed to + * `TakeManySparseFromTensorsMap`. Ensure the Operations are colocated. + */ +@Operator(group = "sparse") +public final class AddSparseToTensorsMap extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.AddSparseToTensorsMap} + */ + public static class Options { + + /** + * @param container The container name for the `SparseTensorsMap` created by this op. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName The shared name for the `SparseTensorsMap` created by this op. + * If blank, the new Operation's unique name is used. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AddSparseToTensorsMap operation. + * + * @param scope current scope + * @param sparseIndices 2-D. The `indices` of the `SparseTensor`. + * @param sparseValues 1-D. The `values` of the `SparseTensor`. + * @param sparseShape 1-D. The `shape` of the `SparseTensor`. + * @param options carries optional attributes values + * @return a new instance of AddSparseToTensorsMap + */ + public static AddSparseToTensorsMap create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AddSparseToTensorsMap", scope.makeOpName("AddSparseToTensorsMap")); + opBuilder.addInput(sparseIndices.asOutput()); + opBuilder.addInput(sparseValues.asOutput()); + opBuilder.addInput(sparseShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new AddSparseToTensorsMap(opBuilder.build()); + } + + /** + * @param container The container name for the `SparseTensorsMap` created by this op. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName The shared name for the `SparseTensorsMap` created by this op. + * If blank, the new Operation's unique name is used. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * 0-D. The handle of the `SparseTensor` now stored in the + * `SparseTensorsMap`. + */ + public Output sparseHandle() { + return sparseHandle; + } + + @Override + public Output asOutput() { + return sparseHandle; + } + + private Output sparseHandle; + + private AddSparseToTensorsMap(Operation operation) { + super(operation); + int outputIdx = 0; + sparseHandle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseToDenseSetOperation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseToDenseSetOperation.java new file mode 100644 index 00000000000..c5d8f2cb41c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseToDenseSetOperation.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies set operation along last dimension of 2 `Tensor` inputs. + *

              + * See SetOperationOp::SetOperationFromContext for values of `set_operation`. + *

              + * Output `result` is a `SparseTensor` represented by `result_indices`, + * `result_values`, and `result_shape`. For `set1` and `set2` ranked `n`, this + * has rank `n` and the same 1st `n-1` dimensions as `set1` and `set2`. The `nth` + * dimension contains the result of `set_operation` applied to the corresponding + * `[0...n-1]` dimension of `set`. + * + * @param data type for {@code resultValues()} output + */ +@Operator(group = "sparse") +public final class DenseToDenseSetOperation extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.DenseToDenseSetOperation} + */ + public static class Options { + + /** + * @param validateIndices + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + + private Boolean validateIndices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DenseToDenseSetOperation operation. + * + * @param scope current scope + * @param set1 `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set2`. + * Dimension `n` contains values in a set, duplicates are allowed but ignored. + * @param set2 `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set1`. + * Dimension `n` contains values in a set, duplicates are allowed but ignored. + * @param setOperation + * @param options carries optional attributes values + * @return a new instance of DenseToDenseSetOperation + */ + public static DenseToDenseSetOperation create(Scope scope, Operand set1, Operand set2, String setOperation, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DenseToDenseSetOperation", scope.makeOpName("DenseToDenseSetOperation")); + opBuilder.addInput(set1.asOutput()); + opBuilder.addInput(set2.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("set_operation", setOperation); + if (options != null) { + for (Options opts : options) { + if (opts.validateIndices != null) { + opBuilder.setAttr("validate_indices", opts.validateIndices); + } + } + } + return new DenseToDenseSetOperation(opBuilder.build()); + } + + /** + * @param validateIndices + */ + public static Options validateIndices(Boolean validateIndices) { + return new Options().validateIndices(validateIndices); + } + + /** + * 2D indices of a `SparseTensor`. + */ + public Output resultIndices() { + return resultIndices; + } + + /** + * 1D values of a `SparseTensor`. + */ + public Output resultValues() { + return resultValues; + } + + /** + * 1D `Tensor` shape of a `SparseTensor`. `result_shape[0...n-1]` is + * the same as the 1st `n-1` dimensions of `set1` and `set2`, `result_shape[n]` + * is the max result set size across all `0...n-1` dimensions. + */ + public Output resultShape() { + return resultShape; + } + + private Output resultIndices; + private Output resultValues; + private Output resultShape; + + private DenseToDenseSetOperation(Operation operation) { + super(operation); + int outputIdx = 0; + resultIndices = operation.output(outputIdx++); + resultValues = operation.output(outputIdx++); + resultShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseToSparseSetOperation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseToSparseSetOperation.java new file mode 100644 index 00000000000..e193d9cc836 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseToSparseSetOperation.java @@ -0,0 +1,147 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies set operation along last dimension of `Tensor` and `SparseTensor`. + *

              + * See SetOperationOp::SetOperationFromContext for values of `set_operation`. + *

              + * Input `set2` is a `SparseTensor` represented by `set2_indices`, `set2_values`, + * and `set2_shape`. For `set2` ranked `n`, 1st `n-1` dimensions must be the same + * as `set1`. Dimension `n` contains values in a set, duplicates are allowed but + * ignored. + *

              + * If `validate_indices` is `True`, this op validates the order and range of `set2` + * indices. + *

              + * Output `result` is a `SparseTensor` represented by `result_indices`, + * `result_values`, and `result_shape`. For `set1` and `set2` ranked `n`, this + * has rank `n` and the same 1st `n-1` dimensions as `set1` and `set2`. The `nth` + * dimension contains the result of `set_operation` applied to the corresponding + * `[0...n-1]` dimension of `set`. + * + * @param data type for {@code resultValues()} output + */ +@Operator(group = "sparse") +public final class DenseToSparseSetOperation extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.DenseToSparseSetOperation} + */ + public static class Options { + + /** + * @param validateIndices + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + + private Boolean validateIndices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new DenseToSparseSetOperation operation. + * + * @param scope current scope + * @param set1 `Tensor` with rank `n`. 1st `n-1` dimensions must be the same as `set2`. + * Dimension `n` contains values in a set, duplicates are allowed but ignored. + * @param set2Indices 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major + * order. + * @param set2Values 1D `Tensor`, values of a `SparseTensor`. Must be in row-major + * order. + * @param set2Shape 1D `Tensor`, shape of a `SparseTensor`. `set2_shape[0...n-1]` must + * be the same as the 1st `n-1` dimensions of `set1`, `result_shape[n]` is the + * max set size across `n-1` dimensions. + * @param setOperation + * @param options carries optional attributes values + * @return a new instance of DenseToSparseSetOperation + */ + public static DenseToSparseSetOperation create(Scope scope, Operand set1, Operand set2Indices, Operand set2Values, Operand set2Shape, String setOperation, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("DenseToSparseSetOperation", scope.makeOpName("DenseToSparseSetOperation")); + opBuilder.addInput(set1.asOutput()); + opBuilder.addInput(set2Indices.asOutput()); + opBuilder.addInput(set2Values.asOutput()); + opBuilder.addInput(set2Shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("set_operation", setOperation); + if (options != null) { + for (Options opts : options) { + if (opts.validateIndices != null) { + opBuilder.setAttr("validate_indices", opts.validateIndices); + } + } + } + return new DenseToSparseSetOperation(opBuilder.build()); + } + + /** + * @param validateIndices + */ + public static Options validateIndices(Boolean validateIndices) { + return new Options().validateIndices(validateIndices); + } + + /** + * 2D indices of a `SparseTensor`. + */ + public Output resultIndices() { + return resultIndices; + } + + /** + * 1D values of a `SparseTensor`. + */ + public Output resultValues() { + return resultValues; + } + + /** + * 1D `Tensor` shape of a `SparseTensor`. `result_shape[0...n-1]` is + * the same as the 1st `n-1` dimensions of `set1` and `set2`, `result_shape[n]` + * is the max result set size across all `0...n-1` dimensions. + */ + public Output resultShape() { + return resultShape; + } + + private Output resultIndices; + private Output resultValues; + private Output resultShape; + + private DenseToSparseSetOperation(Operation operation) { + super(operation); + int outputIdx = 0; + resultIndices = operation.output(outputIdx++); + resultValues = operation.output(outputIdx++); + resultShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DeserializeSparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DeserializeSparse.java new file mode 100644 index 00000000000..304d4579d78 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DeserializeSparse.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Deserialize `SparseTensor` objects. + *

              + * The input `serialized_sparse` must have the shape `[?, ?, ..., ?, 3]` where + * the last dimension stores serialized `SparseTensor` objects and the other N + * dimensions (N >= 0) correspond to a batch. The ranks of the original + * `SparseTensor` objects must all match. When the final `SparseTensor` is + * created, its rank is the rank of the incoming `SparseTensor` objects plus N; + * the sparse tensors have been concatenated along new dimensions, one for each + * batch. + *

              + * The output `SparseTensor` object's shape values for the original dimensions + * are the max across the input `SparseTensor` objects' shape values for the + * corresponding dimensions. The new dimensions match the size of the batch. + *

              + * The input `SparseTensor` objects' indices are assumed ordered in + * standard lexicographic order. If this is not the case, after this + * step run `SparseReorder` to restore index ordering. + *

              + * For example, if the serialized input is a `[2 x 3]` matrix representing two + * original `SparseTensor` objects: + *

              + * index = [ 0] + * [10] + * [20] + * values = [1, 2, 3] + * shape = [50] + *

              + * and + *

              + * index = [ 2] + * [10] + * values = [4, 5] + * shape = [30] + *

              + * then the final deserialized `SparseTensor` will be: + *

              + * index = [0 0] + * [0 10] + * [0 20] + * [1 2] + * [1 10] + * values = [1, 2, 3, 4, 5] + * shape = [2 50] + * + * @param data type for {@code sparseValues()} output + */ +@Operator(group = "sparse") +public final class DeserializeSparse extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new DeserializeSparse operation. + * + * @param scope current scope + * @param serializedSparse The serialized `SparseTensor` objects. The last dimension + * must have 3 columns. + * @param dtype The `dtype` of the serialized `SparseTensor` objects. + * @return a new instance of DeserializeSparse + */ + public static DeserializeSparse create(Scope scope, Operand serializedSparse, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("DeserializeSparse", scope.makeOpName("DeserializeSparse")); + opBuilder.addInput(serializedSparse.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new DeserializeSparse(opBuilder.build()); + } + + /** + */ + public Output sparseIndices() { + return sparseIndices; + } + + /** + */ + public Output sparseValues() { + return sparseValues; + } + + /** + */ + public Output sparseShape() { + return sparseShape; + } + + private Output sparseIndices; + private Output sparseValues; + private Output sparseShape; + + private DeserializeSparse(Operation operation) { + super(operation); + int outputIdx = 0; + sparseIndices = operation.output(outputIdx++); + sparseValues = operation.output(outputIdx++); + sparseShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorApplyGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorApplyGradient.java new file mode 100644 index 00000000000..8b6b45f058a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorApplyGradient.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies a sparse gradient to a given accumulator. + *

              + * Does not add if local_step is smaller than the accumulator's + * global_step. + */ +@Operator(group = "sparse") +public final class SparseAccumulatorApplyGradient extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseAccumulatorApplyGradient operation. + * + * @param scope current scope + * @param handle The handle to a accumulator. + * @param localStep The local_step value at which the sparse gradient was computed. + * @param gradientIndices Indices of the sparse gradient to be accumulated. Must be a + * vector. + * @param gradientValues Values are the non-zero slices of the gradient, and must have + * the same first dimension as indices, i.e., the nnz represented by indices and + * values must be consistent. + * @param gradientShape Shape of the sparse gradient to be accumulated. + * @param hasKnownShape Boolean indicating whether gradient_shape is unknown, in which + * case the input is ignored during validation. + * @return a new instance of SparseAccumulatorApplyGradient + */ + public static SparseAccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradientIndices, Operand gradientValues, Operand gradientShape, Boolean hasKnownShape) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseAccumulatorApplyGradient", scope.makeOpName("SparseAccumulatorApplyGradient")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(localStep.asOutput()); + opBuilder.addInput(gradientIndices.asOutput()); + opBuilder.addInput(gradientValues.asOutput()); + opBuilder.addInput(gradientShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("has_known_shape", hasKnownShape); + return new SparseAccumulatorApplyGradient(opBuilder.build()); + } + + + private SparseAccumulatorApplyGradient(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorTakeGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorTakeGradient.java new file mode 100644 index 00000000000..6e62cc0e484 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorTakeGradient.java @@ -0,0 +1,95 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Extracts the average sparse gradient in a SparseConditionalAccumulator. + *

              + * The op will blocks until sufficient (i.e., more than num_required) + * gradients have been accumulated. If the accumulator has already + * aggregated more than num_required gradients, it will return its + * average of the accumulated gradients. Also automatically increments + * the recorded global_step in the accumulator by 1, and resets the + * aggregate to 0. + * + * @param data type for {@code values()} output + */ +@Operator(group = "sparse") +public final class SparseAccumulatorTakeGradient extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseAccumulatorTakeGradient operation. + * + * @param scope current scope + * @param handle The handle to a SparseConditionalAccumulator. + * @param numRequired Number of gradients required before we return an aggregate. + * @param dtype The data type of accumulated gradients. Needs to correspond to the type + * of the accumulator. + * @return a new instance of SparseAccumulatorTakeGradient + */ + public static SparseAccumulatorTakeGradient create(Scope scope, Operand handle, Operand numRequired, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseAccumulatorTakeGradient", scope.makeOpName("SparseAccumulatorTakeGradient")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(numRequired.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new SparseAccumulatorTakeGradient(opBuilder.build()); + } + + /** + * Indices of the average of the accumulated sparse gradients. + */ + public Output indices() { + return indices; + } + + /** + * Values of the average of the accumulated sparse gradients. + */ + public Output values() { + return values; + } + + /** + * Shape of the average of the accumulated sparse gradients. + */ + public Output shape() { + return shape; + } + + private Output indices; + private Output values; + private Output shape; + + private SparseAccumulatorTakeGradient(Operation operation) { + super(operation); + int outputIdx = 0; + indices = operation.output(outputIdx++); + values = operation.output(outputIdx++); + shape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAdd.java new file mode 100644 index 00000000000..8213ae13dc1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAdd.java @@ -0,0 +1,106 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds two `SparseTensor` objects to produce another `SparseTensor`. + *

              + * The input `SparseTensor` objects' indices are assumed ordered in standard + * lexicographic order. If this is not the case, before this step run + * `SparseReorder` to restore index ordering. + *

              + * By default, if two values sum to zero at some index, the output `SparseTensor` + * would still include that particular location in its index, storing a zero in the + * corresponding value slot. To override this, callers can specify `thresh`, + * indicating that if the sum has a magnitude strictly smaller than `thresh`, its + * corresponding value and index would then not be included. In particular, + * `thresh == 0` (default) means everything is kept and actual thresholding happens + * only for a positive value. + *

              + * In the following shapes, `nnz` is the count after taking `thresh` into account. + * + * @param data type for {@code sumValues()} output + */ +@Operator(group = "sparse") +public final class SparseAdd extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseAdd operation. + * + * @param scope current scope + * @param aIndices 2-D. The `indices` of the first `SparseTensor`, size `[nnz, ndims]` Matrix. + * @param aValues 1-D. The `values` of the first `SparseTensor`, size `[nnz]` Vector. + * @param aShape 1-D. The `shape` of the first `SparseTensor`, size `[ndims]` Vector. + * @param bIndices 2-D. The `indices` of the second `SparseTensor`, size `[nnz, ndims]` Matrix. + * @param bValues 1-D. The `values` of the second `SparseTensor`, size `[nnz]` Vector. + * @param bShape 1-D. The `shape` of the second `SparseTensor`, size `[ndims]` Vector. + * @param thresh 0-D. The magnitude threshold that determines if an output value/index + * pair takes space. + * @return a new instance of SparseAdd + */ + public static SparseAdd create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand bIndices, Operand bValues, Operand bShape, Operand thresh) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseAdd", scope.makeOpName("SparseAdd")); + opBuilder.addInput(aIndices.asOutput()); + opBuilder.addInput(aValues.asOutput()); + opBuilder.addInput(aShape.asOutput()); + opBuilder.addInput(bIndices.asOutput()); + opBuilder.addInput(bValues.asOutput()); + opBuilder.addInput(bShape.asOutput()); + opBuilder.addInput(thresh.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseAdd(opBuilder.build()); + } + + /** + */ + public Output sumIndices() { + return sumIndices; + } + + /** + */ + public Output sumValues() { + return sumValues; + } + + /** + */ + public Output sumShape() { + return sumShape; + } + + private Output sumIndices; + private Output sumValues; + private Output sumShape; + + private SparseAdd(Operation operation) { + super(operation); + int outputIdx = 0; + sumIndices = operation.output(outputIdx++); + sumValues = operation.output(outputIdx++); + sumShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAddGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAddGrad.java new file mode 100644 index 00000000000..0952cd2e7bd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAddGrad.java @@ -0,0 +1,88 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * The gradient operator for the SparseAdd op. + *

              + * The SparseAdd op calculates A + B, where A, B, and the sum are all represented + * as `SparseTensor` objects. This op takes in the upstream gradient w.r.t. + * non-empty values of the sum, and outputs the gradients w.r.t. the non-empty + * values of A and B. + * + * @param data type for {@code aValGrad()} output + */ +@Operator(group = "sparse") +public final class SparseAddGrad extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseAddGrad operation. + * + * @param scope current scope + * @param backpropValGrad 1-D with shape `[nnz(sum)]`. The gradient with respect to + * the non-empty values of the sum. + * @param aIndices 2-D. The `indices` of the `SparseTensor` A, size `[nnz(A), ndims]`. + * @param bIndices 2-D. The `indices` of the `SparseTensor` B, size `[nnz(B), ndims]`. + * @param sumIndices 2-D. The `indices` of the sum `SparseTensor`, size + * `[nnz(sum), ndims]`. + * @return a new instance of SparseAddGrad + */ + public static SparseAddGrad create(Scope scope, Operand backpropValGrad, Operand aIndices, Operand bIndices, Operand sumIndices) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseAddGrad", scope.makeOpName("SparseAddGrad")); + opBuilder.addInput(backpropValGrad.asOutput()); + opBuilder.addInput(aIndices.asOutput()); + opBuilder.addInput(bIndices.asOutput()); + opBuilder.addInput(sumIndices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseAddGrad(opBuilder.build()); + } + + /** + * 1-D with shape `[nnz(A)]`. The gradient with respect to the + * non-empty values of A. + */ + public Output aValGrad() { + return aValGrad; + } + + /** + * 1-D with shape `[nnz(B)]`. The gradient with respect to the + * non-empty values of B. + */ + public Output bValGrad() { + return bValGrad; + } + + private Output aValGrad; + private Output bValGrad; + + private SparseAddGrad(Operation operation) { + super(operation); + int outputIdx = 0; + aValGrad = operation.output(outputIdx++); + bValGrad = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseConcat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseConcat.java new file mode 100644 index 00000000000..5566807c81d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseConcat.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Concatenates a list of `SparseTensor` along the specified dimension. + *

              + * Concatenation is with respect to the dense versions of these sparse tensors. + * It is assumed that each input is a `SparseTensor` whose elements are ordered + * along increasing dimension number. + *

              + * All inputs' shapes must match, except for the concat dimension. The + * `indices`, `values`, and `shapes` lists must have the same length. + *

              + * The output shape is identical to the inputs', except along the concat + * dimension, where it is the sum of the inputs' sizes along that dimension. + *

              + * The output elements will be resorted to preserve the sort order along + * increasing dimension number. + *

              + * This op runs in `O(M log M)` time, where `M` is the total number of non-empty + * values across all inputs. This is due to the need for an internal sort in + * order to concatenate efficiently across an arbitrary dimension. + *

              + * For example, if `concat_dim = 1` and the inputs are + *

              + * sp_inputs[0]: shape = [2, 3] + * [0, 2]: "a" + * [1, 0]: "b" + * [1, 1]: "c" + *

              + * sp_inputs[1]: shape = [2, 4] + * [0, 1]: "d" + * [0, 2]: "e" + *

              + * then the output will be + *

              + * shape = [2, 7] + * [0, 2]: "a" + * [0, 4]: "d" + * [0, 5]: "e" + * [1, 0]: "b" + * [1, 1]: "c" + *

              + * Graphically this is equivalent to doing + *

              + * [ a] concat [ d e ] = [ a d e ] + * [b c ] [ ] [b c ] + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseConcat extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseConcat operation. + * + * @param scope current scope + * @param indices 2-D. Indices of each input `SparseTensor`. + * @param values 1-D. Non-empty values of each `SparseTensor`. + * @param shapes 1-D. Shapes of each `SparseTensor`. + * @param concatDim Dimension to concatenate along. Must be in range [-rank, rank), + * where rank is the number of dimensions in each input `SparseTensor`. + * @return a new instance of SparseConcat + */ + public static SparseConcat create(Scope scope, Iterable> indices, Iterable> values, Iterable> shapes, Long concatDim) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseConcat", scope.makeOpName("SparseConcat")); + opBuilder.addInputList(Operands.asOutputs(indices)); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder.addInputList(Operands.asOutputs(shapes)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("concat_dim", concatDim); + return new SparseConcat(opBuilder.build()); + } + + /** + * 2-D. Indices of the concatenated `SparseTensor`. + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * 1-D. Non-empty values of the concatenated `SparseTensor`. + */ + public Output outputValues() { + return outputValues; + } + + /** + * 1-D. Shape of the concatenated `SparseTensor`. + */ + public Output outputShape() { + return outputShape; + } + + private Output outputIndices; + private Output outputValues; + private Output outputShape; + + private SparseConcat(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + outputShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseConditionalAccumulator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseConditionalAccumulator.java new file mode 100644 index 00000000000..5fa61be5922 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseConditionalAccumulator.java @@ -0,0 +1,154 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A conditional accumulator for aggregating sparse gradients. + *

              + * The accumulator accepts gradients marked with local_step greater or + * equal to the most recent global_step known to the accumulator. The + * average can be extracted from the accumulator, provided sufficient + * gradients have been accumulated. Extracting the average automatically + * resets the aggregate to 0, and increments the global_step recorded by + * the accumulator. + */ +@Operator(group = "sparse") +public final class SparseConditionalAccumulator extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseConditionalAccumulator} + */ + public static class Options { + + /** + * @param container If non-empty, this accumulator is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this accumulator will be shared under the given name + * across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param reductionType + */ + public Options reductionType(String reductionType) { + this.reductionType = reductionType; + return this; + } + + private String container; + private String sharedName; + private String reductionType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseConditionalAccumulator operation. + * + * @param scope current scope + * @param dtype The type of the value being accumulated. + * @param shape The shape of the values. + * @param options carries optional attributes values + * @return a new instance of SparseConditionalAccumulator + */ + public static SparseConditionalAccumulator create(Scope scope, Class dtype, Shape shape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseConditionalAccumulator", scope.makeOpName("SparseConditionalAccumulator")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + opBuilder.setAttr("shape", shape); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.reductionType != null) { + opBuilder.setAttr("reduction_type", opts.reductionType); + } + } + } + return new SparseConditionalAccumulator(opBuilder.build()); + } + + /** + * @param container If non-empty, this accumulator is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this accumulator will be shared under the given name + * across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param reductionType + */ + public static Options reductionType(String reductionType) { + return new Options().reductionType(reductionType); + } + + /** + * The handle to the accumulator. + */ + public Output handle() { + return handle; + } + + @Override + public Output asOutput() { + return handle; + } + + private Output handle; + + private SparseConditionalAccumulator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseCross.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseCross.java new file mode 100644 index 00000000000..7fbf1f01ba3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseCross.java @@ -0,0 +1,141 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Generates sparse cross from a list of sparse and dense tensors. + *

              + * The op takes two lists, one of 2D `SparseTensor` and one of 2D `Tensor`, each + * representing features of one feature column. It outputs a 2D `SparseTensor` with + * the batchwise crosses of these features. + *

              + * For example, if the inputs are + *

              + * inputs[0]: SparseTensor with shape = [2, 2] + * [0, 0]: "a" + * [1, 0]: "b" + * [1, 1]: "c" + *

              + * inputs[1]: SparseTensor with shape = [2, 1] + * [0, 0]: "d" + * [1, 0]: "e" + *

              + * inputs[2]: Tensor [["f"], ["g"]] + *

              + * then the output will be + *

              + * shape = [2, 2] + * [0, 0]: "a_X_d_X_f" + * [1, 0]: "b_X_e_X_g" + * [1, 1]: "c_X_e_X_g" + *

              + * if hashed_output=true then the output will be + *

              + * shape = [2, 2] + * [0, 0]: FingerprintCat64( + * Fingerprint64("f"), FingerprintCat64( + * Fingerprint64("d"), Fingerprint64("a"))) + * [1, 0]: FingerprintCat64( + * Fingerprint64("g"), FingerprintCat64( + * Fingerprint64("e"), Fingerprint64("b"))) + * [1, 1]: FingerprintCat64( + * Fingerprint64("g"), FingerprintCat64( + * Fingerprint64("e"), Fingerprint64("c"))) + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseCross extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseCross operation. + * + * @param scope current scope + * @param indices 2-D. Indices of each input `SparseTensor`. + * @param values 1-D. values of each `SparseTensor`. + * @param shapes 1-D. Shapes of each `SparseTensor`. + * @param denseInputs 2-D. Columns represented by dense `Tensor`. + * @param hashedOutput If true, returns the hash of the cross instead of the string. + * This will allow us avoiding string manipulations. + * @param numBuckets It is used if hashed_output is true. + * output = hashed_value%num_buckets if num_buckets > 0 else hashed_value. + * @param hashKey Specify the hash_key that will be used by the `FingerprintCat64` + * function to combine the crosses fingerprints. + * @param outType + * @param internalType + * @return a new instance of SparseCross + */ + public static SparseCross create(Scope scope, Iterable> indices, Iterable> values, Iterable> shapes, Iterable> denseInputs, Boolean hashedOutput, Long numBuckets, Long hashKey, Class outType, Class internalType) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseCross", scope.makeOpName("SparseCross")); + opBuilder.addInputList(Operands.asOutputs(indices)); + opBuilder.addInputList(Operands.asOutputs(values)); + opBuilder.addInputList(Operands.asOutputs(shapes)); + opBuilder.addInputList(Operands.asOutputs(denseInputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("hashed_output", hashedOutput); + opBuilder.setAttr("num_buckets", numBuckets); + opBuilder.setAttr("hash_key", hashKey); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + opBuilder.setAttr("internal_type", DataType.fromClass(internalType)); + return new SparseCross(opBuilder.build()); + } + + /** + * 2-D. Indices of the concatenated `SparseTensor`. + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * 1-D. Non-empty values of the concatenated or hashed + * `SparseTensor`. + */ + public Output outputValues() { + return outputValues; + } + + /** + * 1-D. Shape of the concatenated `SparseTensor`. + */ + public Output outputShape() { + return outputShape; + } + + private Output outputIndices; + private Output outputValues; + private Output outputShape; + + private SparseCross(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + outputShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseAdd.java new file mode 100644 index 00000000000..7206c575a09 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseAdd.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds up a SparseTensor and a dense Tensor, using these special rules: + *

              + * (1) Broadcasts the dense side to have the same shape as the sparse side, if + * eligible; + * (2) Then, only the dense values pointed to by the indices of the SparseTensor + * participate in the cwise addition. + *

              + * By these rules, the result is a logical SparseTensor with exactly the same + * indices and shape, but possibly with different non-zero values. The output of + * this Op is the resultant non-zero values. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseDenseCwiseAdd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseDenseCwiseAdd operation. + * + * @param scope current scope + * @param spIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param spValues 1-D. `N` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @param dense `R`-D. The dense Tensor operand. + * @return a new instance of SparseDenseCwiseAdd + */ + public static SparseDenseCwiseAdd create(Scope scope, Operand spIndices, Operand spValues, Operand spShape, Operand dense) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseDenseCwiseAdd", scope.makeOpName("SparseDenseCwiseAdd")); + opBuilder.addInput(spIndices.asOutput()); + opBuilder.addInput(spValues.asOutput()); + opBuilder.addInput(spShape.asOutput()); + opBuilder.addInput(dense.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseDenseCwiseAdd(opBuilder.build()); + } + + /** + * 1-D. The `N` values that are operated on. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseDenseCwiseAdd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseDiv.java new file mode 100644 index 00000000000..0ecc4202f6f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseDiv.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Component-wise divides a SparseTensor by a dense Tensor. + *

              + * Limitation: this Op only broadcasts the dense side to the sparse side, but not + * the other direction. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseDenseCwiseDiv extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseDenseCwiseDiv operation. + * + * @param scope current scope + * @param spIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param spValues 1-D. `N` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @param dense `R`-D. The dense Tensor operand. + * @return a new instance of SparseDenseCwiseDiv + */ + public static SparseDenseCwiseDiv create(Scope scope, Operand spIndices, Operand spValues, Operand spShape, Operand dense) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseDenseCwiseDiv", scope.makeOpName("SparseDenseCwiseDiv")); + opBuilder.addInput(spIndices.asOutput()); + opBuilder.addInput(spValues.asOutput()); + opBuilder.addInput(spShape.asOutput()); + opBuilder.addInput(dense.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseDenseCwiseDiv(opBuilder.build()); + } + + /** + * 1-D. The `N` values that are operated on. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseDenseCwiseDiv(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseMul.java new file mode 100644 index 00000000000..b5313e8ddfb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseDenseCwiseMul.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Component-wise multiplies a SparseTensor by a dense Tensor. + *

              + * The output locations corresponding to the implicitly zero elements in the sparse + * tensor will be zero (i.e., will not take up storage space), regardless of the + * contents of the dense tensor (even if it's +/-INF and that INF0 == NaN). + *

              + * Limitation*: this Op only broadcasts the dense side to the sparse side, but not + * the other direction. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseDenseCwiseMul extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseDenseCwiseMul operation. + * + * @param scope current scope + * @param spIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param spValues 1-D. `N` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @param dense `R`-D. The dense Tensor operand. + * @return a new instance of SparseDenseCwiseMul + */ + public static SparseDenseCwiseMul create(Scope scope, Operand spIndices, Operand spValues, Operand spShape, Operand dense) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseDenseCwiseMul", scope.makeOpName("SparseDenseCwiseMul")); + opBuilder.addInput(spIndices.asOutput()); + opBuilder.addInput(spValues.asOutput()); + opBuilder.addInput(spShape.asOutput()); + opBuilder.addInput(dense.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseDenseCwiseMul(opBuilder.build()); + } + + /** + * 1-D. The `N` values that are operated on. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseDenseCwiseMul(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseFillEmptyRows.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseFillEmptyRows.java new file mode 100644 index 00000000000..1e3a9e5f179 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseFillEmptyRows.java @@ -0,0 +1,136 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Fills empty rows in the input 2-D `SparseTensor` with a default value. + *

              + * The input `SparseTensor` is represented via the tuple of inputs + * (`indices`, `values`, `dense_shape`). The output `SparseTensor` has the + * same `dense_shape` but with indices `output_indices` and values + * `output_values`. + *

              + * This op inserts a single entry for every row that doesn't have any values. + * The index is created as `[row, 0, ..., 0]` and the inserted value + * is `default_value`. + *

              + * For example, suppose `sp_input` has shape `[5, 6]` and non-empty values: + *

              + * [0, 1]: a + * [0, 3]: b + * [2, 0]: c + * [3, 1]: d + *

              + * Rows 1 and 4 are empty, so the output will be of shape `[5, 6]` with values: + *

              + * [0, 1]: a + * [0, 3]: b + * [1, 0]: default_value + * [2, 0]: c + * [3, 1]: d + * [4, 0]: default_value + *

              + * The output `SparseTensor` will be in row-major order and will have the + * same shape as the input. + *

              + * This op also returns an indicator vector shaped `[dense_shape[0]]` such that + *

              + * empty_row_indicator[i] = True iff row i was an empty row. + *

              + * And a reverse index map vector shaped `[indices.shape[0]]` that is used during + * backpropagation, + *

              + * reverse_index_map[j] = out_j s.t. indices[j, :] == output_indices[out_j, :] + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseFillEmptyRows extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseFillEmptyRows operation. + * + * @param scope current scope + * @param indices 2-D. the indices of the sparse tensor. + * @param values 1-D. the values of the sparse tensor. + * @param denseShape 1-D. the shape of the sparse tensor. + * @param defaultValue 0-D. default value to insert into location `[row, 0, ..., 0]` + * for rows missing from the input sparse tensor. + * output indices: 2-D. the indices of the filled sparse tensor. + * @return a new instance of SparseFillEmptyRows + */ + public static SparseFillEmptyRows create(Scope scope, Operand indices, Operand values, Operand denseShape, Operand defaultValue) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseFillEmptyRows", scope.makeOpName("SparseFillEmptyRows")); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder.addInput(denseShape.asOutput()); + opBuilder.addInput(defaultValue.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseFillEmptyRows(opBuilder.build()); + } + + /** + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * 1-D. the values of the filled sparse tensor. + */ + public Output outputValues() { + return outputValues; + } + + /** + * 1-D. whether the dense row was missing in the + * input sparse tensor. + */ + public Output emptyRowIndicator() { + return emptyRowIndicator; + } + + /** + * 1-D. a map from the input indices to the output indices. + */ + public Output reverseIndexMap() { + return reverseIndexMap; + } + + private Output outputIndices; + private Output outputValues; + private Output emptyRowIndicator; + private Output reverseIndexMap; + + private SparseFillEmptyRows(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + emptyRowIndicator = operation.output(outputIdx++); + reverseIndexMap = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseFillEmptyRowsGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseFillEmptyRowsGrad.java new file mode 100644 index 00000000000..af952c6f48a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseFillEmptyRowsGrad.java @@ -0,0 +1,84 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * The gradient of SparseFillEmptyRows. + *

              + * Takes vectors reverse_index_map, shaped `[N]`, and grad_values, + * shaped `[N_full]`, where `N_full >= N` and copies data into either + * `d_values` or `d_default_value`. Here `d_values` is shaped `[N]` and + * `d_default_value` is a scalar. + *

              + * d_values[j] = grad_values[reverse_index_map[j]] + * d_default_value = sum_{k : 0 .. N_full - 1} ( + * grad_values[k] * 1{k not in reverse_index_map}) + * + * @param data type for {@code dValues()} output + */ +@Operator(group = "sparse") +public final class SparseFillEmptyRowsGrad extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseFillEmptyRowsGrad operation. + * + * @param scope current scope + * @param reverseIndexMap 1-D. The reverse index map from SparseFillEmptyRows. + * @param gradValues 1-D. The gradients from backprop. + * @return a new instance of SparseFillEmptyRowsGrad + */ + public static SparseFillEmptyRowsGrad create(Scope scope, Operand reverseIndexMap, Operand gradValues) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseFillEmptyRowsGrad", scope.makeOpName("SparseFillEmptyRowsGrad")); + opBuilder.addInput(reverseIndexMap.asOutput()); + opBuilder.addInput(gradValues.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseFillEmptyRowsGrad(opBuilder.build()); + } + + /** + * 1-D. The backprop into values. + */ + public Output dValues() { + return dValues; + } + + /** + * 0-D. The backprop into default_value. + */ + public Output dDefaultValue() { + return dDefaultValue; + } + + private Output dValues; + private Output dDefaultValue; + + private SparseFillEmptyRowsGrad(Operation operation) { + super(operation); + int outputIdx = 0; + dValues = operation.output(outputIdx++); + dDefaultValue = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseMatMul.java new file mode 100644 index 00000000000..b4978aa4a4c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseMatMul.java @@ -0,0 +1,169 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Multiply matrix "a" by matrix "b". + *

              + * The inputs must be two-dimensional matrices and the inner dimension of "a" must + * match the outer dimension of "b". Both "a" and "b" must be `Tensor`s not + * `SparseTensor`s. This op is optimized for the case where at least one of "a" or + * "b" is sparse, in the sense that they have a large proportion of zero values. + * The breakeven for using this versus a dense matrix multiply on one platform was + * 30% zero values in the sparse matrix. + *

              + * The gradient computation of this operation will only take advantage of sparsity + * in the input gradient when that gradient comes from a Relu. + */ +@Operator(group = "sparse") +public final class SparseMatMul extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseMatMul} + */ + public static class Options { + + /** + * @param transposeA + */ + public Options transposeA(Boolean transposeA) { + this.transposeA = transposeA; + return this; + } + + /** + * @param transposeB + */ + public Options transposeB(Boolean transposeB) { + this.transposeB = transposeB; + return this; + } + + /** + * @param aIsSparse + */ + public Options aIsSparse(Boolean aIsSparse) { + this.aIsSparse = aIsSparse; + return this; + } + + /** + * @param bIsSparse + */ + public Options bIsSparse(Boolean bIsSparse) { + this.bIsSparse = bIsSparse; + return this; + } + + private Boolean transposeA; + private Boolean transposeB; + private Boolean aIsSparse; + private Boolean bIsSparse; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseMatMul operation. + * + * @param scope current scope + * @param a + * @param b + * @param options carries optional attributes values + * @return a new instance of SparseMatMul + */ + public static SparseMatMul create(Scope scope, Operand a, Operand b, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseMatMul", scope.makeOpName("SparseMatMul")); + opBuilder.addInput(a.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.transposeA != null) { + opBuilder.setAttr("transpose_a", opts.transposeA); + } + if (opts.transposeB != null) { + opBuilder.setAttr("transpose_b", opts.transposeB); + } + if (opts.aIsSparse != null) { + opBuilder.setAttr("a_is_sparse", opts.aIsSparse); + } + if (opts.bIsSparse != null) { + opBuilder.setAttr("b_is_sparse", opts.bIsSparse); + } + } + } + return new SparseMatMul(opBuilder.build()); + } + + /** + * @param transposeA + */ + public static Options transposeA(Boolean transposeA) { + return new Options().transposeA(transposeA); + } + + /** + * @param transposeB + */ + public static Options transposeB(Boolean transposeB) { + return new Options().transposeB(transposeB); + } + + /** + * @param aIsSparse + */ + public static Options aIsSparse(Boolean aIsSparse) { + return new Options().aIsSparse(aIsSparse); + } + + /** + * @param bIsSparse + */ + public static Options bIsSparse(Boolean bIsSparse) { + return new Options().bIsSparse(bIsSparse); + } + + /** + */ + public Output product() { + return product; + } + + @Override + public Output asOutput() { + return product; + } + + private Output product; + + private SparseMatMul(Operation operation) { + super(operation); + int outputIdx = 0; + product = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceMax.java new file mode 100644 index 00000000000..7b399d15ff3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceMax.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the max of elements across dimensions of a SparseTensor. + *

              + * This Op takes a SparseTensor and is the sparse counterpart to + * `tf.reduce_max()`. In particular, this Op also returns a dense `Tensor` + * instead of a sparse one. + *

              + * Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained + * with length 1. + *

              + * If `reduction_axes` has no entries, all dimensions are reduced, and a tensor + * with a single element is returned. Additionally, the axes can be negative, + * which are interpreted according to the indexing rules in Python. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseReduceMax extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseReduceMax} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseReduceMax operation. + * + * @param scope current scope + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceMax + */ + public static SparseReduceMax create(Scope scope, Operand inputIndices, Operand inputValues, Operand inputShape, Operand reductionAxes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseReduceMax", scope.makeOpName("SparseReduceMax")); + opBuilder.addInput(inputIndices.asOutput()); + opBuilder.addInput(inputValues.asOutput()); + opBuilder.addInput(inputShape.asOutput()); + opBuilder.addInput(reductionAxes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new SparseReduceMax(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * `R-K`-D. The reduced Tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseReduceMax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceMaxSparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceMaxSparse.java new file mode 100644 index 00000000000..06f9d79d429 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceMaxSparse.java @@ -0,0 +1,133 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the max of elements across dimensions of a SparseTensor. + *

              + * This Op takes a SparseTensor and is the sparse counterpart to + * `tf.reduce_max()`. In contrast to SparseReduceMax, this Op returns a + * SparseTensor. + *

              + * Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained + * with length 1. + *

              + * If `reduction_axes` has no entries, all dimensions are reduced, and a tensor + * with a single element is returned. Additionally, the axes can be negative, + * which are interpreted according to the indexing rules in Python. + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseReduceMaxSparse extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseReduceMaxSparse} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseReduceMaxSparse operation. + * + * @param scope current scope + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceMaxSparse + */ + public static SparseReduceMaxSparse create(Scope scope, Operand inputIndices, Operand inputValues, Operand inputShape, Operand reductionAxes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseReduceMaxSparse", scope.makeOpName("SparseReduceMaxSparse")); + opBuilder.addInput(inputIndices.asOutput()); + opBuilder.addInput(inputValues.asOutput()); + opBuilder.addInput(inputShape.asOutput()); + opBuilder.addInput(reductionAxes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new SparseReduceMaxSparse(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + */ + public Output outputIndices() { + return outputIndices; + } + + /** + */ + public Output outputValues() { + return outputValues; + } + + /** + */ + public Output outputShape() { + return outputShape; + } + + private Output outputIndices; + private Output outputValues; + private Output outputShape; + + private SparseReduceMaxSparse(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + outputShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceSum.java new file mode 100644 index 00000000000..81ca8cd6287 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceSum.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum of elements across dimensions of a SparseTensor. + *

              + * This Op takes a SparseTensor and is the sparse counterpart to + * `tf.reduce_sum()`. In particular, this Op also returns a dense `Tensor` + * instead of a sparse one. + *

              + * Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained + * with length 1. + *

              + * If `reduction_axes` has no entries, all dimensions are reduced, and a tensor + * with a single element is returned. Additionally, the axes can be negative, + * which are interpreted according to the indexing rules in Python. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseReduceSum extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseReduceSum} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseReduceSum operation. + * + * @param scope current scope + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceSum + */ + public static SparseReduceSum create(Scope scope, Operand inputIndices, Operand inputValues, Operand inputShape, Operand reductionAxes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseReduceSum", scope.makeOpName("SparseReduceSum")); + opBuilder.addInput(inputIndices.asOutput()); + opBuilder.addInput(inputValues.asOutput()); + opBuilder.addInput(inputShape.asOutput()); + opBuilder.addInput(reductionAxes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new SparseReduceSum(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * `R-K`-D. The reduced Tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseReduceSum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceSumSparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceSumSparse.java new file mode 100644 index 00000000000..3cb7d8f4246 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReduceSumSparse.java @@ -0,0 +1,133 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum of elements across dimensions of a SparseTensor. + *

              + * This Op takes a SparseTensor and is the sparse counterpart to + * `tf.reduce_sum()`. In contrast to SparseReduceSum, this Op returns a + * SparseTensor. + *

              + * Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless + * `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in + * `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained + * with length 1. + *

              + * If `reduction_axes` has no entries, all dimensions are reduced, and a tensor + * with a single element is returned. Additionally, the axes can be negative, + * which are interpreted according to the indexing rules in Python. + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseReduceSumSparse extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseReduceSumSparse} + */ + public static class Options { + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + private Boolean keepDims; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseReduceSumSparse operation. + * + * @param scope current scope + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @param reductionAxes 1-D. Length-`K` vector containing the reduction axes. + * @param options carries optional attributes values + * @return a new instance of SparseReduceSumSparse + */ + public static SparseReduceSumSparse create(Scope scope, Operand inputIndices, Operand inputValues, Operand inputShape, Operand reductionAxes, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseReduceSumSparse", scope.makeOpName("SparseReduceSumSparse")); + opBuilder.addInput(inputIndices.asOutput()); + opBuilder.addInput(inputValues.asOutput()); + opBuilder.addInput(inputShape.asOutput()); + opBuilder.addInput(reductionAxes.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + } + } + return new SparseReduceSumSparse(opBuilder.build()); + } + + /** + * @param keepDims If true, retain reduced dimensions with length 1. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + */ + public Output outputIndices() { + return outputIndices; + } + + /** + */ + public Output outputValues() { + return outputValues; + } + + /** + */ + public Output outputShape() { + return outputShape; + } + + private Output outputIndices; + private Output outputValues; + private Output outputShape; + + private SparseReduceSumSparse(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + outputShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReorder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReorder.java new file mode 100644 index 00000000000..a29e4225324 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReorder.java @@ -0,0 +1,88 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reorders a SparseTensor into the canonical, row-major ordering. + *

              + * Note that by convention, all sparse ops preserve the canonical ordering along + * increasing dimension number. The only time ordering can be violated is during + * manual manipulation of the indices and values vectors to add entries. + *

              + * Reordering does not affect the shape of the SparseTensor. + *

              + * If the tensor has rank `R` and `N` non-empty values, `input_indices` has + * shape `[N, R]`, input_values has length `N`, and input_shape has length `R`. + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseReorder extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseReorder operation. + * + * @param scope current scope + * @param inputIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, possibly not in canonical ordering. + * @param inputValues 1-D. `N` non-empty values corresponding to `input_indices`. + * @param inputShape 1-D. Shape of the input SparseTensor. + * @return a new instance of SparseReorder + */ + public static SparseReorder create(Scope scope, Operand inputIndices, Operand inputValues, Operand inputShape) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseReorder", scope.makeOpName("SparseReorder")); + opBuilder.addInput(inputIndices.asOutput()); + opBuilder.addInput(inputValues.asOutput()); + opBuilder.addInput(inputShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseReorder(opBuilder.build()); + } + + /** + * 2-D. `N x R` matrix with the same indices as input_indices, but + * in canonical row-major ordering. + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * 1-D. `N` non-empty values corresponding to `output_indices`. + */ + public Output outputValues() { + return outputValues; + } + + private Output outputIndices; + private Output outputValues; + + private SparseReorder(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReshape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReshape.java new file mode 100644 index 00000000000..fa01b3f03c2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseReshape.java @@ -0,0 +1,95 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Reshapes a SparseTensor to represent values in a new dense shape. + *

              + * This operation has the same semantics as reshape on the represented dense + * tensor. The `input_indices` are recomputed based on the requested `new_shape`. + *

              + * If one component of `new_shape` is the special value -1, the size of that + * dimension is computed so that the total dense size remains constant. At + * most one component of `new_shape` can be -1. The number of dense elements + * implied by `new_shape` must be the same as the number of dense elements + * originally implied by `input_shape`. + *

              + * Reshaping does not affect the order of values in the SparseTensor. + *

              + * If the input tensor has rank `R_in` and `N` non-empty values, and `new_shape` + * has length `R_out`, then `input_indices` has shape `[N, R_in]`, + * `input_shape` has length `R_in`, `output_indices` has shape `[N, R_out]`, and + * `output_shape` has length `R_out`. + */ +@Operator(group = "sparse") +public final class SparseReshape extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseReshape operation. + * + * @param scope current scope + * @param inputIndices 2-D. `N x R_in` matrix with the indices of non-empty values in a + * SparseTensor. + * @param inputShape 1-D. `R_in` vector with the input SparseTensor's dense shape. + * @param newShape 1-D. `R_out` vector with the requested new dense shape. + * @return a new instance of SparseReshape + */ + public static SparseReshape create(Scope scope, Operand inputIndices, Operand inputShape, Operand newShape) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseReshape", scope.makeOpName("SparseReshape")); + opBuilder.addInput(inputIndices.asOutput()); + opBuilder.addInput(inputShape.asOutput()); + opBuilder.addInput(newShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseReshape(opBuilder.build()); + } + + /** + * 2-D. `N x R_out` matrix with the updated indices of non-empty + * values in the output SparseTensor. + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * 1-D. `R_out` vector with the full dense shape of the output + * SparseTensor. This is the same as `new_shape` but with any -1 dimensions + * filled in. + */ + public Output outputShape() { + return outputShape; + } + + private Output outputIndices; + private Output outputShape; + + private SparseReshape(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMean.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMean.java new file mode 100644 index 00000000000..293e89925c0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMean.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the mean along sparse segments of a tensor. + *

              + * See `tf.sparse.segment_sum` for usage examples. + *

              + * Like `SegmentMean`, but `segment_ids` can have rank less than `data`'s first + * dimension, selecting a subset of dimension 0, specified by `indices`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentMean extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentMean operation. + * + * @param scope current scope + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @return a new instance of SparseSegmentMean + */ + public static SparseSegmentMean create(Scope scope, Operand data, Operand indices, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentMean", scope.makeOpName("SparseSegmentMean")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentMean(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentMean(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanGrad.java new file mode 100644 index 00000000000..21ca5f6b2ff --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanGrad.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes gradients for SparseSegmentMean. + *

              + * Returns tensor "output" with same shape as grad, except for dimension 0 whose + * value is output_dim0. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentMeanGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentMeanGrad operation. + * + * @param scope current scope + * @param grad gradient propagated to the SparseSegmentMean op. + * @param indices indices passed to the corresponding SparseSegmentMean op. + * @param segmentIds segment_ids passed to the corresponding SparseSegmentMean op. + * @param outputDim0 dimension 0 of "data" passed to SparseSegmentMean op. + * @return a new instance of SparseSegmentMeanGrad + */ + public static SparseSegmentMeanGrad create(Scope scope, Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentMeanGrad", scope.makeOpName("SparseSegmentMeanGrad")); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(outputDim0.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentMeanGrad(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentMeanGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanWithNumSegments.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanWithNumSegments.java new file mode 100644 index 00000000000..d0892757cf6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanWithNumSegments.java @@ -0,0 +1,83 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the mean along sparse segments of a tensor. + *

              + * Like `SparseSegmentMean`, but allows missing ids in `segment_ids`. If an id is + * misisng, the `output` tensor at that position will be zeroed. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentMeanWithNumSegments extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentMeanWithNumSegments operation. + * + * @param scope current scope + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @param numSegments Should equal the number of distinct segment IDs. + * @return a new instance of SparseSegmentMeanWithNumSegments + */ + public static SparseSegmentMeanWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentMeanWithNumSegments", scope.makeOpName("SparseSegmentMeanWithNumSegments")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentMeanWithNumSegments(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which has size + * `num_segments`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentMeanWithNumSegments(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtN.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtN.java new file mode 100644 index 00000000000..4e2a851f043 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtN.java @@ -0,0 +1,79 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum along sparse segments of a tensor divided by the sqrt of N. + *

              + * N is the size of the segment being reduced. + *

              + * See `tf.sparse.segment_sum` for usage examples. + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentSqrtN extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentSqrtN operation. + * + * @param scope current scope + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @return a new instance of SparseSegmentSqrtN + */ + public static SparseSegmentSqrtN create(Scope scope, Operand data, Operand indices, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSqrtN", scope.makeOpName("SparseSegmentSqrtN")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentSqrtN(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentSqrtN(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNGrad.java new file mode 100644 index 00000000000..1f935e4b9d1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNGrad.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes gradients for SparseSegmentSqrtN. + *

              + * Returns tensor "output" with same shape as grad, except for dimension 0 whose + * value is output_dim0. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentSqrtNGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentSqrtNGrad operation. + * + * @param scope current scope + * @param grad gradient propagated to the SparseSegmentSqrtN op. + * @param indices indices passed to the corresponding SparseSegmentSqrtN op. + * @param segmentIds segment_ids passed to the corresponding SparseSegmentSqrtN op. + * @param outputDim0 dimension 0 of "data" passed to SparseSegmentSqrtN op. + * @return a new instance of SparseSegmentSqrtNGrad + */ + public static SparseSegmentSqrtNGrad create(Scope scope, Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSqrtNGrad", scope.makeOpName("SparseSegmentSqrtNGrad")); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(outputDim0.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentSqrtNGrad(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentSqrtNGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNWithNumSegments.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNWithNumSegments.java new file mode 100644 index 00000000000..e64f0cd2ae7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNWithNumSegments.java @@ -0,0 +1,85 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum along sparse segments of a tensor divided by the sqrt of N. + *

              + * N is the size of the segment being reduced. + *

              + * Like `SparseSegmentSqrtN`, but allows missing ids in `segment_ids`. If an id is + * misisng, the `output` tensor at that position will be zeroed. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentSqrtNWithNumSegments extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentSqrtNWithNumSegments operation. + * + * @param scope current scope + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @param numSegments Should equal the number of distinct segment IDs. + * @return a new instance of SparseSegmentSqrtNWithNumSegments + */ + public static SparseSegmentSqrtNWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSqrtNWithNumSegments", scope.makeOpName("SparseSegmentSqrtNWithNumSegments")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentSqrtNWithNumSegments(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentSqrtNWithNumSegments(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSum.java new file mode 100644 index 00000000000..e4e1e4552f9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSum.java @@ -0,0 +1,104 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum along sparse segments of a tensor. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) + * for an explanation of segments. + *

              + * Like `SegmentSum`, but `segment_ids` can have rank less than `data`'s first + * dimension, selecting a subset of dimension 0, specified by `indices`. + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
              + * 
              + * # Select two rows, one segment.
              + * tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0]))
              + * # => [[0 0 0 0]]
              + * 
              + * # Select two rows, two segment.
              + * tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1]))
              + * # => [[ 1  2  3  4]
              + * #     [-1 -2 -3 -4]]
              + * 
              + * # Select all rows, two segments.
              + * tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1]))
              + * # => [[0 0 0 0]
              + * #     [5 6 7 8]]
              + * 
              + * # Which is equivalent to:
              + * tf.segment_sum(c, tf.constant([0, 0, 1]))
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentSum extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentSum operation. + * + * @param scope current scope + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @return a new instance of SparseSegmentSum + */ + public static SparseSegmentSum create(Scope scope, Operand data, Operand indices, Operand segmentIds) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSum", scope.makeOpName("SparseSegmentSum")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentSum(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `k`, the number of segments. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentSum(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSumWithNumSegments.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSumWithNumSegments.java new file mode 100644 index 00000000000..35f7dcf6ec2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSumWithNumSegments.java @@ -0,0 +1,104 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes the sum along sparse segments of a tensor. + *

              + * Like `SparseSegmentSum`, but allows missing ids in `segment_ids`. If an id is + * misisng, the `output` tensor at that position will be zeroed. + *

              + * Read + * [the section on segmentation](https://tensorflow.org/api_docs/python/tf/sparse#Segmentation) + * for an explanation of segments. + *

              + * For example: + *

              {@code
              + * c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
              + * 
              + * tf.sparse_segment_sum_with_num_segments(
              + *     c, tf.constant([0, 1]), tf.constant([0, 0]), num_segments=3)
              + * # => [[0 0 0 0]
              + * #     [0 0 0 0]
              + * #     [0 0 0 0]]
              + * 
              + * tf.sparse_segment_sum_with_num_segments(c,
              + *                                         tf.constant([0, 1]),
              + *                                         tf.constant([0, 2],
              + *                                         num_segments=4))
              + * # => [[ 1  2  3  4]
              + * #     [ 0  0  0  0]
              + * #     [-1 -2 -3 -4]
              + * #     [ 0  0  0  0]]
              + * }
              + * + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSegmentSumWithNumSegments extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSegmentSumWithNumSegments operation. + * + * @param scope current scope + * @param data + * @param indices A 1-D tensor. Has same rank as `segment_ids`. + * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. + * @param numSegments Should equal the number of distinct segment IDs. + * @return a new instance of SparseSegmentSumWithNumSegments + */ + public static SparseSegmentSumWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSumWithNumSegments", scope.makeOpName("SparseSegmentSumWithNumSegments")); + opBuilder.addInput(data.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(segmentIds.asOutput()); + opBuilder.addInput(numSegments.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSegmentSumWithNumSegments(opBuilder.build()); + } + + /** + * Has same shape as data, except for dimension 0 which + * has size `num_segments`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSegmentSumWithNumSegments(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSlice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSlice.java new file mode 100644 index 00000000000..7a1b01270c4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSlice.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Slice a `SparseTensor` based on the `start` and `size`. + *

              + * For example, if the input is + *

              + * input_tensor = shape = [2, 7] + * [ a d e ] + * [b c ] + *

              + * Graphically the output tensors are: + *

              + * sparse_slice([0, 0], [2, 4]) = shape = [2, 4] + * [ a ] + * [b c ] + *

              + * sparse_slice([0, 4], [2, 3]) = shape = [2, 3] + * [ d e ] + * [ ] + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseSlice extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseSlice operation. + * + * @param scope current scope + * @param indices 2-D tensor represents the indices of the sparse tensor. + * @param values 1-D tensor represents the values of the sparse tensor. + * @param shape 1-D. tensor represents the shape of the sparse tensor. + * @param start 1-D. tensor represents the start of the slice. + * @param size 1-D. tensor represents the size of the slice. + * output indices: A list of 1-D tensors represents the indices of the output + * sparse tensors. + * @return a new instance of SparseSlice + */ + public static SparseSlice create(Scope scope, Operand indices, Operand values, Operand shape, Operand start, Operand size) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSlice", scope.makeOpName("SparseSlice")); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder.addInput(start.asOutput()); + opBuilder.addInput(size.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSlice(opBuilder.build()); + } + + /** + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * A list of 1-D tensors represents the values of the output sparse + * tensors. + */ + public Output outputValues() { + return outputValues; + } + + /** + * A list of 1-D tensors represents the shape of the output sparse + * tensors. + */ + public Output outputShape() { + return outputShape; + } + + private Output outputIndices; + private Output outputValues; + private Output outputShape; + + private SparseSlice(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + outputShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSliceGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSliceGrad.java new file mode 100644 index 00000000000..8d94122ed98 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSliceGrad.java @@ -0,0 +1,80 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * The gradient operator for the SparseSlice op. + *

              + * This op takes in the upstream gradient w.r.t. non-empty values of + * the sliced `SparseTensor`, and outputs the gradients w.r.t. + * the non-empty values of input `SparseTensor`. + * + * @param data type for {@code valGrad()} output + */ +@Operator(group = "sparse") +public final class SparseSliceGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSliceGrad operation. + * + * @param scope current scope + * @param backpropValGrad 1-D. The gradient with respect to + * the non-empty values of the sliced `SparseTensor`. + * @param inputIndices 2-D. The `indices` of the input `SparseTensor`. + * @param inputStart 1-D. tensor represents the start of the slice. + * @param outputIndices 2-D. The `indices` of the sliced `SparseTensor`. + * @return a new instance of SparseSliceGrad + */ + public static SparseSliceGrad create(Scope scope, Operand backpropValGrad, Operand inputIndices, Operand inputStart, Operand outputIndices) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSliceGrad", scope.makeOpName("SparseSliceGrad")); + opBuilder.addInput(backpropValGrad.asOutput()); + opBuilder.addInput(inputIndices.asOutput()); + opBuilder.addInput(inputStart.asOutput()); + opBuilder.addInput(outputIndices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSliceGrad(opBuilder.build()); + } + + /** + * 1-D. The gradient with respect to the non-empty values of input `SparseTensor`. + */ + public Output valGrad() { + return valGrad; + } + + @Override + public Output asOutput() { + return valGrad; + } + + private Output valGrad; + + private SparseSliceGrad(Operation operation) { + super(operation); + int outputIdx = 0; + valGrad = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSoftmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSoftmax.java new file mode 100644 index 00000000000..f71f0e05558 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSoftmax.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies softmax to a batched N-D `SparseTensor`. + *

              + * The inputs represent an N-D SparseTensor with logical shape `[..., B, C]` + * (where `N >= 2`), and with indices sorted in the canonical lexicographic order. + *

              + * This op is equivalent to applying the normal `tf.nn.softmax()` to each innermost + * logical submatrix with shape `[B, C]`, but with the catch that the implicitly + * zero elements do not participate. Specifically, the algorithm is equivalent + * to the following: + *

              + * (1) Applies `tf.nn.softmax()` to a densified view of each innermost submatrix + * with shape `[B, C]`, along the size-C dimension; + * (2) Masks out the original implicitly-zero locations; + * (3) Renormalizes the remaining elements. + *

              + * Hence, the `SparseTensor` result has exactly the same non-zero indices and + * shape. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseSoftmax extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseSoftmax operation. + * + * @param scope current scope + * @param spIndices 2-D. `NNZ x R` matrix with the indices of non-empty values in a + * SparseTensor, in canonical ordering. + * @param spValues 1-D. `NNZ` non-empty values corresponding to `sp_indices`. + * @param spShape 1-D. Shape of the input SparseTensor. + * @return a new instance of SparseSoftmax + */ + public static SparseSoftmax create(Scope scope, Operand spIndices, Operand spValues, Operand spShape) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSoftmax", scope.makeOpName("SparseSoftmax")); + opBuilder.addInput(spIndices.asOutput()); + opBuilder.addInput(spValues.asOutput()); + opBuilder.addInput(spShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSoftmax(opBuilder.build()); + } + + /** + * 1-D. The `NNZ` values for the result `SparseTensor`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseSoftmax(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSparseMaximum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSparseMaximum.java new file mode 100644 index 00000000000..0ccafcd5462 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSparseMaximum.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the element-wise max of two SparseTensors. + *

              + * Assumes the two SparseTensors have the same shape, i.e., no broadcasting. + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseSparseMaximum extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseSparseMaximum operation. + * + * @param scope current scope + * @param aIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, in the canonical lexicographic ordering. + * @param aValues 1-D. `N` non-empty values corresponding to `a_indices`. + * @param aShape 1-D. Shape of the input SparseTensor. + * @param bIndices counterpart to `a_indices` for the other operand. + * @param bValues counterpart to `a_values` for the other operand; must be of the same dtype. + * @param bShape counterpart to `a_shape` for the other operand; the two shapes must be equal. + * @return a new instance of SparseSparseMaximum + */ + public static SparseSparseMaximum create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand bIndices, Operand bValues, Operand bShape) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSparseMaximum", scope.makeOpName("SparseSparseMaximum")); + opBuilder.addInput(aIndices.asOutput()); + opBuilder.addInput(aValues.asOutput()); + opBuilder.addInput(aShape.asOutput()); + opBuilder.addInput(bIndices.asOutput()); + opBuilder.addInput(bValues.asOutput()); + opBuilder.addInput(bShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSparseMaximum(opBuilder.build()); + } + + /** + * 2-D. The indices of the output SparseTensor. + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * 1-D. The values of the output SparseTensor. + */ + public Output outputValues() { + return outputValues; + } + + private Output outputIndices; + private Output outputValues; + + private SparseSparseMaximum(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSparseMinimum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSparseMinimum.java new file mode 100644 index 00000000000..4099c9d44fb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSparseMinimum.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the element-wise min of two SparseTensors. + *

              + * Assumes the two SparseTensors have the same shape, i.e., no broadcasting. + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseSparseMinimum extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseSparseMinimum operation. + * + * @param scope current scope + * @param aIndices 2-D. `N x R` matrix with the indices of non-empty values in a + * SparseTensor, in the canonical lexicographic ordering. + * @param aValues 1-D. `N` non-empty values corresponding to `a_indices`. + * @param aShape 1-D. Shape of the input SparseTensor. + * @param bIndices counterpart to `a_indices` for the other operand. + * @param bValues counterpart to `a_values` for the other operand; must be of the same dtype. + * @param bShape counterpart to `a_shape` for the other operand; the two shapes must be equal. + * @return a new instance of SparseSparseMinimum + */ + public static SparseSparseMinimum create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand bIndices, Operand bValues, Operand bShape) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSparseMinimum", scope.makeOpName("SparseSparseMinimum")); + opBuilder.addInput(aIndices.asOutput()); + opBuilder.addInput(aValues.asOutput()); + opBuilder.addInput(aShape.asOutput()); + opBuilder.addInput(bIndices.asOutput()); + opBuilder.addInput(bValues.asOutput()); + opBuilder.addInput(bShape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseSparseMinimum(opBuilder.build()); + } + + /** + * 2-D. The indices of the output SparseTensor. + */ + public Output outputIndices() { + return outputIndices; + } + + /** + * 1-D. The values of the output SparseTensor. + */ + public Output outputValues() { + return outputValues; + } + + private Output outputIndices; + private Output outputValues; + + private SparseSparseMinimum(Operation operation) { + super(operation); + int outputIdx = 0; + outputIndices = operation.output(outputIdx++); + outputValues = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSplit.java new file mode 100644 index 00000000000..0fafdf7f38e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSplit.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Split a `SparseTensor` into `num_split` tensors along one dimension. + *

              + * If the `shape[split_dim]` is not an integer multiple of `num_split`. Slices + * `[0 : shape[split_dim] % num_split]` gets one extra dimension. + * For example, if `split_dim = 1` and `num_split = 2` and the input is + *

              + * input_tensor = shape = [2, 7] + * [ a d e ] + * [b c ] + *

              + * Graphically the output tensors are: + *

              + * output_tensor[0] = shape = [2, 4] + * [ a ] + * [b c ] + *

              + * output_tensor[1] = shape = [2, 3] + * [ d e ] + * [ ] + * + * @param data type for {@code outputValues()} output + */ +@Operator(group = "sparse") +public final class SparseSplit extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SparseSplit operation. + * + * @param scope current scope + * @param splitDim 0-D. The dimension along which to split. Must be in the range + * `[0, rank(shape))`. + * @param indices 2-D tensor represents the indices of the sparse tensor. + * @param values 1-D tensor represents the values of the sparse tensor. + * @param shape 1-D. tensor represents the shape of the sparse tensor. + * output indices: A list of 1-D tensors represents the indices of the output + * sparse tensors. + * @param numSplit The number of ways to split. + * @return a new instance of SparseSplit + */ + public static SparseSplit create(Scope scope, Operand splitDim, Operand indices, Operand values, Operand shape, Long numSplit) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseSplit", scope.makeOpName("SparseSplit")); + opBuilder.addInput(splitDim.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_split", numSplit); + return new SparseSplit(opBuilder.build()); + } + + /** + */ + public List> outputIndices() { + return outputIndices; + } + + /** + * A list of 1-D tensors represents the values of the output sparse + * tensors. + */ + public List> outputValues() { + return outputValues; + } + + /** + * A list of 1-D tensors represents the shape of the output sparse + * tensors. + */ + public List> outputShape() { + return outputShape; + } + + private List> outputIndices; + private List> outputValues; + private List> outputShape; + + @SuppressWarnings("unchecked") + private SparseSplit(Operation operation) { + super(operation); + int outputIdx = 0; + int outputIndicesLength = operation.outputListLength("output_indices"); + outputIndices = Arrays.asList((Output[])operation.outputList(outputIdx, outputIndicesLength)); + outputIdx += outputIndicesLength; + int outputValuesLength = operation.outputListLength("output_values"); + outputValues = Arrays.asList((Output[])operation.outputList(outputIdx, outputValuesLength)); + outputIdx += outputValuesLength; + int outputShapeLength = operation.outputListLength("output_shape"); + outputShape = Arrays.asList((Output[])operation.outputList(outputIdx, outputShapeLength)); + outputIdx += outputShapeLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseAdd.java new file mode 100644 index 00000000000..2c27031864b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseAdd.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Adds up a `SparseTensor` and a dense `Tensor`, producing a dense `Tensor`. + *

              + * This Op does not require `a_indices` be sorted in standard lexicographic order. + * + * @param data type for {@code output()} output + */ +@Operator(group = "sparse") +public final class SparseTensorDenseAdd extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SparseTensorDenseAdd operation. + * + * @param scope current scope + * @param aIndices 2-D. The `indices` of the `SparseTensor`, with shape `[nnz, ndims]`. + * @param aValues 1-D. The `values` of the `SparseTensor`, with shape `[nnz]`. + * @param aShape 1-D. The `shape` of the `SparseTensor`, with shape `[ndims]`. + * @param b `ndims`-D Tensor. With shape `a_shape`. + * @return a new instance of SparseTensorDenseAdd + */ + public static SparseTensorDenseAdd create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand b) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseTensorDenseAdd", scope.makeOpName("SparseTensorDenseAdd")); + opBuilder.addInput(aIndices.asOutput()); + opBuilder.addInput(aValues.asOutput()); + opBuilder.addInput(aShape.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SparseTensorDenseAdd(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SparseTensorDenseAdd(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseMatMul.java new file mode 100644 index 00000000000..8d6b02e7ad4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseMatMul.java @@ -0,0 +1,141 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Multiply SparseTensor (of rank 2) "A" by dense matrix "B". + *

              + * No validity checking is performed on the indices of A. However, the following + * input format is recommended for optimal behavior: + *

              + * if adjoint_a == false: + * A should be sorted in lexicographically increasing order. Use SparseReorder + * if you're not sure. + * if adjoint_a == true: + * A should be sorted in order of increasing dimension 1 (i.e., "column major" + * order instead of "row major" order). + * + * @param data type for {@code product()} output + */ +@Operator(group = "sparse") +public final class SparseTensorDenseMatMul extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseTensorDenseMatMul} + */ + public static class Options { + + /** + * @param adjointA Use the adjoint of A in the matrix multiply. If A is complex, this + * is transpose(conj(A)). Otherwise it's transpose(A). + */ + public Options adjointA(Boolean adjointA) { + this.adjointA = adjointA; + return this; + } + + /** + * @param adjointB Use the adjoint of B in the matrix multiply. If B is complex, this + * is transpose(conj(B)). Otherwise it's transpose(B). + */ + public Options adjointB(Boolean adjointB) { + this.adjointB = adjointB; + return this; + } + + private Boolean adjointA; + private Boolean adjointB; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseTensorDenseMatMul operation. + * + * @param scope current scope + * @param aIndices 2-D. The `indices` of the `SparseTensor`, size `[nnz, 2]` Matrix. + * @param aValues 1-D. The `values` of the `SparseTensor`, size `[nnz]` Vector. + * @param aShape 1-D. The `shape` of the `SparseTensor`, size `[2]` Vector. + * @param b 2-D. A dense Matrix. + * @param options carries optional attributes values + * @return a new instance of SparseTensorDenseMatMul + */ + public static SparseTensorDenseMatMul create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand b, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseTensorDenseMatMul", scope.makeOpName("SparseTensorDenseMatMul")); + opBuilder.addInput(aIndices.asOutput()); + opBuilder.addInput(aValues.asOutput()); + opBuilder.addInput(aShape.asOutput()); + opBuilder.addInput(b.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.adjointA != null) { + opBuilder.setAttr("adjoint_a", opts.adjointA); + } + if (opts.adjointB != null) { + opBuilder.setAttr("adjoint_b", opts.adjointB); + } + } + } + return new SparseTensorDenseMatMul(opBuilder.build()); + } + + /** + * @param adjointA Use the adjoint of A in the matrix multiply. If A is complex, this + * is transpose(conj(A)). Otherwise it's transpose(A). + */ + public static Options adjointA(Boolean adjointA) { + return new Options().adjointA(adjointA); + } + + /** + * @param adjointB Use the adjoint of B in the matrix multiply. If B is complex, this + * is transpose(conj(B)). Otherwise it's transpose(B). + */ + public static Options adjointB(Boolean adjointB) { + return new Options().adjointB(adjointB); + } + + /** + */ + public Output product() { + return product; + } + + @Override + public Output asOutput() { + return product; + } + + private Output product; + + private SparseTensorDenseMatMul(Operation operation) { + super(operation); + int outputIdx = 0; + product = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseToDense.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseToDense.java new file mode 100644 index 00000000000..08a9994b220 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseToDense.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts a sparse representation into a dense tensor. + *

              + * Builds an array `dense` with shape `output_shape` such that + *

              {@code
              + * # If sparse_indices is scalar
              + * dense[i] = (i == sparse_indices ? sparse_values : default_value)
              + * 
              + * # If sparse_indices is a vector, then for each i
              + * dense[sparse_indices[i]] = sparse_values[i]
              + * 
              + * # If sparse_indices is an n by d matrix, then for each i in [0, n)
              + * dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i]
              + * }
              + * All other values in `dense` are set to `default_value`. If `sparse_values` is a + * scalar, all sparse indices are set to this single value. + *

              + * Indices should be sorted in lexicographic order, and indices must not + * contain any repeats. If `validate_indices` is true, these properties + * are checked during execution. + * + * @param data type for {@code dense()} output + */ +@Operator(group = "sparse") +public final class SparseToDense extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseToDense} + */ + public static class Options { + + /** + * @param validateIndices If true, indices are checked to make sure they are sorted in + * lexicographic order and that there are no repeats. + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + + private Boolean validateIndices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseToDense operation. + * + * @param scope current scope + * @param sparseIndices 0-D, 1-D, or 2-D. `sparse_indices[i]` contains the complete + * index where `sparse_values[i]` will be placed. + * @param outputShape 1-D. Shape of the dense output tensor. + * @param sparseValues 1-D. Values corresponding to each row of `sparse_indices`, + * or a scalar value to be used for all sparse indices. + * @param defaultValue Scalar value to set for indices not specified in + * `sparse_indices`. + * @param options carries optional attributes values + * @return a new instance of SparseToDense + */ + public static SparseToDense create(Scope scope, Operand sparseIndices, Operand outputShape, Operand sparseValues, Operand defaultValue, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseToDense", scope.makeOpName("SparseToDense")); + opBuilder.addInput(sparseIndices.asOutput()); + opBuilder.addInput(outputShape.asOutput()); + opBuilder.addInput(sparseValues.asOutput()); + opBuilder.addInput(defaultValue.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.validateIndices != null) { + opBuilder.setAttr("validate_indices", opts.validateIndices); + } + } + } + return new SparseToDense(opBuilder.build()); + } + + /** + * @param validateIndices If true, indices are checked to make sure they are sorted in + * lexicographic order and that there are no repeats. + */ + public static Options validateIndices(Boolean validateIndices) { + return new Options().validateIndices(validateIndices); + } + + /** + * Dense output tensor of shape `output_shape`. + */ + public Output dense() { + return dense; + } + + @Override + public Output asOutput() { + return dense; + } + + private Output dense; + + private SparseToDense(Operation operation) { + super(operation); + int outputIdx = 0; + dense = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseToSparseSetOperation.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseToSparseSetOperation.java new file mode 100644 index 00000000000..7018f43e82b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseToSparseSetOperation.java @@ -0,0 +1,162 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies set operation along last dimension of 2 `SparseTensor` inputs. + *

              + * See SetOperationOp::SetOperationFromContext for values of `set_operation`. + *

              + * If `validate_indices` is `True`, `sparse.SparseToSparseSetOperation` validates the + * order and range of `set1` and `set2` indices. + *

              + * Input `set1` is a `SparseTensor` represented by `set1_indices`, `set1_values`, + * and `set1_shape`. For `set1` ranked `n`, 1st `n-1` dimensions must be the same + * as `set2`. Dimension `n` contains values in a set, duplicates are allowed but + * ignored. + *

              + * Input `set2` is a `SparseTensor` represented by `set2_indices`, `set2_values`, + * and `set2_shape`. For `set2` ranked `n`, 1st `n-1` dimensions must be the same + * as `set1`. Dimension `n` contains values in a set, duplicates are allowed but + * ignored. + *

              + * If `validate_indices` is `True`, this op validates the order and range of `set1` + * and `set2` indices. + *

              + * Output `result` is a `SparseTensor` represented by `result_indices`, + * `result_values`, and `result_shape`. For `set1` and `set2` ranked `n`, this + * has rank `n` and the same 1st `n-1` dimensions as `set1` and `set2`. The `nth` + * dimension contains the result of `set_operation` applied to the corresponding + * `[0...n-1]` dimension of `set`. + * + * @param data type for {@code resultValues()} output + */ +@Operator(group = "sparse") +public final class SparseToSparseSetOperation extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.SparseToSparseSetOperation} + */ + public static class Options { + + /** + * @param validateIndices + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + + private Boolean validateIndices; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseToSparseSetOperation operation. + * + * @param scope current scope + * @param set1Indices 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major + * order. + * @param set1Values 1D `Tensor`, values of a `SparseTensor`. Must be in row-major + * order. + * @param set1Shape 1D `Tensor`, shape of a `SparseTensor`. `set1_shape[0...n-1]` must + * be the same as `set2_shape[0...n-1]`, `set1_shape[n]` is the + * max set size across `0...n-1` dimensions. + * @param set2Indices 2D `Tensor`, indices of a `SparseTensor`. Must be in row-major + * order. + * @param set2Values 1D `Tensor`, values of a `SparseTensor`. Must be in row-major + * order. + * @param set2Shape 1D `Tensor`, shape of a `SparseTensor`. `set2_shape[0...n-1]` must + * be the same as `set1_shape[0...n-1]`, `set2_shape[n]` is the + * max set size across `0...n-1` dimensions. + * @param setOperation + * @param options carries optional attributes values + * @return a new instance of SparseToSparseSetOperation + */ + public static SparseToSparseSetOperation create(Scope scope, Operand set1Indices, Operand set1Values, Operand set1Shape, Operand set2Indices, Operand set2Values, Operand set2Shape, String setOperation, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseToSparseSetOperation", scope.makeOpName("SparseToSparseSetOperation")); + opBuilder.addInput(set1Indices.asOutput()); + opBuilder.addInput(set1Values.asOutput()); + opBuilder.addInput(set1Shape.asOutput()); + opBuilder.addInput(set2Indices.asOutput()); + opBuilder.addInput(set2Values.asOutput()); + opBuilder.addInput(set2Shape.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("set_operation", setOperation); + if (options != null) { + for (Options opts : options) { + if (opts.validateIndices != null) { + opBuilder.setAttr("validate_indices", opts.validateIndices); + } + } + } + return new SparseToSparseSetOperation(opBuilder.build()); + } + + /** + * @param validateIndices + */ + public static Options validateIndices(Boolean validateIndices) { + return new Options().validateIndices(validateIndices); + } + + /** + * 2D indices of a `SparseTensor`. + */ + public Output resultIndices() { + return resultIndices; + } + + /** + * 1D values of a `SparseTensor`. + */ + public Output resultValues() { + return resultValues; + } + + /** + * 1D `Tensor` shape of a `SparseTensor`. `result_shape[0...n-1]` is + * the same as the 1st `n-1` dimensions of `set1` and `set2`, `result_shape[n]` + * is the max result set size across all `0...n-1` dimensions. + */ + public Output resultShape() { + return resultShape; + } + + private Output resultIndices; + private Output resultValues; + private Output resultShape; + + private SparseToSparseSetOperation(Operation operation) { + super(operation); + int outputIdx = 0; + resultIndices = operation.output(outputIdx++); + resultValues = operation.output(outputIdx++); + resultShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/TakeManySparseFromTensorsMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/TakeManySparseFromTensorsMap.java new file mode 100644 index 00000000000..93ce8141b96 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/TakeManySparseFromTensorsMap.java @@ -0,0 +1,189 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.sparse; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Read `SparseTensors` from a `SparseTensorsMap` and concatenate them. + *

              + * The input `sparse_handles` must be an `int64` matrix of shape `[N, 1]` where + * `N` is the minibatch size and the rows correspond to the output handles of + * `AddSparseToTensorsMap` or `AddManySparseToTensorsMap`. The ranks of the + * original `SparseTensor` objects that went into the given input ops must all + * match. When the final `SparseTensor` is created, it has rank one + * higher than the ranks of the incoming `SparseTensor` objects + * (they have been concatenated along a new row dimension on the left). + *

              + * The output `SparseTensor` object's shape values for all dimensions but the + * first are the max across the input `SparseTensor` objects' shape values + * for the corresponding dimensions. Its first shape value is `N`, the minibatch + * size. + *

              + * The input `SparseTensor` objects' indices are assumed ordered in + * standard lexicographic order. If this is not the case, after this + * step run `SparseReorder` to restore index ordering. + *

              + * For example, if the handles represent an input, which is a `[2, 3]` matrix + * representing two original `SparseTensor` objects: + *

              {@code
              + *     index = [ 0]
              + *             [10]
              + *             [20]
              + *     values = [1, 2, 3]
              + *     shape = [50]
              + * }
              + * and + *
              {@code
              + *     index = [ 2]
              + *             [10]
              + *     values = [4, 5]
              + *     shape = [30]
              + * }
              + * then the final `SparseTensor` will be: + *
              {@code
              + *     index = [0  0]
              + *             [0 10]
              + *             [0 20]
              + *             [1  2]
              + *             [1 10]
              + *     values = [1, 2, 3, 4, 5]
              + *     shape = [2 50]
              + * }
              + * + * + * @param data type for {@code sparseValues()} output + */ +@Operator(group = "sparse") +public final class TakeManySparseFromTensorsMap extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.sparse.TakeManySparseFromTensorsMap} + */ + public static class Options { + + /** + * @param container The container name for the `SparseTensorsMap` read by this op. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName The shared name for the `SparseTensorsMap` read by this op. + * It should not be blank; rather the `shared_name` or unique Operation name + * of the Op that created the original `SparseTensorsMap` should be used. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + private String container; + private String sharedName; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new TakeManySparseFromTensorsMap operation. + * + * @param scope current scope + * @param sparseHandles 1-D, The `N` serialized `SparseTensor` objects. + * Shape: `[N]`. + * @param dtype The `dtype` of the `SparseTensor` objects stored in the + * `SparseTensorsMap`. + * @param options carries optional attributes values + * @return a new instance of TakeManySparseFromTensorsMap + */ + public static TakeManySparseFromTensorsMap create(Scope scope, Operand sparseHandles, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("TakeManySparseFromTensorsMap", scope.makeOpName("TakeManySparseFromTensorsMap")); + opBuilder.addInput(sparseHandles.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + } + } + return new TakeManySparseFromTensorsMap(opBuilder.build()); + } + + /** + * @param container The container name for the `SparseTensorsMap` read by this op. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName The shared name for the `SparseTensorsMap` read by this op. + * It should not be blank; rather the `shared_name` or unique Operation name + * of the Op that created the original `SparseTensorsMap` should be used. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * 2-D. The `indices` of the minibatch `SparseTensor`. + */ + public Output sparseIndices() { + return sparseIndices; + } + + /** + * 1-D. The `values` of the minibatch `SparseTensor`. + */ + public Output sparseValues() { + return sparseValues; + } + + /** + * 1-D. The `shape` of the minibatch `SparseTensor`. + */ + public Output sparseShape() { + return sparseShape; + } + + private Output sparseIndices; + private Output sparseValues; + private Output sparseShape; + + private TakeManySparseFromTensorsMap(Operation operation) { + super(operation); + int outputIdx = 0; + sparseIndices = operation.output(outputIdx++); + sparseValues = operation.output(outputIdx++); + sparseShape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Join.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Join.java new file mode 100644 index 00000000000..62e81851ff5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Join.java @@ -0,0 +1,105 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Joins the strings in the given list of string tensors into one tensor; + *

              + * with the given separator (default is an empty separator). + */ +@Operator(group = "strings") +public final class Join extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.Join} + */ + public static class Options { + + /** + * @param separator string, an optional join separator. + */ + public Options separator(String separator) { + this.separator = separator; + return this; + } + + private String separator; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Join operation. + * + * @param scope current scope + * @param inputs A list of string tensors. The tensors must all have the same shape, + * or be scalars. Scalars may be mixed in; these will be broadcast to the shape + * of non-scalar inputs. + * @param options carries optional attributes values + * @return a new instance of Join + */ + public static Join create(Scope scope, Iterable> inputs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StringJoin", scope.makeOpName("Join")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.separator != null) { + opBuilder.setAttr("separator", opts.separator); + } + } + } + return new Join(opBuilder.build()); + } + + /** + * @param separator string, an optional join separator. + */ + public static Options separator(String separator) { + return new Options().separator(separator); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Join(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ReduceJoin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ReduceJoin.java new file mode 100644 index 00000000000..cf28fe3d69c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ReduceJoin.java @@ -0,0 +1,149 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Joins a string Tensor across the given dimensions. + *

              + * Computes the string join across dimensions in the given string Tensor of shape + * `[\\(d_0, d_1, ..., d_{n-1}\\)]`. Returns a new Tensor created by joining the input + * strings with the given separator (default: empty string). Negative indices are + * counted backwards from the end, with `-1` being equivalent to `n - 1`. If + * indices are not specified, joins across all dimensions beginning from `n - 1` + * through `0`. + *

              + * For example: + *

              {@code
              + * # tensor `a` is [["a", "b"], ["c", "d"]]
              + * tf.reduce_join(a, 0) ==> ["ac", "bd"]
              + * tf.reduce_join(a, 1) ==> ["ab", "cd"]
              + * tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"]
              + * tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"]
              + * tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]]
              + * tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]]
              + * tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"]
              + * tf.reduce_join(a, [0, 1]) ==> "acbd"
              + * tf.reduce_join(a, [1, 0]) ==> "abcd"
              + * tf.reduce_join(a, []) ==> [["a", "b"], ["c", "d"]]
              + * tf.reduce_join(a) = tf.reduce_join(a, [1, 0]) ==> "abcd"
              + * }
              + * + */ +@Operator(group = "strings") +public final class ReduceJoin extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.ReduceJoin} + */ + public static class Options { + + /** + * @param keepDims If `True`, retain reduced dimensions with length `1`. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + + /** + * @param separator The separator to use when joining. + */ + public Options separator(String separator) { + this.separator = separator; + return this; + } + + private Boolean keepDims; + private String separator; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ReduceJoin operation. + * + * @param scope current scope + * @param inputs The input to be joined. All reduced indices must have non-zero size. + * @param reductionIndices The dimensions to reduce over. Dimensions are reduced in the + * order specified. Omitting `reduction_indices` is equivalent to passing + * `[n-1, n-2, ..., 0]`. Negative indices from `-n` to `-1` are supported. + * @param options carries optional attributes values + * @return a new instance of ReduceJoin + */ + public static ReduceJoin create(Scope scope, Operand inputs, Operand reductionIndices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ReduceJoin", scope.makeOpName("ReduceJoin")); + opBuilder.addInput(inputs.asOutput()); + opBuilder.addInput(reductionIndices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.keepDims != null) { + opBuilder.setAttr("keep_dims", opts.keepDims); + } + if (opts.separator != null) { + opBuilder.setAttr("separator", opts.separator); + } + } + } + return new ReduceJoin(opBuilder.build()); + } + + /** + * @param keepDims If `True`, retain reduced dimensions with length `1`. + */ + public static Options keepDims(Boolean keepDims) { + return new Options().keepDims(keepDims); + } + + /** + * @param separator The separator to use when joining. + */ + public static Options separator(String separator) { + return new Options().separator(separator); + } + + /** + * Has shape equal to that of the input with reduced dimensions removed or + * set to `1` depending on `keep_dims`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ReduceJoin(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/RegexFullMatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/RegexFullMatch.java new file mode 100644 index 00000000000..ef99dcaf7f0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/RegexFullMatch.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Check if the input matches the regex pattern. + *

              + * The input is a string tensor of any shape. The pattern is a scalar + * string tensor which is applied to every element of the input tensor. + * The boolean values (True or False) of the output tensor indicate + * if the input matches the regex pattern provided. + *

              + * The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) + */ +@Operator(group = "strings") +public final class RegexFullMatch extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new RegexFullMatch operation. + * + * @param scope current scope + * @param input A string tensor of the text to be processed. + * @param pattern A scalar string tensor containing the regular expression to match the input. + * @return a new instance of RegexFullMatch + */ + public static RegexFullMatch create(Scope scope, Operand input, Operand pattern) { + OperationBuilder opBuilder = scope.env().opBuilder("RegexFullMatch", scope.makeOpName("RegexFullMatch")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(pattern.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new RegexFullMatch(opBuilder.build()); + } + + /** + * A bool tensor with the same shape as `input`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RegexFullMatch(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/RegexReplace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/RegexReplace.java new file mode 100644 index 00000000000..90abd5d9d97 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/RegexReplace.java @@ -0,0 +1,113 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Replaces matches of the `pattern` regular expression in `input` with the + * replacement string provided in `rewrite`. + *

              + * It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) + */ +@Operator(group = "strings") +public final class RegexReplace extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.RegexReplace} + */ + public static class Options { + + /** + * @param replaceGlobal If True, the replacement is global (that is, all matches of the `pattern` regular + * expression in each input string are rewritten), otherwise the `rewrite` + * substitution is only made for the first `pattern` match. + */ + public Options replaceGlobal(Boolean replaceGlobal) { + this.replaceGlobal = replaceGlobal; + return this; + } + + private Boolean replaceGlobal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RegexReplace operation. + * + * @param scope current scope + * @param input The text to be processed. + * @param pattern The regular expression to be matched in the `input` strings. + * @param rewrite The rewrite string to be substituted for the `pattern` expression where it is + * matched in the `input` strings. + * @param options carries optional attributes values + * @return a new instance of RegexReplace + */ + public static RegexReplace create(Scope scope, Operand input, Operand pattern, Operand rewrite, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RegexReplace", scope.makeOpName("RegexReplace")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(pattern.asOutput()); + opBuilder.addInput(rewrite.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.replaceGlobal != null) { + opBuilder.setAttr("replace_global", opts.replaceGlobal); + } + } + } + return new RegexReplace(opBuilder.build()); + } + + /** + * @param replaceGlobal If True, the replacement is global (that is, all matches of the `pattern` regular + * expression in each input string are rewritten), otherwise the `rewrite` + * substitution is only made for the first `pattern` match. + */ + public static Options replaceGlobal(Boolean replaceGlobal) { + return new Options().replaceGlobal(replaceGlobal); + } + + /** + * The text after applying pattern match and rewrite substitution. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private RegexReplace(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StaticRegexFullMatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StaticRegexFullMatch.java new file mode 100644 index 00000000000..ba57d3fc909 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StaticRegexFullMatch.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Check if the input matches the regex pattern. + *

              + * The input is a string tensor of any shape. The pattern is the + * regular expression to be matched with every element of the input tensor. + * The boolean values (True or False) of the output tensor indicate + * if the input matches the regex pattern provided. + *

              + * The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) + */ +public final class StaticRegexFullMatch extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StaticRegexFullMatch operation. + * + * @param scope current scope + * @param input A string tensor of the text to be processed. + * @param pattern The regular expression to match the input. + * @return a new instance of StaticRegexFullMatch + */ + public static StaticRegexFullMatch create(Scope scope, Operand input, String pattern) { + OperationBuilder opBuilder = scope.env().opBuilder("StaticRegexFullMatch", scope.makeOpName("StaticRegexFullMatch")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("pattern", pattern); + return new StaticRegexFullMatch(opBuilder.build()); + } + + /** + * A bool tensor with the same shape as `input`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StaticRegexFullMatch(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StaticRegexReplace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StaticRegexReplace.java new file mode 100644 index 00000000000..af094e057c1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StaticRegexReplace.java @@ -0,0 +1,107 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Replaces the match of pattern in input with rewrite. + *

              + * It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) + */ +public final class StaticRegexReplace extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.StaticRegexReplace} + */ + public static class Options { + + /** + * @param replaceGlobal If True, the replacement is global, otherwise the replacement + * is done only on the first match. + */ + public Options replaceGlobal(Boolean replaceGlobal) { + this.replaceGlobal = replaceGlobal; + return this; + } + + private Boolean replaceGlobal; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StaticRegexReplace operation. + * + * @param scope current scope + * @param input The text to be processed. + * @param pattern The regular expression to match the input. + * @param rewrite The rewrite to be applied to the matched expression. + * @param options carries optional attributes values + * @return a new instance of StaticRegexReplace + */ + public static StaticRegexReplace create(Scope scope, Operand input, String pattern, String rewrite, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StaticRegexReplace", scope.makeOpName("StaticRegexReplace")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("pattern", pattern); + opBuilder.setAttr("rewrite", rewrite); + if (options != null) { + for (Options opts : options) { + if (opts.replaceGlobal != null) { + opBuilder.setAttr("replace_global", opts.replaceGlobal); + } + } + } + return new StaticRegexReplace(opBuilder.build()); + } + + /** + * @param replaceGlobal If True, the replacement is global, otherwise the replacement + * is done only on the first match. + */ + public static Options replaceGlobal(Boolean replaceGlobal) { + return new Options().replaceGlobal(replaceGlobal); + } + + /** + * The text after applying pattern and rewrite. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StaticRegexReplace(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringFormat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringFormat.java new file mode 100644 index 00000000000..cabf4dce51f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringFormat.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Formats a string template using a list of tensors. + *

              + * Formats a string template using a list of tensors, pretty-printing tensor summaries. + */ +@Operator(group = "strings") +public final class StringFormat extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.StringFormat} + */ + public static class Options { + + /** + * @param template A string, the template to format tensor summaries into. + */ + public Options template(String template) { + this.template = template; + return this; + } + + /** + * @param placeholder A string, at each placeholder in the template a subsequent tensor summary will be inserted. + */ + public Options placeholder(String placeholder) { + this.placeholder = placeholder; + return this; + } + + /** + * @param summarize When formatting the tensor summaries print the first and last summarize entries of each tensor dimension. + */ + public Options summarize(Long summarize) { + this.summarize = summarize; + return this; + } + + private String template; + private String placeholder; + private Long summarize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StringFormat operation. + * + * @param scope current scope + * @param inputs The list of tensors to format into the placeholder string. + * @param options carries optional attributes values + * @return a new instance of StringFormat + */ + public static StringFormat create(Scope scope, Iterable> inputs, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StringFormat", scope.makeOpName("StringFormat")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.template != null) { + opBuilder.setAttr("template", opts.template); + } + if (opts.placeholder != null) { + opBuilder.setAttr("placeholder", opts.placeholder); + } + if (opts.summarize != null) { + opBuilder.setAttr("summarize", opts.summarize); + } + } + } + return new StringFormat(opBuilder.build()); + } + + /** + * @param template A string, the template to format tensor summaries into. + */ + public static Options template(String template) { + return new Options().template(template); + } + + /** + * @param placeholder A string, at each placeholder in the template a subsequent tensor summary will be inserted. + */ + public static Options placeholder(String placeholder) { + return new Options().placeholder(placeholder); + } + + /** + * @param summarize When formatting the tensor summaries print the first and last summarize entries of each tensor dimension. + */ + public static Options summarize(Long summarize) { + return new Options().summarize(summarize); + } + + /** + * = The resulting string scalar. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StringFormat(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringLength.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringLength.java new file mode 100644 index 00000000000..bbac3a54868 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringLength.java @@ -0,0 +1,112 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * String lengths of `input`. + *

              + * Computes the length of each string given in the input tensor. + */ +@Operator(group = "strings") +public final class StringLength extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.StringLength} + */ + public static class Options { + + /** + * @param unit The unit that is counted to compute string length. One of: `"BYTE"` (for + * the number of bytes in each string) or `"UTF8_CHAR"` (for the number of UTF-8 + * encoded Unicode code points in each string). Results are undefined + * if `unit=UTF8_CHAR` and the `input` strings do not contain structurally + * valid UTF-8. + */ + public Options unit(String unit) { + this.unit = unit; + return this; + } + + private String unit; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StringLength operation. + * + * @param scope current scope + * @param input The string for which to compute the length. + * @param options carries optional attributes values + * @return a new instance of StringLength + */ + public static StringLength create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StringLength", scope.makeOpName("StringLength")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.unit != null) { + opBuilder.setAttr("unit", opts.unit); + } + } + } + return new StringLength(opBuilder.build()); + } + + /** + * @param unit The unit that is counted to compute string length. One of: `"BYTE"` (for + * the number of bytes in each string) or `"UTF8_CHAR"` (for the number of UTF-8 + * encoded Unicode code points in each string). Results are undefined + * if `unit=UTF8_CHAR` and the `input` strings do not contain structurally + * valid UTF-8. + */ + public static Options unit(String unit) { + return new Options().unit(unit); + } + + /** + * Integer tensor that has the same shape as `input`. The output contains the + * element-wise string lengths of `input`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private StringLength(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringSplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringSplit.java new file mode 100644 index 00000000000..a56d350e51f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/StringSplit.java @@ -0,0 +1,137 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Split elements of `source` based on `sep` into a `SparseTensor`. + *

              + * Let N be the size of source (typically N will be the batch size). Split each + * element of `source` based on `sep` and return a `SparseTensor` + * containing the split tokens. Empty tokens are ignored. + *

              + * For example, N = 2, source[0] is 'hello world' and source[1] is 'a b c', + * then the output will be + *

              {@code
              + * st.indices = [0, 0;
              + *               0, 1;
              + *               1, 0;
              + *               1, 1;
              + *               1, 2]
              + * st.shape = [2, 3]
              + * st.values = ['hello', 'world', 'a', 'b', 'c']
              + * }
              + * If `sep` is given, consecutive delimiters are not grouped together and are + * deemed to delimit empty strings. For example, source of `"1<>2<><>3"` and + * sep of `"<>"` returns `["1", "2", "", "3"]`. If `sep` is None or an empty + * string, consecutive whitespace are regarded as a single separator, and the + * result will contain no empty strings at the startor end if the string has + * leading or trailing whitespace. + *

              + * Note that the above mentioned behavior matches python's str.split. + */ +@Operator(group = "strings") +public final class StringSplit extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.StringSplit} + */ + public static class Options { + + /** + * @param maxsplit An `int`. If `maxsplit > 0`, limit of the split of the result. + */ + public Options maxsplit(Long maxsplit) { + this.maxsplit = maxsplit; + return this; + } + + private Long maxsplit; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new StringSplit operation. + * + * @param scope current scope + * @param input `1-D` string `Tensor`, the strings to split. + * @param sep `0-D` string `Tensor`, the delimiter character. + * @param options carries optional attributes values + * @return a new instance of StringSplit + */ + public static StringSplit create(Scope scope, Operand input, Operand sep, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("StringSplitV2", scope.makeOpName("StringSplit")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(sep.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.maxsplit != null) { + opBuilder.setAttr("maxsplit", opts.maxsplit); + } + } + } + return new StringSplit(opBuilder.build()); + } + + /** + * @param maxsplit An `int`. If `maxsplit > 0`, limit of the split of the result. + */ + public static Options maxsplit(Long maxsplit) { + return new Options().maxsplit(maxsplit); + } + + /** + */ + public Output indices() { + return indices; + } + + /** + */ + public Output values() { + return values; + } + + /** + */ + public Output shape() { + return shape; + } + + private Output indices; + private Output values; + private Output shape; + + private StringSplit(Operation operation) { + super(operation); + int outputIdx = 0; + indices = operation.output(outputIdx++); + values = operation.output(outputIdx++); + shape = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Strip.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Strip.java new file mode 100644 index 00000000000..ffa6f27797c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Strip.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Strip leading and trailing whitespaces from the Tensor. + */ +@Operator(group = "strings") +public final class Strip extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new Strip operation. + * + * @param scope current scope + * @param input A string `Tensor` of any shape. + * @return a new instance of Strip + */ + public static Strip create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("StringStrip", scope.makeOpName("Strip")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Strip(opBuilder.build()); + } + + /** + * A string `Tensor` of the same shape as the input. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Strip(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Substr.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Substr.java new file mode 100644 index 00000000000..baeb6e50400 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/Substr.java @@ -0,0 +1,183 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Return substrings from `Tensor` of strings. + *

              + * For each string in the input `Tensor`, creates a substring starting at index + * `pos` with a total length of `len`. + *

              + * If `len` defines a substring that would extend beyond the length of the input + * string, then as many characters as possible are used. + *

              + * A negative `pos` indicates distance within the string backwards from the end. + *

              + * If `pos` specifies an index which is out of range for any of the input strings, + * then an `InvalidArgumentError` is thrown. + *

              + * `pos` and `len` must have the same shape, otherwise a `ValueError` is thrown on + * Op creation. + *

              + * NOTE: `strings.Substr` supports broadcasting up to two dimensions. More about + * broadcasting + * [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) + *

              + * --- + *

              + * Examples + *

              + * Using scalar `pos` and `len`: + *

              {@code
              + * input = [b'Hello', b'World']
              + * position = 1
              + * length = 3
              + * 
              + * output = [b'ell', b'orl']
              + * }
              + * Using `pos` and `len` with same shape as `input`: + *
              {@code
              + * input = [[b'ten', b'eleven', b'twelve'],
              + *          [b'thirteen', b'fourteen', b'fifteen'],
              + *          [b'sixteen', b'seventeen', b'eighteen']]
              + * position = [[1, 2, 3],
              + *             [1, 2, 3],
              + *             [1, 2, 3]]
              + * length =   [[2, 3, 4],
              + *             [4, 3, 2],
              + *             [5, 5, 5]]
              + * 
              + * output = [[b'en', b'eve', b'lve'],
              + *           [b'hirt', b'urt', b'te'],
              + *           [b'ixtee', b'vente', b'hteen']]
              + * }
              + * Broadcasting `pos` and `len` onto `input`: + *
              {@code
              + * input = [[b'ten', b'eleven', b'twelve'],
              + *          [b'thirteen', b'fourteen', b'fifteen'],
              + *          [b'sixteen', b'seventeen', b'eighteen'],
              + *          [b'nineteen', b'twenty', b'twentyone']]
              + * position = [1, 2, 3]
              + * length =   [1, 2, 3]
              + * 
              + * output = [[b'e', b'ev', b'lve'],
              + *           [b'h', b'ur', b'tee'],
              + *           [b'i', b've', b'hte'],
              + *           [b'i', b'en', b'nty']]
              + * }
              + * Broadcasting `input` onto `pos` and `len`: + *
              {@code
              + * input = b'thirteen'
              + * position = [1, 5, 7]
              + * length =   [3, 2, 1]
              + * 
              + * output = [b'hir', b'ee', b'n']
              + * }
              + * + */ +@Operator(group = "strings") +public final class Substr extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.Substr} + */ + public static class Options { + + /** + * @param unit The unit that is used to create the substring. One of: `"BYTE"` (for + * defining position and length by bytes) or `"UTF8_CHAR"` (for the UTF-8 + * encoded Unicode code points). The default is `"BYTE"`. Results are undefined if + * `unit=UTF8_CHAR` and the `input` strings do not contain structurally valid + * UTF-8. + */ + public Options unit(String unit) { + this.unit = unit; + return this; + } + + private String unit; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new Substr operation. + * + * @param scope current scope + * @param input Tensor of strings + * @param pos Scalar defining the position of first character in each substring + * @param len Scalar defining the number of characters to include in each substring + * @param options carries optional attributes values + * @return a new instance of Substr + */ + public static Substr create(Scope scope, Operand input, Operand pos, Operand len, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("Substr", scope.makeOpName("Substr")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(pos.asOutput()); + opBuilder.addInput(len.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.unit != null) { + opBuilder.setAttr("unit", opts.unit); + } + } + } + return new Substr(opBuilder.build()); + } + + /** + * @param unit The unit that is used to create the substring. One of: `"BYTE"` (for + * defining position and length by bytes) or `"UTF8_CHAR"` (for the UTF-8 + * encoded Unicode code points). The default is `"BYTE"`. Results are undefined if + * `unit=UTF8_CHAR` and the `input` strings do not contain structurally valid + * UTF-8. + */ + public static Options unit(String unit) { + return new Options().unit(unit); + } + + /** + * Tensor of substrings + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private Substr(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucket.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucket.java new file mode 100644 index 00000000000..568af6a5c5f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucket.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts each string in the input Tensor to its hash mod by a number of buckets. + *

              + * The hash function is deterministic on the content of the string within the + * process. + *

              + * Note that the hash function may change from time to time. + * This functionality will be deprecated and it's recommended to use + * `tf.string_to_hash_bucket_fast()` or `tf.string_to_hash_bucket_strong()`. + */ +@Operator(group = "strings") +public final class ToHashBucket extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ToHashBucket operation. + * + * @param scope current scope + * @param stringTensor + * @param numBuckets The number of buckets. + * @return a new instance of ToHashBucket + */ + public static ToHashBucket create(Scope scope, Operand stringTensor, Long numBuckets) { + OperationBuilder opBuilder = scope.env().opBuilder("StringToHashBucket", scope.makeOpName("ToHashBucket")); + opBuilder.addInput(stringTensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_buckets", numBuckets); + return new ToHashBucket(opBuilder.build()); + } + + /** + * A Tensor of the same shape as the input `string_tensor`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ToHashBucket(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucketFast.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucketFast.java new file mode 100644 index 00000000000..5726d89ae0e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucketFast.java @@ -0,0 +1,76 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts each string in the input Tensor to its hash mod by a number of buckets. + *

              + * The hash function is deterministic on the content of the string within the + * process and will never change. However, it is not suitable for cryptography. + * This function may be used when CPU time is scarce and inputs are trusted or + * unimportant. There is a risk of adversaries constructing inputs that all hash + * to the same bucket. To prevent this problem, use a strong hash function with + * `tf.string_to_hash_bucket_strong`. + */ +@Operator(group = "strings") +public final class ToHashBucketFast extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ToHashBucketFast operation. + * + * @param scope current scope + * @param input The strings to assign a hash bucket. + * @param numBuckets The number of buckets. + * @return a new instance of ToHashBucketFast + */ + public static ToHashBucketFast create(Scope scope, Operand input, Long numBuckets) { + OperationBuilder opBuilder = scope.env().opBuilder("StringToHashBucketFast", scope.makeOpName("ToHashBucketFast")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_buckets", numBuckets); + return new ToHashBucketFast(opBuilder.build()); + } + + /** + * A Tensor of the same shape as the input `string_tensor`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ToHashBucketFast(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucketStrong.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucketStrong.java new file mode 100644 index 00000000000..76fcb3d319a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToHashBucketStrong.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts each string in the input Tensor to its hash mod by a number of buckets. + *

              + * The hash function is deterministic on the content of the string within the + * process. The hash function is a keyed hash function, where attribute `key` + * defines the key of the hash function. `key` is an array of 2 elements. + *

              + * A strong hash is important when inputs may be malicious, e.g. URLs with + * additional components. Adversaries could try to make their inputs hash to the + * same bucket for a denial-of-service attack or to skew the results. A strong + * hash can be used to make it difficult to find inputs with a skewed hash value + * distribution over buckets. This requires that the hash function is + * seeded by a high-entropy (random) "key" unknown to the adversary. + *

              + * The additional robustness comes at a cost of roughly 4x higher compute + * time than `tf.string_to_hash_bucket_fast`. + */ +@Operator(group = "strings") +public final class ToHashBucketStrong extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ToHashBucketStrong operation. + * + * @param scope current scope + * @param input The strings to assign a hash bucket. + * @param numBuckets The number of buckets. + * @param key The key used to seed the hash function, passed as a list of two uint64 + * elements. + * @return a new instance of ToHashBucketStrong + */ + public static ToHashBucketStrong create(Scope scope, Operand input, Long numBuckets, List key) { + OperationBuilder opBuilder = scope.env().opBuilder("StringToHashBucketStrong", scope.makeOpName("ToHashBucketStrong")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("num_buckets", numBuckets); + long[] keyArray = new long[key.size()]; + for (int i = 0; i < keyArray.length; ++i) { + keyArray[i] = key.get(i); + } + opBuilder.setAttr("key", keyArray); + return new ToHashBucketStrong(opBuilder.build()); + } + + /** + * A Tensor of the same shape as the input `string_tensor`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ToHashBucketStrong(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToNumber.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToNumber.java new file mode 100644 index 00000000000..7517b0852d8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/ToNumber.java @@ -0,0 +1,86 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Converts each string in the input Tensor to the specified numeric type. + *

              + * (Note that int32 overflow results in an error while float overflow + * results in a rounded value.) + * + * @param data type for {@code output()} output + */ +@Operator(group = "strings") +public final class ToNumber extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ToNumber operation. + * + * @param scope current scope + * @param stringTensor + * @param outType The numeric type to interpret each string in `string_tensor` as. + * @return a new instance of ToNumber + */ + public static ToNumber create(Scope scope, Operand stringTensor, Class outType) { + OperationBuilder opBuilder = scope.env().opBuilder("StringToNumber", scope.makeOpName("ToNumber")); + opBuilder.addInput(stringTensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("out_type", DataType.fromClass(outType)); + return new ToNumber(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new ToNumber operation using default output types. + * + * @param scope current scope + * @param stringTensor + * @return a new instance of ToNumber + */ + public static ToNumber create(Scope scope, Operand stringTensor) { + return create(scope, stringTensor, Float.class); + } + + /** + * A Tensor of the same shape as the input `string_tensor`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private ToNumber(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeDecodeWithOffsets.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeDecodeWithOffsets.java new file mode 100644 index 00000000000..fc959f0b38e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeDecodeWithOffsets.java @@ -0,0 +1,218 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Decodes each string in `input` into a sequence of Unicode code points. + *

              + * The character codepoints for all strings are returned using a single vector + * `char_values`, with strings expanded to characters in row-major order. + * Similarly, the character start byte offsets are returned using a single vector + * `char_to_byte_starts`, with strings expanded in row-major order. + *

              + * The `row_splits` tensor indicates where the codepoints and start offsets for + * each input string begin and end within the `char_values` and + * `char_to_byte_starts` tensors. In particular, the values for the `i`th + * string (in row-major order) are stored in the slice + * `[row_splits[i]:row_splits[i+1]]`. Thus: + *

                + *
              • + * `char_values[row_splits[i]+j]` is the Unicode codepoint for the `j`th + * character in the `i`th string (in row-major order). + *
              • + *
              • + * `char_to_bytes_starts[row_splits[i]+j]` is the start byte offset for the `j`th + * character in the `i`th string (in row-major order). + *
              • + *
              • + * `row_splits[i+1] - row_splits[i]` is the number of characters in the `i`th + * string (in row-major order). + * + * @param data type for {@code rowSplits()} output + */ +public final class UnicodeDecodeWithOffsets extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.UnicodeDecodeWithOffsets} + */ + public static class Options { + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public Options errors(String errors) { + this.errors = errors; + return this; + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD or U+65533.) + */ + public Options replacementChar(Long replacementChar) { + this.replacementChar = replacementChar; + return this; + } + + /** + * @param replaceControlCharacters Whether to replace the C0 control characters (00-1F) with the + * `replacement_char`. Default is false. + */ + public Options replaceControlCharacters(Boolean replaceControlCharacters) { + this.replaceControlCharacters = replaceControlCharacters; + return this; + } + + private String errors; + private Long replacementChar; + private Boolean replaceControlCharacters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new UnicodeDecodeWithOffsets operation. + * + * @param scope current scope + * @param input The text to be decoded. Can have any shape. Note that the output is flattened + * to a vector of char values. + * @param inputEncoding Text encoding of the input strings. This is any of the encodings supported + * by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. + * @param Tsplits + * @param options carries optional attributes values + * @return a new instance of UnicodeDecodeWithOffsets + */ + public static UnicodeDecodeWithOffsets create(Scope scope, Operand input, String inputEncoding, Class Tsplits, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("UnicodeDecodeWithOffsets", scope.makeOpName("UnicodeDecodeWithOffsets")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("input_encoding", inputEncoding); + opBuilder.setAttr("Tsplits", DataType.fromClass(Tsplits)); + if (options != null) { + for (Options opts : options) { + if (opts.errors != null) { + opBuilder.setAttr("errors", opts.errors); + } + if (opts.replacementChar != null) { + opBuilder.setAttr("replacement_char", opts.replacementChar); + } + if (opts.replaceControlCharacters != null) { + opBuilder.setAttr("replace_control_characters", opts.replaceControlCharacters); + } + } + } + return new UnicodeDecodeWithOffsets(opBuilder.build()); + } + + /** + * Factory method to create a class wrapping a new UnicodeDecodeWithOffsets operation using default output types. + * + * @param scope current scope + * @param input The text to be decoded. Can have any shape. Note that the output is flattened + * to a vector of char values. + * @param inputEncoding Text encoding of the input strings. This is any of the encodings supported + * by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. + * @param options carries optional attributes values + * @return a new instance of UnicodeDecodeWithOffsets + */ + public static UnicodeDecodeWithOffsets create(Scope scope, Operand input, String inputEncoding, Options... options) { + return create(scope, input, inputEncoding, Long.class, options); + } + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public static Options errors(String errors) { + return new Options().errors(errors); + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD or U+65533.) + */ + public static Options replacementChar(Long replacementChar) { + return new Options().replacementChar(replacementChar); + } + + /** + * @param replaceControlCharacters Whether to replace the C0 control characters (00-1F) with the + * `replacement_char`. Default is false. + */ + public static Options replaceControlCharacters(Boolean replaceControlCharacters) { + return new Options().replaceControlCharacters(replaceControlCharacters); + } + + /** + * A 1D int32 tensor containing the row splits. + */ + public Output rowSplits() { + return rowSplits; + } + + /** + * A 1D int32 Tensor containing the decoded codepoints. + */ + public Output charValues() { + return charValues; + } + + /** + * A 1D int32 Tensor containing the byte index in the input string where each + * character in `char_values` starts. + */ + public Output charToByteStarts() { + return charToByteStarts; + } + + private Output rowSplits; + private Output charValues; + private Output charToByteStarts; + + private UnicodeDecodeWithOffsets(Operation operation) { + super(operation); + int outputIdx = 0; + rowSplits = operation.output(outputIdx++); + charValues = operation.output(outputIdx++); + charToByteStarts = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeScript.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeScript.java new file mode 100644 index 00000000000..3ef65dc3bb9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeScript.java @@ -0,0 +1,73 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Determine the script codes of a given tensor of Unicode integer code points. + *

                + * This operation converts Unicode code points to script codes corresponding to + * each code point. Script codes correspond to International Components for + * Unicode (ICU) UScriptCode values. See http://icu-project.org/apiref/icu4c/uscript_8h.html. + * Returns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will + * match input shape. + */ +@Operator(group = "strings") +public final class UnicodeScript extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new UnicodeScript operation. + * + * @param scope current scope + * @param input A Tensor of int32 Unicode code points. + * @return a new instance of UnicodeScript + */ + public static UnicodeScript create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("UnicodeScript", scope.makeOpName("UnicodeScript")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new UnicodeScript(opBuilder.build()); + } + + /** + * A Tensor of int32 script codes corresponding to each input code point. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnicodeScript(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeTranscode.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeTranscode.java new file mode 100644 index 00000000000..5f92fc940a3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeTranscode.java @@ -0,0 +1,200 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.strings; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Transcode the input text from a source encoding to a destination encoding. + *

                + * The input is a string tensor of any shape. The output is a string tensor of + * the same shape containing the transcoded strings. Output strings are always + * valid unicode. If the input contains invalid encoding positions, the + * `errors` attribute sets the policy for how to deal with them. If the default + * error-handling policy is used, invalid formatting will be substituted in the + * output by the `replacement_char`. If the errors policy is to `ignore`, any + * invalid encoding positions in the input are skipped and not included in the + * output. If it set to `strict` then any invalid formatting will result in an + * InvalidArgument error. + *

                + * This operation can be used with `output_encoding = input_encoding` to enforce + * correct formatting for inputs even if they are already in the desired encoding. + *

                + * If the input is prefixed by a Byte Order Mark needed to determine encoding + * (e.g. if the encoding is UTF-16 and the BOM indicates big-endian), then that + * BOM will be consumed and not emitted into the output. If the input encoding + * is marked with an explicit endianness (e.g. UTF-16-BE), then the BOM is + * interpreted as a non-breaking-space and is preserved in the output (including + * always for UTF-8). + *

                + * The end result is that if the input is marked as an explicit endianness the + * transcoding is faithful to all codepoints in the source. If it is not marked + * with an explicit endianness, the BOM is not considered part of the string itself + * but as metadata, and so is not preserved in the output. + */ +@Operator(group = "strings") +public final class UnicodeTranscode extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.strings.UnicodeTranscode} + */ + public static class Options { + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public Options errors(String errors) { + this.errors = errors; + return this; + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD or U+65533.) + *

                + * Note that for UTF-8, passing a replacement character expressible in 1 byte, such + * as ' ', will preserve string alignment to the source since invalid bytes will be + * replaced with a 1-byte replacement. For UTF-16-BE and UTF-16-LE, any 1 or 2 byte + * replacement character will preserve byte alignment to the source. + */ + public Options replacementChar(Long replacementChar) { + this.replacementChar = replacementChar; + return this; + } + + /** + * @param replaceControlCharacters Whether to replace the C0 control characters (00-1F) with the + * `replacement_char`. Default is false. + */ + public Options replaceControlCharacters(Boolean replaceControlCharacters) { + this.replaceControlCharacters = replaceControlCharacters; + return this; + } + + private String errors; + private Long replacementChar; + private Boolean replaceControlCharacters; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new UnicodeTranscode operation. + * + * @param scope current scope + * @param input The text to be processed. Can have any shape. + * @param inputEncoding Text encoding of the input strings. This is any of the encodings supported + * by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. + * @param outputEncoding The unicode encoding to use in the output. Must be one of + * `"UTF-8", "UTF-16-BE", "UTF-32-BE"`. Multi-byte encodings will be big-endian. + * @param options carries optional attributes values + * @return a new instance of UnicodeTranscode + */ + public static UnicodeTranscode create(Scope scope, Operand input, String inputEncoding, String outputEncoding, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("UnicodeTranscode", scope.makeOpName("UnicodeTranscode")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("input_encoding", inputEncoding); + opBuilder.setAttr("output_encoding", outputEncoding); + if (options != null) { + for (Options opts : options) { + if (opts.errors != null) { + opBuilder.setAttr("errors", opts.errors); + } + if (opts.replacementChar != null) { + opBuilder.setAttr("replacement_char", opts.replacementChar); + } + if (opts.replaceControlCharacters != null) { + opBuilder.setAttr("replace_control_characters", opts.replaceControlCharacters); + } + } + } + return new UnicodeTranscode(opBuilder.build()); + } + + /** + * @param errors Error handling policy when there is invalid formatting found in the input. + * The value of 'strict' will cause the operation to produce a InvalidArgument + * error on any invalid input formatting. A value of 'replace' (the default) will + * cause the operation to replace any invalid formatting in the input with the + * `replacement_char` codepoint. A value of 'ignore' will cause the operation to + * skip any invalid formatting in the input and produce no corresponding output + * character. + */ + public static Options errors(String errors) { + return new Options().errors(errors); + } + + /** + * @param replacementChar The replacement character codepoint to be used in place of any invalid + * formatting in the input when `errors='replace'`. Any valid unicode codepoint may + * be used. The default value is the default unicode replacement character is + * 0xFFFD or U+65533.) + *

                + * Note that for UTF-8, passing a replacement character expressible in 1 byte, such + * as ' ', will preserve string alignment to the source since invalid bytes will be + * replaced with a 1-byte replacement. For UTF-16-BE and UTF-16-LE, any 1 or 2 byte + * replacement character will preserve byte alignment to the source. + */ + public static Options replacementChar(Long replacementChar) { + return new Options().replacementChar(replacementChar); + } + + /** + * @param replaceControlCharacters Whether to replace the C0 control characters (00-1F) with the + * `replacement_char`. Default is false. + */ + public static Options replaceControlCharacters(Boolean replaceControlCharacters) { + return new Options().replaceControlCharacters(replaceControlCharacters); + } + + /** + * A string tensor containing unicode text encoded using `output_encoding`. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private UnicodeTranscode(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/AudioSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/AudioSummary.java new file mode 100644 index 00000000000..ac1d69c5cca --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/AudioSummary.java @@ -0,0 +1,120 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs a `Summary` protocol buffer with audio. + *

                + * The summary has up to `max_outputs` summary values containing audio. The + * audio is built from `tensor` which must be 3-D with shape `[batch_size, + * frames, channels]` or 2-D with shape `[batch_size, frames]`. The values are + * assumed to be in the range of `[-1.0, 1.0]` with a sample rate of `sample_rate`. + *

                + * The `tag` argument is a scalar `Tensor` of type `string`. It is used to + * build the `tag` of the summary values: + *

                  + *
                • + * If `max_outputs` is 1, the summary value tag is 'tag/audio'. + *
                • + *
                • + * If `max_outputs` is greater than 1, the summary value tags are + * generated sequentially as 'tag/audio/0', 'tag/audio/1', etc. + */ +@Operator(group = "summary") +public final class AudioSummary extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.summary.AudioSummary} + */ + public static class Options { + + /** + * @param maxOutputs Max number of batch elements to generate audio for. + */ + public Options maxOutputs(Long maxOutputs) { + this.maxOutputs = maxOutputs; + return this; + } + + private Long maxOutputs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new AudioSummary operation. + * + * @param scope current scope + * @param tag Scalar. Used to build the `tag` attribute of the summary values. + * @param tensor 2-D of shape `[batch_size, frames]`. + * @param sampleRate The sample rate of the signal in hertz. + * @param options carries optional attributes values + * @return a new instance of AudioSummary + */ + public static AudioSummary create(Scope scope, Operand tag, Operand tensor, Operand sampleRate, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("AudioSummaryV2", scope.makeOpName("AudioSummary")); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(sampleRate.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.maxOutputs != null) { + opBuilder.setAttr("max_outputs", opts.maxOutputs); + } + } + } + return new AudioSummary(opBuilder.build()); + } + + /** + * @param maxOutputs Max number of batch elements to generate audio for. + */ + public static Options maxOutputs(Long maxOutputs) { + return new Options().maxOutputs(maxOutputs); + } + + /** + * Scalar. Serialized `Summary` protocol buffer. + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private AudioSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CloseSummaryWriter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CloseSummaryWriter.java new file mode 100644 index 00000000000..a5ab4623754 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CloseSummaryWriter.java @@ -0,0 +1,48 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class CloseSummaryWriter extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new CloseSummaryWriter operation. + * + * @param scope current scope + * @param writer + * @return a new instance of CloseSummaryWriter + */ + public static CloseSummaryWriter create(Scope scope, Operand writer) { + OperationBuilder opBuilder = scope.env().opBuilder("CloseSummaryWriter", scope.makeOpName("CloseSummaryWriter")); + opBuilder.addInput(writer.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new CloseSummaryWriter(opBuilder.build()); + } + + + private CloseSummaryWriter(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CreateSummaryDbWriter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CreateSummaryDbWriter.java new file mode 100644 index 00000000000..42e390e8683 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CreateSummaryDbWriter.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class CreateSummaryDbWriter extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new CreateSummaryDbWriter operation. + * + * @param scope current scope + * @param writer + * @param dbUri + * @param experimentName + * @param runName + * @param userName + * @return a new instance of CreateSummaryDbWriter + */ + public static CreateSummaryDbWriter create(Scope scope, Operand writer, Operand dbUri, Operand experimentName, Operand runName, Operand userName) { + OperationBuilder opBuilder = scope.env().opBuilder("CreateSummaryDbWriter", scope.makeOpName("CreateSummaryDbWriter")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(dbUri.asOutput()); + opBuilder.addInput(experimentName.asOutput()); + opBuilder.addInput(runName.asOutput()); + opBuilder.addInput(userName.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new CreateSummaryDbWriter(opBuilder.build()); + } + + + private CreateSummaryDbWriter(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CreateSummaryFileWriter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CreateSummaryFileWriter.java new file mode 100644 index 00000000000..86b236a40b1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/CreateSummaryFileWriter.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class CreateSummaryFileWriter extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new CreateSummaryFileWriter operation. + * + * @param scope current scope + * @param writer + * @param logdir + * @param maxQueue + * @param flushMillis + * @param filenameSuffix + * @return a new instance of CreateSummaryFileWriter + */ + public static CreateSummaryFileWriter create(Scope scope, Operand writer, Operand logdir, Operand maxQueue, Operand flushMillis, Operand filenameSuffix) { + OperationBuilder opBuilder = scope.env().opBuilder("CreateSummaryFileWriter", scope.makeOpName("CreateSummaryFileWriter")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(logdir.asOutput()); + opBuilder.addInput(maxQueue.asOutput()); + opBuilder.addInput(flushMillis.asOutput()); + opBuilder.addInput(filenameSuffix.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new CreateSummaryFileWriter(opBuilder.build()); + } + + + private CreateSummaryFileWriter(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/FlushSummaryWriter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/FlushSummaryWriter.java new file mode 100644 index 00000000000..93f677af0a3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/FlushSummaryWriter.java @@ -0,0 +1,48 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class FlushSummaryWriter extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new FlushSummaryWriter operation. + * + * @param scope current scope + * @param writer + * @return a new instance of FlushSummaryWriter + */ + public static FlushSummaryWriter create(Scope scope, Operand writer) { + OperationBuilder opBuilder = scope.env().opBuilder("FlushSummaryWriter", scope.makeOpName("FlushSummaryWriter")); + opBuilder.addInput(writer.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new FlushSummaryWriter(opBuilder.build()); + } + + + private FlushSummaryWriter(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/HistogramSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/HistogramSummary.java new file mode 100644 index 00000000000..3890ebe73fb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/HistogramSummary.java @@ -0,0 +1,75 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs a `Summary` protocol buffer with a histogram. + *

                  + * The generated + * [`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) + * has one summary value containing a histogram for `values`. + *

                  + * This op reports an `InvalidArgument` error if any value is not finite. + */ +@Operator(group = "summary") +public final class HistogramSummary extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new HistogramSummary operation. + * + * @param scope current scope + * @param tag Scalar. Tag to use for the `Summary.Value`. + * @param values Any shape. Values to use to build the histogram. + * @return a new instance of HistogramSummary + */ + public static HistogramSummary create(Scope scope, Operand tag, Operand values) { + OperationBuilder opBuilder = scope.env().opBuilder("HistogramSummary", scope.makeOpName("HistogramSummary")); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new HistogramSummary(opBuilder.build()); + } + + /** + * Scalar. Serialized `Summary` protocol buffer. + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private HistogramSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImageSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImageSummary.java new file mode 100644 index 00000000000..f0af64451f2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImageSummary.java @@ -0,0 +1,171 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Tensor; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs a `Summary` protocol buffer with images. + *

                  + * The summary has up to `max_images` summary values containing images. The + * images are built from `tensor` which must be 4-D with shape `[batch_size, + * height, width, channels]` and where `channels` can be: + *

                    + *
                  • + * 1: `tensor` is interpreted as Grayscale. + *
                  • + *
                  • + * 3: `tensor` is interpreted as RGB. + *
                  • + *
                  • + * 4: `tensor` is interpreted as RGBA. + *
                  • + *
                  + * The images have the same number of channels as the input tensor. For float + * input, the values are normalized one image at a time to fit in the range + * `[0, 255]`. `uint8` values are unchanged. The op uses two different + * normalization algorithms: + *
                    + *
                  • + * If the input values are all positive, they are rescaled so the largest one + * is 255. + *
                  • + *
                  • + * If any input value is negative, the values are shifted so input value 0.0 + * is at 127. They are then rescaled so that either the smallest value is 0, + * or the largest one is 255. + *
                  • + *
                  + * The `tag` argument is a scalar `Tensor` of type `string`. It is used to + * build the `tag` of the summary values: + *
                    + *
                  • + * If `max_images` is 1, the summary value tag is 'tag/image'. + *
                  • + *
                  • + * If `max_images` is greater than 1, the summary value tags are + * generated sequentially as 'tag/image/0', 'tag/image/1', etc. + *
                  • + *
                  + * The `bad_color` argument is the color to use in the generated images for + * non-finite input values. It is a `uint8` 1-D tensor of length `channels`. + * Each element must be in the range `[0, 255]` (It represents the value of a + * pixel in the output image). Non-finite values in the input tensor are + * replaced by this tensor in the output image. The default value is the color + * red. + */ +@Operator(group = "summary") +public final class ImageSummary extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.summary.ImageSummary} + */ + public static class Options { + + /** + * @param maxImages Max number of batch elements to generate images for. + */ + public Options maxImages(Long maxImages) { + this.maxImages = maxImages; + return this; + } + + /** + * @param badColor Color to use for pixels with non-finite values. + */ + public Options badColor(Tensor badColor) { + this.badColor = badColor; + return this; + } + + private Long maxImages; + private Tensor badColor; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ImageSummary operation. + * + * @param scope current scope + * @param tag Scalar. Used to build the `tag` attribute of the summary values. + * @param tensor 4-D of shape `[batch_size, height, width, channels]` where + * `channels` is 1, 3, or 4. + * @param options carries optional attributes values + * @return a new instance of ImageSummary + */ + public static ImageSummary create(Scope scope, Operand tag, Operand tensor, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ImageSummary", scope.makeOpName("ImageSummary")); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.maxImages != null) { + opBuilder.setAttr("max_images", opts.maxImages); + } + if (opts.badColor != null) { + opBuilder.setAttr("bad_color", opts.badColor); + } + } + } + return new ImageSummary(opBuilder.build()); + } + + /** + * @param maxImages Max number of batch elements to generate images for. + */ + public static Options maxImages(Long maxImages) { + return new Options().maxImages(maxImages); + } + + /** + * @param badColor Color to use for pixels with non-finite values. + */ + public static Options badColor(Tensor badColor) { + return new Options().badColor(badColor); + } + + /** + * Scalar. Serialized `Summary` protocol buffer. + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private ImageSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImportEvent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImportEvent.java new file mode 100644 index 00000000000..ca279814773 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImportEvent.java @@ -0,0 +1,50 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class ImportEvent extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new ImportEvent operation. + * + * @param scope current scope + * @param writer + * @param event + * @return a new instance of ImportEvent + */ + public static ImportEvent create(Scope scope, Operand writer, Operand event) { + OperationBuilder opBuilder = scope.env().opBuilder("ImportEvent", scope.makeOpName("ImportEvent")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(event.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ImportEvent(opBuilder.build()); + } + + + private ImportEvent(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/MergeSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/MergeSummary.java new file mode 100644 index 00000000000..b2107dc3b34 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/MergeSummary.java @@ -0,0 +1,77 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Merges summaries. + *

                  + * This op creates a + * [`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) + * protocol buffer that contains the union of all the values in the input + * summaries. + *

                  + * When the Op is run, it reports an `InvalidArgument` error if multiple values + * in the summaries to merge use the same tag. + */ +@Operator(group = "summary") +public final class MergeSummary extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new MergeSummary operation. + * + * @param scope current scope + * @param inputs Can be of any shape. Each must contain serialized `Summary` protocol + * buffers. + * @return a new instance of MergeSummary + */ + public static MergeSummary create(Scope scope, Iterable> inputs) { + OperationBuilder opBuilder = scope.env().opBuilder("MergeSummary", scope.makeOpName("MergeSummary")); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new MergeSummary(opBuilder.build()); + } + + /** + * Scalar. Serialized `Summary` protocol buffer. + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private MergeSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ScalarSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ScalarSummary.java new file mode 100644 index 00000000000..98fdb9a4b5e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ScalarSummary.java @@ -0,0 +1,72 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs a `Summary` protocol buffer with scalar values. + *

                  + * The input `tags` and `values` must have the same shape. The generated summary + * has a summary value for each tag-value pair in `tags` and `values`. + */ +@Operator(group = "summary") +public final class ScalarSummary extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new ScalarSummary operation. + * + * @param scope current scope + * @param tags Tags for the summary. + * @param values Same shape as `tags. Values for the summary. + * @return a new instance of ScalarSummary + */ + public static ScalarSummary create(Scope scope, Operand tags, Operand values) { + OperationBuilder opBuilder = scope.env().opBuilder("ScalarSummary", scope.makeOpName("ScalarSummary")); + opBuilder.addInput(tags.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new ScalarSummary(opBuilder.build()); + } + + /** + * Scalar. Serialized `Summary` protocol buffer. + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private ScalarSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/StatsAggregatorSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/StatsAggregatorSummary.java new file mode 100644 index 00000000000..3eb408f81b9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/StatsAggregatorSummary.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Produces a summary of any statistics recorded by the given statistics manager. + */ +public final class StatsAggregatorSummary extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new StatsAggregatorSummary operation. + * + * @param scope current scope + * @param iterator + * @return a new instance of StatsAggregatorSummary + */ + public static StatsAggregatorSummary create(Scope scope, Operand iterator) { + OperationBuilder opBuilder = scope.env().opBuilder("StatsAggregatorSummary", scope.makeOpName("StatsAggregatorSummary")); + opBuilder.addInput(iterator.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new StatsAggregatorSummary(opBuilder.build()); + } + + /** + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private StatsAggregatorSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/SummaryWriter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/SummaryWriter.java new file mode 100644 index 00000000000..0ec10e8ba35 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/SummaryWriter.java @@ -0,0 +1,115 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class SummaryWriter extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.summary.SummaryWriter} + */ + public static class Options { + + /** + * @param sharedName + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param container + */ + public Options container(String container) { + this.container = container; + return this; + } + + private String sharedName; + private String container; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SummaryWriter operation. + * + * @param scope current scope + * @param options carries optional attributes values + * @return a new instance of SummaryWriter + */ + public static SummaryWriter create(Scope scope, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SummaryWriter", scope.makeOpName("SummaryWriter")); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + } + } + return new SummaryWriter(opBuilder.build()); + } + + /** + * @param sharedName + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param container + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + */ + public Output writer() { + return writer; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) writer; + } + + private Output writer; + + private SummaryWriter(Operation operation) { + super(operation); + int outputIdx = 0; + writer = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/TensorSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/TensorSummary.java new file mode 100644 index 00000000000..8ccde18421f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/TensorSummary.java @@ -0,0 +1,71 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Outputs a `Summary` protocol buffer with a tensor and per-plugin data. + */ +@Operator(group = "summary") +public final class TensorSummary extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TensorSummary operation. + * + * @param scope current scope + * @param tag A string attached to this summary. Used for organization in TensorBoard. + * @param tensor A tensor to serialize. + * @param serializedSummaryMetadata A serialized SummaryMetadata proto. Contains plugin + * data. + * @return a new instance of TensorSummary + */ + public static TensorSummary create(Scope scope, Operand tag, Operand tensor, Operand serializedSummaryMetadata) { + OperationBuilder opBuilder = scope.env().opBuilder("TensorSummaryV2", scope.makeOpName("TensorSummary")); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(serializedSummaryMetadata.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TensorSummary(opBuilder.build()); + } + + /** + */ + public Output summary() { + return summary; + } + + @Override + public Output asOutput() { + return summary; + } + + private Output summary; + + private TensorSummary(Operation operation) { + super(operation); + int outputIdx = 0; + summary = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteAudioSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteAudioSummary.java new file mode 100644 index 00000000000..2fa63f9d7ae --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteAudioSummary.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class WriteAudioSummary extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.summary.WriteAudioSummary} + */ + public static class Options { + + /** + * @param maxOutputs + */ + public Options maxOutputs(Long maxOutputs) { + this.maxOutputs = maxOutputs; + return this; + } + + private Long maxOutputs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new WriteAudioSummary operation. + * + * @param scope current scope + * @param writer + * @param step + * @param tag + * @param tensor + * @param sampleRate + * @param options carries optional attributes values + * @return a new instance of WriteAudioSummary + */ + public static WriteAudioSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand tensor, Operand sampleRate, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteAudioSummary", scope.makeOpName("WriteAudioSummary")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(sampleRate.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.maxOutputs != null) { + opBuilder.setAttr("max_outputs", opts.maxOutputs); + } + } + } + return new WriteAudioSummary(opBuilder.build()); + } + + /** + * @param maxOutputs + */ + public static Options maxOutputs(Long maxOutputs) { + return new Options().maxOutputs(maxOutputs); + } + + + private WriteAudioSummary(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteGraphSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteGraphSummary.java new file mode 100644 index 00000000000..e00392e7d3f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteGraphSummary.java @@ -0,0 +1,52 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class WriteGraphSummary extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new WriteGraphSummary operation. + * + * @param scope current scope + * @param writer + * @param step + * @param tensor + * @return a new instance of WriteGraphSummary + */ + public static WriteGraphSummary create(Scope scope, Operand writer, Operand step, Operand tensor) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteGraphSummary", scope.makeOpName("WriteGraphSummary")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WriteGraphSummary(opBuilder.build()); + } + + + private WriteGraphSummary(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteHistogramSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteHistogramSummary.java new file mode 100644 index 00000000000..3927383bf92 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteHistogramSummary.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class WriteHistogramSummary extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new WriteHistogramSummary operation. + * + * @param scope current scope + * @param writer + * @param step + * @param tag + * @param values + * @return a new instance of WriteHistogramSummary + */ + public static WriteHistogramSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand values) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteHistogramSummary", scope.makeOpName("WriteHistogramSummary")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(values.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WriteHistogramSummary(opBuilder.build()); + } + + + private WriteHistogramSummary(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteImageSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteImageSummary.java new file mode 100644 index 00000000000..fdaa895095f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteImageSummary.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.types.UInt8; + +/** + */ +public final class WriteImageSummary extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.summary.WriteImageSummary} + */ + public static class Options { + + /** + * @param maxImages + */ + public Options maxImages(Long maxImages) { + this.maxImages = maxImages; + return this; + } + + private Long maxImages; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new WriteImageSummary operation. + * + * @param scope current scope + * @param writer + * @param step + * @param tag + * @param tensor + * @param badColor + * @param options carries optional attributes values + * @return a new instance of WriteImageSummary + */ + public static WriteImageSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand tensor, Operand badColor, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteImageSummary", scope.makeOpName("WriteImageSummary")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(badColor.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.maxImages != null) { + opBuilder.setAttr("max_images", opts.maxImages); + } + } + } + return new WriteImageSummary(opBuilder.build()); + } + + /** + * @param maxImages + */ + public static Options maxImages(Long maxImages) { + return new Options().maxImages(maxImages); + } + + + private WriteImageSummary(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteScalarSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteScalarSummary.java new file mode 100644 index 00000000000..234eeff3cb4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteScalarSummary.java @@ -0,0 +1,54 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class WriteScalarSummary extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new WriteScalarSummary operation. + * + * @param scope current scope + * @param writer + * @param step + * @param tag + * @param value + * @return a new instance of WriteScalarSummary + */ + public static WriteScalarSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand value) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteScalarSummary", scope.makeOpName("WriteScalarSummary")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(value.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WriteScalarSummary(opBuilder.build()); + } + + + private WriteScalarSummary(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteSummary.java new file mode 100644 index 00000000000..875cc002da1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteSummary.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.summary; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + */ +public final class WriteSummary extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new WriteSummary operation. + * + * @param scope current scope + * @param writer + * @param step + * @param tensor + * @param tag + * @param summaryMetadata + * @return a new instance of WriteSummary + */ + public static WriteSummary create(Scope scope, Operand writer, Operand step, Operand tensor, Operand tag, Operand summaryMetadata) { + OperationBuilder opBuilder = scope.env().opBuilder("WriteSummary", scope.makeOpName("WriteSummary")); + opBuilder.addInput(writer.asOutput()); + opBuilder.addInput(step.asOutput()); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(tag.asOutput()); + opBuilder.addInput(summaryMetadata.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new WriteSummary(opBuilder.build()); + } + + + private WriteSummary(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorApplyGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorApplyGradient.java new file mode 100644 index 00000000000..59a8b944bff --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorApplyGradient.java @@ -0,0 +1,57 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies a gradient to a given accumulator. + *

                  + * Does not add if local_step is lesser than the accumulator's global_step. + */ +@Operator(group = "train") +public final class AccumulatorApplyGradient extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AccumulatorApplyGradient operation. + * + * @param scope current scope + * @param handle The handle to a accumulator. + * @param localStep The local_step value at which the gradient was computed. + * @param gradient A tensor of the gradient to be accumulated. + * @return a new instance of AccumulatorApplyGradient + */ + public static AccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradient) { + OperationBuilder opBuilder = scope.env().opBuilder("AccumulatorApplyGradient", scope.makeOpName("AccumulatorApplyGradient")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(localStep.asOutput()); + opBuilder.addInput(gradient.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AccumulatorApplyGradient(opBuilder.build()); + } + + + private AccumulatorApplyGradient(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorNumAccumulated.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorNumAccumulated.java new file mode 100644 index 00000000000..1cd6128f313 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorNumAccumulated.java @@ -0,0 +1,67 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the number of gradients aggregated in the given accumulators. + */ +@Operator(group = "train") +public final class AccumulatorNumAccumulated extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AccumulatorNumAccumulated operation. + * + * @param scope current scope + * @param handle The handle to an accumulator. + * @return a new instance of AccumulatorNumAccumulated + */ + public static AccumulatorNumAccumulated create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.env().opBuilder("AccumulatorNumAccumulated", scope.makeOpName("AccumulatorNumAccumulated")); + opBuilder.addInput(handle.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AccumulatorNumAccumulated(opBuilder.build()); + } + + /** + * The number of gradients aggregated in the given accumulator. + */ + public Output numAccumulated() { + return numAccumulated; + } + + @Override + public Output asOutput() { + return numAccumulated; + } + + private Output numAccumulated; + + private AccumulatorNumAccumulated(Operation operation) { + super(operation); + int outputIdx = 0; + numAccumulated = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorSetGlobalStep.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorSetGlobalStep.java new file mode 100644 index 00000000000..2410fa84f25 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorSetGlobalStep.java @@ -0,0 +1,56 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Updates the accumulator with a new value for global_step. + *

                  + * Logs warning if the accumulator's value is already higher than + * new_global_step. + */ +@Operator(group = "train") +public final class AccumulatorSetGlobalStep extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new AccumulatorSetGlobalStep operation. + * + * @param scope current scope + * @param handle The handle to an accumulator. + * @param newGlobalStep The new global_step value to set. + * @return a new instance of AccumulatorSetGlobalStep + */ + public static AccumulatorSetGlobalStep create(Scope scope, Operand handle, Operand newGlobalStep) { + OperationBuilder opBuilder = scope.env().opBuilder("AccumulatorSetGlobalStep", scope.makeOpName("AccumulatorSetGlobalStep")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(newGlobalStep.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new AccumulatorSetGlobalStep(opBuilder.build()); + } + + + private AccumulatorSetGlobalStep(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorTakeGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorTakeGradient.java new file mode 100644 index 00000000000..7097e287c9f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorTakeGradient.java @@ -0,0 +1,81 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Extracts the average gradient in the given ConditionalAccumulator. + *

                  + * The op blocks until sufficient (i.e., more than num_required) + * gradients have been accumulated. If the accumulator has already + * aggregated more than num_required gradients, it returns the average of + * the accumulated gradients. Also automatically increments the recorded + * global_step in the accumulator by 1, and resets the aggregate to 0. + * + * @param data type for {@code average()} output + */ +@Operator(group = "train") +public final class AccumulatorTakeGradient extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new AccumulatorTakeGradient operation. + * + * @param scope current scope + * @param handle The handle to an accumulator. + * @param numRequired Number of gradients required before we return an aggregate. + * @param dtype The data type of accumulated gradients. Needs to correspond to the type + * of the accumulator. + * @return a new instance of AccumulatorTakeGradient + */ + public static AccumulatorTakeGradient create(Scope scope, Operand handle, Operand numRequired, Class dtype) { + OperationBuilder opBuilder = scope.env().opBuilder("AccumulatorTakeGradient", scope.makeOpName("AccumulatorTakeGradient")); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(numRequired.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + return new AccumulatorTakeGradient(opBuilder.build()); + } + + /** + * The average of the accumulated gradients. + */ + public Output average() { + return average; + } + + @Override + public Output asOutput() { + return average; + } + + private Output average; + + private AccumulatorTakeGradient(Operation operation) { + super(operation); + int outputIdx = 0; + average = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdaMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdaMax.java new file mode 100644 index 00000000000..bf8548492d0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdaMax.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Update '*var' according to the AdaMax algorithm. + *

                  + * m_t <- beta1 * m_{t-1} + (1 - beta1) * g + * v_t <- max(beta2 * v_{t-1}, abs(g)) + * variable <- variable - learning_rate / (1 - beta1^t) * m_t / (v_t + epsilon) + * + * @param data type for {@code out()} output + */ +public final class ApplyAdaMax extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyAdaMax} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyAdaMax operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdaMax + */ + public static ApplyAdaMax create(Scope scope, Operand var, Operand m, Operand v, Operand beta1Power, Operand lr, Operand beta1, Operand beta2, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyAdaMax", scope.makeOpName("ApplyAdaMax")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(beta1Power.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(beta1.asOutput()); + opBuilder.addInput(beta2.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyAdaMax(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyAdaMax(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdadelta.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdadelta.java new file mode 100644 index 00000000000..9263bf24506 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdadelta.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the adadelta scheme. + *

                  + * accum = rho() * accum + (1 - rho()) * grad.square(); + * update = (update_accum + epsilon).sqrt() * (accum + epsilon()).rsqrt() * grad; + * update_accum = rho() * update_accum + (1 - rho()) * update.square(); + * var -= update; + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyAdadelta extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyAdadelta} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var, accum and update_accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyAdadelta operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param accumUpdate Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdadelta + */ + public static ApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyAdadelta", scope.makeOpName("ApplyAdadelta")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(accumUpdate.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyAdadelta(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var, accum and update_accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyAdadelta(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdagrad.java new file mode 100644 index 00000000000..da9f22d63d6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdagrad.java @@ -0,0 +1,135 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the adagrad scheme. + *

                  + * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyAdagrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyAdagrad} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdagrad + */ + public static ApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyAdagrad", scope.makeOpName("ApplyAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new ApplyAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyAdagrad(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdagradDa.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdagradDa.java new file mode 100644 index 00000000000..92774306704 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdagradDa.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the proximal adagrad scheme. + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyAdagradDa extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyAdagradDa} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyAdagradDa operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ApplyAdagradDa + */ + public static ApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyAdagradDA", scope.makeOpName("ApplyAdagradDa")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(gradientAccumulator.asOutput()); + opBuilder.addInput(gradientSquaredAccumulator.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(globalStep.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyAdagradDa(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyAdagradDa(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdam.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdam.java new file mode 100644 index 00000000000..687d7a65b71 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAdam.java @@ -0,0 +1,149 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the Adam algorithm. + *

                  + * $$lr_t := \text{learning\_rate} * \sqrt{1 - beta_2^t} / (1 - beta_1^t)$$ + * $$m_t := beta_1 * m_{t-1} + (1 - beta_1) * g$$ + * $$v_t := beta_2 * v_{t-1} + (1 - beta_2) * g * g$$ + * $$variable := variable - lr_t * m_t / (\sqrt{v_t} + \epsilon)$$ + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyAdam extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyAdam} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, uses the nesterov update. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyAdam operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param beta2Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAdam + */ + public static ApplyAdam create(Scope scope, Operand var, Operand m, Operand v, Operand beta1Power, Operand beta2Power, Operand lr, Operand beta1, Operand beta2, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyAdam", scope.makeOpName("ApplyAdam")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(beta1Power.asOutput()); + opBuilder.addInput(beta2Power.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(beta1.asOutput()); + opBuilder.addInput(beta2.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new ApplyAdam(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, uses the nesterov update. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyAdam(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAddSign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAddSign.java new file mode 100644 index 00000000000..e2c2c243fe4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyAddSign.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the AddSign update. + *

                  + * m_t <- beta1 * m_{t-1} + (1 - beta1) * g + * update <- (alpha + sign_decay * sign(g) *sign(m)) * g + * variable <- variable - lr_t * update + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyAddSign extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyAddSign} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyAddSign operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param alpha Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyAddSign + */ + public static ApplyAddSign create(Scope scope, Operand var, Operand m, Operand lr, Operand alpha, Operand signDecay, Operand beta, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyAddSign", scope.makeOpName("ApplyAddSign")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(signDecay.asOutput()); + opBuilder.addInput(beta.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyAddSign(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyAddSign(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyCenteredRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyCenteredRmsProp.java new file mode 100644 index 00000000000..efc9b7c76f8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyCenteredRmsProp.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the centered RMSProp algorithm. + *

                  + * The centered RMSProp algorithm uses an estimate of the centered second moment + * (i.e., the variance) for normalization, as opposed to regular RMSProp, which + * uses the (uncentered) second moment. This often helps with training, but is + * slightly more expensive in terms of computation and memory. + *

                  + * Note that in dense implementation of this algorithm, mg, ms, and mom will + * update even if the grad is zero, but in this sparse implementation, mg, ms, + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * mean_grad = decay * mean_grad + (1-decay) * gradient + *

                  + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) + *

                  + * mg <- rho * mg_{t-1} + (1-rho) * grad + * ms <- rho * ms_{t-1} + (1-rho) * grad * grad + * mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms - mg * mg + epsilon) + * var <- var - mom + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyCenteredRmsProp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyCenteredRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyCenteredRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyCenteredRmsProp + */ + public static ApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyCenteredRMSProp", scope.makeOpName("ApplyCenteredRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(mg.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyCenteredRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyCenteredRmsProp(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyFtrl.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyFtrl.java new file mode 100644 index 00000000000..5003f176d4c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyFtrl.java @@ -0,0 +1,131 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the Ftrl-proximal scheme. + *

                  + * grad_with_shrinkage = grad + 2 * l2_shrinkage * var + * accum_new = accum + grad_with_shrinkage * grad_with_shrinkage + * linear += grad_with_shrinkage + + * (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var + * quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 + * var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 + * accum = accum_new + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyFtrl extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyFtrl} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyFtrl operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regulariation. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ApplyFtrl + */ + public static ApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyFtrlV2", scope.makeOpName("ApplyFtrl")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(linear.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(l2Shrinkage.asOutput()); + opBuilder.addInput(lrPower.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyFtrl(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyFtrl(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyGradientDescent.java new file mode 100644 index 00000000000..3f5852283f5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyGradientDescent.java @@ -0,0 +1,109 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' by subtracting 'alpha' * 'delta' from it. + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyGradientDescent extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyGradientDescent} + */ + public static class Options { + + /** + * @param useLocking If `True`, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyGradientDescent operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ApplyGradientDescent + */ + public static ApplyGradientDescent create(Scope scope, Operand var, Operand alpha, Operand delta, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyGradientDescent", scope.makeOpName("ApplyGradientDescent")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyGradientDescent(opBuilder.build()); + } + + /** + * @param useLocking If `True`, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyGradientDescent(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyMomentum.java new file mode 100644 index 00000000000..254be2deafa --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyMomentum.java @@ -0,0 +1,143 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the momentum scheme. Set use_nesterov = True if you + *

                  + * want to use Nesterov momentum. + *

                  + * accum = accum * momentum + grad + * var -= lr * accum + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyMomentum extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyMomentum} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyMomentum operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ApplyMomentum + */ + public static ApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand momentum, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyMomentum", scope.makeOpName("ApplyMomentum")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new ApplyMomentum(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyMomentum(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyPowerSign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyPowerSign.java new file mode 100644 index 00000000000..e08ec4a0bbb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyPowerSign.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the AddSign update. + *

                  + * m_t <- beta1 * m_{t-1} + (1 - beta1) * g + * update <- exp(logbase * sign_decay * sign(g) * sign(m_t)) * g + * variable <- variable - lr_t * update + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyPowerSign extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyPowerSign} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyPowerSign operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param logbase Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyPowerSign + */ + public static ApplyPowerSign create(Scope scope, Operand var, Operand m, Operand lr, Operand logbase, Operand signDecay, Operand beta, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyPowerSign", scope.makeOpName("ApplyPowerSign")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(logbase.asOutput()); + opBuilder.addInput(signDecay.asOutput()); + opBuilder.addInput(beta.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyPowerSign(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyPowerSign(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyProximalAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyProximalAdagrad.java new file mode 100644 index 00000000000..0a4a169e156 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyProximalAdagrad.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' and '*accum' according to FOBOS with Adagrad learning rate. + *

                  + * accum += grad grad + * prox_v = var - lr grad (1 / sqrt(accum)) + * var = sign(prox_v)/(1+lrl2) max{|prox_v|-lrl1,0} + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyProximalAdagrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyProximalAdagrad} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyProximalAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyProximalAdagrad + */ + public static ApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyProximalAdagrad", scope.makeOpName("ApplyProximalAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyProximalAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyProximalAdagrad(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyProximalGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyProximalGradientDescent.java new file mode 100644 index 00000000000..f22686eabcb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyProximalGradientDescent.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' as FOBOS algorithm with fixed learning rate. + *

                  + * prox_v = var - alpha delta + * var = sign(prox_v)/(1+alphal2) max{|prox_v|-alphal1,0} + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyProximalGradientDescent extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyProximalGradientDescent} + */ + public static class Options { + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyProximalGradientDescent operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ApplyProximalGradientDescent + */ + public static ApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand delta, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyProximalGradientDescent", scope.makeOpName("ApplyProximalGradientDescent")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyProximalGradientDescent(opBuilder.build()); + } + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyProximalGradientDescent(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyRmsProp.java new file mode 100644 index 00000000000..5d9ccaa0147 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ApplyRmsProp.java @@ -0,0 +1,132 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the RMSProp algorithm. + *

                  + * Note that in dense implementation of this algorithm, ms and mom will + * update even if the grad is zero, but in this sparse implementation, ms + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon) + *

                  + * ms <- rho * ms_{t-1} + (1-rho) * grad * grad + * mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) + * var <- var - mom + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class ApplyRmsProp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ApplyRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ApplyRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ApplyRmsProp + */ + public static ApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ApplyRMSProp", scope.makeOpName("ApplyRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ApplyRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private ApplyRmsProp(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ConditionalAccumulator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ConditionalAccumulator.java new file mode 100644 index 00000000000..1157cb00f8d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ConditionalAccumulator.java @@ -0,0 +1,154 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Shape; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * A conditional accumulator for aggregating gradients. + *

                  + * The accumulator accepts gradients marked with local_step greater or + * equal to the most recent global_step known to the accumulator. The + * average can be extracted from the accumulator, provided sufficient + * gradients have been accumulated. Extracting the average automatically + * resets the aggregate to 0, and increments the global_step recorded by + * the accumulator. + */ +@Operator(group = "train") +public final class ConditionalAccumulator extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ConditionalAccumulator} + */ + public static class Options { + + /** + * @param container If non-empty, this accumulator is placed in the given container. + * Otherwise, a default container is used. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * @param sharedName If non-empty, this accumulator will be shared under the + * given name across multiple sessions. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * @param reductionType + */ + public Options reductionType(String reductionType) { + this.reductionType = reductionType; + return this; + } + + private String container; + private String sharedName; + private String reductionType; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ConditionalAccumulator operation. + * + * @param scope current scope + * @param dtype The type of the value being accumulated. + * @param shape The shape of the values, can be [], in which case shape is unknown. + * @param options carries optional attributes values + * @return a new instance of ConditionalAccumulator + */ + public static ConditionalAccumulator create(Scope scope, Class dtype, Shape shape, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ConditionalAccumulator", scope.makeOpName("ConditionalAccumulator")); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dtype", DataType.fromClass(dtype)); + opBuilder.setAttr("shape", shape); + if (options != null) { + for (Options opts : options) { + if (opts.container != null) { + opBuilder.setAttr("container", opts.container); + } + if (opts.sharedName != null) { + opBuilder.setAttr("shared_name", opts.sharedName); + } + if (opts.reductionType != null) { + opBuilder.setAttr("reduction_type", opts.reductionType); + } + } + } + return new ConditionalAccumulator(opBuilder.build()); + } + + /** + * @param container If non-empty, this accumulator is placed in the given container. + * Otherwise, a default container is used. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * @param sharedName If non-empty, this accumulator will be shared under the + * given name across multiple sessions. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * @param reductionType + */ + public static Options reductionType(String reductionType) { + return new Options().reductionType(reductionType); + } + + /** + * The handle to the accumulator. + */ + public Output handle() { + return handle; + } + + @Override + public Output asOutput() { + return handle; + } + + private Output handle; + + private ConditionalAccumulator(Operation operation) { + super(operation); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/GenerateVocabRemapping.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/GenerateVocabRemapping.java new file mode 100644 index 00000000000..72bd31765cd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/GenerateVocabRemapping.java @@ -0,0 +1,144 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Given a path to new and old vocabulary files, returns a remapping Tensor of + *

                  + * length `num_new_vocab`, where `remapping[i]` contains the row number in the old + * vocabulary that corresponds to row `i` in the new vocabulary (starting at line + * `new_vocab_offset` and up to `num_new_vocab` entities), or `-1` if entry `i` + * in the new vocabulary is not in the old vocabulary. The old vocabulary is + * constrained to the first `old_vocab_size` entries if `old_vocab_size` is not the + * default value of -1. + *

                  + * `num_vocab_offset` enables + * use in the partitioned variable case, and should generally be set through + * examining partitioning info. The format of the files should be a text file, + * with each line containing a single entity within the vocabulary. + *

                  + * For example, with `new_vocab_file` a text file containing each of the following + * elements on a single line: `[f0, f1, f2, f3]`, old_vocab_file = [f1, f0, f3], + * `num_new_vocab = 3, new_vocab_offset = 1`, the returned remapping would be + * `[0, -1, 2]`. + *

                  + * The op also returns a count of how many entries in the new vocabulary + * were present in the old vocabulary, which is used to calculate the number of + * values to initialize in a weight matrix remapping + *

                  + * This functionality can be used to remap both row vocabularies (typically, + * features) and column vocabularies (typically, classes) from TensorFlow + * checkpoints. Note that the partitioning logic relies on contiguous vocabularies + * corresponding to div-partitioned variables. Moreover, the underlying remapping + * uses an IndexTable (as opposed to an inexact CuckooTable), so client code should + * use the corresponding index_table_from_file() as the FeatureColumn framework + * does (as opposed to tf.feature_to_id(), which uses a CuckooTable). + */ +@Operator(group = "train") +public final class GenerateVocabRemapping extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.GenerateVocabRemapping} + */ + public static class Options { + + /** + * @param oldVocabSize Number of entries in the old vocab file to consider. If -1, + * use the entire old vocabulary. + */ + public Options oldVocabSize(Long oldVocabSize) { + this.oldVocabSize = oldVocabSize; + return this; + } + + private Long oldVocabSize; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new GenerateVocabRemapping operation. + * + * @param scope current scope + * @param newVocabFile Path to the new vocab file. + * @param oldVocabFile Path to the old vocab file. + * @param newVocabOffset How many entries into the new vocab file to start reading. + * @param numNewVocab Number of entries in the new vocab file to remap. + * @param options carries optional attributes values + * @return a new instance of GenerateVocabRemapping + */ + public static GenerateVocabRemapping create(Scope scope, Operand newVocabFile, Operand oldVocabFile, Long newVocabOffset, Long numNewVocab, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("GenerateVocabRemapping", scope.makeOpName("GenerateVocabRemapping")); + opBuilder.addInput(newVocabFile.asOutput()); + opBuilder.addInput(oldVocabFile.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("new_vocab_offset", newVocabOffset); + opBuilder.setAttr("num_new_vocab", numNewVocab); + if (options != null) { + for (Options opts : options) { + if (opts.oldVocabSize != null) { + opBuilder.setAttr("old_vocab_size", opts.oldVocabSize); + } + } + } + return new GenerateVocabRemapping(opBuilder.build()); + } + + /** + * @param oldVocabSize Number of entries in the old vocab file to consider. If -1, + * use the entire old vocabulary. + */ + public static Options oldVocabSize(Long oldVocabSize) { + return new Options().oldVocabSize(oldVocabSize); + } + + /** + * A Tensor of length num_new_vocab where the element at index i + * is equal to the old ID that maps to the new ID i. This element is -1 for any + * new ID that is not found in the old vocabulary. + */ + public Output remapping() { + return remapping; + } + + /** + * Number of new vocab entries found in old vocab. + */ + public Output numPresent() { + return numPresent; + } + + private Output remapping; + private Output numPresent; + + private GenerateVocabRemapping(Operation operation) { + super(operation); + int outputIdx = 0; + remapping = operation.output(outputIdx++); + numPresent = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/MergeV2Checkpoints.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/MergeV2Checkpoints.java new file mode 100644 index 00000000000..5f0d4cb1751 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/MergeV2Checkpoints.java @@ -0,0 +1,97 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * V2 format specific: merges the metadata files of sharded checkpoints. The + *

                  + * result is one logical checkpoint, with one physical metadata file and renamed + * data files. + *

                  + * Intended for "grouping" multiple checkpoints in a sharded checkpoint setup. + *

                  + * If delete_old_dirs is true, attempts to delete recursively the dirname of each + * path in the input checkpoint_prefixes. This is useful when those paths are non + * user-facing temporary locations. + */ +@Operator(group = "train") +public final class MergeV2Checkpoints extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.MergeV2Checkpoints} + */ + public static class Options { + + /** + * @param deleteOldDirs see above. + */ + public Options deleteOldDirs(Boolean deleteOldDirs) { + this.deleteOldDirs = deleteOldDirs; + return this; + } + + private Boolean deleteOldDirs; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new MergeV2Checkpoints operation. + * + * @param scope current scope + * @param checkpointPrefixes prefixes of V2 checkpoints to merge. + * @param destinationPrefix scalar. The desired final prefix. Allowed to be the same + * as one of the checkpoint_prefixes. + * @param options carries optional attributes values + * @return a new instance of MergeV2Checkpoints + */ + public static MergeV2Checkpoints create(Scope scope, Operand checkpointPrefixes, Operand destinationPrefix, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("MergeV2Checkpoints", scope.makeOpName("MergeV2Checkpoints")); + opBuilder.addInput(checkpointPrefixes.asOutput()); + opBuilder.addInput(destinationPrefix.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.deleteOldDirs != null) { + opBuilder.setAttr("delete_old_dirs", opts.deleteOldDirs); + } + } + } + return new MergeV2Checkpoints(opBuilder.build()); + } + + /** + * @param deleteOldDirs see above. + */ + public static Options deleteOldDirs(Boolean deleteOldDirs) { + return new Options().deleteOldDirs(deleteOldDirs); + } + + + private MergeV2Checkpoints(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/NegTrain.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/NegTrain.java new file mode 100644 index 00000000000..d3d146b4dfe --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/NegTrain.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Training via negative sampling. + */ +@Operator(group = "train") +public final class NegTrain extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new NegTrain operation. + * + * @param scope current scope + * @param wIn input word embedding. + * @param wOut output word embedding. + * @param examples A vector of word ids. + * @param labels A vector of word ids. + * @param lr + * @param vocabCount Count of words in the vocabulary. + * @param numNegativeSamples Number of negative samples per example. + * @return a new instance of NegTrain + */ + public static NegTrain create(Scope scope, Operand wIn, Operand wOut, Operand examples, Operand labels, Operand lr, List vocabCount, Long numNegativeSamples) { + OperationBuilder opBuilder = scope.env().opBuilder("NegTrain", scope.makeOpName("NegTrain")); + opBuilder.addInput(wIn.asOutput()); + opBuilder.addInput(wOut.asOutput()); + opBuilder.addInput(examples.asOutput()); + opBuilder.addInput(labels.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + long[] vocabCountArray = new long[vocabCount.size()]; + for (int i = 0; i < vocabCountArray.length; ++i) { + vocabCountArray[i] = vocabCount.get(i); + } + opBuilder.setAttr("vocab_count", vocabCountArray); + opBuilder.setAttr("num_negative_samples", numNegativeSamples); + return new NegTrain(opBuilder.build()); + } + + + private NegTrain(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/PreventGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/PreventGradient.java new file mode 100644 index 00000000000..ede8e0b11e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/PreventGradient.java @@ -0,0 +1,113 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * An identity op that triggers an error if a gradient is requested. + *

                  + * When executed in a graph, this op outputs its input tensor as-is. + *

                  + * When building ops to compute gradients, the TensorFlow gradient system + * will return an error when trying to lookup the gradient of this op, + * because no gradient must ever be registered for this function. This + * op exists to prevent subtle bugs from silently returning unimplemented + * gradients in some corner cases. + * + * @param data type for {@code output()} output + */ +@Operator(group = "train") +public final class PreventGradient extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.PreventGradient} + */ + public static class Options { + + /** + * @param message Will be printed in the error when anyone tries to differentiate + * this operation. + */ + public Options message(String message) { + this.message = message; + return this; + } + + private String message; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new PreventGradient operation. + * + * @param scope current scope + * @param input any tensor. + * @param options carries optional attributes values + * @return a new instance of PreventGradient + */ + public static PreventGradient create(Scope scope, Operand input, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("PreventGradient", scope.makeOpName("PreventGradient")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.message != null) { + opBuilder.setAttr("message", opts.message); + } + } + } + return new PreventGradient(opBuilder.build()); + } + + /** + * @param message Will be printed in the error when anyone tries to differentiate + * this operation. + */ + public static Options message(String message) { + return new Options().message(message); + } + + /** + * the same input tensor. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private PreventGradient(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdaMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdaMax.java new file mode 100644 index 00000000000..b1d2907d3b8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdaMax.java @@ -0,0 +1,107 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Update '*var' according to the AdaMax algorithm. + *

                  + * m_t <- beta1 * m_{t-1} + (1 - beta1) * g + * v_t <- max(beta2 * v_{t-1}, abs(g)) + * variable <- variable - learning_rate / (1 - beta1^t) * m_t / (v_t + epsilon) + */ +public final class ResourceApplyAdaMax extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyAdaMax} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAdaMax operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdaMax + */ + public static ResourceApplyAdaMax create(Scope scope, Operand var, Operand m, Operand v, Operand beta1Power, Operand lr, Operand beta1, Operand beta2, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAdaMax", scope.makeOpName("ResourceApplyAdaMax")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(beta1Power.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(beta1.asOutput()); + opBuilder.addInput(beta2.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyAdaMax(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyAdaMax(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdadelta.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdadelta.java new file mode 100644 index 00000000000..c8909c6d1f2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdadelta.java @@ -0,0 +1,104 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the adadelta scheme. + *

                  + * accum = rho() * accum + (1 - rho()) * grad.square(); + * update = (update_accum + epsilon).sqrt() * (accum + epsilon()).rsqrt() * grad; + * update_accum = rho() * update_accum + (1 - rho()) * update.square(); + * var -= update; + */ +@Operator(group = "train") +public final class ResourceApplyAdadelta extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyAdadelta} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var, accum and update_accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAdadelta operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param accumUpdate Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdadelta + */ + public static ResourceApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAdadelta", scope.makeOpName("ResourceApplyAdadelta")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(accumUpdate.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyAdadelta(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var, accum and update_accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyAdadelta(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdagrad.java new file mode 100644 index 00000000000..c62fdebd34e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdagrad.java @@ -0,0 +1,117 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the adagrad scheme. + *

                  + * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) + */ +@Operator(group = "train") +public final class ResourceApplyAdagrad extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyAdagrad} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdagrad + */ + public static ResourceApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAdagrad", scope.makeOpName("ResourceApplyAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new ResourceApplyAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + + private ResourceApplyAdagrad(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdagradDa.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdagradDa.java new file mode 100644 index 00000000000..f173947b5c8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdagradDa.java @@ -0,0 +1,101 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the proximal adagrad scheme. + */ +@Operator(group = "train") +public final class ResourceApplyAdagradDa extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyAdagradDa} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAdagradDa operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdagradDa + */ + public static ResourceApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAdagradDA", scope.makeOpName("ResourceApplyAdagradDa")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(gradientAccumulator.asOutput()); + opBuilder.addInput(gradientSquaredAccumulator.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(globalStep.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyAdagradDa(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyAdagradDa(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdam.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdam.java new file mode 100644 index 00000000000..414ae9c88dc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAdam.java @@ -0,0 +1,131 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the Adam algorithm. + *

                  + * $$lr_t := \text{learning\_rate} * \sqrt{1 - beta_2^t} / (1 - beta_1^t)$$ + * $$m_t := beta_1 * m_{t-1} + (1 - beta_1) * g$$ + * $$v_t := beta_2 * v_{t-1} + (1 - beta_2) * g * g$$ + * $$variable := variable - lr_t * m_t / (\sqrt{v_t} + \epsilon)$$ + */ +@Operator(group = "train") +public final class ResourceApplyAdam extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyAdam} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, uses the nesterov update. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAdam operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param v Should be from a Variable(). + * @param beta1Power Must be a scalar. + * @param beta2Power Must be a scalar. + * @param lr Scaling factor. Must be a scalar. + * @param beta1 Momentum factor. Must be a scalar. + * @param beta2 Momentum factor. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAdam + */ + public static ResourceApplyAdam create(Scope scope, Operand var, Operand m, Operand v, Operand beta1Power, Operand beta2Power, Operand lr, Operand beta1, Operand beta2, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAdam", scope.makeOpName("ResourceApplyAdam")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(v.asOutput()); + opBuilder.addInput(beta1Power.asOutput()); + opBuilder.addInput(beta2Power.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(beta1.asOutput()); + opBuilder.addInput(beta2.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new ResourceApplyAdam(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, m, and v tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, uses the nesterov update. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + + private ResourceApplyAdam(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAddSign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAddSign.java new file mode 100644 index 00000000000..085f50106bf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyAddSign.java @@ -0,0 +1,105 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the AddSign update. + *

                  + * m_t <- beta1 * m_{t-1} + (1 - beta1) * g + * update <- (alpha + sign_decay * sign(g) *sign(m)) * g + * variable <- variable - lr_t * update + */ +@Operator(group = "train") +public final class ResourceApplyAddSign extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyAddSign} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyAddSign operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param alpha Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyAddSign + */ + public static ResourceApplyAddSign create(Scope scope, Operand var, Operand m, Operand lr, Operand alpha, Operand signDecay, Operand beta, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyAddSign", scope.makeOpName("ResourceApplyAddSign")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(signDecay.asOutput()); + opBuilder.addInput(beta.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyAddSign(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyAddSign(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyCenteredRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyCenteredRmsProp.java new file mode 100644 index 00000000000..eb238cdca6d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyCenteredRmsProp.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the centered RMSProp algorithm. + *

                  + * The centered RMSProp algorithm uses an estimate of the centered second moment + * (i.e., the variance) for normalization, as opposed to regular RMSProp, which + * uses the (uncentered) second moment. This often helps with training, but is + * slightly more expensive in terms of computation and memory. + *

                  + * Note that in dense implementation of this algorithm, mg, ms, and mom will + * update even if the grad is zero, but in this sparse implementation, mg, ms, + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * mean_grad = decay * mean_grad + (1-decay) * gradient + *

                  + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) + *

                  + * mg <- rho * mg_{t-1} + (1-rho) * grad + * ms <- rho * ms_{t-1} + (1-rho) * grad * grad + * mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms - mg * mg + epsilon) + * var <- var - mom + */ +@Operator(group = "train") +public final class ResourceApplyCenteredRmsProp extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyCenteredRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyCenteredRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyCenteredRmsProp + */ + public static ResourceApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyCenteredRMSProp", scope.makeOpName("ResourceApplyCenteredRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(mg.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyCenteredRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyCenteredRmsProp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyFtrl.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyFtrl.java new file mode 100644 index 00000000000..225ba816b24 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyFtrl.java @@ -0,0 +1,113 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the Ftrl-proximal scheme. + *

                  + * grad_with_shrinkage = grad + 2 * l2_shrinkage * var + * accum_new = accum + grad_with_shrinkage * grad_with_shrinkage + * linear += grad_with_shrinkage + + * (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var + * quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 + * var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 + * accum = accum_new + */ +@Operator(group = "train") +public final class ResourceApplyFtrl extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyFtrl} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyFtrl operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regulariation. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyFtrl + */ + public static ResourceApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyFtrlV2", scope.makeOpName("ResourceApplyFtrl")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(linear.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(l2Shrinkage.asOutput()); + opBuilder.addInput(lrPower.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyFtrl(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyFtrl(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyGradientDescent.java new file mode 100644 index 00000000000..4cb535df56a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyGradientDescent.java @@ -0,0 +1,91 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' by subtracting 'alpha' * 'delta' from it. + */ +@Operator(group = "train") +public final class ResourceApplyGradientDescent extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyGradientDescent} + */ + public static class Options { + + /** + * @param useLocking If `True`, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyGradientDescent operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyGradientDescent + */ + public static ResourceApplyGradientDescent create(Scope scope, Operand var, Operand alpha, Operand delta, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyGradientDescent", scope.makeOpName("ResourceApplyGradientDescent")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyGradientDescent(opBuilder.build()); + } + + /** + * @param useLocking If `True`, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyGradientDescent(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyMomentum.java new file mode 100644 index 00000000000..915902e57c6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyMomentum.java @@ -0,0 +1,125 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the momentum scheme. Set use_nesterov = True if you + *

                  + * want to use Nesterov momentum. + *

                  + * accum = accum * momentum + grad + * var -= lr * accum + */ +@Operator(group = "train") +public final class ResourceApplyMomentum extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyMomentum} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyMomentum operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param grad The gradient. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyMomentum + */ + public static ResourceApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand momentum, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyMomentum", scope.makeOpName("ResourceApplyMomentum")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new ResourceApplyMomentum(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + + private ResourceApplyMomentum(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyPowerSign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyPowerSign.java new file mode 100644 index 00000000000..9c2669d14bc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyPowerSign.java @@ -0,0 +1,105 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the AddSign update. + *

                  + * m_t <- beta1 * m_{t-1} + (1 - beta1) * g + * update <- exp(logbase * sign_decay * sign(g) * sign(m_t)) * g + * variable <- variable - lr_t * update + */ +@Operator(group = "train") +public final class ResourceApplyPowerSign extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyPowerSign} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyPowerSign operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param m Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param logbase Must be a scalar. + * @param signDecay Must be a scalar. + * @param beta Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyPowerSign + */ + public static ResourceApplyPowerSign create(Scope scope, Operand var, Operand m, Operand lr, Operand logbase, Operand signDecay, Operand beta, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyPowerSign", scope.makeOpName("ResourceApplyPowerSign")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(m.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(logbase.asOutput()); + opBuilder.addInput(signDecay.asOutput()); + opBuilder.addInput(beta.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyPowerSign(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and m tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyPowerSign(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyProximalAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyProximalAdagrad.java new file mode 100644 index 00000000000..2151c65b88c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyProximalAdagrad.java @@ -0,0 +1,101 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' and '*accum' according to FOBOS with Adagrad learning rate. + *

                  + * accum += grad grad + * prox_v = var - lr grad (1 / sqrt(accum)) + * var = sign(prox_v)/(1+lrl2) max{|prox_v|-lrl1,0} + */ +@Operator(group = "train") +public final class ResourceApplyProximalAdagrad extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyProximalAdagrad} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyProximalAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyProximalAdagrad + */ + public static ResourceApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyProximalAdagrad", scope.makeOpName("ResourceApplyProximalAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyProximalAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyProximalAdagrad(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyProximalGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyProximalGradientDescent.java new file mode 100644 index 00000000000..9eeb3079af4 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyProximalGradientDescent.java @@ -0,0 +1,98 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' as FOBOS algorithm with fixed learning rate. + *

                  + * prox_v = var - alpha delta + * var = sign(prox_v)/(1+alphal2) max{|prox_v|-alphal1,0} + */ +@Operator(group = "train") +public final class ResourceApplyProximalGradientDescent extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyProximalGradientDescent} + */ + public static class Options { + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyProximalGradientDescent operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param delta The change. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyProximalGradientDescent + */ + public static ResourceApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand delta, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyProximalGradientDescent", scope.makeOpName("ResourceApplyProximalGradientDescent")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyProximalGradientDescent(opBuilder.build()); + } + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyProximalGradientDescent(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyRmsProp.java new file mode 100644 index 00000000000..54af4c19763 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceApplyRmsProp.java @@ -0,0 +1,114 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the RMSProp algorithm. + *

                  + * Note that in dense implementation of this algorithm, ms and mom will + * update even if the grad is zero, but in this sparse implementation, ms + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon) + *

                  + * ms <- rho * ms_{t-1} + (1-rho) * grad * grad + * mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) + * var <- var - mom + */ +@Operator(group = "train") +public final class ResourceApplyRmsProp extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceApplyRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceApplyRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attributes values + * @return a new instance of ResourceApplyRmsProp + */ + public static ResourceApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceApplyRMSProp", scope.makeOpName("ResourceApplyRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceApplyRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceApplyRmsProp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdadelta.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdadelta.java new file mode 100644 index 00000000000..54a43176034 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdadelta.java @@ -0,0 +1,101 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * var: Should be from a Variable(). + */ +@Operator(group = "train") +public final class ResourceSparseApplyAdadelta extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyAdadelta} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyAdadelta operation. + * + * @param scope current scope + * @param var + * @param accum Should be from a Variable(). + * @param accumUpdate : Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyAdadelta + */ + public static ResourceSparseApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdadelta", scope.makeOpName("ResourceSparseApplyAdadelta")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(accumUpdate.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceSparseApplyAdadelta(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceSparseApplyAdadelta(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagrad.java new file mode 100644 index 00000000000..d594ec19999 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagrad.java @@ -0,0 +1,120 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update relevant entries in '*var' and '*accum' according to the adagrad scheme. + *

                  + * That is for rows we have grad for, we update var and accum as follows: + * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) + */ +@Operator(group = "train") +public final class ResourceSparseApplyAdagrad extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyAdagrad} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyAdagrad + */ + public static ResourceSparseApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdagrad", scope.makeOpName("ResourceSparseApplyAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new ResourceSparseApplyAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + + private ResourceSparseApplyAdagrad(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradDa.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradDa.java new file mode 100644 index 00000000000..27c69356309 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradDa.java @@ -0,0 +1,103 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update entries in '*var' and '*accum' according to the proximal adagrad scheme. + */ +@Operator(group = "train") +public final class ResourceSparseApplyAdagradDa extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyAdagradDa} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyAdagradDa operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyAdagradDa + */ + public static ResourceSparseApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdagradDA", scope.makeOpName("ResourceSparseApplyAdagradDa")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(gradientAccumulator.asOutput()); + opBuilder.addInput(gradientSquaredAccumulator.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(globalStep.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceSparseApplyAdagradDa(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceSparseApplyAdagradDa(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyCenteredRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyCenteredRmsProp.java new file mode 100644 index 00000000000..0823cc88297 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyCenteredRmsProp.java @@ -0,0 +1,124 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the centered RMSProp algorithm. + *

                  + * The centered RMSProp algorithm uses an estimate of the centered second moment + * (i.e., the variance) for normalization, as opposed to regular RMSProp, which + * uses the (uncentered) second moment. This often helps with training, but is + * slightly more expensive in terms of computation and memory. + *

                  + * Note that in dense implementation of this algorithm, mg, ms, and mom will + * update even if the grad is zero, but in this sparse implementation, mg, ms, + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * mean_grad = decay * mean_grad + (1-decay) * gradient + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) + *

                  + * ms <- rho * ms_{t-1} + (1-rho) * grad * grad + * mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) + * var <- var - mom + */ +@Operator(group = "train") +public final class ResourceSparseApplyCenteredRmsProp extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyCenteredRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyCenteredRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyCenteredRmsProp + */ + public static ResourceSparseApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyCenteredRMSProp", scope.makeOpName("ResourceSparseApplyCenteredRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(mg.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceSparseApplyCenteredRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceSparseApplyCenteredRmsProp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyFtrl.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyFtrl.java new file mode 100644 index 00000000000..dabd99378c6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyFtrl.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update relevant entries in '*var' according to the Ftrl-proximal scheme. + *

                  + * That is for rows we have grad for, we update var, accum and linear as follows: + * grad_with_shrinkage = grad + 2 * l2_shrinkage * var + * accum_new = accum + grad_with_shrinkage * grad_with_shrinkage + * linear += grad_with_shrinkage + + * (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var + * quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 + * var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 + * accum = accum_new + */ +@Operator(group = "train") +public final class ResourceSparseApplyFtrl extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyFtrl} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyFtrl operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyFtrl + */ + public static ResourceSparseApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyFtrlV2", scope.makeOpName("ResourceSparseApplyFtrl")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(linear.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(l2Shrinkage.asOutput()); + opBuilder.addInput(lrPower.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceSparseApplyFtrl(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceSparseApplyFtrl(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyMomentum.java new file mode 100644 index 00000000000..31913c66da6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyMomentum.java @@ -0,0 +1,129 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update relevant entries in '*var' and '*accum' according to the momentum scheme. + *

                  + * Set use_nesterov = True if you want to use Nesterov momentum. + *

                  + * That is for rows we have grad for, we update var and accum as follows: + *

                  + * accum = accum * momentum + grad + * var -= lr * accum + */ +@Operator(group = "train") +public final class ResourceSparseApplyMomentum extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyMomentum} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyMomentum operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyMomentum + */ + public static ResourceSparseApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyMomentum", scope.makeOpName("ResourceSparseApplyMomentum")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new ResourceSparseApplyMomentum(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + + private ResourceSparseApplyMomentum(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalAdagrad.java new file mode 100644 index 00000000000..5ec0f053ce5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalAdagrad.java @@ -0,0 +1,105 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Sparse update entries in '*var' and '*accum' according to FOBOS algorithm. + *

                  + * That is for rows we have grad for, we update var and accum as follows: + * accum += grad grad + * prox_v = var + * prox_v -= lr grad (1 / sqrt(accum)) + * var = sign(prox_v)/(1+lrl2) max{|prox_v|-lrl1,0} + */ +@Operator(group = "train") +public final class ResourceSparseApplyProximalAdagrad extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyProximalAdagrad} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyProximalAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyProximalAdagrad + */ + public static ResourceSparseApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyProximalAdagrad", scope.makeOpName("ResourceSparseApplyProximalAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceSparseApplyProximalAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceSparseApplyProximalAdagrad(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalGradientDescent.java new file mode 100644 index 00000000000..2f258ab1d2b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalGradientDescent.java @@ -0,0 +1,101 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Sparse update '*var' as FOBOS algorithm with fixed learning rate. + *

                  + * That is for rows we have grad for, we update var as follows: + * prox_v = var - alpha grad + * var = sign(prox_v)/(1+alphal2) max{|prox_v|-alphal1,0} + */ +@Operator(group = "train") +public final class ResourceSparseApplyProximalGradientDescent extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyProximalGradientDescent} + */ + public static class Options { + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyProximalGradientDescent operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyProximalGradientDescent + */ + public static ResourceSparseApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyProximalGradientDescent", scope.makeOpName("ResourceSparseApplyProximalGradientDescent")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceSparseApplyProximalGradientDescent(opBuilder.build()); + } + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceSparseApplyProximalGradientDescent(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyRmsProp.java new file mode 100644 index 00000000000..8ae16ea5c70 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyRmsProp.java @@ -0,0 +1,116 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the RMSProp algorithm. + *

                  + * Note that in dense implementation of this algorithm, ms and mom will + * update even if the grad is zero, but in this sparse implementation, ms + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon) + *

                  + * ms <- rho * ms_{t-1} + (1-rho) * grad * grad + * mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) + * var <- var - mom + */ +@Operator(group = "train") +public final class ResourceSparseApplyRmsProp extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.ResourceSparseApplyRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new ResourceSparseApplyRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of ResourceSparseApplyRmsProp + */ + public static ResourceSparseApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyRMSProp", scope.makeOpName("ResourceSparseApplyRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new ResourceSparseApplyRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + + private ResourceSparseApplyRmsProp(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/Restore.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/Restore.java new file mode 100644 index 00000000000..5ab8db3403c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/Restore.java @@ -0,0 +1,101 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Restores tensors from a V2 checkpoint. + *

                  + * For backward compatibility with the V1 format, this Op currently allows + * restoring from a V1 checkpoint as well: + * - This Op first attempts to find the V2 index file pointed to by "prefix", and + * if found proceed to read it as a V2 checkpoint; + * - Otherwise the V1 read path is invoked. + * Relying on this behavior is not recommended, as the ability to fall back to read + * V1 might be deprecated and eventually removed. + *

                  + * By default, restores the named tensors in full. If the caller wishes to restore + * specific slices of stored tensors, "shape_and_slices" should be non-empty + * strings and correspondingly well-formed. + *

                  + * Callers must ensure all the named tensors are indeed stored in the checkpoint. + */ +@Operator(group = "train") +public final class Restore extends PrimitiveOp implements Iterable> { + + /** + * Factory method to create a class wrapping a new Restore operation. + * + * @param scope current scope + * @param prefix Must have a single element. The prefix of a V2 checkpoint. + * @param tensorNames shape {N}. The names of the tensors to be restored. + * @param shapeAndSlices shape {N}. The slice specs of the tensors to be restored. + * Empty strings indicate that they are non-partitioned tensors. + * @param dtypes shape {N}. The list of expected dtype for the tensors. Must match + * those stored in the checkpoint. + * @return a new instance of Restore + */ + public static Restore create(Scope scope, Operand prefix, Operand tensorNames, Operand shapeAndSlices, List> dtypes) { + OperationBuilder opBuilder = scope.env().opBuilder("RestoreV2", scope.makeOpName("Restore")); + opBuilder.addInput(prefix.asOutput()); + opBuilder.addInput(tensorNames.asOutput()); + opBuilder.addInput(shapeAndSlices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + DataType[] dtypesArray = new DataType[dtypes.size()]; + for (int i = 0; i < dtypesArray.length; ++i) { + dtypesArray[i] = DataType.fromClass(dtypes.get(i)); + } + opBuilder.setAttr("dtypes", dtypesArray); + return new Restore(opBuilder.build()); + } + + /** + * shape {N}. The restored tensors, whose shapes are read from the + * checkpoint directly. + */ + public List> tensors() { + return tensors; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) tensors.iterator(); + } + + private List> tensors; + + private Restore(Operation operation) { + super(operation); + int outputIdx = 0; + int tensorsLength = operation.outputListLength("tensors"); + tensors = Arrays.asList(operation.outputList(outputIdx, tensorsLength)); + outputIdx += tensorsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/RestoreSlice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/RestoreSlice.java new file mode 100644 index 00000000000..4edc59931f1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/RestoreSlice.java @@ -0,0 +1,122 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.DataType; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Restores a tensor from checkpoint files. + *

                  + * This is like `Restore` except that restored tensor can be listed as filling + * only a slice of a larger tensor. `shape_and_slice` specifies the shape of the + * larger tensor and the slice that the restored tensor covers. + *

                  + * The `shape_and_slice` input has the same format as the + * elements of the `shapes_and_slices` input of the `SaveSlices` op. + * + * @param data type for {@code tensor()} output + */ +@Operator(group = "train") +public final class RestoreSlice extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.RestoreSlice} + */ + public static class Options { + + /** + * @param preferredShard Index of file to open first if multiple files match + * `file_pattern`. See the documentation for `Restore`. + */ + public Options preferredShard(Long preferredShard) { + this.preferredShard = preferredShard; + return this; + } + + private Long preferredShard; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new RestoreSlice operation. + * + * @param scope current scope + * @param filePattern Must have a single element. The pattern of the files from + * which we read the tensor. + * @param tensorName Must have a single element. The name of the tensor to be + * restored. + * @param shapeAndSlice Scalar. The shapes and slice specifications to use when + * restoring a tensors. + * @param dt The type of the tensor to be restored. + * @param options carries optional attributes values + * @return a new instance of RestoreSlice + */ + public static RestoreSlice create(Scope scope, Operand filePattern, Operand tensorName, Operand shapeAndSlice, Class dt, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("RestoreSlice", scope.makeOpName("RestoreSlice")); + opBuilder.addInput(filePattern.asOutput()); + opBuilder.addInput(tensorName.asOutput()); + opBuilder.addInput(shapeAndSlice.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("dt", DataType.fromClass(dt)); + if (options != null) { + for (Options opts : options) { + if (opts.preferredShard != null) { + opBuilder.setAttr("preferred_shard", opts.preferredShard); + } + } + } + return new RestoreSlice(opBuilder.build()); + } + + /** + * @param preferredShard Index of file to open first if multiple files match + * `file_pattern`. See the documentation for `Restore`. + */ + public static Options preferredShard(Long preferredShard) { + return new Options().preferredShard(preferredShard); + } + + /** + * The restored tensor. + */ + public Output tensor() { + return tensor; + } + + @Override + public Output asOutput() { + return tensor; + } + + private Output tensor; + + private RestoreSlice(Operation operation) { + super(operation); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/Save.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/Save.java new file mode 100644 index 00000000000..f56f4a9b9ba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/Save.java @@ -0,0 +1,64 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Saves tensors in V2 checkpoint format. + *

                  + * By default, saves the named tensors in full. If the caller wishes to save + * specific slices of full tensors, "shape_and_slices" should be non-empty strings + * and correspondingly well-formed. + */ +@Operator(group = "train") +public final class Save extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new Save operation. + * + * @param scope current scope + * @param prefix Must have a single element. The prefix of the V2 checkpoint to which we + * write the tensors. + * @param tensorNames shape {N}. The names of the tensors to be saved. + * @param shapeAndSlices shape {N}. The slice specs of the tensors to be saved. + * Empty strings indicate that they are non-partitioned tensors. + * @param tensors `N` tensors to save. + * @return a new instance of Save + */ + public static Save create(Scope scope, Operand prefix, Operand tensorNames, Operand shapeAndSlices, Iterable> tensors) { + OperationBuilder opBuilder = scope.env().opBuilder("SaveV2", scope.makeOpName("Save")); + opBuilder.addInput(prefix.asOutput()); + opBuilder.addInput(tensorNames.asOutput()); + opBuilder.addInput(shapeAndSlices.asOutput()); + opBuilder.addInputList(Operands.asOutputs(tensors)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new Save(opBuilder.build()); + } + + + private Save(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SaveSlices.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SaveSlices.java new file mode 100644 index 00000000000..3df127c1e4b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SaveSlices.java @@ -0,0 +1,90 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Saves input tensors slices to disk. + *

                  + * This is like `Save` except that tensors can be listed in the saved file as being + * a slice of a larger tensor. `shapes_and_slices` specifies the shape of the + * larger tensor and the slice that this tensor covers. `shapes_and_slices` must + * have as many elements as `tensor_names`. + *

                  + * Elements of the `shapes_and_slices` input must either be: + *

                    + *
                  • + * The empty string, in which case the corresponding tensor is + * saved normally. + *
                  • + *
                  • + * A string of the form `dim0 dim1 ... dimN-1 slice-spec` where the + * `dimI` are the dimensions of the larger tensor and `slice-spec` + * specifies what part is covered by the tensor to save. + *
                  • + *
                  + * `slice-spec` itself is a `:`-separated list: `slice0:slice1:...:sliceN-1` + * where each `sliceI` is either: + *
                    + *
                  • + * The string `-` meaning that the slice covers all indices of this dimension + *
                  • + *
                  • + * `start,length` where `start` and `length` are integers. In that + * case the slice covers `length` indices starting at `start`. + *
                  • + *
                  + * See also `Save`. + */ +@Operator(group = "train") +public final class SaveSlices extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SaveSlices operation. + * + * @param scope current scope + * @param filename Must have a single element. The name of the file to which we write the + * tensor. + * @param tensorNames Shape `[N]`. The names of the tensors to be saved. + * @param shapesAndSlices Shape `[N]`. The shapes and slice specifications to use when + * saving the tensors. + * @param data `N` tensors to save. + * @return a new instance of SaveSlices + */ + public static SaveSlices create(Scope scope, Operand filename, Operand tensorNames, Operand shapesAndSlices, Iterable> data) { + OperationBuilder opBuilder = scope.env().opBuilder("SaveSlices", scope.makeOpName("SaveSlices")); + opBuilder.addInput(filename.asOutput()); + opBuilder.addInput(tensorNames.asOutput()); + opBuilder.addInput(shapesAndSlices.asOutput()); + opBuilder.addInputList(Operands.asOutputs(data)); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SaveSlices(opBuilder.build()); + } + + + private SaveSlices(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaFprint.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaFprint.java new file mode 100644 index 00000000000..cb5c885f4c7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaFprint.java @@ -0,0 +1,68 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Computes fingerprints of the input strings. + */ +@Operator(group = "train") +public final class SdcaFprint extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new SdcaFprint operation. + * + * @param scope current scope + * @param input vector of strings to compute fingerprints on. + * @return a new instance of SdcaFprint + */ + public static SdcaFprint create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.env().opBuilder("SdcaFprint", scope.makeOpName("SdcaFprint")); + opBuilder.addInput(input.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new SdcaFprint(opBuilder.build()); + } + + /** + * a (N,2) shaped matrix where N is the number of elements in the input + * vector. Each row contains the low and high parts of the fingerprint. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private SdcaFprint(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaOptimizer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaOptimizer.java new file mode 100644 index 00000000000..2f18e53407c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaOptimizer.java @@ -0,0 +1,177 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import java.util.Arrays; +import java.util.List; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; + +/** + * Distributed version of Stochastic Dual Coordinate Ascent (SDCA) optimizer for + *

                  + * linear models with L1 + L2 regularization. As global optimization objective is + * strongly-convex, the optimizer optimizes the dual objective at each step. The + * optimizer applies each update one example at a time. Examples are sampled + * uniformly, and the optimizer is learning rate free and enjoys linear convergence + * rate. + *

                  + * [Proximal Stochastic Dual Coordinate Ascent](http://arxiv.org/pdf/1211.2717v1.pdf).
                  + * Shai Shalev-Shwartz, Tong Zhang. 2012 + *

                  + * $$Loss Objective = \sum f_{i} (wx_{i}) + (l2 / 2) * |w|^2 + l1 * |w|$$ + *

                  + * [Adding vs. Averaging in Distributed Primal-Dual Optimization](http://arxiv.org/abs/1502.03508).
                  + * Chenxin Ma, Virginia Smith, Martin Jaggi, Michael I. Jordan, + * Peter Richtarik, Martin Takac. 2015 + *

                  + * [Stochastic Dual Coordinate Ascent with Adaptive Probabilities](https://arxiv.org/abs/1502.08053).
                  + * Dominik Csiba, Zheng Qu, Peter Richtarik. 2015 + */ +public final class SdcaOptimizer extends PrimitiveOp { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SdcaOptimizer} + */ + public static class Options { + + /** + * @param adaptive Whether to use Adaptive SDCA for the inner loop. + */ + public Options adaptive(Boolean adaptive) { + this.adaptive = adaptive; + return this; + } + + private Boolean adaptive; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SdcaOptimizer operation. + * + * @param scope current scope + * @param sparseExampleIndices a list of vectors which contain example indices. + * @param sparseFeatureIndices a list of vectors which contain feature indices. + * @param sparseFeatureValues a list of vectors which contains feature value + * associated with each feature group. + * @param denseFeatures a list of matrices which contains the dense feature values. + * @param exampleWeights a vector which contains the weight associated with each + * example. + * @param exampleLabels a vector which contains the label/target associated with each + * example. + * @param sparseIndices a list of vectors where each value is the indices which has + * corresponding weights in sparse_weights. This field maybe omitted for the + * dense approach. + * @param sparseWeights a list of vectors where each value is the weight associated with + * a sparse feature group. + * @param denseWeights a list of vectors where the values are the weights associated + * with a dense feature group. + * @param exampleStateData a list of vectors containing the example state data. + * @param lossType Type of the primal loss. Currently SdcaSolver supports logistic, + * squared and hinge losses. + * @param l1 Symmetric l1 regularization strength. + * @param l2 Symmetric l2 regularization strength. + * @param numLossPartitions Number of partitions of the global loss function. + * @param numInnerIterations Number of iterations per mini-batch. + * @param options carries optional attributes values + * @return a new instance of SdcaOptimizer + */ + public static SdcaOptimizer create(Scope scope, Iterable> sparseExampleIndices, Iterable> sparseFeatureIndices, Iterable> sparseFeatureValues, Iterable> denseFeatures, Operand exampleWeights, Operand exampleLabels, Iterable> sparseIndices, Iterable> sparseWeights, Iterable> denseWeights, Operand exampleStateData, String lossType, Float l1, Float l2, Long numLossPartitions, Long numInnerIterations, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SdcaOptimizerV2", scope.makeOpName("SdcaOptimizer")); + opBuilder.addInputList(Operands.asOutputs(sparseExampleIndices)); + opBuilder.addInputList(Operands.asOutputs(sparseFeatureIndices)); + opBuilder.addInputList(Operands.asOutputs(sparseFeatureValues)); + opBuilder.addInputList(Operands.asOutputs(denseFeatures)); + opBuilder.addInput(exampleWeights.asOutput()); + opBuilder.addInput(exampleLabels.asOutput()); + opBuilder.addInputList(Operands.asOutputs(sparseIndices)); + opBuilder.addInputList(Operands.asOutputs(sparseWeights)); + opBuilder.addInputList(Operands.asOutputs(denseWeights)); + opBuilder.addInput(exampleStateData.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("loss_type", lossType); + opBuilder.setAttr("l1", l1); + opBuilder.setAttr("l2", l2); + opBuilder.setAttr("num_loss_partitions", numLossPartitions); + opBuilder.setAttr("num_inner_iterations", numInnerIterations); + if (options != null) { + for (Options opts : options) { + if (opts.adaptive != null) { + opBuilder.setAttr("adaptive", opts.adaptive); + } + } + } + return new SdcaOptimizer(opBuilder.build()); + } + + /** + * @param adaptive Whether to use Adaptive SDCA for the inner loop. + */ + public static Options adaptive(Boolean adaptive) { + return new Options().adaptive(adaptive); + } + + /** + * a list of vectors containing the updated example state + * data. + */ + public Output outExampleStateData() { + return outExampleStateData; + } + + /** + * a list of vectors where each value is the delta + * weights associated with a sparse feature group. + */ + public List> outDeltaSparseWeights() { + return outDeltaSparseWeights; + } + + /** + * a list of vectors where the values are the delta + * weights associated with a dense feature group. + */ + public List> outDeltaDenseWeights() { + return outDeltaDenseWeights; + } + + private Output outExampleStateData; + private List> outDeltaSparseWeights; + private List> outDeltaDenseWeights; + + @SuppressWarnings("unchecked") + private SdcaOptimizer(Operation operation) { + super(operation); + int outputIdx = 0; + outExampleStateData = operation.output(outputIdx++); + int outDeltaSparseWeightsLength = operation.outputListLength("out_delta_sparse_weights"); + outDeltaSparseWeights = Arrays.asList((Output[])operation.outputList(outputIdx, outDeltaSparseWeightsLength)); + outputIdx += outDeltaSparseWeightsLength; + int outDeltaDenseWeightsLength = operation.outputListLength("out_delta_dense_weights"); + outDeltaDenseWeights = Arrays.asList((Output[])operation.outputList(outputIdx, outDeltaDenseWeightsLength)); + outputIdx += outDeltaDenseWeightsLength; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaShrinkL1.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaShrinkL1.java new file mode 100644 index 00000000000..1b228281454 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SdcaShrinkL1.java @@ -0,0 +1,57 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.Operands; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Applies L1 regularization shrink step on the parameters. + */ +@Operator(group = "train") +public final class SdcaShrinkL1 extends PrimitiveOp { + + /** + * Factory method to create a class wrapping a new SdcaShrinkL1 operation. + * + * @param scope current scope + * @param weights a list of vectors where each value is the weight associated with a + * feature group. + * @param l1 Symmetric l1 regularization strength. + * @param l2 Symmetric l2 regularization strength. Should be a positive float. + * @return a new instance of SdcaShrinkL1 + */ + public static SdcaShrinkL1 create(Scope scope, Iterable> weights, Float l1, Float l2) { + OperationBuilder opBuilder = scope.env().opBuilder("SdcaShrinkL1", scope.makeOpName("SdcaShrinkL1")); + opBuilder.addInputList(Operands.asOutputs(weights)); + opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.setAttr("l1", l1); + opBuilder.setAttr("l2", l2); + return new SdcaShrinkL1(opBuilder.build()); + } + + + private SdcaShrinkL1(Operation operation) { + super(operation); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdadelta.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdadelta.java new file mode 100644 index 00000000000..fa0b951ab60 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdadelta.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * var: Should be from a Variable(). + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyAdadelta extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyAdadelta} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyAdadelta operation. + * + * @param scope current scope + * @param var + * @param accum Should be from a Variable(). + * @param accumUpdate : Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param rho Decay factor. Must be a scalar. + * @param epsilon Constant factor. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyAdadelta + */ + public static SparseApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyAdadelta", scope.makeOpName("SparseApplyAdadelta")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(accumUpdate.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new SparseApplyAdadelta(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyAdadelta(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagrad.java new file mode 100644 index 00000000000..a5ab8579cdc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagrad.java @@ -0,0 +1,138 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update relevant entries in '*var' and '*accum' according to the adagrad scheme. + *

                  + * That is for rows we have grad for, we update var and accum as follows: + * $$accum += grad * grad$$ + * $$var -= lr * grad * (1 / sqrt(accum))$$ + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyAdagrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyAdagrad} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param updateSlots + */ + public Options updateSlots(Boolean updateSlots) { + this.updateSlots = updateSlots; + return this; + } + + private Boolean useLocking; + private Boolean updateSlots; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyAdagrad + */ + public static SparseApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyAdagrad", scope.makeOpName("SparseApplyAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.updateSlots != null) { + opBuilder.setAttr("update_slots", opts.updateSlots); + } + } + } + return new SparseApplyAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param updateSlots + */ + public static Options updateSlots(Boolean updateSlots) { + return new Options().updateSlots(updateSlots); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyAdagrad(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagradDa.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagradDa.java new file mode 100644 index 00000000000..bd63ff92d86 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagradDa.java @@ -0,0 +1,121 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update entries in '*var' and '*accum' according to the proximal adagrad scheme. + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyAdagradDa extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyAdagradDa} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyAdagradDa operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of SparseApplyAdagradDa + */ + public static SparseApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyAdagradDA", scope.makeOpName("SparseApplyAdagradDa")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(gradientAccumulator.asOutput()); + opBuilder.addInput(gradientSquaredAccumulator.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(globalStep.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new SparseApplyAdagradDa(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyAdagradDa(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyCenteredRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyCenteredRmsProp.java new file mode 100644 index 00000000000..fef12ee9630 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyCenteredRmsProp.java @@ -0,0 +1,142 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the centered RMSProp algorithm. + *

                  + * The centered RMSProp algorithm uses an estimate of the centered second moment + * (i.e., the variance) for normalization, as opposed to regular RMSProp, which + * uses the (uncentered) second moment. This often helps with training, but is + * slightly more expensive in terms of computation and memory. + *

                  + * Note that in dense implementation of this algorithm, mg, ms, and mom will + * update even if the grad is zero, but in this sparse implementation, mg, ms, + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * mean_grad = decay * mean_grad + (1-decay) * gradient + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) + *

                  + * $$ms <- rho * ms_{t-1} + (1-rho) * grad * grad$$ + * $$mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon)$$ + * $$var <- var - mom$$ + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyCenteredRmsProp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyCenteredRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyCenteredRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param mg Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of SparseApplyCenteredRmsProp + */ + public static SparseApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyCenteredRMSProp", scope.makeOpName("SparseApplyCenteredRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(mg.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new SparseApplyCenteredRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, mg, ms, and mom tensors is + * protected by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyCenteredRmsProp(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyFtrl.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyFtrl.java new file mode 100644 index 00000000000..b77d5971ffa --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyFtrl.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update relevant entries in '*var' according to the Ftrl-proximal scheme. + *

                  + * That is for rows we have grad for, we update var, accum and linear as follows: + * grad_with_shrinkage = grad + 2 * l2_shrinkage * var + * accum_new = accum + grad_with_shrinkage * grad_with_shrinkage + * linear += grad_with_shrinkage + + * (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var + * quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 + * var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 + * accum = accum_new + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyFtrl extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyFtrl} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyFtrl operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param linear Should be from a Variable(). + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 shrinkage regulariation. Must be a scalar. + * @param l2Shrinkage + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of SparseApplyFtrl + */ + public static SparseApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyFtrlV2", scope.makeOpName("SparseApplyFtrl")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(linear.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(l2Shrinkage.asOutput()); + opBuilder.addInput(lrPower.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new SparseApplyFtrl(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyFtrl(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyMomentum.java new file mode 100644 index 00000000000..0b155c84dfd --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyMomentum.java @@ -0,0 +1,147 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update relevant entries in '*var' and '*accum' according to the momentum scheme. + *

                  + * Set use_nesterov = True if you want to use Nesterov momentum. + *

                  + * That is for rows we have grad for, we update var and accum as follows: + *

                  + * $$accum = accum * momentum + grad$$ + * $$var -= lr * accum$$ + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyMomentum extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyMomentum} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public Options useNesterov(Boolean useNesterov) { + this.useNesterov = useNesterov; + return this; + } + + private Boolean useLocking; + private Boolean useNesterov; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyMomentum operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attributes values + * @return a new instance of SparseApplyMomentum + */ + public static SparseApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyMomentum", scope.makeOpName("SparseApplyMomentum")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.useNesterov != null) { + opBuilder.setAttr("use_nesterov", opts.useNesterov); + } + } + } + return new SparseApplyMomentum(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var and accum tensors will be protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * @param useNesterov If `True`, the tensor passed to compute grad will be + * var - lr * momentum * accum, so in the end, the var you get is actually + * var - lr * momentum * accum. + */ + public static Options useNesterov(Boolean useNesterov) { + return new Options().useNesterov(useNesterov); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyMomentum(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalAdagrad.java new file mode 100644 index 00000000000..6d1e4b63074 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalAdagrad.java @@ -0,0 +1,123 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Sparse update entries in '*var' and '*accum' according to FOBOS algorithm. + *

                  + * That is for rows we have grad for, we update var and accum as follows: + * $$accum += grad grad$$ + * $$prox_v = var$$ + * $$prox_v -= lr grad (1 / sqrt(accum))$$ + * $$var = sign(prox_v)/(1+lrl2) max{|prox_v|-lrl1,0}$$ + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyProximalAdagrad extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyProximalAdagrad} + */ + public static class Options { + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyProximalAdagrad operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param accum Should be from a Variable(). + * @param lr Learning rate. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyProximalAdagrad + */ + public static SparseApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyProximalAdagrad", scope.makeOpName("SparseApplyProximalAdagrad")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(accum.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new SparseApplyProximalAdagrad(opBuilder.build()); + } + + /** + * @param useLocking If True, updating of the var and accum tensors will be protected by + * a lock; otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyProximalAdagrad(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalGradientDescent.java new file mode 100644 index 00000000000..81b0057d6ab --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalGradientDescent.java @@ -0,0 +1,119 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Sparse update '*var' as FOBOS algorithm with fixed learning rate. + *

                  + * That is for rows we have grad for, we update var as follows: + * $$prox_v = var - alpha grad$$ + * $$var = sign(prox_v)/(1+alphal2) max{|prox_v|-alphal1,0}$$ + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyProximalGradientDescent extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyProximalGradientDescent} + */ + public static class Options { + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyProximalGradientDescent operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 regularization. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attributes values + * @return a new instance of SparseApplyProximalGradientDescent + */ + public static SparseApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyProximalGradientDescent", scope.makeOpName("SparseApplyProximalGradientDescent")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(alpha.asOutput()); + opBuilder.addInput(l1.asOutput()); + opBuilder.addInput(l2.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new SparseApplyProximalGradientDescent(opBuilder.build()); + } + + /** + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyProximalGradientDescent(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyRmsProp.java new file mode 100644 index 00000000000..f877e241cdb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyRmsProp.java @@ -0,0 +1,134 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Update '*var' according to the RMSProp algorithm. + *

                  + * Note that in dense implementation of this algorithm, ms and mom will + * update even if the grad is zero, but in this sparse implementation, ms + * and mom will not update in iterations during which the grad is zero. + *

                  + * mean_square = decay * mean_square + (1-decay) * gradient ** 2 + * Delta = learning_rate * gradient / sqrt(mean_square + epsilon) + *

                  + * $$ms <- rho * ms_{t-1} + (1-rho) * grad * grad$$ + * $$mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon)$$ + * $$var <- var - mom$$ + * + * @param data type for {@code out()} output + */ +@Operator(group = "train") +public final class SparseApplyRmsProp extends PrimitiveOp implements Operand { + + /** + * Optional attributes for {@link org.tensorflow.op.train.SparseApplyRmsProp} + */ + public static class Options { + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + private Boolean useLocking; + + private Options() { + } + } + + /** + * Factory method to create a class wrapping a new SparseApplyRmsProp operation. + * + * @param scope current scope + * @param var Should be from a Variable(). + * @param ms Should be from a Variable(). + * @param mom Should be from a Variable(). + * @param lr Scaling factor. Must be a scalar. + * @param rho Decay rate. Must be a scalar. + * @param momentum + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attributes values + * @return a new instance of SparseApplyRmsProp + */ + public static SparseApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyRMSProp", scope.makeOpName("SparseApplyRmsProp")); + opBuilder.addInput(var.asOutput()); + opBuilder.addInput(ms.asOutput()); + opBuilder.addInput(mom.asOutput()); + opBuilder.addInput(lr.asOutput()); + opBuilder.addInput(rho.asOutput()); + opBuilder.addInput(momentum.asOutput()); + opBuilder.addInput(epsilon.asOutput()); + opBuilder.addInput(grad.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + } + } + return new SparseApplyRmsProp(opBuilder.build()); + } + + /** + * @param useLocking If `True`, updating of the var, ms, and mom tensors is protected + * by a lock; otherwise the behavior is undefined, but may exhibit less + * contention. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Same as "var". + */ + public Output out() { + return out; + } + + @Override + public Output asOutput() { + return out; + } + + private Output out; + + private SparseApplyRmsProp(Operation operation) { + super(operation); + int outputIdx = 0; + out = operation.output(outputIdx++); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/TileGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/TileGrad.java new file mode 100644 index 00000000000..c0bc9692d92 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/TileGrad.java @@ -0,0 +1,74 @@ +/* Copyright 2018 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. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.train; + +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Operator; + +/** + * Returns the gradient of `Tile`. + *

                  + * Since `Tile` takes an input and repeats the input `multiples` times + * along each dimension, `train.TileGrad` takes in `multiples` and aggregates + * each repeated tile of `input` into `output`. + * + * @param data type for {@code output()} output + */ +@Operator(group = "train") +public final class TileGrad extends PrimitiveOp implements Operand { + + /** + * Factory method to create a class wrapping a new TileGrad operation. + * + * @param scope current scope + * @param input + * @param multiples + * @return a new instance of TileGrad + */ + public static TileGrad create(Scope scope, Operand input, Operand multiples) { + OperationBuilder opBuilder = scope.env().opBuilder("TileGrad", scope.makeOpName("TileGrad")); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(multiples.asOutput()); + opBuilder = scope.applyControlDependencies(opBuilder); + return new TileGrad(opBuilder.build()); + } + + /** + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + private Output output; + + private TileGrad(Operation operation) { + super(operation); + int outputIdx = 0; + output = operation.output(outputIdx++); + } +} diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/AbstractOperation.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/AbstractOperation.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/AbstractOperation.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/AbstractOperation.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/DataType.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/DataType.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/DataType.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/DataType.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/EagerOperation.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperation.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/EagerOperation.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperation.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/EagerOperationBuilder.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperationBuilder.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/EagerOperationBuilder.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperationBuilder.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/EagerSession.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerSession.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/EagerSession.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerSession.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/ExecutionEnvironment.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/ExecutionEnvironment.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/ExecutionEnvironment.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/ExecutionEnvironment.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Graph.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Graph.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/GraphOperation.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperation.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/GraphOperation.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperation.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/GraphOperationBuilder.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/GraphOperationBuilder.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/NativeLibrary.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/NativeLibrary.java similarity index 99% rename from core/tensorflow-core/src/main/java/org/tensorflow/NativeLibrary.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/NativeLibrary.java index 2ab0e4706cb..f67d91c5016 100644 --- a/core/tensorflow-core/src/main/java/org/tensorflow/NativeLibrary.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/NativeLibrary.java @@ -45,6 +45,8 @@ final class NativeLibrary { private static final String JNI_LIBNAME = "tensorflow_jni"; public static void load() { + org.bytedeco.javacpp.Loader.load(org.tensorflow.c_api.global.tensorflow.class); + if (isLoaded() || tryLoadLibrary()) { // Either: // (1) The native library has already been statically loaded, OR diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Operand.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Operand.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Operand.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Operand.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Operation.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Operation.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Operation.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Operation.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/OperationBuilder.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/OperationBuilder.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/OperationBuilder.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/OperationBuilder.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Output.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Output.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Output.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Output.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/SavedModelBundle.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/SavedModelBundle.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/SavedModelBundle.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/SavedModelBundle.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Server.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Server.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Server.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Server.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Session.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Session.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Session.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Session.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Shape.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Shape.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Shape.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Shape.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Tensor.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Tensor.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Tensor.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Tensor.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/TensorFlow.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/TensorFlow.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/TensorFlowException.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlowException.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/TensorFlowException.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlowException.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/Tensors.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Tensors.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/Tensors.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Tensors.java diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Buffer.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Buffer.java new file mode 100644 index 00000000000..ec6238965d3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Buffer.java @@ -0,0 +1,69 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api; + +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.Properties; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public abstract class AbstractTF_Buffer extends Pointer { + protected static class DeleteDeallocator extends TF_Buffer implements Pointer.Deallocator { + DeleteDeallocator(TF_Buffer s) { super(s); } + @Override public void deallocate() { if (!isNull()) TF_DeleteBuffer(this); setNull(); } + } + + public AbstractTF_Buffer(Pointer p) { super(p); } + + /** + * Calls TF_NewBuffer(), and registers a deallocator. + * @return TF_Buffer created. Do not call TF_DeleteBuffer() on it. + */ + public static TF_Buffer newBuffer() { + TF_Buffer b = TF_NewBuffer(); + if (b != null) { + b.deallocator(new DeleteDeallocator(b)); + } + return b; + } + + /** Returns {@code newBufferFromString(new BytePointer(proto)). */ + public static TF_Buffer newBufferFromString(byte[] proto) { + return newBufferFromString(new BytePointer(proto)); + } + + /** + * Calls TF_NewBufferFromString(), and registers a deallocator. + * @return TF_Buffer created. Do not call TF_DeleteBuffer() on it. + */ + public static TF_Buffer newBufferFromString(Pointer proto) { + TF_Buffer b = TF_NewBufferFromString(proto, proto.limit()); + if (b != null) { + b.deallocator(new DeleteDeallocator(b)); + } + return b; + } + + /** + * Calls the deallocator, if registered, otherwise has no effect. + */ + public void delete() { + deallocate(); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Graph.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Graph.java new file mode 100644 index 00000000000..c0a15a8f492 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Graph.java @@ -0,0 +1,52 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api; + +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.Properties; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public abstract class AbstractTF_Graph extends Pointer { + protected static class DeleteDeallocator extends TF_Graph implements Pointer.Deallocator { + DeleteDeallocator(TF_Graph s) { super(s); } + @Override public void deallocate() { if (!isNull()) TF_DeleteGraph(this); setNull(); } + } + + public AbstractTF_Graph(Pointer p) { super(p); } + + /** + * Calls TF_NewGraph(), and registers a deallocator. + * @return TF_Graph created. Do not call TF_DeleteGraph() on it. + */ + public static TF_Graph newGraph() { + TF_Graph g = TF_NewGraph(); + if (g != null) { + g.deallocator(new DeleteDeallocator(g)); + } + return g; + } + + /** + * Calls the deallocator, if registered, otherwise has no effect. + */ + public void delete() { + deallocate(); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_ImportGraphDefOptions.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_ImportGraphDefOptions.java new file mode 100644 index 00000000000..1179a2c36d2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_ImportGraphDefOptions.java @@ -0,0 +1,52 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api; + +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.Properties; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public abstract class AbstractTF_ImportGraphDefOptions extends Pointer { + protected static class DeleteDeallocator extends TF_ImportGraphDefOptions implements Pointer.Deallocator { + DeleteDeallocator(TF_ImportGraphDefOptions s) { super(s); } + @Override public void deallocate() { if (!isNull()) TF_DeleteImportGraphDefOptions(this); setNull(); } + } + + public AbstractTF_ImportGraphDefOptions(Pointer p) { super(p); } + + /** + * Calls TF_NewImportGraphDefOptions(), and registers a deallocator. + * @return TF_ImportGraphDefOptions created. Do not call TF_DeleteImportGraphDefOptions() on it. + */ + public static TF_ImportGraphDefOptions newImportGraphDefOptions() { + TF_ImportGraphDefOptions o = TF_NewImportGraphDefOptions(); + if (o != null) { + o.deallocator(new DeleteDeallocator(o)); + } + return o; + } + + /** + * Calls the deallocator, if registered, otherwise has no effect. + */ + public void delete() { + deallocate(); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Session.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Session.java new file mode 100644 index 00000000000..15aeb076444 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Session.java @@ -0,0 +1,60 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api; + +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.Properties; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public abstract class AbstractTF_Session extends Pointer { + protected static class DeleteDeallocator extends TF_Session implements Pointer.Deallocator { + DeleteDeallocator(TF_Session s) { super(s); } + @Override public void deallocate() { if (!isNull()) TF_DeleteSession(this, TF_Status.newStatus()); setNull(); } + } + + /** References to prevent deallocation. */ + protected TF_Graph graph; + protected TF_SessionOptions opts; + protected TF_Status status; + + public AbstractTF_Session(Pointer p) { super(p); } + + /** + * Calls TF_NewSession(), and registers a deallocator. + * @return TF_Session created. Do not call TF_DeleteSession() on it. + */ + public static TF_Session newSession(TF_Graph graph, TF_SessionOptions opts, TF_Status status) { + TF_Session s = TF_NewSession(graph, opts, status); + if (s != null) { + s.graph = graph; + s.opts = opts; + s.status = status; + s.deallocator(new DeleteDeallocator(s)); + } + return s; + } + + /** + * Calls the deallocator, if registered, otherwise has no effect. + */ + public void delete() { + deallocate(); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_SessionOptions.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_SessionOptions.java new file mode 100644 index 00000000000..4c89013ec88 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_SessionOptions.java @@ -0,0 +1,52 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api; + +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.Properties; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public abstract class AbstractTF_SessionOptions extends Pointer { + protected static class DeleteDeallocator extends TF_SessionOptions implements Pointer.Deallocator { + DeleteDeallocator(TF_SessionOptions s) { super(s); } + @Override public void deallocate() { if (!isNull()) TF_DeleteSessionOptions(this); setNull(); } + } + + public AbstractTF_SessionOptions(Pointer p) { super(p); } + + /** + * Calls TF_NewSessionOptions(), and registers a deallocator. + * @return TF_SessionOptions created. Do not call TF_DeleteSessionOptions() on it. + */ + public static TF_SessionOptions newSessionOptions() { + TF_SessionOptions o = TF_NewSessionOptions(); + if (o != null) { + o.deallocator(new DeleteDeallocator(o)); + } + return o; + } + + /** + * Calls the deallocator, if registered, otherwise has no effect. + */ + public void delete() { + deallocate(); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Status.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Status.java new file mode 100644 index 00000000000..30d079b7795 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Status.java @@ -0,0 +1,52 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api; + +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.Properties; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public abstract class AbstractTF_Status extends Pointer { + protected static class DeleteDeallocator extends TF_Status implements Pointer.Deallocator { + DeleteDeallocator(TF_Status s) { super(s); } + @Override public void deallocate() { if (!isNull()) TF_DeleteStatus(this); setNull(); } + } + + public AbstractTF_Status(Pointer p) { super(p); } + + /** + * Calls TF_NewStatus(), and registers a deallocator. + * @return TF_Status created. Do not call TF_DeleteStatus() on it. + */ + public static TF_Status newStatus() { + TF_Status s = TF_NewStatus(); + if (s != null) { + s.deallocator(new DeleteDeallocator(s)); + } + return s; + } + + /** + * Calls the deallocator, if registered, otherwise has no effect. + */ + public void delete() { + deallocate(); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Tensor.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Tensor.java new file mode 100644 index 00000000000..4c0c5127a27 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/AbstractTF_Tensor.java @@ -0,0 +1,80 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api; + +import org.bytedeco.javacpp.*; +import org.bytedeco.javacpp.annotation.Properties; + +import static org.tensorflow.c_api.global.tensorflow.*; + +@Properties(inherit = org.tensorflow.c_api.presets.tensorflow.class) +public abstract class AbstractTF_Tensor extends Pointer { + protected static class DeleteDeallocator extends TF_Tensor implements Pointer.Deallocator { + DeleteDeallocator(TF_Tensor s) { super(s); } + @Override public void deallocate() { if (!isNull()) TF_DeleteTensor(this); setNull(); } + } + + /** TensorFlow crashes if we don't pass it a deallocator, so... */ + protected static Deallocator_Pointer_long_Pointer dummyDeallocator = new Deallocator_Pointer_long_Pointer() { + @Override public void call(Pointer data, long len, Pointer arg) { } + }; + + static { + PointerScope s = PointerScope.getInnerScope(); + if (s != null) { + s.detach(dummyDeallocator); + } + } + + /** A reference to prevent deallocation. */ + protected Pointer pointer; + + public AbstractTF_Tensor(Pointer p) { super(p); } + + /** + * Calls TF_NewTensor(), and registers a deallocator. + * @return TF_Tensor created. Do not call TF_DeleteTensor() on it. + */ + public static TF_Tensor newTensor(int dtype, long[] dims, Pointer data) { + TF_Tensor t = TF_NewTensor(dtype, dims, dims.length, data, data.limit(), dummyDeallocator, null); + if (t != null) { + t.pointer = data; + t.deallocator(new DeleteDeallocator(t)); + } + return t; + } + + /** + * Calls TF_AllocateTensor(), and registers a deallocator. + * @return TF_Tensor created. Do not call TF_DeleteTensor() on it. + */ + public static TF_Tensor allocateTensor(int dtype, long[] dims, long length) { + TF_Tensor t = TF_AllocateTensor(dtype, dims, dims.length, length); + if (t != null) { + t.deallocator(new DeleteDeallocator(t)); + } + return t; + } + + /** + * Calls the deallocator, if registered, otherwise has no effect. + */ + public void delete() { + deallocate(); + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/presets/tensorflow.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/presets/tensorflow.java new file mode 100644 index 00000000000..9721705e39e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/c_api/presets/tensorflow.java @@ -0,0 +1,144 @@ +/* + Copyright 2019 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. + ======================================================================= + */ + +package org.tensorflow.c_api.presets; + +import java.util.List; +import org.bytedeco.javacpp.BytePointer; +import org.bytedeco.javacpp.ClassProperties; +import org.bytedeco.javacpp.LoadEnabled; +import org.bytedeco.javacpp.Loader; +import org.bytedeco.javacpp.annotation.Platform; +import org.bytedeco.javacpp.annotation.Properties; +import org.bytedeco.javacpp.tools.Info; +import org.bytedeco.javacpp.tools.InfoMap; +import org.bytedeco.javacpp.tools.InfoMapper; +import org.bytedeco.javacpp.tools.Logger; + +/** + * + * @author Samuel Audet + */ +@Properties( + value = { + @Platform( + value = {"linux", "macosx", "windows"}, + compiler = "cpp11", + include = { + "tensorflow/c/tf_attrtype.h", + "tensorflow/c/tf_datatype.h", + "tensorflow/c/tf_status.h", + "tensorflow/c/tf_tensor.h", + "tensorflow/c/c_api.h", +// "tensorflow/c/env.h", + "tensorflow/c/kernels.h", + "tensorflow/c/ops.h", + "tensorflow/c/eager/c_api.h" + }, + link = "tensorflow@.2", + preload = {"iomp5", "mklml", "mklml_intel", "tensorflow_framework@.2"}, + preloadresource = "/org/bytedeco/mkldnn/" + ), + @Platform( + value = "windows", + preload = { + "api-ms-win-crt-locale-l1-1-0", "api-ms-win-crt-string-l1-1-0", "api-ms-win-crt-stdio-l1-1-0", "api-ms-win-crt-math-l1-1-0", + "api-ms-win-crt-heap-l1-1-0", "api-ms-win-crt-runtime-l1-1-0", "api-ms-win-crt-convert-l1-1-0", "api-ms-win-crt-environment-l1-1-0", + "api-ms-win-crt-time-l1-1-0", "api-ms-win-crt-filesystem-l1-1-0", "api-ms-win-crt-utility-l1-1-0", "api-ms-win-crt-multibyte-l1-1-0", + "api-ms-win-core-string-l1-1-0", "api-ms-win-core-errorhandling-l1-1-0", "api-ms-win-core-timezone-l1-1-0", "api-ms-win-core-file-l1-1-0", + "api-ms-win-core-namedpipe-l1-1-0", "api-ms-win-core-handle-l1-1-0", "api-ms-win-core-file-l2-1-0", "api-ms-win-core-heap-l1-1-0", + "api-ms-win-core-libraryloader-l1-1-0", "api-ms-win-core-synch-l1-1-0", "api-ms-win-core-processthreads-l1-1-0", + "api-ms-win-core-processenvironment-l1-1-0", "api-ms-win-core-datetime-l1-1-0", "api-ms-win-core-localization-l1-2-0", + "api-ms-win-core-sysinfo-l1-1-0", "api-ms-win-core-synch-l1-2-0", "api-ms-win-core-console-l1-1-0", "api-ms-win-core-debug-l1-1-0", + "api-ms-win-core-rtlsupport-l1-1-0", "api-ms-win-core-processthreads-l1-1-1", "api-ms-win-core-file-l1-2-0", "api-ms-win-core-profile-l1-1-0", + "api-ms-win-core-memory-l1-1-0", "api-ms-win-core-util-l1-1-0", "api-ms-win-core-interlocked-l1-1-0", "ucrtbase", + "vcruntime140", "msvcp140", "concrt140", "vcomp140", "msvcr120", "libiomp5md", "mklml", "tensorflow_framework" + } + ), + @Platform( + value = "windows-x86", + preloadpath = { + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x86/Microsoft.VC140.CRT/", + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x86/Microsoft.VC140.OpenMP/", + "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt/DLLs/x86/" + } + ), + @Platform( + value = "windows-x86_64", + preloadpath = { + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x64/Microsoft.VC140.CRT/", + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x64/Microsoft.VC140.OpenMP/", + "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt/DLLs/x64/" + } + ) + }, + target = "org.tensorflow.c_api", + global = "org.tensorflow.c_api.global.tensorflow") +public class tensorflow implements LoadEnabled, InfoMapper { + + @Override public void init(ClassProperties properties) { + String platform = properties.getProperty("platform"); + List preloadpaths = properties.get("platform.preloadpath"); + + String vcredistdir = System.getenv("VCToolsRedistDir"); + if (vcredistdir != null && vcredistdir.length() > 0) { + switch (platform) { + case "windows-x86": + preloadpaths.add(0, vcredistdir + "\\x86\\Microsoft.VC141.CRT"); + preloadpaths.add(1, vcredistdir + "\\x86\\Microsoft.VC141.OpenMP"); + break; + case "windows-x86_64": + preloadpaths.add(0, vcredistdir + "\\x64\\Microsoft.VC141.CRT"); + preloadpaths.add(1, vcredistdir + "\\x64\\Microsoft.VC141.OpenMP"); + break; + default: + // not Windows + } + } + } + + public void map(InfoMap infoMap) { + infoMap.put(new Info("TF_CAPI_EXPORT").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.c_api.AbstractTF_Status")) + .put(new Info("TF_Buffer").pointerTypes("TF_Buffer").base("org.tensorflow.c_api.AbstractTF_Buffer")) + .put(new Info("TF_Tensor").pointerTypes("TF_Tensor").base("org.tensorflow.c_api.AbstractTF_Tensor")) + .put(new Info("TF_SessionOptions").pointerTypes("TF_SessionOptions").base("org.tensorflow.c_api.AbstractTF_SessionOptions")) + .put(new Info("TF_Graph").pointerTypes("TF_Graph").base("org.tensorflow.c_api.AbstractTF_Graph")) + .put(new Info("TF_Graph::graph").javaText("public native @MemberGetter @ByRef Graph graph();")) + .put(new Info("TF_Graph::refiner").javaText("public native @MemberGetter @ByRef ShapeRefiner refiner();")) + .put(new Info("TF_ImportGraphDefOptions").pointerTypes("TF_ImportGraphDefOptions").base("org.tensorflow.c_api.AbstractTF_ImportGraphDefOptions")) + .put(new Info("TF_Operation", "TFE_MonitoringCounterCell", "TFE_MonitoringSamplerCell", + "TFE_MonitoringCounter0", "TFE_MonitoringCounter1", "TFE_MonitoringCounter2", + "TFE_MonitoringIntGaugeCell", "TFE_MonitoringStringGaugeCell", "TFE_MonitoringBoolGaugeCell", + "TFE_MonitoringIntGauge0", "TFE_MonitoringIntGauge1", "TFE_MonitoringIntGauge2", + "TFE_MonitoringStringGauge0", "TFE_MonitoringStringGauge1", "TFE_MonitoringStringGauge2", + "TFE_MonitoringBoolGauge0", "TFE_MonitoringBoolGauge1", "TFE_MonitoringBoolGauge2", + "TFE_MonitoringSampler0", "TFE_MonitoringSampler1", "TFE_MonitoringSampler2").purify()) + .put(new Info("TF_Operation::node").javaText("public native @MemberGetter @ByRef Node node();")) + .put(new Info("TFE_MonitoringCounterCell::cell").javaText("public native @MemberGetter @ByRef CounterCell cell();")) + .put(new Info("TFE_MonitoringSamplerCell::cell").javaText("public native @MemberGetter @ByRef SamplerCell cell();")) + .put(new Info("TFE_MonitoringIntGaugeCell::cell").javaText("public native @MemberGetter @ByRef IntGaugeCell cell();")) + .put(new Info("TFE_MonitoringStringGaugeCell::cell").javaText("public native @MemberGetter @ByRef StringGaugeCell cell();")) + .put(new Info("TFE_MonitoringBoolGaugeCell::cell").javaText("public native @MemberGetter @ByRef BoolGaugeCell cell();")) + .put(new Info("TFE_Context::context").javaText("@MemberGetter public native @ByRef EagerContext context();")) + .put(new Info("TFE_Op::operation").javaText("@MemberGetter public native @ByRef EagerOperation operation();")) + .put(new Info("TF_ShapeInferenceContextDimValueKnown", "TFE_NewTensorHandle(const tensorflow::Tensor&, TF_Status*)").skip()) + .put(new Info("TF_Session").pointerTypes("TF_Session").base("org.tensorflow.c_api.AbstractTF_Session")) + .put(new Info("TF_WhileParams").purify()); + } +} diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/NameScope.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/NameScope.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/NameScope.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/NameScope.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/Op.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/Op.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/Op.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/Op.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/Operands.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/Operands.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/Operands.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/Operands.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/PrimitiveOp.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/PrimitiveOp.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/PrimitiveOp.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/PrimitiveOp.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/Scope.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/Scope.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/Scope.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/Scope.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/annotation/Operator.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/annotation/Operator.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/annotation/Operator.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/annotation/Operator.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/core/Constant.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Constant.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/core/Constant.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Constant.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/core/Gradients.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Gradients.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/core/Gradients.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Gradients.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/op/core/Zeros.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Zeros.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/op/core/Zeros.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Zeros.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/package-info.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/package-info.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/package-info.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/package-info.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/types/UInt8.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/UInt8.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/types/UInt8.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/UInt8.java diff --git a/core/tensorflow-core/src/main/java/org/tensorflow/types/package-info.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/package-info.java similarity index 100% rename from core/tensorflow-core/src/main/java/org/tensorflow/types/package-info.java rename to tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/package-info.java diff --git a/core/tensorflow-core-native/src/main/native/eager_operation_builder_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_builder_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/eager_operation_builder_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_builder_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/eager_operation_builder_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_builder_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/eager_operation_builder_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_builder_jni.h diff --git a/core/tensorflow-core-native/src/main/native/eager_operation_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/eager_operation_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/eager_operation_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/eager_operation_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/eager_operation_jni.h diff --git a/core/tensorflow-core-native/src/main/native/eager_session_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/eager_session_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/eager_session_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/eager_session_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/eager_session_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/eager_session_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/eager_session_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/eager_session_jni.h diff --git a/core/tensorflow-core-native/src/main/native/exception_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/exception_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/exception_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/exception_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/exception_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/exception_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/exception_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/exception_jni.h diff --git a/core/tensorflow-core-native/src/main/native/graph_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/graph_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/graph_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/graph_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/graph_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/graph_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/graph_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/graph_jni.h diff --git a/core/tensorflow-core-native/src/main/native/graph_operation_builder_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_builder_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/graph_operation_builder_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_builder_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/graph_operation_builder_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_builder_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/graph_operation_builder_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_builder_jni.h diff --git a/core/tensorflow-core-native/src/main/native/graph_operation_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/graph_operation_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/graph_operation_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/graph_operation_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/graph_operation_jni.h diff --git a/core/tensorflow-core-native/src/main/native/saved_model_bundle_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/saved_model_bundle_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/saved_model_bundle_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/saved_model_bundle_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/saved_model_bundle_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/saved_model_bundle_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/saved_model_bundle_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/saved_model_bundle_jni.h diff --git a/core/tensorflow-core-native/src/main/native/server_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/server_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/server_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/server_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/server_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/server_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/server_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/server_jni.h diff --git a/core/tensorflow-core-native/src/main/native/session_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/session_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/session_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/session_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/session_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/session_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/session_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/session_jni.h diff --git a/core/tensorflow-core-native/src/main/native/tensor_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/tensor_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/tensor_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/tensor_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/tensor_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/tensor_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/tensor_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/tensor_jni.h diff --git a/core/tensorflow-core-native/src/main/native/tensorflow_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/tensorflow_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/tensorflow_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/tensorflow_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/tensorflow_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/tensorflow_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/tensorflow_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/tensorflow_jni.h diff --git a/core/tensorflow-core-native/src/main/native/utils_jni.cc b/tensorflow-core/tensorflow-core-api/src/main/native/utils_jni.cc similarity index 100% rename from core/tensorflow-core-native/src/main/native/utils_jni.cc rename to tensorflow-core/tensorflow-core-api/src/main/native/utils_jni.cc diff --git a/core/tensorflow-core-native/src/main/native/utils_jni.h b/tensorflow-core/tensorflow-core-api/src/main/native/utils_jni.h similarity index 100% rename from core/tensorflow-core-native/src/main/native/utils_jni.h rename to tensorflow-core/tensorflow-core-api/src/main/native/utils_jni.h diff --git a/core/tensorflow-core-native/src/main/resources/LICENSE b/tensorflow-core/tensorflow-core-api/src/main/resources/LICENSE similarity index 100% rename from core/tensorflow-core-native/src/main/resources/LICENSE rename to tensorflow-core/tensorflow-core-api/src/main/resources/LICENSE diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/EagerOperationBuilderTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/EagerOperationBuilderTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/EagerOperationBuilderTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/EagerOperationBuilderTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/EagerOperationTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/EagerOperationTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/EagerOperationTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/EagerOperationTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/EagerSessionTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/EagerSessionTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/EagerSessionTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/EagerSessionTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/GraphOperationBuilderTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/GraphOperationBuilderTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/GraphOperationBuilderTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/GraphOperationBuilderTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/GraphOperationTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/GraphOperationTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/GraphOperationTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/GraphOperationTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/GraphTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/GraphTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/GraphTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/GraphTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/SavedModelBundleTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/SavedModelBundleTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/SavedModelBundleTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/SavedModelBundleTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/SessionTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/SessionTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/SessionTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/SessionTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/ShapeTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/ShapeTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/ShapeTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/ShapeTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/TensorFlowTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/TensorFlowTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/TensorFlowTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/TensorFlowTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/TensorTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/TensorTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/TensorTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/TensorTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/TestUtil.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/TestUtil.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/TestUtil.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/TestUtil.java diff --git a/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/c_api/HelloWorldTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/c_api/HelloWorldTest.java new file mode 100644 index 00000000000..92b9eac8d75 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/c_api/HelloWorldTest.java @@ -0,0 +1,32 @@ +/* Copyright 2019 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. +==============================================================================*/ + +package org.tensorflow.c_api; + +import static org.junit.Assert.assertTrue; +import static org.tensorflow.c_api.global.tensorflow.TF_Version; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class HelloWorldTest { + + @Test + public void getVersion() { + assertTrue(TF_Version().getString().length() > 0); + } +} diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/op/OperandsTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/OperandsTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/op/OperandsTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/OperandsTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/op/PrimitiveOpTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/PrimitiveOpTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/op/PrimitiveOpTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/PrimitiveOpTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/op/ScopeTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/ScopeTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/op/ScopeTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/ScopeTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/op/core/ConstantTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/ConstantTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/op/core/ConstantTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/ConstantTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/op/core/GeneratedOperationsTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/GeneratedOperationsTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/op/core/GeneratedOperationsTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/GeneratedOperationsTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/op/core/GradientsTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/GradientsTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/op/core/GradientsTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/GradientsTest.java diff --git a/core/tensorflow-core/src/test/java/org/tensorflow/op/core/ZerosTest.java b/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/ZerosTest.java similarity index 100% rename from core/tensorflow-core/src/test/java/org/tensorflow/op/core/ZerosTest.java rename to tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/op/core/ZerosTest.java diff --git a/core/tensorflow-core/src/test/native/my_test_op.cc b/tensorflow-core/tensorflow-core-api/src/test/native/my_test_op.cc similarity index 100% rename from core/tensorflow-core/src/test/native/my_test_op.cc rename to tensorflow-core/tensorflow-core-api/src/test/native/my_test_op.cc diff --git a/core/tensorflow-core/src/test/resources/saved_model/assets/foo.txt b/tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/assets/foo.txt similarity index 100% rename from core/tensorflow-core/src/test/resources/saved_model/assets/foo.txt rename to tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/assets/foo.txt diff --git a/core/tensorflow-core/src/test/resources/saved_model/saved_model.pb b/tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/saved_model.pb similarity index 100% rename from core/tensorflow-core/src/test/resources/saved_model/saved_model.pb rename to tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/saved_model.pb diff --git a/core/tensorflow-core/src/test/resources/saved_model/variables/variables.data-00000-of-00001 b/tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/variables/variables.data-00000-of-00001 similarity index 100% rename from core/tensorflow-core/src/test/resources/saved_model/variables/variables.data-00000-of-00001 rename to tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/variables/variables.data-00000-of-00001 diff --git a/core/tensorflow-core/src/test/resources/saved_model/variables/variables.index b/tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/variables/variables.index similarity index 100% rename from core/tensorflow-core/src/test/resources/saved_model/variables/variables.index rename to tensorflow-core/tensorflow-core-api/src/test/resources/saved_model/variables/variables.index diff --git a/core/annotation-processor/pom.xml b/tensorflow-core/tensorflow-core-generator/pom.xml similarity index 84% rename from core/annotation-processor/pom.xml rename to tensorflow-core/tensorflow-core-generator/pom.xml index a0ddad72f15..6371f9cc1d0 100644 --- a/core/annotation-processor/pom.xml +++ b/tensorflow-core/tensorflow-core-generator/pom.xml @@ -4,13 +4,13 @@ 4.0.0 org.tensorflow - parent-core - 2.0.0-SNAPSHOT + tensorflow-core + 0.1.0-SNAPSHOT - annotation-processor + tensorflow-core-generator jar - Core Annotation Processor + TensorFlow Core Annotation Processor Annotation processor for TensorFlow Java client @@ -31,7 +31,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.1 + 3.8.0 1.7 1.7 @@ -40,7 +40,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.0.1 attach-sources diff --git a/core/annotation-processor/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java b/tensorflow-core/tensorflow-core-generator/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java similarity index 100% rename from core/annotation-processor/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java rename to tensorflow-core/tensorflow-core-generator/src/main/java/org/tensorflow/processor/operator/OperatorProcessor.java diff --git a/tensorflow-core/tensorflow-core-platform/pom.xml b/tensorflow-core/tensorflow-core-platform/pom.xml new file mode 100644 index 00000000000..b72990ba16b --- /dev/null +++ b/tensorflow-core/tensorflow-core-platform/pom.xml @@ -0,0 +1,103 @@ + + + + 4.0.0 + + + org.tensorflow + tensorflow-core + 0.1.0-SNAPSHOT + + tensorflow-core-platform + TensorFlow Core API Library Platform + + + tensorflow-core-api + + + + + org.bytedeco + mkl-dnn-platform + ${mkl-dnn.version} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.linux-x86_64} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.macosx-x86_64} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.windows-x86_64} + + + + + + + maven-jar-plugin + + + default-jar + + + + ${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86_64.jar + + + + + + empty-javadoc-jar + + jar + + + javadoc + + + + empty-sources-jar + + jar + + + sources + + + + + + + +